From 698569f8428ca088f764d704034a1330517b98c0 Mon Sep 17 00:00:00 2001
From: tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>
Date: Sun, 26 Jun 2011 00:41:16 +0000
Subject: Finish rebranding of Krita as Chalk

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238363 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
---
 Doxyfile.temp                                      |     2 +-
 README                                             |     2 +-
 README.APPS                                        |     2 +-
 README.PACKAGERS                                   |    22 +-
 chalk/AUTHORS                                      |    20 +
 chalk/ChangeLog                                    |     1 +
 chalk/HACKING                                      |    93 +
 chalk/IMAGE_LIBRARIES                              |   259 +
 chalk/Makefile.am                                  |    47 +
 chalk/README                                       |    13 +
 chalk/TODO                                         |   181 +
 chalk/UIcomments                                   |    59 +
 chalk/chalk.desktop                                |    95 +
 chalk/chalk.rc                                     |   199 +
 chalk/chalk_part_init.cc                           |    23 +
 chalk/chalk_readonly.rc                            |    35 +
 chalk/chalkcolor/Makefile.am                       |    45 +
 chalk/chalkcolor/README                            |     4 +
 chalk/chalkcolor/TODO                              |    11 +
 chalk/chalkcolor/chalk_colorspace.desktop          |    38 +
 chalk/chalkcolor/colorspaces/Makefile.am           |    20 +
 .../chalkcolor/colorspaces/kis_alpha_colorspace.cc |   296 +
 .../chalkcolor/colorspaces/kis_alpha_colorspace.h  |    93 +
 chalk/chalkcolor/colorspaces/kis_lab_colorspace.cc |   571 +
 chalk/chalkcolor/colorspaces/kis_lab_colorspace.h  |   153 +
 chalk/chalkcolor/colorspaces/kis_xyz_colorspace.cc |   624 +
 chalk/chalkcolor/colorspaces/kis_xyz_colorspace.h  |   112 +
 chalk/chalkcolor/kis_abstract_colorspace.cc        |   762 +
 chalk/chalkcolor/kis_abstract_colorspace.h         |   312 +
 chalk/chalkcolor/kis_basic_histogram_producers.cc  |   484 +
 chalk/chalkcolor/kis_basic_histogram_producers.h   |   197 +
 chalk/chalkcolor/kis_channelinfo.h                 |   115 +
 chalk/chalkcolor/kis_color.cc                      |   185 +
 chalk/chalkcolor/kis_color.h                       |    90 +
 chalk/chalkcolor/kis_color_conversions.cc          |   427 +
 chalk/chalkcolor/kis_color_conversions.h           |    49 +
 chalk/chalkcolor/kis_colorspace.cc                 |    39 +
 chalk/chalkcolor/kis_colorspace.h                  |   450 +
 .../chalkcolor/kis_colorspace_factory_registry.cc  |   222 +
 chalk/chalkcolor/kis_colorspace_factory_registry.h |   121 +
 chalk/chalkcolor/kis_colorspace_iface.cc           |    39 +
 chalk/chalkcolor/kis_colorspace_iface.h            |    43 +
 chalk/chalkcolor/kis_composite_op.cc               |   138 +
 chalk/chalkcolor/kis_composite_op.h                |   103 +
 chalk/chalkcolor/kis_f16half_base_colorspace.cc    |   125 +
 chalk/chalkcolor/kis_f16half_base_colorspace.h     |   107 +
 chalk/chalkcolor/kis_f32_base_colorspace.cc        |   125 +
 chalk/chalkcolor/kis_f32_base_colorspace.h         |    83 +
 chalk/chalkcolor/kis_histogram_producer.cc         |    67 +
 chalk/chalkcolor/kis_histogram_producer.h          |   129 +
 chalk/chalkcolor/kis_profile.cc                    |   208 +
 chalk/chalkcolor/kis_profile.h                     |    98 +
 chalk/chalkcolor/kis_u16_base_colorspace.cc        |   148 +
 chalk/chalkcolor/kis_u16_base_colorspace.h         |    80 +
 chalk/chalkcolor/kis_u8_base_colorspace.cc         |   118 +
 chalk/chalkcolor/kis_u8_base_colorspace.h          |    77 +
 chalk/chalkcolor/tests/Makefile.am                 |    16 +
 .../tests/kis_color_conversions_tester.cpp         |   227 +
 .../tests/kis_color_conversions_tester.h           |    44 +
 chalk/chalkpart.desktop                            |    91 +
 chalk/colorspaces/Makefile.am                      |    15 +
 chalk/colorspaces/README                           |    11 +
 chalk/colorspaces/cmyk_u16/Makefile.am             |    30 +
 .../cmyk_u16/chalk_cmyk_u16_plugin.desktop         |    85 +
 chalk/colorspaces/cmyk_u16/cmyk_u16_plugin.cc      |    61 +
 chalk/colorspaces/cmyk_u16/cmyk_u16_plugin.h       |    38 +
 .../cmyk_u16/kis_cmyk_u16_colorspace.cc            |   714 +
 .../colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.h |   123 +
 chalk/colorspaces/cmyk_u8/Makefile.am              |    20 +
 chalk/colorspaces/cmyk_u8/chalkcmykplugin.desktop  |    99 +
 chalk/colorspaces/cmyk_u8/cmyk_plugin.cc           |    66 +
 chalk/colorspaces/cmyk_u8/cmyk_plugin.h            |    38 +
 chalk/colorspaces/cmyk_u8/cmykplugin.rc            |     7 +
 chalk/colorspaces/cmyk_u8/composite.h              |    76 +
 chalk/colorspaces/cmyk_u8/kis_cmyk_colorspace.cc   |   710 +
 chalk/colorspaces/cmyk_u8/kis_cmyk_colorspace.h    |   126 +
 chalk/colorspaces/cmyk_u8/templates/.directory     |     5 +
 chalk/colorspaces/cmyk_u8/templates/Makefile.am    |     8 +
 .../templates/cr48-action-template_cmyk_empty.png  |   Bin 0 -> 432 bytes
 .../templates/crsc-action-template_cmyk_empty.svgz |   Bin 0 -> 1655 bytes
 .../cmyk_u8/templates/white_2000x800.desktop       |   100 +
 .../cmyk_u8/templates/white_2000x800.kra           |   Bin 0 -> 17590 bytes
 chalk/colorspaces/gray_u16/Makefile.am             |    29 +
 .../gray_u16/chalk_gray_u16_plugin.desktop         |    83 +
 chalk/colorspaces/gray_u16/gray_u16_plugin.cc      |    63 +
 chalk/colorspaces/gray_u16/gray_u16_plugin.h       |    38 +
 .../gray_u16/kis_gray_u16_colorspace.cc            |   658 +
 .../colorspaces/gray_u16/kis_gray_u16_colorspace.h |   118 +
 chalk/colorspaces/gray_u8/Makefile.am              |    31 +
 chalk/colorspaces/gray_u8/chalkgrayplugin.desktop  |    97 +
 chalk/colorspaces/gray_u8/gray_plugin.cc           |    77 +
 chalk/colorspaces/gray_u8/gray_plugin.h            |    37 +
 chalk/colorspaces/gray_u8/grayplugin.rc            |     7 +
 chalk/colorspaces/gray_u8/kis_gray_colorspace.cc   |   997 +
 chalk/colorspaces/gray_u8/kis_gray_colorspace.h    |   114 +
 chalk/colorspaces/gray_u8/templates/.directory     |    48 +
 chalk/colorspaces/gray_u8/templates/Makefile.am    |     8 +
 .../templates/cr48-action-template_gray_empty.png  |   Bin 0 -> 1368 bytes
 .../templates/crsc-action-template_gray_empty.svgz |   Bin 0 -> 1725 bytes
 .../gray_u8/templates/white_640x480.desktop        |    99 +
 .../gray_u8/templates/white_640x480.kra            |   Bin 0 -> 2824 bytes
 chalk/colorspaces/gray_u8/tests/Makefile.am        |    17 +
 .../kis_strategy_colorspace_grayscale_tester.cpp   |   155 +
 .../kis_strategy_colorspace_grayscale_tester.h     |    34 +
 chalk/colorspaces/lms_f32/Makefile.am              |    28 +
 .../lms_f32/chalk_lms_f32_plugin.desktop           |    77 +
 .../colorspaces/lms_f32/kis_lms_f32_colorspace.cc  |   385 +
 chalk/colorspaces/lms_f32/kis_lms_f32_colorspace.h |   157 +
 chalk/colorspaces/lms_f32/lms_f32_plugin.cc        |    64 +
 chalk/colorspaces/lms_f32/lms_f32_plugin.h         |    40 +
 chalk/colorspaces/lms_f32/lms_f32_plugin.rc        |     9 +
 chalk/colorspaces/rgb_f16half/Makefile.am          |    35 +
 .../rgb_f16half/chalk_rgb_f16half_plugin.desktop   |    76 +
 .../rgb_f16half/kis_rgb_f16half_colorspace.cc      |   952 +
 .../rgb_f16half/kis_rgb_f16half_colorspace.h       |   144 +
 .../colorspaces/rgb_f16half/rgb_f16half_plugin.cc  |    63 +
 chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.h |    39 +
 .../colorspaces/rgb_f16half/rgb_f16half_plugin.rc  |     9 +
 chalk/colorspaces/rgb_f16half/tests/Makefile.am    |    19 +
 .../tests/kis_rgb_f16half_colorspace_tester.cc     |   545 +
 .../tests/kis_rgb_f16half_colorspace_tester.h      |    47 +
 chalk/colorspaces/rgb_f32/Makefile.am              |    34 +
 .../rgb_f32/chalk_rgb_f32_plugin.desktop           |    77 +
 .../colorspaces/rgb_f32/kis_rgb_f32_colorspace.cc  |   949 +
 chalk/colorspaces/rgb_f32/kis_rgb_f32_colorspace.h |   165 +
 chalk/colorspaces/rgb_f32/rgb_f32_plugin.cc        |    63 +
 chalk/colorspaces/rgb_f32/rgb_f32_plugin.h         |    39 +
 chalk/colorspaces/rgb_f32/rgb_f32_plugin.rc        |     9 +
 chalk/colorspaces/rgb_f32/tests/Makefile.am        |    17 +
 .../kis_strategy_colorspace_rgb_f32_tester.cc      |   541 +
 .../tests/kis_strategy_colorspace_rgb_f32_tester.h |    47 +
 chalk/colorspaces/rgb_u16/Makefile.am              |    32 +
 .../rgb_u16/chalk_rgb_u16_plugin.desktop           |    80 +
 .../colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc  |   869 +
 chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.h |   128 +
 chalk/colorspaces/rgb_u16/rgb_u16_plugin.cc        |    61 +
 chalk/colorspaces/rgb_u16/rgb_u16_plugin.h         |    37 +
 chalk/colorspaces/rgb_u16/tests/Makefile.am        |    17 +
 .../kis_strategy_colorspace_rgb_u16_tester.cc      |   524 +
 .../tests/kis_strategy_colorspace_rgb_u16_tester.h |    46 +
 chalk/colorspaces/rgb_u8/Makefile.am               |    33 +
 chalk/colorspaces/rgb_u8/chalkrgbplugin.desktop    |    99 +
 chalk/colorspaces/rgb_u8/composite.h               |   868 +
 chalk/colorspaces/rgb_u8/kis_rgb_colorspace.cc     |  1501 +
 chalk/colorspaces/rgb_u8/kis_rgb_colorspace.h      |   116 +
 chalk/colorspaces/rgb_u8/rgb_plugin.cc             |    74 +
 chalk/colorspaces/rgb_u8/rgb_plugin.h              |    38 +
 chalk/colorspaces/rgb_u8/rgbplugin.rc              |     9 +
 chalk/colorspaces/rgb_u8/templates/.directory      |     6 +
 chalk/colorspaces/rgb_u8/templates/Makefile.am     |     8 +
 .../templates/cr48-action-template_rgb_empty.png   |   Bin 0 -> 2364 bytes
 .../templates/crsc-action-template_rgb_empty.svgz  |   Bin 0 -> 1818 bytes
 .../rgb_u8/templates/transparent_1024x768.desktop  |    91 +
 .../rgb_u8/templates/transparent_1024x768.kra      |   Bin 0 -> 7141 bytes
 .../rgb_u8/templates/transparent_1280x1024.desktop |    92 +
 .../rgb_u8/templates/transparent_1280x1024.kra     |   Bin 0 -> 9806 bytes
 .../rgb_u8/templates/transparent_1600x1200.desktop |    97 +
 .../rgb_u8/templates/transparent_1600x1200.kra     |   Bin 0 -> 13147 bytes
 .../rgb_u8/templates/transparent_640x480.desktop   |    92 +
 .../rgb_u8/templates/transparent_640x480.kra       |   Bin 0 -> 4947 bytes
 .../rgb_u8/templates/white_1024x768.desktop        |   102 +
 .../rgb_u8/templates/white_1024x768.kra            |   Bin 0 -> 5323 bytes
 .../rgb_u8/templates/white_1280x1024.desktop       |    95 +
 .../rgb_u8/templates/white_1280x1024.kra           |   Bin 0 -> 7988 bytes
 .../rgb_u8/templates/white_1600x1200.desktop       |    95 +
 .../rgb_u8/templates/white_1600x1200.kra           |   Bin 0 -> 11442 bytes
 .../rgb_u8/templates/white_640x480.desktop         |   102 +
 .../colorspaces/rgb_u8/templates/white_640x480.kra |   Bin 0 -> 3164 bytes
 chalk/colorspaces/rgb_u8/tests/Makefile.am         |    17 +
 .../tests/kis_strategy_colorspace_rgb_tester.cpp   |   197 +
 .../tests/kis_strategy_colorspace_rgb_tester.h     |    34 +
 chalk/colorspaces/wet/Makefile.am                  |    28 +
 chalk/colorspaces/wet/chalkwetplugin.desktop       |    86 +
 chalk/colorspaces/wet/kis_texture_filter.cc        |    43 +
 chalk/colorspaces/wet/kis_texture_filter.h         |    38 +
 chalk/colorspaces/wet/kis_texture_painter.cc       |    92 +
 chalk/colorspaces/wet/kis_texture_painter.h        |    40 +
 chalk/colorspaces/wet/kis_wet_colorspace.cc        |   514 +
 chalk/colorspaces/wet/kis_wet_colorspace.h         |   219 +
 chalk/colorspaces/wet/kis_wet_palette_widget.cc    |   245 +
 chalk/colorspaces/wet/kis_wet_palette_widget.h     |    68 +
 .../wet/kis_wetness_visualisation_filter.cc        |    77 +
 .../wet/kis_wetness_visualisation_filter.h         |    51 +
 chalk/colorspaces/wet/kis_wetop.cc                 |   230 +
 chalk/colorspaces/wet/kis_wetop.h                  |    73 +
 chalk/colorspaces/wet/todo                         |    24 +
 chalk/colorspaces/wet/wdgpressure.ui               |    60 +
 chalk/colorspaces/wet/wet_plugin.cc                |   128 +
 chalk/colorspaces/wet/wet_plugin.h                 |    46 +
 chalk/colorspaces/wet/wetdreams/Makefile           |     6 +
 chalk/colorspaces/wet/wetdreams/wetmain.c          |   517 +
 chalk/colorspaces/wet/wetdreams/wetpaint.c         |   101 +
 chalk/colorspaces/wet/wetdreams/wetpaint.h         |     4 +
 chalk/colorspaces/wet/wetdreams/wetphysics.c       |   334 +
 chalk/colorspaces/wet/wetdreams/wetphysics.h       |     9 +
 chalk/colorspaces/wet/wetdreams/wetpix.c           |   332 +
 chalk/colorspaces/wet/wetdreams/wetpix.h           |    87 +
 chalk/colorspaces/wet/wetdreams/wettexture.c       |    84 +
 chalk/colorspaces/wet/wetdreams/wettexture.h       |     9 +
 chalk/colorspaces/wet/wetphysicsfilter.cc          |   424 +
 chalk/colorspaces/wet/wetphysicsfilter.h           |    87 +
 chalk/colorspaces/wet/wetplugin.rc                 |     8 +
 chalk/colorspaces/wetsticky/Makefile.am            |    25 +
 chalk/colorspaces/wetsticky/README                 |    42 +
 chalk/colorspaces/wetsticky/TODO                   |     7 +
 chalk/colorspaces/wetsticky/brushop/Makefile.am    |    28 +
 chalk/colorspaces/wetsticky/brushop/README         |     2 +
 .../wetsticky/brushop/chalkwsbrushpaintop.desktop  |    73 +
 .../colorspaces/wetsticky/brushop/kis_wsbrushop.cc |   117 +
 .../colorspaces/wetsticky/brushop/kis_wsbrushop.h  |    56 +
 .../wetsticky/brushop/wetpaintbrush.png            |   Bin 0 -> 1329 bytes
 .../wetsticky/brushop/wsbrushpaintop_plugin.cc     |    56 +
 .../wetsticky/brushop/wsbrushpaintop_plugin.h      |    44 +
 chalk/colorspaces/wetsticky/chalkwsplugin.desktop  |    46 +
 .../wetsticky/kis_wet_sticky_colorspace.cc         |   605 +
 .../wetsticky/kis_wet_sticky_colorspace.h          |   148 +
 .../colorspaces/wetsticky/kis_ws_engine_filter.cc  |   180 +
 chalk/colorspaces/wetsticky/kis_ws_engine_filter.h |    77 +
 chalk/colorspaces/wetsticky/wet_sticky_plugin.cc   |    60 +
 chalk/colorspaces/wetsticky/wet_sticky_plugin.h    |    42 +
 chalk/colorspaces/wetsticky/ws/GNU                 |     0
 .../wetsticky/ws/GNU Public Licence.txt            |   341 +
 chalk/colorspaces/wetsticky/ws/README              |     4 +
 chalk/colorspaces/wetsticky/ws/TODO                |    24 +
 chalk/colorspaces/wetsticky/ws/after.jpg           |   Bin 0 -> 29607 bytes
 chalk/colorspaces/wetsticky/ws/anim.c              |   154 +
 chalk/colorspaces/wetsticky/ws/before.jpg          |   Bin 0 -> 15496 bytes
 chalk/colorspaces/wetsticky/ws/canvas.c            |   514 +
 chalk/colorspaces/wetsticky/ws/canvas.h            |    70 +
 chalk/colorspaces/wetsticky/ws/cmap.c              |   681 +
 chalk/colorspaces/wetsticky/ws/constants.h         |    69 +
 chalk/colorspaces/wetsticky/ws/engine.c            |   802 +
 chalk/colorspaces/wetsticky/ws/engine.h            |    33 +
 chalk/colorspaces/wetsticky/ws/engine3.c           |   617 +
 chalk/colorspaces/wetsticky/ws/load_ppm.c          |   244 +
 chalk/colorspaces/wetsticky/ws/main.c              |   105 +
 chalk/colorspaces/wetsticky/ws/makefile            |    55 +
 chalk/colorspaces/wetsticky/ws/mona.pgm            |   Bin 0 -> 86269 bytes
 chalk/colorspaces/wetsticky/ws/ogl_interface.c     |   302 +
 chalk/colorspaces/wetsticky/ws/test2.jpg           |   Bin 0 -> 13051 bytes
 chalk/colorspaces/wetsticky/ws/test3.jpg           |   Bin 0 -> 21238 bytes
 chalk/colorspaces/wetsticky/ws/types.h             |    72 +
 chalk/colorspaces/wetsticky/ws/win_interface.h     |    28 +
 chalk/colorspaces/wetsticky/ws/x_interface.c       |   795 +
 chalk/colorspaces/wetsticky/wstool.ui              |   262 +
 chalk/colorspaces/ycbcr_u16/Makefile.am            |    27 +
 .../ycbcr_u16/chalk_ycbcr_u16_plugin.desktop       |    71 +
 .../ycbcr_u16/kis_ycbcr_u16_colorspace.cc          |   338 +
 .../ycbcr_u16/kis_ycbcr_u16_colorspace.h           |   144 +
 chalk/colorspaces/ycbcr_u16/ycbcr_u16_plugin.cc    |    60 +
 chalk/colorspaces/ycbcr_u16/ycbcr_u16_plugin.h     |    38 +
 chalk/colorspaces/ycbcr_u8/Makefile.am             |    29 +
 .../ycbcr_u8/chalk_ycbcr_u8_plugin.desktop         |    71 +
 .../ycbcr_u8/kis_ycbcr_u8_colorspace.cc            |   344 +
 .../colorspaces/ycbcr_u8/kis_ycbcr_u8_colorspace.h |   144 +
 chalk/colorspaces/ycbcr_u8/ycbcr_u8_plugin.cc      |    62 +
 chalk/colorspaces/ycbcr_u8/ycbcr_u8_plugin.h       |    38 +
 chalk/configure.in.bot                             |    19 +
 chalk/configure.in.in                              |   113 +
 chalk/core/Makefile.am                             |    59 +
 chalk/core/createdcop.py                           |   171 +
 chalk/core/kis_adjustment_layer.cc                 |   252 +
 chalk/core/kis_adjustment_layer.h                  |   106 +
 chalk/core/kis_alpha_mask.cc                       |   132 +
 chalk/core/kis_alpha_mask.h                        |   106 +
 chalk/core/kis_autobrush_resource.cc               |   106 +
 chalk/core/kis_autobrush_resource.h                |    71 +
 chalk/core/kis_autogradient_resource.cc            |   221 +
 chalk/core/kis_autogradient_resource.h             |    88 +
 chalk/core/kis_background.cc                       |   155 +
 chalk/core/kis_background.h                        |    49 +
 chalk/core/kis_basic_math_toolbox.cpp              |   137 +
 chalk/core/kis_basic_math_toolbox.h                |    44 +
 chalk/core/kis_boundary.cc                         |    83 +
 chalk/core/kis_boundary.h                          |    57 +
 chalk/core/kis_brush.cc                            |  1333 +
 chalk/core/kis_brush.h                             |   192 +
 chalk/core/kis_change_profile_visitor.h            |   109 +
 chalk/core/kis_colorspace_convert_visitor.h        |   101 +
 chalk/core/kis_command.cc                          |    43 +
 chalk/core/kis_command.h                           |    55 +
 chalk/core/kis_convolution_painter.cc              |   426 +
 chalk/core/kis_convolution_painter.h               |    95 +
 chalk/core/kis_crop_visitor.h                      |   109 +
 chalk/core/kis_datamanager.h                       |   217 +
 chalk/core/kis_exif_info.cc                        |    66 +
 chalk/core/kis_exif_info.h                         |    58 +
 chalk/core/kis_exif_value.cc                       |   678 +
 chalk/core/kis_exif_value.h                        |   270 +
 chalk/core/kis_fill_painter.cc                     |   407 +
 chalk/core/kis_fill_painter.h                      |   207 +
 chalk/core/kis_filter.cc                           |   133 +
 chalk/core/kis_filter.h                            |   201 +
 chalk/core/kis_filter_config_widget.cc             |    31 +
 chalk/core/kis_filter_config_widget.h              |    50 +
 chalk/core/kis_filter_configuration.cc             |   185 +
 chalk/core/kis_filter_configuration.h              |   105 +
 chalk/core/kis_filter_registry.cc                  |    82 +
 chalk/core/kis_filter_registry.h                   |    53 +
 chalk/core/kis_filter_strategy.cc                  |   192 +
 chalk/core/kis_filter_strategy.h                   |   150 +
 chalk/core/kis_gradient.cc                         |   639 +
 chalk/core/kis_gradient.h                          |   265 +
 chalk/core/kis_gradient_painter.cc                 |   723 +
 chalk/core/kis_gradient_painter.h                  |    84 +
 chalk/core/kis_group_layer.cc                      |   428 +
 chalk/core/kis_group_layer.h                       |   141 +
 chalk/core/kis_histogram.cc                        |   215 +
 chalk/core/kis_histogram.h                         |   150 +
 chalk/core/kis_image.cc                            |  1702 +
 chalk/core/kis_image.h                             |   461 +
 chalk/core/kis_image_iface.cc                      |    97 +
 chalk/core/kis_image_iface.h                       |    65 +
 chalk/core/kis_imagepipe_brush.cc                  |   456 +
 chalk/core/kis_imagepipe_brush.h                   |   169 +
 chalk/core/kis_iterator.cc                         |   142 +
 chalk/core/kis_iterator.h                          |   173 +
 chalk/core/kis_iteratorpixeltrait.h                |   131 +
 chalk/core/kis_iterators_pixel.cc                  |    59 +
 chalk/core/kis_iterators_pixel.h                   |   154 +
 chalk/core/kis_layer.cc                            |   611 +
 chalk/core/kis_layer.h                             |   257 +
 chalk/core/kis_layer_visitor.h                     |    43 +
 chalk/core/kis_math_toolbox.cpp                    |   166 +
 chalk/core/kis_math_toolbox.h                      |   124 +
 chalk/core/kis_merge_visitor.h                     |   358 +
 chalk/core/kis_meta_registry.cc                    |    68 +
 chalk/core/kis_meta_registry.h                     |    49 +
 chalk/core/kis_nameserver.cc                       |    49 +
 chalk/core/kis_nameserver.h                        |    40 +
 chalk/core/kis_paint_device.cc                     |  1285 +
 chalk/core/kis_paint_device.h                      |   597 +
 chalk/core/kis_paint_device_action.h               |    43 +
 chalk/core/kis_paint_device_iface.cc               |    74 +
 chalk/core/kis_paint_device_iface.h                |    85 +
 chalk/core/kis_paint_layer.cc                      |   509 +
 chalk/core/kis_paint_layer.h                       |   157 +
 chalk/core/kis_painter.cc                          |   928 +
 chalk/core/kis_painter.h                           |   432 +
 chalk/core/kis_paintop.cc                          |   113 +
 chalk/core/kis_paintop.h                           |   141 +
 chalk/core/kis_paintop_registry.cc                 |   139 +
 chalk/core/kis_paintop_registry.h                  |    84 +
 chalk/core/kis_palette.cc                          |   306 +
 chalk/core/kis_palette.h                           |   113 +
 chalk/core/kis_part_layer_iface.h                  |    36 +
 chalk/core/kis_pattern.cc                          |   335 +
 chalk/core/kis_pattern.h                           |    80 +
 chalk/core/kis_perspective_grid.cpp                |   100 +
 chalk/core/kis_perspective_grid.h                  |   107 +
 chalk/core/kis_perspective_math.cpp                |   546 +
 chalk/core/kis_perspective_math.h                  |    70 +
 chalk/core/kis_perspectivetransform_worker.cpp     |   121 +
 chalk/core/kis_perspectivetransform_worker.h       |    52 +
 chalk/core/kis_point.h                             |    48 +
 chalk/core/kis_random_accessor.cpp                 |    58 +
 chalk/core/kis_random_accessor.h                   |    95 +
 chalk/core/kis_random_sub_accessor.cpp             |    84 +
 chalk/core/kis_random_sub_accessor.h               |    45 +
 chalk/core/kis_rect.cc                             |    28 +
 chalk/core/kis_rect.h                              |    50 +
 chalk/core/kis_resource.cc                         |    62 +
 chalk/core/kis_resource.h                          |    84 +
 chalk/core/kis_rotate_visitor.cc                   |   406 +
 chalk/core/kis_rotate_visitor.h                    |    80 +
 chalk/core/kis_scale_visitor.cc                    |   279 +
 chalk/core/kis_scale_visitor.h                     |   204 +
 chalk/core/kis_selected_transaction.cc             |    73 +
 chalk/core/kis_selected_transaction.h              |    50 +
 chalk/core/kis_selection.cc                        |   582 +
 chalk/core/kis_selection.h                         |   160 +
 chalk/core/kis_shear_visitor.h                     |    95 +
 chalk/core/kis_strategy_move.cc                    |   148 +
 chalk/core/kis_strategy_move.h                     |    59 +
 chalk/core/kis_substrate.h                         |    78 +
 chalk/core/kis_thread.h                            |    57 +
 chalk/core/kis_thread_pool.cc                      |   192 +
 chalk/core/kis_thread_pool.h                       |    70 +
 chalk/core/kis_transaction.cc                      |    94 +
 chalk/core/kis_transaction.h                       |    46 +
 chalk/core/kis_transform_visitor.h                 |   137 +
 chalk/core/kis_transform_worker.cc                 |   676 +
 chalk/core/kis_transform_worker.h                  |    79 +
 chalk/core/kis_types.h                             |    90 +
 chalk/core/kis_vec.cc                              |    67 +
 chalk/core/kis_vec.h                               |   405 +
 chalk/core/tests/Makefile.am                       |    30 +
 .../core/tests/kis_filter_configuration_tester.cc  |    67 +
 chalk/core/tests/kis_filter_configuration_tester.h |    34 +
 chalk/core/tests/kis_image_tester.cpp              |    88 +
 chalk/core/tests/kis_image_tester.h                |    32 +
 chalk/core/tests/kis_integer_maths_tester.cpp      |    93 +
 chalk/core/tests/kis_integer_maths_tester.h        |    34 +
 chalk/core/tiles/Makefile.am                       |    23 +
 chalk/core/tiles/kis_memento.cc                    |   154 +
 chalk/core/tiles/kis_memento.h                     |   147 +
 chalk/core/tiles/kis_tile.cc                       |   152 +
 chalk/core/tiles/kis_tile.h                        |    87 +
 chalk/core/tiles/kis_tile_global.h                 |    23 +
 chalk/core/tiles/kis_tiled_random_accessor.cc      |   115 +
 chalk/core/tiles/kis_tiled_random_accessor.h       |    66 +
 chalk/core/tiles/kis_tileddatamanager.cc           |  1044 +
 chalk/core/tiles/kis_tileddatamanager.h            |   233 +
 chalk/core/tiles/kis_tiledhlineiterator.cc         |   213 +
 chalk/core/tiles/kis_tilediterator.cc              |   131 +
 chalk/core/tiles/kis_tilediterator.h               |   213 +
 chalk/core/tiles/kis_tiledrectiterator.cc          |   242 +
 chalk/core/tiles/kis_tiledvlineiterator.cc         |   154 +
 chalk/core/tiles/kis_tilemanager.cc                |   578 +
 chalk/core/tiles/kis_tilemanager.h                 |   139 +
 chalk/core/tiles/tests/Makefile.am                 |    15 +
 chalk/core/tiles/tests/kis_tiled_data_tester.cpp   |    74 +
 chalk/core/tiles/tests/kis_tiled_data_tester.h     |    32 +
 chalk/data/Makefile.am                             |     7 +
 chalk/data/README                                  |    13 +
 chalk/data/brushes/10x10square.gbr                 |   Bin 0 -> 143 bytes
 chalk/data/brushes/10x10squareBlur.gbr             |   Bin 0 -> 148 bytes
 chalk/data/brushes/11circle.gbr                    |   Bin 0 -> 161 bytes
 chalk/data/brushes/11fcircle.gbr                   |   Bin 0 -> 159 bytes
 chalk/data/brushes/13circle.gbr                    |   Bin 0 -> 209 bytes
 chalk/data/brushes/13fcircle.gbr                   |   Bin 0 -> 207 bytes
 chalk/data/brushes/15circle.gbr                    |   Bin 0 -> 265 bytes
 chalk/data/brushes/15fcircle.gbr                   |   Bin 0 -> 263 bytes
 chalk/data/brushes/17circle.gbr                    |   Bin 0 -> 329 bytes
 chalk/data/brushes/17fcircle.gbr                   |   Bin 0 -> 327 bytes
 chalk/data/brushes/19circle.gbr                    |   Bin 0 -> 401 bytes
 chalk/data/brushes/19fcircle.gbr                   |   Bin 0 -> 399 bytes
 chalk/data/brushes/1circle.gbr                     |   Bin 0 -> 41 bytes
 chalk/data/brushes/20x20square.gbr                 |   Bin 0 -> 443 bytes
 chalk/data/brushes/20x20squareBlur.gbr             |   Bin 0 -> 448 bytes
 chalk/data/brushes/3circle.gbr                     |   Bin 0 -> 49 bytes
 chalk/data/brushes/3fcircle.gbr                    |   Bin 0 -> 47 bytes
 chalk/data/brushes/5circle.gbr                     |   Bin 0 -> 65 bytes
 chalk/data/brushes/5fcircle.gbr                    |   Bin 0 -> 63 bytes
 chalk/data/brushes/5x5square.gbr                   |   Bin 0 -> 66 bytes
 chalk/data/brushes/5x5squareBlur.gbr               |   Bin 0 -> 71 bytes
 chalk/data/brushes/7circle.gbr                     |   Bin 0 -> 89 bytes
 chalk/data/brushes/7fcircle.gbr                    |   Bin 0 -> 87 bytes
 chalk/data/brushes/9circle.gbr                     |   Bin 0 -> 121 bytes
 chalk/data/brushes/9fcircle.gbr                    |   Bin 0 -> 119 bytes
 chalk/data/brushes/BRUSHES.README                  |    19 +
 chalk/data/brushes/COPYING                         |   340 +
 chalk/data/brushes/DStar11.gbr                     |   Bin 0 -> 168 bytes
 chalk/data/brushes/DStar17.gbr                     |   Bin 0 -> 336 bytes
 chalk/data/brushes/DStar25.gbr                     |   Bin 0 -> 672 bytes
 chalk/data/brushes/Makefile.am                     |    69 +
 chalk/data/brushes/SketchBrush-16.gih              |   Bin 0 -> 1618 bytes
 chalk/data/brushes/SketchBrush-32.gih              |   Bin 0 -> 5458 bytes
 chalk/data/brushes/SketchBrush-64.gih              |   Bin 0 -> 20818 bytes
 chalk/data/brushes/callig1.gbr                     |   Bin 0 -> 147 bytes
 chalk/data/brushes/callig2.gbr                     |   Bin 0 -> 447 bytes
 chalk/data/brushes/callig3.gbr                     |   Bin 0 -> 272 bytes
 chalk/data/brushes/callig4.gbr                     |   Bin 0 -> 72 bytes
 chalk/data/brushes/confetti.gbr                    |   Bin 0 -> 793 bytes
 chalk/data/brushes/confetti.gih                    |   Bin 0 -> 8076 bytes
 chalk/data/brushes/cursor.gbr                      |   Bin 0 -> 899 bytes
 chalk/data/brushes/cursor_big_lb.gbr               |   Bin 0 -> 2858 bytes
 chalk/data/brushes/cursor_big_lw.gbr               |   Bin 0 -> 2858 bytes
 chalk/data/brushes/cursor_big_rb.gbr               |   Bin 0 -> 2858 bytes
 chalk/data/brushes/cursor_big_rw.gbr               |   Bin 0 -> 2858 bytes
 chalk/data/brushes/cursor_lw.gbr                   |   Bin 0 -> 1802 bytes
 chalk/data/brushes/cursor_resize_diag_1.gbr        |   Bin 0 -> 1072 bytes
 chalk/data/brushes/cursor_resize_diag_2.gbr        |   Bin 0 -> 1072 bytes
 chalk/data/brushes/cursor_resize_hor.gbr           |   Bin 0 -> 958 bytes
 chalk/data/brushes/cursor_resize_vert.gbr          |   Bin 0 -> 959 bytes
 chalk/data/brushes/cursor_rw.gbr                   |   Bin 0 -> 1802 bytes
 chalk/data/brushes/cursor_small_lb.gbr             |   Bin 0 -> 1004 bytes
 chalk/data/brushes/cursor_small_lw.gbr             |   Bin 0 -> 1004 bytes
 chalk/data/brushes/cursor_small_rb.gbr             |   Bin 0 -> 1004 bytes
 chalk/data/brushes/cursor_small_rw.gbr             |   Bin 0 -> 1004 bytes
 chalk/data/brushes/cursor_tiny_lw.gbr              |   Bin 0 -> 523 bytes
 chalk/data/brushes/cursor_tiny_rw.gbr              |   Bin 0 -> 523 bytes
 chalk/data/brushes/cursor_up.gbr                   |   Bin 0 -> 1606 bytes
 chalk/data/brushes/dunes.gbr                       |   Bin 0 -> 1100 bytes
 chalk/data/brushes/feltpen.gih                     |   Bin 0 -> 118795 bytes
 chalk/data/brushes/galaxy.gbr                      |   Bin 0 -> 2636 bytes
 chalk/data/brushes/galaxy_big.gbr                  |   Bin 0 -> 10037 bytes
 chalk/data/brushes/galaxy_small.gbr                |   Bin 0 -> 749 bytes
 chalk/data/brushes/hsparks.gih                     |   Bin 0 -> 127644 bytes
 chalk/data/brushes/pepper.gbr                      |   Bin 0 -> 11991 bytes
 chalk/data/brushes/pixel.gbr                       |   Bin 0 -> 48 bytes
 chalk/data/brushes/vine.gih                        |   Bin 0 -> 116027 bytes
 chalk/data/chalk_filter.desktop                    |    47 +
 chalk/data/chalk_paintop.desktop                   |    41 +
 chalk/data/chalk_plugin.desktop                    |    42 +
 chalk/data/chalk_tool.desktop                      |    46 +
 chalk/data/gradients/Abstract_1.ggr                |     9 +
 chalk/data/gradients/Abstract_2.ggr                |     9 +
 chalk/data/gradients/Abstract_3.ggr                |     9 +
 chalk/data/gradients/Aneurism.ggr                  |    11 +
 chalk/data/gradients/Blinds.ggr                    |    12 +
 chalk/data/gradients/Blue_Green.ggr                |     5 +
 chalk/data/gradients/Browns.ggr                    |    14 +
 chalk/data/gradients/Brushed_Aluminium.ggr         |    27 +
 chalk/data/gradients/Burning_Paper.ggr             |     9 +
 chalk/data/gradients/Burning_Transparency.ggr      |     9 +
 chalk/data/gradients/CD.ggr                        |    21 +
 chalk/data/gradients/CD_Half.ggr                   |    12 +
 chalk/data/gradients/Caribbean_Blues.ggr           |     6 +
 chalk/data/gradients/Coffee.ggr                    |     4 +
 chalk/data/gradients/Cold_Steel.ggr                |     5 +
 chalk/data/gradients/Cold_Steel_2.ggr              |     6 +
 chalk/data/gradients/Crown_molding.ggr             |     9 +
 chalk/data/gradients/Dark_1.ggr                    |     6 +
 chalk/data/gradients/Deep_Sea.ggr                  |     5 +
 chalk/data/gradients/Default.ggr                   |     4 +
 chalk/data/gradients/Flare_Glow_Angular_1.ggr      |    49 +
 chalk/data/gradients/Flare_Glow_Radial_1.ggr       |     7 +
 chalk/data/gradients/Flare_Glow_Radial_2.ggr       |     8 +
 chalk/data/gradients/Flare_Glow_Radial_3.ggr       |     8 +
 chalk/data/gradients/Flare_Glow_Radial_4.ggr       |     6 +
 chalk/data/gradients/Flare_Radial_101.ggr          |    10 +
 chalk/data/gradients/Flare_Radial_102.ggr          |     9 +
 chalk/data/gradients/Flare_Radial_103.ggr          |     4 +
 chalk/data/gradients/Flare_Rays_Radial_1.ggr       |     5 +
 chalk/data/gradients/Flare_Rays_Radial_2.ggr       |     5 +
 chalk/data/gradients/Flare_Rays_Size_1.ggr         |    19 +
 chalk/data/gradients/Flare_Sizefac_101.ggr         |     4 +
 chalk/data/gradients/Four_bars.ggr                 |    11 +
 chalk/data/gradients/French_flag.ggr               |     6 +
 chalk/data/gradients/French_flag_smooth.ggr        |     5 +
 .../gradients/Full_saturation_spectrum_CCW.ggr     |     4 +
 .../data/gradients/Full_saturation_spectrum_CW.ggr |     4 +
 chalk/data/gradients/German_flag.ggr               |     6 +
 chalk/data/gradients/German_flag_smooth.ggr        |     5 +
 chalk/data/gradients/Golden.ggr                    |    17 +
 chalk/data/gradients/Greens.ggr                    |    12 +
 chalk/data/gradients/Horizon_1.ggr                 |     8 +
 chalk/data/gradients/Horizon_2.ggr                 |     8 +
 chalk/data/gradients/Incandescent.ggr              |     7 +
 chalk/data/gradients/Land_1.ggr                    |     8 +
 chalk/data/gradients/Land_and_Sea.ggr              |     8 +
 chalk/data/gradients/Makefile.am                   |     4 +
 chalk/data/gradients/Metallic_Something.ggr        |    11 +
 chalk/data/gradients/Mexican_flag.ggr              |     6 +
 chalk/data/gradients/Mexican_flag_smooth.ggr       |     5 +
 chalk/data/gradients/Nauseating_Headache.ggr       |    28 +
 chalk/data/gradients/Neon_Cyan.ggr                 |     7 +
 chalk/data/gradients/Neon_Green.ggr                |     7 +
 chalk/data/gradients/Neon_Yellow.ggr               |     7 +
 chalk/data/gradients/Pastel_Rainbow.ggr            |     4 +
 chalk/data/gradients/Pastels.ggr                   |    17 +
 chalk/data/gradients/Purples.ggr                   |    10 +
 chalk/data/gradients/Radial_Eyeball_Blue.ggr       |     8 +
 chalk/data/gradients/Radial_Eyeball_Brown.ggr      |     8 +
 chalk/data/gradients/Radial_Eyeball_Green.ggr      |     8 +
 chalk/data/gradients/Radial_Glow_1.ggr             |     8 +
 chalk/data/gradients/Radial_Rainbow_Hoop.ggr       |     6 +
 chalk/data/gradients/Romanian_flag.ggr             |     6 +
 chalk/data/gradients/Romanian_flag_smooth.ggr      |     5 +
 chalk/data/gradients/Rounded_edge.ggr              |    10 +
 chalk/data/gradients/Shadows_1.ggr                 |     8 +
 chalk/data/gradients/Shadows_2.ggr                 |     8 +
 chalk/data/gradients/Shadows_3.ggr                 |     9 +
 chalk/data/gradients/Skyline.ggr                   |     8 +
 chalk/data/gradients/Skyline_polluted.ggr          |     8 +
 chalk/data/gradients/Square_Wood_Frame.ggr         |     9 +
 chalk/data/gradients/Sunrise.ggr                   |     9 +
 chalk/data/gradients/Three_bars_sin.ggr            |     9 +
 chalk/data/gradients/Tropical_Colors.ggr           |    12 +
 chalk/data/gradients/Tube_Red.ggr                  |    10 +
 chalk/data/gradients/Wood_1.ggr                    |     6 +
 chalk/data/gradients/Wood_2.ggr                    |    12 +
 chalk/data/gradients/Yellow_Contrast.ggr           |    10 +
 chalk/data/gradients/Yellow_Orange.ggr             |     5 +
 chalk/data/images/Azay-Le-Rideau.jpg               |   Bin 0 -> 82588 bytes
 chalk/data/images/Makefile.am                      |     6 +
 chalk/data/images/WeyDesc.png                      |   Bin 0 -> 1061530 bytes
 chalk/data/images/evenings.jpg                     |   Bin 0 -> 53510 bytes
 chalk/data/images/hakonepa.jpg                     |   Bin 0 -> 58724 bytes
 chalk/data/images/hiro_awate.jpg                   |   Bin 0 -> 54283 bytes
 chalk/data/images/paintbrush.png                   |   Bin 0 -> 13186 bytes
 chalk/data/images/previewfilter.png                |   Bin 0 -> 5988 bytes
 chalk/data/palettes/40_Colors.gpl                  |    43 +
 chalk/data/palettes/Anchor.gpl                     |   448 +
 chalk/data/palettes/Bears.gpl                      |   259 +
 chalk/data/palettes/Bgold.gpl                      |   259 +
 chalk/data/palettes/Blues.gpl                      |   261 +
 chalk/data/palettes/Borders.gpl                    |   259 +
 chalk/data/palettes/Browns_And_Yellows.gpl         |    25 +
 chalk/data/palettes/Caramel.gpl                    |   259 +
 chalk/data/palettes/Cascade.gpl                    |   259 +
 chalk/data/palettes/China.gpl                      |   259 +
 chalk/data/palettes/Coldfire.gpl                   |   259 +
 chalk/data/palettes/Cool_Colors.gpl                |    11 +
 chalk/data/palettes/Cranes.gpl                     |   259 +
 chalk/data/palettes/DMC.gpl                        |   458 +
 chalk/data/palettes/Dark_pastels.gpl               |   259 +
 chalk/data/palettes/Default.gpl                    |    26 +
 chalk/data/palettes/Ega.gpl                        |   244 +
 chalk/data/palettes/Firecode.gpl                   |   259 +
 chalk/data/palettes/Gold.gpl                       |   259 +
 chalk/data/palettes/GrayViolet.gpl                 |   259 +
 chalk/data/palettes/Grayblue.gpl                   |   259 +
 chalk/data/palettes/Grays.gpl                      |    34 +
 chalk/data/palettes/Greens.gpl                     |   259 +
 chalk/data/palettes/Hilite.gpl                     |   259 +
 chalk/data/palettes/Khaki.gpl                      |   258 +
 chalk/data/palettes/Lights.gpl                     |    28 +
 chalk/data/palettes/Madeira.gpl                    |   372 +
 chalk/data/palettes/Makefile.am                    |    50 +
 chalk/data/palettes/Muted.gpl                      |    81 +
 chalk/data/palettes/Named_Colors.gpl               |   452 +
 chalk/data/palettes/News3.gpl                      |   259 +
 chalk/data/palettes/Op2.gpl                        |   259 +
 chalk/data/palettes/Paintjet.gpl                   |    22 +
 chalk/data/palettes/Pantone_Coated_Approx.gpl      |   949 +
 chalk/data/palettes/Pastels.gpl                    |    21 +
 chalk/data/palettes/Plasma.gpl                     |   260 +
 chalk/data/palettes/Reds.gpl                       |   259 +
 chalk/data/palettes/Reds_And_Purples.gpl           |    33 +
 chalk/data/palettes/Royal.gpl                      |   259 +
 chalk/data/palettes/Topographic.gpl                |   265 +
 chalk/data/palettes/Visibone.gpl                   |   346 +
 chalk/data/palettes/Visibone_2.gpl                 |   266 +
 chalk/data/palettes/Volcano.gpl                    |   259 +
 chalk/data/palettes/Warm_Colors.gpl                |    10 +
 chalk/data/palettes/Web.gpl                        |   220 +
 chalk/data/palettes/new_kde.gpl                    |    48 +
 chalk/data/patterns/3dgreen.pat                    |   Bin 0 -> 6108 bytes
 chalk/data/patterns/Craters.pat                    |   Bin 0 -> 39707 bytes
 chalk/data/patterns/Makefile.am                    |     5 +
 chalk/data/patterns/Moonfoot.pat                   |   Bin 0 -> 14442 bytes
 chalk/data/patterns/Stripes1px.pat                 |   Bin 0 -> 9253 bytes
 chalk/data/patterns/Stripes2px.pat                 |   Bin 0 -> 9248 bytes
 chalk/data/patterns/amethyst.pat                   |   Bin 0 -> 12321 bytes
 chalk/data/patterns/bark.pat                       |   Bin 0 -> 22173 bytes
 chalk/data/patterns/blue.pat                       |   Bin 0 -> 6108 bytes
 chalk/data/patterns/bluegrid.pat                   |   Bin 0 -> 1909 bytes
 chalk/data/patterns/bluesquares.pat                |   Bin 0 -> 48037 bytes
 chalk/data/patterns/blueweb.pat                    |   Bin 0 -> 12321 bytes
 chalk/data/patterns/brick.pat                      |   Bin 0 -> 27674 bytes
 chalk/data/patterns/burlap.pat                     |   Bin 0 -> 27676 bytes
 chalk/data/patterns/burlwood.pat                   |   Bin 0 -> 27681 bytes
 chalk/data/patterns/choc_swirl.pat                 |   Bin 0 -> 7538 bytes
 chalk/data/patterns/corkboard.pat                  |   Bin 0 -> 10097 bytes
 chalk/data/patterns/cracked.pat                    |   Bin 0 -> 62238 bytes
 chalk/data/patterns/crinklepaper.pat               |   Bin 0 -> 49191 bytes
 chalk/data/patterns/electric.pat                   |   Bin 0 -> 9638 bytes
 chalk/data/patterns/fibers.pat                     |   Bin 0 -> 7531 bytes
 chalk/data/patterns/granite1.pat                   |   Bin 0 -> 10035 bytes
 chalk/data/patterns/ground1.pat                    |   Bin 0 -> 30034 bytes
 chalk/data/patterns/ice.pat                        |   Bin 0 -> 43228 bytes
 chalk/data/patterns/java.pat                       |   Bin 0 -> 12315 bytes
 chalk/data/patterns/leather.pat                    |   Bin 0 -> 12320 bytes
 chalk/data/patterns/leaves.pat                     |   Bin 0 -> 7537 bytes
 chalk/data/patterns/leopard.pat                    |   Bin 0 -> 11921 bytes
 chalk/data/patterns/lightning.pat                  |   Bin 0 -> 40707 bytes
 chalk/data/patterns/marble1.pat                    |   Bin 0 -> 16418 bytes
 chalk/data/patterns/marble2.pat                    |   Bin 0 -> 16418 bytes
 chalk/data/patterns/marble3.pat                    |   Bin 0 -> 12322 bytes
 chalk/data/patterns/nops.pat                       |   Bin 0 -> 49177 bytes
 chalk/data/patterns/paper.pat                      |   Bin 0 -> 10030 bytes
 chalk/data/patterns/parque1.pat                    |   Bin 0 -> 12322 bytes
 chalk/data/patterns/parque2.pat                    |   Bin 0 -> 12322 bytes
 chalk/data/patterns/parque3.pat                    |   Bin 0 -> 12322 bytes
 chalk/data/patterns/pastel.pat                     |   Bin 0 -> 12325 bytes
 chalk/data/patterns/pine.pat                       |   Bin 0 -> 10781 bytes
 chalk/data/patterns/pink_marble.pat                |   Bin 0 -> 49188 bytes
 chalk/data/patterns/pool.pat                       |   Bin 0 -> 6111 bytes
 chalk/data/patterns/qube1.pat                      |   Bin 0 -> 5331 bytes
 chalk/data/patterns/rain.pat                       |   Bin 0 -> 35021 bytes
 chalk/data/patterns/recessed.pat                   |   Bin 0 -> 6433 bytes
 chalk/data/patterns/redcube.pat                    |   Bin 0 -> 12320 bytes
 chalk/data/patterns/rock.pat                       |   Bin 0 -> 30510 bytes
 chalk/data/patterns/sky.pat                        |   Bin 0 -> 11002 bytes
 chalk/data/patterns/slate.pat                      |   Bin 0 -> 16414 bytes
 chalk/data/patterns/sm_squares.pat                 |   Bin 0 -> 7538 bytes
 chalk/data/patterns/starfield.pat                  |   Bin 0 -> 49163 bytes
 chalk/data/patterns/stone33.pat                    |   Bin 0 -> 73034 bytes
 chalk/data/patterns/terra.pat                      |   Bin 0 -> 12318 bytes
 chalk/data/patterns/walnut.pat                     |   Bin 0 -> 49183 bytes
 chalk/data/patterns/warning.pat                    |   Bin 0 -> 1233 bytes
 chalk/data/patterns/wood1.pat                      |   Bin 0 -> 27690 bytes
 chalk/data/patterns/wood2.pat                      |   Bin 0 -> 30030 bytes
 chalk/data/patterns/wood3.pat                      |   Bin 0 -> 7532 bytes
 chalk/data/patterns/wood4.pat                      |   Bin 0 -> 7532 bytes
 chalk/data/patterns/wood5.pat                      |   Bin 0 -> 27677 bytes
 chalk/data/profiles/Adobe.icm                      |   Bin 0 -> 2036 bytes
 chalk/data/profiles/Apple.icm                      |   Bin 0 -> 2036 bytes
 chalk/data/profiles/CIE.icm                        |   Bin 0 -> 2036 bytes
 chalk/data/profiles/CMY.icm                        |   Bin 0 -> 101936 bytes
 chalk/data/profiles/ColorMatch.icm                 |   Bin 0 -> 2044 bytes
 chalk/data/profiles/Makefile.am                    |     4 +
 chalk/data/profiles/NTSC.icm                       |   Bin 0 -> 2044 bytes
 chalk/data/profiles/PAL.icm                        |   Bin 0 -> 2040 bytes
 chalk/data/profiles/README                         |     5 +
 chalk/data/profiles/SMPTE-C.icm                    |   Bin 0 -> 2052 bytes
 chalk/data/profiles/WideGamut.icm                  |   Bin 0 -> 2044 bytes
 chalk/data/profiles/cmyk.icm                       |   Bin 0 -> 725407 bytes
 chalk/data/profiles/fogra27l.icm                   |   Bin 0 -> 225823 bytes
 chalk/data/profiles/lcmslabi.icm                   |   Bin 0 -> 154326 bytes
 chalk/data/profiles/lcmsxyzi.icm                   |   Bin 0 -> 154323 bytes
 chalk/data/profiles/monoscnr.icm                   |   Bin 0 -> 410 bytes
 chalk/data/profiles/sRGB.icm                       |   Bin 0 -> 2032 bytes
 chalk/data/profiles/srgb_color_space_profile.icm   |   Bin 0 -> 3144 bytes
 chalk/data/profiles/srgbspac.icm                   |   Bin 0 -> 28202 bytes
 chalk/data/profiles/tifflab8spac.icm               |   Bin 0 -> 200182 bytes
 chalk/data/profiles/ycc601.icm                     |   Bin 0 -> 101940 bytes
 chalk/data/profiles/ycc709.icm                     |   Bin 0 -> 101940 bytes
 chalk/data/templates/.directory                    |    56 +
 chalk/design.h                                     |    27 +
 chalk/doc/DESIGN.obsolete                          |   179 +
 chalk/doc/Developing Chalk Plugins.odt             |   Bin 0 -> 50195 bytes
 chalk/doc/autoextending paintdevices               |    54 +
 chalk/doc/background_paper.txt                     |    84 +
 chalk/doc/brush.txt                                |    36 +
 chalk/doc/chalk-features                           |   215 +
 chalk/doc/chalk.kpr                                |   Bin 0 -> 2857392 bytes
 chalk/doc/chalk.pdf                                |   Bin 0 -> 2701147 bytes
 chalk/doc/chalk.xmi                                | 56432 +++++++++++++++++++
 chalk/doc/channels_masks_selections                |    12 +
 chalk/doc/colordiff                                |    68 +
 chalk/doc/colorspaces.xmi                          | 41965 ++++++++++++++
 chalk/doc/colorstrategyAPI                         |    58 +
 chalk/doc/controller.xmi                           | 39776 +++++++++++++
 chalk/doc/coordinates.txt                          |     9 +
 chalk/doc/dirty.txt                                |    53 +
 chalk/doc/doc-outline                              |   187 +
 chalk/doc/histograms.xmi                           |  4145 ++
 chalk/doc/hooks                                    |    33 +
 chalk/doc/howtofilters.txt                         |    30 +
 chalk/doc/impexp.txt                               |    41 +
 chalk/doc/large_files                              |    36 +
 chalk/doc/layersupdatesignals.flw                  |   Bin 0 -> 10783 bytes
 chalk/doc/manual/chalk.kwd                         |   Bin 0 -> 2505238 bytes
 chalk/doc/oasis                                    |     5 +
 chalk/doc/paint_device.txt                         |    98 +
 chalk/doc/palettedesign.txt                        |    34 +
 chalk/doc/plugins.txt                              |    32 +
 chalk/doc/profiles.txt                             |   125 +
 chalk/doc/resolution.txt                           |    40 +
 chalk/doc/scripts/dcop.py                          |    14 +
 chalk/doc/sdk                                      |    10 +
 chalk/doc/selections                               |   127 +
 chalk/doc/the preview widget                       |    81 +
 chalk/doc/transform_undo.txt                       |    38 +
 chalk/dtd/Makefile.am                              |     4 +
 chalk/dtd/chalk.dtd                                |    93 +
 chalk/extracti18n.pl                               |    90 +
 chalk/main.cc                                      |    43 +
 chalk/pics/Makefile.am                             |    22 +
 chalk/pics/chalk.svg                               |   509 +
 chalk/pics/deletelayer.png                         |   Bin 0 -> 376 bytes
 chalk/pics/height.png                              |   Bin 0 -> 202 bytes
 chalk/pics/hi128-app-chalk.png                     |   Bin 0 -> 9549 bytes
 chalk/pics/hi16-app-chalk.png                      |   Bin 0 -> 638 bytes
 chalk/pics/hi22-app-chalk.png                      |   Bin 0 -> 930 bytes
 chalk/pics/hi32-app-chalk.png                      |   Bin 0 -> 1487 bytes
 chalk/pics/hi48-app-chalk.png                      |   Bin 0 -> 2587 bytes
 chalk/pics/hi64-app-chalk.png                      |   Bin 0 -> 3836 bytes
 chalk/pics/linked.png                              |   Bin 0 -> 528 bytes
 chalk/pics/locked.png                              |   Bin 0 -> 557 bytes
 chalk/pics/lowerlayer.png                          |   Bin 0 -> 363 bytes
 chalk/pics/newlayer.png                            |   Bin 0 -> 426 bytes
 chalk/pics/novisible.png                           |   Bin 0 -> 721 bytes
 chalk/pics/raiselayer.png                          |   Bin 0 -> 344 bytes
 chalk/pics/shade.png                               |   Bin 0 -> 235 bytes
 chalk/pics/tablet.png                              |   Bin 0 -> 4454 bytes
 chalk/pics/tool_screenshot.png                     |   Bin 0 -> 852 bytes
 chalk/pics/unlinked.png                            |   Bin 0 -> 363 bytes
 chalk/pics/unlocked.png                            |   Bin 0 -> 605 bytes
 chalk/pics/visible.png                             |   Bin 0 -> 771 bytes
 chalk/pics/width.png                               |   Bin 0 -> 179 bytes
 chalk/plugins/Makefile.am                          |     5 +
 chalk/plugins/README                               |    42 +
 chalk/plugins/configure.in.in                      |     2 +
 chalk/plugins/filters/Makefile.am                  |     4 +
 chalk/plugins/filters/blur/Makefile.am             |    22 +
 chalk/plugins/filters/blur/blur.cc                 |    50 +
 chalk/plugins/filters/blur/blur.h                  |    37 +
 chalk/plugins/filters/blur/chalkblurfilter.desktop |    38 +
 chalk/plugins/filters/blur/kis_blur_filter.cc      |   143 +
 chalk/plugins/filters/blur/kis_blur_filter.h       |    49 +
 chalk/plugins/filters/blur/kis_wdg_blur.cc         |   116 +
 chalk/plugins/filters/blur/kis_wdg_blur.h          |    50 +
 chalk/plugins/filters/blur/wdgblur.ui              |   227 +
 chalk/plugins/filters/bumpmap/Makefile.am          |    19 +
 chalk/plugins/filters/bumpmap/bumpmap.cc           |   533 +
 chalk/plugins/filters/bumpmap/bumpmap.h            |   130 +
 .../filters/bumpmap/chalkbumpmapfilter.desktop     |    71 +
 chalk/plugins/filters/bumpmap/wdgbumpmap.ui        |   374 +
 chalk/plugins/filters/cimg/.kdev_ignore            |     0
 chalk/plugins/filters/cimg/CImg.h                  | 19174 +++++++
 chalk/plugins/filters/cimg/Makefile.am             |    35 +
 chalk/plugins/filters/cimg/chalkcimg.desktop       |    79 +
 chalk/plugins/filters/cimg/kis_cimg_filter.cc      |   711 +
 chalk/plugins/filters/cimg/kis_cimg_filter.h       |   124 +
 chalk/plugins/filters/cimg/kis_cimg_plugin.cc      |    44 +
 chalk/plugins/filters/cimg/kis_cimg_plugin.h       |    32 +
 .../plugins/filters/cimg/kis_cimgconfig_widget.cc  |    94 +
 chalk/plugins/filters/cimg/kis_cimgconfig_widget.h |    50 +
 chalk/plugins/filters/cimg/wdg_cimg.ui             |   298 +
 chalk/plugins/filters/colorify/Colorify.cpp        |   122 +
 chalk/plugins/filters/colorify/Colorify.h          |    56 +
 chalk/plugins/filters/colorify/KisWdgColorify.cpp  |    50 +
 chalk/plugins/filters/colorify/KisWdgColorify.h    |    45 +
 chalk/plugins/filters/colorify/Makefile.am         |    23 +
 chalk/plugins/filters/colorify/WdgColorifyBase.ui  |    97 +
 .../filters/colorify/chalkcolorifyfilter.desktop   |    42 +
 chalk/plugins/filters/colors/Makefile.am           |    21 +
 .../colors/chalkextensioncolorsfilters.desktop     |    42 +
 chalk/plugins/filters/colors/colors.cc             |    53 +
 chalk/plugins/filters/colors/colors.h              |    37 +
 chalk/plugins/filters/colors/kis_color_to_alpha.cc |    95 +
 chalk/plugins/filters/colors/kis_color_to_alpha.h  |    47 +
 chalk/plugins/filters/colors/kis_minmax_filters.cc |   162 +
 chalk/plugins/filters/colors/kis_minmax_filters.h  |    56 +
 .../filters/colors/kis_wdg_color_to_alpha.cc       |    55 +
 .../filters/colors/kis_wdg_color_to_alpha.h        |    45 +
 .../plugins/filters/colors/wdgcolortoalphabase.ui  |   113 +
 chalk/plugins/filters/colorsfilters/Makefile.am    |    26 +
 .../colorsfilters/chalkcolorsfilter.desktop        |    94 +
 .../plugins/filters/colorsfilters/colorsfilters.cc |   315 +
 .../plugins/filters/colorsfilters/colorsfilters.h  |    73 +
 .../kis_brightness_contrast_filter.cc              |   347 +
 .../colorsfilters/kis_brightness_contrast_filter.h |    84 +
 .../filters/colorsfilters/kis_perchannel_filter.cc |   421 +
 .../filters/colorsfilters/kis_perchannel_filter.h  |   100 +
 .../colorsfilters/wdg_brightness_contrast.ui       |   292 +
 .../filters/colorsfilters/wdg_perchannel.ui        |   190 +
 .../plugins/filters/convolutionfilters/Makefile.am |    28 +
 .../chalkconvolutionfilters.desktop                |    75 +
 .../convolutionfilters/convolutionfilters.cc       |   176 +
 .../convolutionfilters/convolutionfilters.h        |   152 +
 .../convolutionfilters/kis_convolution_filter.cc   |   138 +
 .../convolutionfilters/kis_convolution_filter.h    |    99 +
 .../kis_custom_convolution_filter.cc               |    93 +
 .../kis_custom_convolution_filter.h                |    54 +
 ...convolution_filter_configuration_base_widget.ui |   189 +
 ...stom_convolution_filter_configuration_widget.cc |    83 +
 ...ustom_convolution_filter_configuration_widget.h |    46 +
 chalk/plugins/filters/cubismfilter/Makefile.am     |    24 +
 .../filters/cubismfilter/chalkcubismfilter.desktop |    85 +
 .../filters/cubismfilter/kis_cubism_filter.cc      |   453 +
 .../filters/cubismfilter/kis_cubism_filter.h       |    78 +
 .../cubismfilter/kis_cubism_filter_plugin.cc       |    42 +
 .../cubismfilter/kis_cubism_filter_plugin.h        |    32 +
 chalk/plugins/filters/cubismfilter/kis_polygon.cc  |   102 +
 chalk/plugins/filters/cubismfilter/kis_polygon.h   |    37 +
 chalk/plugins/filters/embossfilter/Makefile.am     |    24 +
 .../filters/embossfilter/chalkembossfilter.desktop |    71 +
 .../filters/embossfilter/kis_emboss_filter.cc      |   179 +
 .../filters/embossfilter/kis_emboss_filter.h       |    62 +
 .../embossfilter/kis_emboss_filter_plugin.cc       |    40 +
 .../embossfilter/kis_emboss_filter_plugin.h        |    32 +
 chalk/plugins/filters/example/Makefile.am          |    22 +
 chalk/plugins/filters/example/chalkexample.desktop |    81 +
 chalk/plugins/filters/example/example.cc           |    95 +
 chalk/plugins/filters/example/example.h            |    47 +
 .../plugins/filters/fastcolortransfer/Makefile.am  |    23 +
 .../chalkfastcolortransfer.desktop                 |    69 +
 .../filters/fastcolortransfer/fastcolortransfer.cc |   206 +
 .../filters/fastcolortransfer/fastcolortransfer.h  |    55 +
 .../kis_wdg_fastcolortransfer.cpp                  |    50 +
 .../fastcolortransfer/kis_wdg_fastcolortransfer.h  |    47 +
 .../fastcolortransfer/wdgfastcolortransfer.ui      |    75 +
 chalk/plugins/filters/halftone/kis_halftone.cpp    |   190 +
 chalk/plugins/filters/halftone/kis_halftone.h      |    79 +
 chalk/plugins/filters/imageenhancement/Makefile.am |    27 +
 .../imageenhancement/chalkimageenhancement.desktop |    80 +
 .../filters/imageenhancement/imageenhancement.cpp  |    73 +
 .../filters/imageenhancement/imageenhancement.h    |    34 +
 .../imageenhancement/kis_simple_noise_reducer.cpp  |   129 +
 .../imageenhancement/kis_simple_noise_reducer.h    |    59 +
 .../kis_wavelet_noise_reduction.cpp                |   130 +
 .../imageenhancement/kis_wavelet_noise_reduction.h |    68 +
 .../filters/lenscorrectionfilter/Makefile.am       |    23 +
 .../chalklenscorrectionfilter.desktop              |    69 +
 .../kis_wdg_lens_correction.cpp                    |    74 +
 .../lenscorrectionfilter/kis_wdg_lens_correction.h |    44 +
 .../lenscorrectionfilter/lenscorrectionfilter.cc   |   152 +
 .../lenscorrectionfilter/lenscorrectionfilter.h    |    53 +
 .../wdglenscorrectionoptions.ui                    |   229 +
 chalk/plugins/filters/levelfilter/Makefile.am      |    25 +
 .../filters/levelfilter/chalklevelfilter.desktop   |    73 +
 .../plugins/filters/levelfilter/kgradientslider.cc |   338 +
 .../plugins/filters/levelfilter/kgradientslider.h  |    85 +
 .../filters/levelfilter/kis_level_filter.cc        |   324 +
 .../plugins/filters/levelfilter/kis_level_filter.h |    94 +
 chalk/plugins/filters/levelfilter/levelfilter.cc   |    67 +
 chalk/plugins/filters/levelfilter/levelfilter.h    |    35 +
 chalk/plugins/filters/levelfilter/wdg_level.ui     |   331 +
 chalk/plugins/filters/noisefilter/Makefile.am      |    23 +
 .../filters/noisefilter/chalknoisefilter.desktop   |    77 +
 .../plugins/filters/noisefilter/kis_wdg_noise.cpp  |    59 +
 chalk/plugins/filters/noisefilter/kis_wdg_noise.h  |    44 +
 chalk/plugins/filters/noisefilter/noisefilter.cc   |   128 +
 chalk/plugins/filters/noisefilter/noisefilter.h    |    52 +
 .../plugins/filters/noisefilter/wdgnoiseoptions.ui |   111 +
 chalk/plugins/filters/oilpaintfilter/Makefile.am   |    24 +
 .../oilpaintfilter/chalkoilpaintfilter.desktop     |    77 +
 .../filters/oilpaintfilter/kis_oilpaint_filter.cc  |   256 +
 .../filters/oilpaintfilter/kis_oilpaint_filter.h   |    69 +
 .../oilpaintfilter/kis_oilpaint_filter_plugin.cc   |    43 +
 .../oilpaintfilter/kis_oilpaint_filter_plugin.h    |    32 +
 chalk/plugins/filters/pixelizefilter/Makefile.am   |    24 +
 .../pixelizefilter/chalkpixelizefilter.desktop     |    83 +
 .../filters/pixelizefilter/kis_pixelize_filter.cc  |   188 +
 .../filters/pixelizefilter/kis_pixelize_filter.h   |    61 +
 .../pixelizefilter/kis_pixelize_filter_plugin.cc   |    43 +
 .../pixelizefilter/kis_pixelize_filter_plugin.h    |    32 +
 chalk/plugins/filters/raindropsfilter/Makefile.am  |    24 +
 .../raindropsfilter/chalkraindropsfilter.desktop   |    81 +
 .../raindropsfilter/kis_raindrops_filter.cc        |   439 +
 .../filters/raindropsfilter/kis_raindrops_filter.h |    67 +
 .../raindropsfilter/kis_raindrops_filter_plugin.cc |    44 +
 .../raindropsfilter/kis_raindrops_filter_plugin.h  |    33 +
 chalk/plugins/filters/randompickfilter/Makefile.am |    23 +
 .../randompickfilter/chalkrandompickfilter.desktop |    65 +
 .../randompickfilter/kis_wdg_random_pick.cpp       |    64 +
 .../filters/randompickfilter/kis_wdg_random_pick.h |    44 +
 .../filters/randompickfilter/randompickfilter.cc   |   131 +
 .../filters/randompickfilter/randompickfilter.h    |    52 +
 .../randompickfilter/wdgrandompickoptions.ui       |   135 +
 chalk/plugins/filters/roundcorners/Makefile.am     |    23 +
 .../roundcorners/chalkroundcornersfilter.desktop   |    39 +
 .../roundcorners/kis_round_corners_filter.cc       |   158 +
 .../roundcorners/kis_round_corners_filter.h        |    58 +
 .../kis_round_corners_filter_plugin.cc             |    43 +
 .../roundcorners/kis_round_corners_filter_plugin.h |    32 +
 chalk/plugins/filters/smalltilesfilter/Makefile.am |    23 +
 .../smalltilesfilter/chalksmalltilesfilter.desktop |    39 +
 .../smalltilesfilter/kis_small_tiles_filter.cc     |   187 +
 .../smalltilesfilter/kis_small_tiles_filter.h      |    70 +
 .../kis_small_tiles_filter_plugin.cc               |    43 +
 .../kis_small_tiles_filter_plugin.h                |    32 +
 chalk/plugins/filters/sobelfilter/Makefile.am      |    23 +
 .../filters/sobelfilter/chalksobelfilter.desktop   |    39 +
 .../filters/sobelfilter/kis_sobel_filter.cc        |   217 +
 .../plugins/filters/sobelfilter/kis_sobel_filter.h |    75 +
 .../filters/sobelfilter/kis_sobel_filter_plugin.cc |    43 +
 .../filters/sobelfilter/kis_sobel_filter_plugin.h  |    32 +
 chalk/plugins/filters/threadtest/Makefile.am       |    18 +
 .../filters/threadtest/chalkthreadtest.desktop     |    38 +
 chalk/plugins/filters/threadtest/threadtest.cc     |   140 +
 chalk/plugins/filters/threadtest/threadtest.h      |    46 +
 chalk/plugins/filters/unsharp/Makefile.am          |    20 +
 .../filters/unsharp/chalkunsharpfilter.desktop     |    40 +
 .../plugins/filters/unsharp/kis_unsharp_filter.cc  |   152 +
 chalk/plugins/filters/unsharp/kis_unsharp_filter.h |    47 +
 chalk/plugins/filters/unsharp/kis_wdg_unsharp.cc   |    52 +
 chalk/plugins/filters/unsharp/kis_wdg_unsharp.h    |    45 +
 chalk/plugins/filters/unsharp/unsharp.cc           |    50 +
 chalk/plugins/filters/unsharp/unsharp.h            |    37 +
 chalk/plugins/filters/unsharp/wdgunsharp.ui        |   138 +
 chalk/plugins/filters/wavefilter/Makefile.am       |    23 +
 .../filters/wavefilter/chalkwavefilter.desktop     |    72 +
 chalk/plugins/filters/wavefilter/kis_wdg_wave.cpp  |    90 +
 chalk/plugins/filters/wavefilter/kis_wdg_wave.h    |    44 +
 chalk/plugins/filters/wavefilter/wavefilter.cc     |   169 +
 chalk/plugins/filters/wavefilter/wavefilter.h      |    53 +
 chalk/plugins/filters/wavefilter/wdgwaveoptions.ui |   281 +
 chalk/plugins/paintops/Makefile.am                 |     2 +
 chalk/plugins/paintops/defaultpaintops/Makefile.am |    39 +
 chalk/plugins/paintops/defaultpaintops/README      |     3 +
 .../plugins/paintops/defaultpaintops/airbrush.png  |   Bin 0 -> 1038 bytes
 .../defaultpaintops/chalkdefaultpaintops.desktop   |    93 +
 .../defaultpaintops/defaultpaintops_plugin.cc      |    70 +
 .../defaultpaintops/defaultpaintops_plugin.h       |    36 +
 chalk/plugins/paintops/defaultpaintops/eraser.png  |   Bin 0 -> 735 bytes
 .../paintops/defaultpaintops/kis_airbrushop.cc     |   150 +
 .../paintops/defaultpaintops/kis_airbrushop.h      |    60 +
 .../paintops/defaultpaintops/kis_brushop.cc        |   284 +
 .../plugins/paintops/defaultpaintops/kis_brushop.h |   113 +
 .../paintops/defaultpaintops/kis_convolveop.cc     |    58 +
 .../paintops/defaultpaintops/kis_convolveop.h      |    56 +
 .../defaultpaintops/kis_dlgbrushcurvecontrol.ui    |   271 +
 .../paintops/defaultpaintops/kis_duplicateop.cc    |   341 +
 .../paintops/defaultpaintops/kis_duplicateop.h     |    62 +
 .../paintops/defaultpaintops/kis_eraseop.cc        |   140 +
 .../plugins/paintops/defaultpaintops/kis_eraseop.h |    56 +
 .../plugins/paintops/defaultpaintops/kis_penop.cc  |   132 +
 chalk/plugins/paintops/defaultpaintops/kis_penop.h |    58 +
 .../paintops/defaultpaintops/kis_smudgeop.cc       |   328 +
 .../paintops/defaultpaintops/kis_smudgeop.h        |   118 +
 .../paintops/defaultpaintops/paintbrush.png        |   Bin 0 -> 770 bytes
 chalk/plugins/paintops/defaultpaintops/pencil.png  |   Bin 0 -> 794 bytes
 chalk/plugins/paintops/defaultpaintops/src/README  |     2 +
 .../paintops/defaultpaintops/src/pencil_01.svg     |   637 +
 .../src/pencil_jonathan_dietrich_01.svg            |   434 +
 .../src/pennello_mauro_olivo_01.svg                |   616 +
 chalk/plugins/tools/Makefile.am                    |     3 +
 chalk/plugins/tools/defaulttools/Makefile.am       |    83 +
 .../tools/defaulttools/chalkdefaulttools.desktop   |    56 +
 .../tools/defaulttools/closedhand_cursor.xpm       |    28 +
 chalk/plugins/tools/defaulttools/default_tools.cc  |    88 +
 chalk/plugins/tools/defaulttools/default_tools.h   |    44 +
 chalk/plugins/tools/defaulttools/kis_tool_brush.cc |   167 +
 chalk/plugins/tools/defaulttools/kis_tool_brush.h  |    87 +
 .../tools/defaulttools/kis_tool_colorpicker.cc     |   298 +
 .../tools/defaulttools/kis_tool_colorpicker.h      |    88 +
 .../tools/defaulttools/kis_tool_duplicate.cc       |   255 +
 .../tools/defaulttools/kis_tool_duplicate.h        |    92 +
 .../plugins/tools/defaulttools/kis_tool_ellipse.cc |   186 +
 .../plugins/tools/defaulttools/kis_tool_ellipse.h  |    91 +
 chalk/plugins/tools/defaulttools/kis_tool_fill.cc  |   233 +
 chalk/plugins/tools/defaulttools/kis_tool_fill.h   |   109 +
 .../tools/defaulttools/kis_tool_gradient.cc        |   309 +
 .../plugins/tools/defaulttools/kis_tool_gradient.h |   124 +
 chalk/plugins/tools/defaulttools/kis_tool_line.cc  |   254 +
 chalk/plugins/tools/defaulttools/kis_tool_line.h   |   100 +
 chalk/plugins/tools/defaulttools/kis_tool_move.cc  |   181 +
 chalk/plugins/tools/defaulttools/kis_tool_move.h   |    89 +
 chalk/plugins/tools/defaulttools/kis_tool_pan.cc   |    96 +
 chalk/plugins/tools/defaulttools/kis_tool_pan.h    |    80 +
 .../tools/defaulttools/kis_tool_rectangle.cc       |   187 +
 .../tools/defaulttools/kis_tool_rectangle.h        |    96 +
 chalk/plugins/tools/defaulttools/kis_tool_text.cc  |   198 +
 chalk/plugins/tools/defaulttools/kis_tool_text.h   |    81 +
 chalk/plugins/tools/defaulttools/kis_tool_zoom.cc  |   191 +
 chalk/plugins/tools/defaulttools/kis_tool_zoom.h   |    98 +
 .../plugins/tools/defaulttools/openhand_cursor.xpm |    28 +
 .../plugins/tools/defaulttools/tool_color_fill.png |   Bin 0 -> 1102 bytes
 .../tools/defaulttools/tool_colorpicker.png        |   Bin 0 -> 713 bytes
 .../plugins/tools/defaulttools/tool_duplicate.png  |   Bin 0 -> 1087 bytes
 .../tools/defaulttools/tool_duplicate_cursor.png   |   Bin 0 -> 309 bytes
 chalk/plugins/tools/defaulttools/tool_ellipse.png  |   Bin 0 -> 524 bytes
 .../tools/defaulttools/tool_ellipse_cursor.png     |   Bin 0 -> 309 bytes
 .../tools/defaulttools/tool_fill_cursor.png        |   Bin 0 -> 516 bytes
 chalk/plugins/tools/defaulttools/tool_freehand.png |   Bin 0 -> 658 bytes
 .../tools/defaulttools/tool_freehand_cursor.png    |   Bin 0 -> 261 bytes
 chalk/plugins/tools/defaulttools/tool_gradient.png |   Bin 0 -> 386 bytes
 .../tools/defaulttools/tool_gradient_cursor.png    |   Bin 0 -> 294 bytes
 chalk/plugins/tools/defaulttools/tool_line.png     |   Bin 0 -> 354 bytes
 .../tools/defaulttools/tool_line_cursor.png        |   Bin 0 -> 248 bytes
 chalk/plugins/tools/defaulttools/tool_move.png     |   Bin 0 -> 664 bytes
 chalk/plugins/tools/defaulttools/tool_pan.png      |   Bin 0 -> 863 bytes
 .../plugins/tools/defaulttools/tool_rectangle.png  |   Bin 0 -> 334 bytes
 .../tools/defaulttools/tool_rectangle_cursor.png   |   Bin 0 -> 230 bytes
 chalk/plugins/tools/defaulttools/tool_text.png     |   Bin 0 -> 891 bytes
 .../tools/defaulttools/tool_text_cursor.png        |   Bin 0 -> 300 bytes
 chalk/plugins/tools/defaulttools/tool_zoom.png     |   Bin 0 -> 877 bytes
 .../tools/defaulttools/tool_zoom_minus_cursor.png  |   Bin 0 -> 283 bytes
 .../tools/defaulttools/tool_zoom_plus_cursor.png   |   Bin 0 -> 302 bytes
 chalk/plugins/tools/defaulttools/wdgcolorpicker.ui |   167 +
 chalk/plugins/tools/selectiontools/Makefile.am     |    56 +
 .../selectiontools/chalkselectiontools.desktop     |    52 +
 .../selectiontools/kis_tool_move_selection.cc      |   223 +
 .../tools/selectiontools/kis_tool_move_selection.h |    75 +
 .../tools/selectiontools/kis_tool_select_brush.cc  |   168 +
 .../tools/selectiontools/kis_tool_select_brush.h   |    83 +
 .../selectiontools/kis_tool_select_contiguous.cc   |   234 +
 .../selectiontools/kis_tool_select_contiguous.h    |    95 +
 .../selectiontools/kis_tool_select_elliptical.cc   |   321 +
 .../selectiontools/kis_tool_select_elliptical.h    |    99 +
 .../tools/selectiontools/kis_tool_select_eraser.cc |   156 +
 .../tools/selectiontools/kis_tool_select_eraser.h  |    82 +
 .../selectiontools/kis_tool_select_outline.cc      |   295 +
 .../tools/selectiontools/kis_tool_select_outline.h |   101 +
 .../selectiontools/kis_tool_select_polygonal.cc    |   315 +
 .../selectiontools/kis_tool_select_polygonal.h     |   106 +
 .../selectiontools/kis_tool_select_rectangular.cc  |   323 +
 .../selectiontools/kis_tool_select_rectangular.h   |    95 +
 .../tools/selectiontools/selection_tools.cc        |    77 +
 .../plugins/tools/selectiontools/selection_tools.h |    44 +
 .../tools/selectiontools/tool_brush_selection.png  |   Bin 0 -> 1052 bytes
 .../tools/selectiontools/tool_brush_selection.svg  |   827 +
 .../selectiontools/tool_brush_selection_cursor.png |   Bin 0 -> 339 bytes
 .../selectiontools/tool_contiguous_selection.png   |   Bin 0 -> 836 bytes
 .../tool_contiguous_selection_cursor.png           |   Bin 0 -> 321 bytes
 .../selectiontools/tool_elliptical_selection.png   |   Bin 0 -> 703 bytes
 .../selectiontools/tool_elliptical_selection.svg   |   256 +
 .../tool_elliptical_selection_cursor.png           |   Bin 0 -> 296 bytes
 .../tools/selectiontools/tool_eraser_selection.png |   Bin 0 -> 1087 bytes
 .../tools/selectiontools/tool_eraser_selection.svg |  1993 +
 .../tool_eraser_selection_cursor.png               |   Bin 0 -> 341 bytes
 .../selectiontools/tool_outline_selection.png      |   Bin 0 -> 556 bytes
 .../selectiontools/tool_outline_selection.svg      |   329 +
 .../tool_outline_selection_cursor.png              |   Bin 0 -> 359 bytes
 .../selectiontools/tool_polygonal_selection.png    |   Bin 0 -> 576 bytes
 .../selectiontools/tool_polygonal_selection.svg    |   364 +
 .../tool_polygonal_selection_cursor.png            |   Bin 0 -> 433 bytes
 .../tools/selectiontools/tool_rect_selection.png   |   Bin 0 -> 523 bytes
 .../tools/selectiontools/tool_rect_selection.svg   |   191 +
 .../tool_rectangular_selection_cursor.png          |   Bin 0 -> 224 bytes
 chalk/plugins/tools/tool_crop/Makefile.am          |    37 +
 .../plugins/tools/tool_crop/chalktoolcrop.desktop  |    47 +
 chalk/plugins/tools/tool_crop/kis_tool_crop.cc     |   925 +
 chalk/plugins/tools/tool_crop/kis_tool_crop.h      |   149 +
 chalk/plugins/tools/tool_crop/tool_crop.cc         |    62 +
 chalk/plugins/tools/tool_crop/tool_crop.h          |    43 +
 chalk/plugins/tools/tool_crop/tool_crop.png        |   Bin 0 -> 693 bytes
 chalk/plugins/tools/tool_crop/tool_crop_cursor.png |   Bin 0 -> 306 bytes
 chalk/plugins/tools/tool_crop/wdg_tool_crop.ui     |   216 +
 chalk/plugins/tools/tool_curves/Makefile.am        |    56 +
 .../tools/tool_curves/chalktoolcurves.desktop      |    36 +
 .../tools/tool_curves/kis_curve_framework.cc       |   260 +
 .../tools/tool_curves/kis_curve_framework.h        |   354 +
 chalk/plugins/tools/tool_curves/kis_tool_bezier.cc |   366 +
 chalk/plugins/tools/tool_curves/kis_tool_bezier.h  |    98 +
 .../tools/tool_curves/kis_tool_bezier_paint.cc     |   115 +
 .../tools/tool_curves/kis_tool_bezier_paint.h      |    63 +
 .../tools/tool_curves/kis_tool_bezier_select.cc    |   104 +
 .../tools/tool_curves/kis_tool_bezier_select.h     |    63 +
 chalk/plugins/tools/tool_curves/kis_tool_curve.cc  |   593 +
 chalk/plugins/tools/tool_curves/kis_tool_curve.h   |   205 +
 .../plugins/tools/tool_curves/kis_tool_example.cc  |   108 +
 chalk/plugins/tools/tool_curves/kis_tool_example.h |    67 +
 .../plugins/tools/tool_curves/kis_tool_moutline.cc |   809 +
 .../plugins/tools/tool_curves/kis_tool_moutline.h  |   132 +
 .../tools/tool_curves/tool_bezier_cursor.png       |   Bin 0 -> 2854 bytes
 .../tools/tool_curves/tool_bezier_paint.png        |   Bin 0 -> 680 bytes
 .../tools/tool_curves/tool_bezier_select.png       |   Bin 0 -> 637 bytes
 .../tools/tool_curves/tool_curve_dragging.png      |   Bin 0 -> 2956 bytes
 chalk/plugins/tools/tool_curves/tool_curves.cc     |    67 +
 chalk/plugins/tools/tool_curves/tool_curves.h      |    36 +
 chalk/plugins/tools/tool_curves/tool_example.png   |   Bin 0 -> 2918 bytes
 .../tools/tool_curves/tool_example_cursor.png      |   Bin 0 -> 2854 bytes
 chalk/plugins/tools/tool_curves/tool_moutline.png  |   Bin 0 -> 778 bytes
 .../tools/tool_curves/tool_moutline_cursor.png     |   Bin 0 -> 2858 bytes
 .../tools/tool_curves/tool_moutline_editing.png    |   Bin 0 -> 2968 bytes
 .../plugins/tools/tool_curves/wdg_tool_example.ui  |   128 +
 chalk/plugins/tools/tool_filter/Makefile.am        |    38 +
 .../tools/tool_filter/chalktoolfilter.desktop      |    92 +
 chalk/plugins/tools/tool_filter/kis_filterop.cc    |   154 +
 chalk/plugins/tools/tool_filter/kis_filterop.h     |    63 +
 chalk/plugins/tools/tool_filter/kis_tool_filter.cc |   154 +
 chalk/plugins/tools/tool_filter/kis_tool_filter.h  |    81 +
 chalk/plugins/tools/tool_filter/tool_filter.cc     |    68 +
 chalk/plugins/tools/tool_filter/tool_filter.h      |    43 +
 chalk/plugins/tools/tool_filter/tool_filter.png    |   Bin 0 -> 497 bytes
 chalk/plugins/tools/tool_filter/tool_filter.svg    |   468 +
 .../tools/tool_filter/tool_filter_cursor.png       |   Bin 0 -> 295 bytes
 .../plugins/tools/tool_perspectivegrid/Makefile.am |    35 +
 .../chalktoolperspectivegrid.desktop               |    35 +
 .../kis_tool_perspectivegrid.cc                    |   499 +
 .../kis_tool_perspectivegrid.h                     |   111 +
 .../tool_perspectivegrid/tool_perspectivegrid.cc   |    62 +
 .../tool_perspectivegrid/tool_perspectivegrid.h    |    43 +
 .../tool_perspectivegrid/tool_perspectivegrid.png  |   Bin 0 -> 738 bytes
 .../tool_perspectivegrid/tool_perspectivegrid.svg  |    87 +
 .../tools/tool_perspectivetransform/Makefile.am    |    35 +
 .../chalktoolperspectivetransform.desktop          |    37 +
 .../kis_tool_perspectivetransform.cc               |   742 +
 .../kis_tool_perspectivetransform.h                |   131 +
 .../tool_perspectivetransform.cc                   |    63 +
 .../tool_perspectivetransform.h                    |    43 +
 .../tool_perspectivetransform.png                  |   Bin 0 -> 691 bytes
 .../tool_perspectivetransform.svg                  |    87 +
 chalk/plugins/tools/tool_polygon/Makefile.am       |    36 +
 .../tools/tool_polygon/chalktoolpolygon.desktop    |    52 +
 .../plugins/tools/tool_polygon/kis_tool_polygon.cc |   252 +
 .../plugins/tools/tool_polygon/kis_tool_polygon.h  |   102 +
 chalk/plugins/tools/tool_polygon/tool_polygon.cc   |    62 +
 chalk/plugins/tools/tool_polygon/tool_polygon.h    |    39 +
 chalk/plugins/tools/tool_polygon/tool_polygon.png  |   Bin 0 -> 773 bytes
 .../tools/tool_polygon/tool_polygon_cursor.png     |   Bin 0 -> 402 bytes
 chalk/plugins/tools/tool_polyline/Makefile.am      |    36 +
 .../tools/tool_polyline/chalktoolpolyline.desktop  |    49 +
 .../tools/tool_polyline/kis_tool_polyline.cc       |   271 +
 .../tools/tool_polyline/kis_tool_polyline.h        |   109 +
 chalk/plugins/tools/tool_polyline/polyline.png     |   Bin 0 -> 587 bytes
 chalk/plugins/tools/tool_polyline/tool_polyline.cc |    64 +
 chalk/plugins/tools/tool_polyline/tool_polyline.h  |    43 +
 .../tools/tool_polyline/tool_polyline_cursor.png   |   Bin 0 -> 397 bytes
 chalk/plugins/tools/tool_selectsimilar/Makefile.am |    32 +
 .../chalktoolselectsimilar.desktop                 |    43 +
 .../tool_selectsimilar/kis_tool_selectsimilar.cc   |   271 +
 .../tool_selectsimilar/kis_tool_selectsimilar.h    |   102 +
 .../tools/tool_selectsimilar/selectsimilar.cc      |    61 +
 .../tools/tool_selectsimilar/selectsimilar.h       |    35 +
 .../tool_selectsimilar/tool_similar_selection.png  |   Bin 0 -> 724 bytes
 .../tool_selectsimilar/tool_similar_selection.svg  |  2118 +
 .../tool_similar_selection_minus_cursor.png        |   Bin 0 -> 613 bytes
 .../tool_similar_selection_plus_cursor.png         |   Bin 0 -> 630 bytes
 chalk/plugins/tools/tool_star/Makefile.am          |    37 +
 .../plugins/tools/tool_star/chalktoolstar.desktop  |    52 +
 chalk/plugins/tools/tool_star/kis_tool_star.cc     |   245 +
 chalk/plugins/tools/tool_star/kis_tool_star.h      |   101 +
 chalk/plugins/tools/tool_star/tool_star.cc         |    62 +
 chalk/plugins/tools/tool_star/tool_star.h          |    43 +
 chalk/plugins/tools/tool_star/tool_star.png        |   Bin 0 -> 625 bytes
 chalk/plugins/tools/tool_star/tool_star_cursor.png |   Bin 0 -> 367 bytes
 chalk/plugins/tools/tool_star/wdg_tool_star.ui     |   128 +
 chalk/plugins/tools/tool_transform/Makefile.am     |    37 +
 .../tool_transform/chalktooltransform.desktop      |    46 +
 .../tools/tool_transform/kis_tool_transform.cc     |   916 +
 .../tools/tool_transform/kis_tool_transform.h      |   155 +
 .../plugins/tools/tool_transform/rotate_cursor.xpm |    29 +
 .../plugins/tools/tool_transform/tool_transform.cc |    64 +
 .../plugins/tools/tool_transform/tool_transform.h  |    43 +
 .../tools/tool_transform/tool_transform.png        |   Bin 0 -> 458 bytes
 .../tools/tool_transform/wdg_tool_transform.ui     |   243 +
 chalk/plugins/viewplugins/Makefile.am              |    24 +
 chalk/plugins/viewplugins/colorrange/Makefile.am   |    25 +
 .../viewplugins/colorrange/chalkcolorrange.desktop |    40 +
 chalk/plugins/viewplugins/colorrange/colorrange.cc |    82 +
 chalk/plugins/viewplugins/colorrange/colorrange.h  |    45 +
 chalk/plugins/viewplugins/colorrange/colorrange.rc |    10 +
 .../viewplugins/colorrange/dlg_colorrange.cc       |   351 +
 .../viewplugins/colorrange/dlg_colorrange.h        |   100 +
 .../viewplugins/colorrange/wdg_colorrange.ui       |   252 +
 .../viewplugins/colorspaceconversion/Makefile.am   |    27 +
 .../chalkcolorspaceconversion.desktop              |    40 +
 .../colorspaceconversion/colorspaceconversion.cc   |   155 +
 .../colorspaceconversion/colorspaceconversion.h    |    51 +
 .../colorspaceconversion/colorspaceconversion.rc   |    11 +
 .../dlg_colorspaceconversion.cc                    |    91 +
 .../dlg_colorspaceconversion.h                     |    50 +
 .../colorspaceconversion/wdgconvertcolorspace.ui   |   218 +
 chalk/plugins/viewplugins/dropshadow/Makefile.am   |    31 +
 .../viewplugins/dropshadow/chalkdropshadow.desktop |    39 +
 .../viewplugins/dropshadow/dlg_dropshadow.cc       |   117 +
 .../viewplugins/dropshadow/dlg_dropshadow.h        |    60 +
 chalk/plugins/viewplugins/dropshadow/dropshadow.rc |    11 +
 .../viewplugins/dropshadow/kis_dropshadow.cc       |   758 +
 .../viewplugins/dropshadow/kis_dropshadow.h        |    72 +
 .../dropshadow/kis_dropshadow_plugin.cc            |    91 +
 .../viewplugins/dropshadow/kis_dropshadow_plugin.h |    46 +
 .../viewplugins/dropshadow/wdg_dropshadow.ui       |   235 +
 .../plugins/viewplugins/filtersgallery/Makefile.am |    26 +
 .../filtersgallery/chalkfiltersgallery.desktop     |    45 +
 .../filtersgallery/chalkfiltersgallery.rc          |     9 +
 .../viewplugins/filtersgallery/filters_gallery.cc  |   138 +
 .../viewplugins/filtersgallery/filters_gallery.h   |    54 +
 .../filtersgallery/kis_dlg_filtersgallery.cc       |   133 +
 .../filtersgallery/kis_dlg_filtersgallery.h        |    69 +
 .../filtersgallery/kis_wdg_filtersgallery.ui       |   123 +
 chalk/plugins/viewplugins/histogram/Makefile.am    |    25 +
 .../viewplugins/histogram/chalkhistogram.desktop   |    43 +
 .../plugins/viewplugins/histogram/dlg_histogram.cc |    68 +
 .../plugins/viewplugins/histogram/dlg_histogram.h  |    58 +
 chalk/plugins/viewplugins/histogram/histogram.cc   |   105 +
 chalk/plugins/viewplugins/histogram/histogram.h    |    50 +
 chalk/plugins/viewplugins/histogram/histogram.rc   |    10 +
 .../viewplugins/histogram/kis_histogram_widget.cc  |   147 +
 .../viewplugins/histogram/kis_histogram_widget.h   |    55 +
 .../plugins/viewplugins/histogram/wdghistogram.ui  |   229 +
 .../viewplugins/histogram_docker/Makefile.am       |    22 +
 .../histogram_docker/chalkhistogramdocker.desktop  |    40 +
 .../histogram_docker/chalkhistogramdocker.rc       |     3 +
 .../histogram_docker/histogramdocker.cc            |   192 +
 .../viewplugins/histogram_docker/histogramdocker.h |    81 +
 .../histogram_docker/kis_accumulating_producer.cc  |   102 +
 .../histogram_docker/kis_accumulating_producer.h   |    77 +
 .../histogram_docker/kis_cachedhistogram.cc        |    37 +
 .../histogram_docker/kis_cachedhistogram.h         |    53 +
 .../histogram_docker/kis_imagerasteredcache.cc     |   162 +
 .../histogram_docker/kis_imagerasteredcache.h      |    81 +
 .../plugins/viewplugins/history_docker/Makefile.am |    18 +
 .../history_docker/chalkhistorydocker.desktop      |    73 +
 .../viewplugins/history_docker/historydocker.cc    |    58 +
 .../viewplugins/history_docker/historydocker.h     |    34 +
 chalk/plugins/viewplugins/imagesize/Makefile.am    |    25 +
 .../viewplugins/imagesize/chalkimagesize.desktop   |    39 +
 .../plugins/viewplugins/imagesize/configure.in.in  |     1 +
 .../plugins/viewplugins/imagesize/dlg_imagesize.cc |   277 +
 .../plugins/viewplugins/imagesize/dlg_imagesize.h  |    83 +
 .../plugins/viewplugins/imagesize/dlg_layersize.cc |   261 +
 .../plugins/viewplugins/imagesize/dlg_layersize.h  |    74 +
 chalk/plugins/viewplugins/imagesize/imagesize.cc   |   190 +
 chalk/plugins/viewplugins/imagesize/imagesize.h    |    49 +
 chalk/plugins/viewplugins/imagesize/imagesize.rc   |    15 +
 .../plugins/viewplugins/imagesize/wdg_imagesize.ui |   365 +
 .../plugins/viewplugins/imagesize/wdg_layersize.ui |   234 +
 .../viewplugins/imagesize/wdg_resolution.ui        |   152 +
 .../viewplugins/modify_selection/Makefile.am       |    27 +
 .../modify_selection/chalkmodifyselection.desktop  |    40 +
 .../modify_selection/dlg_border_selection.cc       |    76 +
 .../modify_selection/dlg_border_selection.h        |    49 +
 .../modify_selection/dlg_grow_selection.cc         |    76 +
 .../modify_selection/dlg_grow_selection.h          |    49 +
 .../modify_selection/dlg_shrink_selection.cc       |    81 +
 .../modify_selection/dlg_shrink_selection.h        |    50 +
 .../modify_selection/modify_selection.cc           |   158 +
 .../modify_selection/modify_selection.h            |    47 +
 .../modify_selection/modify_selection.rc           |    10 +
 .../modify_selection/wdg_border_selection.ui       |    57 +
 .../modify_selection/wdg_grow_selection.ui         |    57 +
 .../modify_selection/wdg_shrink_selection.ui       |    68 +
 .../viewplugins/performancetest/Makefile.am        |    25 +
 .../performancetest/chalkperftest.desktop          |    41 +
 .../viewplugins/performancetest/dlg_perftest.cc    |   110 +
 .../viewplugins/performancetest/dlg_perftest.h     |    56 +
 .../viewplugins/performancetest/perftest.cc        |  1198 +
 .../plugins/viewplugins/performancetest/perftest.h |    76 +
 .../viewplugins/performancetest/perftest.rc        |     9 +
 .../viewplugins/performancetest/wdg_perftest.ui    |   283 +
 chalk/plugins/viewplugins/rotateimage/Makefile.am  |    25 +
 .../rotateimage/chalkrotateimage.desktop           |    40 +
 .../viewplugins/rotateimage/dlg_rotateimage.cc     |   147 +
 .../viewplugins/rotateimage/dlg_rotateimage.h      |    66 +
 .../plugins/viewplugins/rotateimage/rotateimage.cc |   134 +
 .../plugins/viewplugins/rotateimage/rotateimage.h  |    50 +
 .../plugins/viewplugins/rotateimage/rotateimage.rc |    25 +
 .../viewplugins/rotateimage/wdg_rotateimage.ui     |   245 +
 chalk/plugins/viewplugins/screenshot/Makefile.am   |    27 +
 .../viewplugins/screenshot/chalkscreenshot.desktop |    47 +
 chalk/plugins/viewplugins/screenshot/ksnapshot.cpp |   499 +
 chalk/plugins/viewplugins/screenshot/ksnapshot.h   |   137 +
 .../viewplugins/screenshot/ksnapshotwidget.ui      |   335 +
 .../viewplugins/screenshot/ksnapshotwidget.ui.h    |   118 +
 chalk/plugins/viewplugins/screenshot/main.cpp      |    38 +
 .../viewplugins/screenshot/regiongrabber.cpp       |   170 +
 .../plugins/viewplugins/screenshot/regiongrabber.h |    72 +
 .../viewplugins/screenshot/screenshot-chalk.rc     |     9 +
 .../screenshot/screenshot-kpresenter.rc            |     9 +
 .../viewplugins/screenshot/screenshot-kword.rc     |     9 +
 .../plugins/viewplugins/screenshot/screenshot.cpp  |    78 +
 chalk/plugins/viewplugins/screenshot/screenshot.h  |    43 +
 chalk/plugins/viewplugins/scripting/Makefile.am    |    29 +
 .../viewplugins/scripting/chalkcore/Makefile.am    |    30 +
 .../scripting/chalkcore/chalkcoremodule.cpp        |   288 +
 .../scripting/chalkcore/chalkcoremodule.h          |   205 +
 .../viewplugins/scripting/chalkcore/krs_brush.cpp  |    41 +
 .../viewplugins/scripting/chalkcore/krs_brush.h    |    48 +
 .../viewplugins/scripting/chalkcore/krs_color.cpp  |    42 +
 .../viewplugins/scripting/chalkcore/krs_color.h    |    49 +
 .../viewplugins/scripting/chalkcore/krs_doc.cpp    |    46 +
 .../viewplugins/scripting/chalkcore/krs_doc.h      |    53 +
 .../viewplugins/scripting/chalkcore/krs_filter.cpp |    76 +
 .../viewplugins/scripting/chalkcore/krs_filter.h   |    76 +
 .../chalkcore/krs_filter_configuration.cpp         |    72 +
 .../scripting/chalkcore/krs_filter_configuration.h |    65 +
 .../scripting/chalkcore/krs_histogram.cpp          |   104 +
 .../scripting/chalkcore/krs_histogram.h            |   115 +
 .../viewplugins/scripting/chalkcore/krs_image.cpp  |   148 +
 .../viewplugins/scripting/chalkcore/krs_image.h    |    94 +
 .../viewplugins/scripting/chalkcore/krs_iterator.h |   307 +
 .../scripting/chalkcore/krs_paint_layer.cpp        |   207 +
 .../scripting/chalkcore/krs_paint_layer.h          |   140 +
 .../scripting/chalkcore/krs_painter.cpp            |   358 +
 .../viewplugins/scripting/chalkcore/krs_painter.h  |   242 +
 .../scripting/chalkcore/krs_pattern.cpp            |    39 +
 .../viewplugins/scripting/chalkcore/krs_pattern.h  |    48 +
 .../scripting/chalkcore/krs_script_progress.cpp    |    67 +
 .../scripting/chalkcore/krs_script_progress.h      |    77 +
 .../scripting/chalkcore/krs_wavelet.cpp            |   114 +
 .../viewplugins/scripting/chalkcore/krs_wavelet.h  |    92 +
 .../viewplugins/scripting/chalkscripting.desktop   |    81 +
 .../scripting/chalkscripting/Makefile.am           |    19 +
 .../chalkscripting/kis_script_monitor.cpp          |    51 +
 .../scripting/chalkscripting/kis_script_monitor.h  |    51 +
 .../chalkscripting/kis_script_progress.cpp         |    64 +
 .../scripting/chalkscripting/kis_script_progress.h |    54 +
 .../viewplugins/scripting/samples/Makefile.am      |     3 +
 .../scripting/samples/python/Makefile.am           |     5 +
 .../viewplugins/scripting/samples/python/invert.py |    48 +
 .../scripting/samples/python/invertpython.rc       |     9 +
 .../scripting/samples/python/reshapehisto.py       |   300 +
 .../scripting/samples/python/reshapehisto.rc       |     9 +
 .../viewplugins/scripting/samples/ruby/Makefile.am |    18 +
 .../viewplugins/scripting/samples/ruby/changecs.rb |     5 +
 .../viewplugins/scripting/samples/ruby/changecs.rc |     9 +
 .../scripting/samples/ruby/filterstest.rb          |    31 +
 .../scripting/samples/ruby/filterstest.rc          |     9 +
 .../viewplugins/scripting/samples/ruby/invert.rb   |    45 +
 .../scripting/samples/ruby/invertruby.rc           |     9 +
 .../scripting/samples/ruby/randompaint.rb          |    98 +
 .../scripting/samples/ruby/randompaint.rc          |     9 +
 .../scripting/samples/ruby/torture-filters.rb      |    70 +
 .../scripting/samples/ruby/torture-filters.rc      |     9 +
 .../scripting/samples/ruby/torture-painting.rb     |   133 +
 .../scripting/samples/ruby/torture-painting.rc     |     9 +
 chalk/plugins/viewplugins/scripting/scripting.cc   |   111 +
 chalk/plugins/viewplugins/scripting/scripting.h    |    54 +
 chalk/plugins/viewplugins/scripting/scripting.rc   |    10 +
 chalk/plugins/viewplugins/selectopaque/Makefile.am |    25 +
 .../selectopaque/chalkselectopaque.desktop         |    26 +
 .../viewplugins/selectopaque/selectopaque.cc       |   116 +
 .../viewplugins/selectopaque/selectopaque.h        |    45 +
 .../viewplugins/selectopaque/selectopaque.rc       |    10 +
 .../viewplugins/separate_channels/Makefile.am      |    27 +
 .../chalkseparatechannels.desktop                  |    42 +
 .../viewplugins/separate_channels/dlg_separate.cc  |   110 +
 .../viewplugins/separate_channels/dlg_separate.h   |    68 +
 .../viewplugins/separate_channels/imageseparate.rc |     9 +
 .../separate_channels/kis_channel_separator.cc     |   301 +
 .../separate_channels/kis_channel_separator.h      |    70 +
 .../kis_separate_channels_plugin.cc                |    96 +
 .../kis_separate_channels_plugin.h                 |    46 +
 .../separate_channels/wdg_separations.ui           |   182 +
 chalk/plugins/viewplugins/shearimage/Makefile.am   |    25 +
 .../viewplugins/shearimage/chalkshearimage.desktop |    37 +
 .../viewplugins/shearimage/dlg_shearimage.cc       |    96 +
 .../viewplugins/shearimage/dlg_shearimage.h        |    55 +
 chalk/plugins/viewplugins/shearimage/shearimage.cc |   113 +
 chalk/plugins/viewplugins/shearimage/shearimage.h  |    47 +
 chalk/plugins/viewplugins/shearimage/shearimage.rc |    13 +
 .../viewplugins/shearimage/wdg_shearimage.ui       |   102 +
 chalk/plugins/viewplugins/substrate/Makefile.am    |    26 +
 .../viewplugins/substrate/chalksubstrate.desktop   |    35 +
 .../plugins/viewplugins/substrate/dlg_substrate.cc |    59 +
 .../plugins/viewplugins/substrate/dlg_substrate.h  |    62 +
 .../substrate/kis_repeating_substrate.cc           |     0
 .../substrate/kis_repeating_substrate.h            |    69 +
 chalk/plugins/viewplugins/substrate/substrate.cc   |    78 +
 chalk/plugins/viewplugins/substrate/substrate.h    |    45 +
 chalk/plugins/viewplugins/substrate/substrate.rc   |     8 +
 .../plugins/viewplugins/substrate/wdgsubstrate.ui  |   221 +
 chalk/plugins/viewplugins/variations/Makefile.am   |    26 +
 .../viewplugins/variations/chalkvariations.desktop |    40 +
 .../viewplugins/variations/dlg_variations.cc       |    58 +
 .../viewplugins/variations/dlg_variations.h        |    62 +
 chalk/plugins/viewplugins/variations/variations.cc |    88 +
 chalk/plugins/viewplugins/variations/variations.h  |    45 +
 chalk/plugins/viewplugins/variations/variations.rc |     8 +
 .../viewplugins/variations/wdg_variations.ui       |   897 +
 chalk/sdk/Makefile.am                              |    23 +
 chalk/sdk/kis_annotation.h                         |    89 +
 chalk/sdk/kis_canvas_controller.h                  |   200 +
 chalk/sdk/kis_canvas_observer.h                    |    55 +
 chalk/sdk/kis_canvas_subject.h                     |   192 +
 chalk/sdk/kis_debug_areas.h                        |    34 +
 chalk/sdk/kis_generic_registry.h                   |   166 +
 chalk/sdk/kis_global.h                             |    83 +
 chalk/sdk/kis_id.h                                 |   108 +
 chalk/sdk/kis_integer_maths.h                      |   111 +
 chalk/sdk/kis_progress_display_interface.h         |    76 +
 chalk/sdk/kis_progress_subject.cc                  |    29 +
 chalk/sdk/kis_progress_subject.h                   |    45 +
 chalk/sdk/kis_shared_ptr_vector.h                  |    70 +
 chalk/sdk/kis_undo_adapter.h                       |    67 +
 chalk/todo-1.6                                     |    74 +
 chalk/ui/Makefile.am                               |    75 +
 chalk/ui/imageviewer.cc                            |    78 +
 chalk/ui/imageviewer.h                             |    53 +
 chalk/ui/kcurve.cc                                 |   450 +
 chalk/ui/kcurve.h                                  |    80 +
 chalk/ui/kis_aboutdata.h                           |    68 +
 chalk/ui/kis_autobrush.cc                          |   177 +
 chalk/ui/kis_autobrush.h                           |    56 +
 chalk/ui/kis_autogradient.cc                       |   147 +
 chalk/ui/kis_autogradient.h                        |    53 +
 chalk/ui/kis_birdeye_box.cc                        |   311 +
 chalk/ui/kis_birdeye_box.h                         |    69 +
 chalk/ui/kis_boundary_painter.cc                   |    81 +
 chalk/ui/kis_boundary_painter.h                    |    33 +
 chalk/ui/kis_brush_chooser.cc                      |   102 +
 chalk/ui/kis_brush_chooser.h                       |    52 +
 chalk/ui/kis_button_event.h                        |    45 +
 chalk/ui/kis_button_press_event.h                  |    31 +
 chalk/ui/kis_button_release_event.h                |    31 +
 chalk/ui/kis_canvas.cc                             |  1355 +
 chalk/ui/kis_canvas.h                              |   387 +
 chalk/ui/kis_canvas_painter.cc                     |  1440 +
 chalk/ui/kis_canvas_painter.h                      |   356 +
 chalk/ui/kis_clipboard.cc                          |   287 +
 chalk/ui/kis_clipboard.h                           |    80 +
 chalk/ui/kis_cmb_composite.cc                      |    88 +
 chalk/ui/kis_cmb_composite.h                       |    71 +
 chalk/ui/kis_cmb_idlist.cc                         |    97 +
 chalk/ui/kis_cmb_idlist.h                          |    68 +
 chalk/ui/kis_color_cup.cc                          |   118 +
 chalk/ui/kis_color_cup.h                           |    96 +
 chalk/ui/kis_config.cc                             |   442 +
 chalk/ui/kis_config.h                              |   143 +
 chalk/ui/kis_controlframe.cc                       |   343 +
 chalk/ui/kis_controlframe.h                        |   130 +
 chalk/ui/kis_cursor.cc                             |   374 +
 chalk/ui/kis_cursor.h                              |    73 +
 chalk/ui/kis_custom_brush.cc                       |   158 +
 chalk/ui/kis_custom_brush.h                        |    63 +
 chalk/ui/kis_custom_image_widget.cc                |   110 +
 chalk/ui/kis_custom_image_widget.h                 |    58 +
 chalk/ui/kis_custom_palette.cc                     |   151 +
 chalk/ui/kis_custom_palette.h                      |    62 +
 chalk/ui/kis_custom_pattern.cc                     |   118 +
 chalk/ui/kis_custom_pattern.h                      |    61 +
 chalk/ui/kis_dlg_adj_layer_props.cc                |   168 +
 chalk/ui/kis_dlg_adj_layer_props.h                 |    81 +
 chalk/ui/kis_dlg_adjustment_layer.cc               |   193 +
 chalk/ui/kis_dlg_adjustment_layer.h                |    86 +
 chalk/ui/kis_dlg_apply_profile.cc                  |    96 +
 chalk/ui/kis_dlg_apply_profile.h                   |    49 +
 chalk/ui/kis_dlg_image_properties.cc               |   173 +
 chalk/ui/kis_dlg_image_properties.h                |    62 +
 chalk/ui/kis_dlg_layer_properties.cc               |   106 +
 chalk/ui/kis_dlg_layer_properties.h                |    54 +
 chalk/ui/kis_dlg_new_layer.cc                      |   159 +
 chalk/ui/kis_dlg_new_layer.h                       |    61 +
 chalk/ui/kis_dlg_preferences.cc                    |   821 +
 chalk/ui/kis_dlg_preferences.h                     |   277 +
 chalk/ui/kis_doc.cc                                |  1171 +
 chalk/ui/kis_doc.h                                 |   224 +
 chalk/ui/kis_doc_iface.cc                          |    67 +
 chalk/ui/kis_doc_iface.h                           |    50 +
 chalk/ui/kis_double_click_event.h                  |    31 +
 chalk/ui/kis_double_widget.cc                      |   147 +
 chalk/ui/kis_double_widget.h                       |    78 +
 chalk/ui/kis_event.h                               |    62 +
 chalk/ui/kis_factory.cc                            |   153 +
 chalk/ui/kis_factory.h                             |    59 +
 chalk/ui/kis_filter_manager.cc                     |   408 +
 chalk/ui/kis_filter_manager.h                      |    87 +
 chalk/ui/kis_filters_listview.cc                   |   250 +
 chalk/ui/kis_filters_listview.h                    |   143 +
 chalk/ui/kis_gradient_chooser.cc                   |    77 +
 chalk/ui/kis_gradient_chooser.h                    |    63 +
 chalk/ui/kis_gradient_slider_widget.cc             |   219 +
 chalk/ui/kis_gradient_slider_widget.h              |    80 +
 chalk/ui/kis_grid_drawer.cpp                       |   223 +
 chalk/ui/kis_grid_drawer.h                         |    71 +
 chalk/ui/kis_grid_manager.cpp                      |   156 +
 chalk/ui/kis_grid_manager.h                        |    65 +
 chalk/ui/kis_histogram_view.cc                     |   354 +
 chalk/ui/kis_histogram_view.h                      |   104 +
 chalk/ui/kis_icon_item.cc                          |   116 +
 chalk/ui/kis_icon_item.h                           |    48 +
 chalk/ui/kis_iconwidget.cc                         |    80 +
 chalk/ui/kis_iconwidget.h                          |    50 +
 chalk/ui/kis_import_catcher.cc                     |    80 +
 chalk/ui/kis_import_catcher.h                      |    58 +
 chalk/ui/kis_input_device.cc                       |   101 +
 chalk/ui/kis_input_device.h                        |    86 +
 chalk/ui/kis_int_spinbox.cc                        |   198 +
 chalk/ui/kis_int_spinbox.h                         |   200 +
 chalk/ui/kis_itemchooser.cc                        |    81 +
 chalk/ui/kis_itemchooser.h                         |    65 +
 chalk/ui/kis_label_cursor_pos.cc                   |    53 +
 chalk/ui/kis_label_cursor_pos.h                    |    43 +
 chalk/ui/kis_label_progress.cc                     |   214 +
 chalk/ui/kis_label_progress.h                      |    66 +
 chalk/ui/kis_label_zoom.cc                         |    21 +
 chalk/ui/kis_label_zoom.h                          |    34 +
 chalk/ui/kis_layerbox.cc                           |   675 +
 chalk/ui/kis_layerbox.h                            |   124 +
 chalk/ui/kis_layerlist.cc                          |   220 +
 chalk/ui/kis_layerlist.h                           |    80 +
 chalk/ui/kis_load_visitor.h                        |   187 +
 chalk/ui/kis_matrix_widget.ui                      |   210 +
 chalk/ui/kis_matrix_widget.ui.h                    |    17 +
 chalk/ui/kis_move_event.h                          |    31 +
 chalk/ui/kis_multi_bool_filter_widget.cc           |    68 +
 chalk/ui/kis_multi_bool_filter_widget.h            |    56 +
 chalk/ui/kis_multi_double_filter_widget.cc         |   103 +
 chalk/ui/kis_multi_double_filter_widget.h          |    79 +
 chalk/ui/kis_multi_integer_filter_widget.cc        |   104 +
 chalk/ui/kis_multi_integer_filter_widget.h         |    83 +
 chalk/ui/kis_opengl_canvas.cc                      |   127 +
 chalk/ui/kis_opengl_canvas.h                       |    76 +
 chalk/ui/kis_opengl_canvas_painter.cc              |   849 +
 chalk/ui/kis_opengl_canvas_painter.h               |   212 +
 chalk/ui/kis_opengl_image_context.cc               |   371 +
 chalk/ui/kis_opengl_image_context.h                |   157 +
 chalk/ui/kis_paintop_box.cc                        |   249 +
 chalk/ui/kis_paintop_box.h                         |   104 +
 chalk/ui/kis_palette_view.cc                       |   150 +
 chalk/ui/kis_palette_view.h                        |    70 +
 chalk/ui/kis_palette_widget.cc                     |   162 +
 chalk/ui/kis_palette_widget.h                      |    80 +
 chalk/ui/kis_part_layer.cc                         |   260 +
 chalk/ui/kis_part_layer.h                          |   148 +
 chalk/ui/kis_part_layer_handler.cc                 |    94 +
 chalk/ui/kis_part_layer_handler.h                  |    58 +
 chalk/ui/kis_pattern_chooser.cc                    |    57 +
 chalk/ui/kis_pattern_chooser.h                     |    42 +
 chalk/ui/kis_perspective_grid_manager.cpp          |   159 +
 chalk/ui/kis_perspective_grid_manager.h            |    55 +
 chalk/ui/kis_populate_visitor.h                    |   117 +
 chalk/ui/kis_previewdialog.cc                      |    46 +
 chalk/ui/kis_previewdialog.h                       |    45 +
 chalk/ui/kis_previewwidget.cc                      |   409 +
 chalk/ui/kis_previewwidget.h                       |   141 +
 chalk/ui/kis_previewwidgetbase.ui                  |   271 +
 chalk/ui/kis_qpaintdevice_canvas.cc                |   120 +
 chalk/ui/kis_qpaintdevice_canvas.h                 |    71 +
 chalk/ui/kis_qpaintdevice_canvas_painter.cc        |   667 +
 chalk/ui/kis_qpaintdevice_canvas_painter.h         |   189 +
 chalk/ui/kis_resource_mediator.cc                  |   117 +
 chalk/ui/kis_resource_mediator.h                   |    73 +
 chalk/ui/kis_resourceserver.cc                     |   199 +
 chalk/ui/kis_resourceserver.h                      |    91 +
 chalk/ui/kis_ruler.cc                              |   367 +
 chalk/ui/kis_ruler.h                               |    81 +
 chalk/ui/kis_save_visitor.h                        |   171 +
 chalk/ui/kis_savexml_visitor.h                     |   144 +
 chalk/ui/kis_selection_manager.cc                  |  1643 +
 chalk/ui/kis_selection_manager.h                   |   137 +
 chalk/ui/kis_selection_options.cc                  |    70 +
 chalk/ui/kis_selection_options.h                   |    57 +
 chalk/ui/kis_text_brush.cc                         |    74 +
 chalk/ui/kis_text_brush.h                          |    71 +
 chalk/ui/kis_tool.cc                               |    69 +
 chalk/ui/kis_tool.h                                |   144 +
 chalk/ui/kis_tool_controller.h                     |    39 +
 chalk/ui/kis_tool_dummy.cc                         |   111 +
 chalk/ui/kis_tool_dummy.h                          |    85 +
 chalk/ui/kis_tool_factory.h                        |    41 +
 chalk/ui/kis_tool_freehand.cc                      |   354 +
 chalk/ui/kis_tool_freehand.h                       |   103 +
 chalk/ui/kis_tool_manager.cc                       |   303 +
 chalk/ui/kis_tool_manager.h                        |   103 +
 chalk/ui/kis_tool_non_paint.cc                     |   115 +
 chalk/ui/kis_tool_non_paint.h                      |    85 +
 chalk/ui/kis_tool_paint.cc                         |   260 +
 chalk/ui/kis_tool_paint.h                          |   119 +
 chalk/ui/kis_tool_registry.cc                      |   111 +
 chalk/ui/kis_tool_registry.h                       |    60 +
 chalk/ui/kis_tool_shape.cc                         |    67 +
 chalk/ui/kis_tool_shape.h                          |    53 +
 chalk/ui/kis_tool_types.h                          |    34 +
 chalk/ui/kis_view.cc                               |  4018 ++
 chalk/ui/kis_view.h                                |   664 +
 chalk/ui/kis_view_iface.cc                         |    98 +
 chalk/ui/kis_view_iface.h                          |    58 +
 chalk/ui/kobirdeyepanel.cpp                        |   619 +
 chalk/ui/kobirdeyepanel.h                          |   263 +
 chalk/ui/layerlist.cpp                             |  1325 +
 chalk/ui/layerlist.h                               |   269 +
 chalk/ui/squeezedcombobox.cpp                      |   167 +
 chalk/ui/squeezedcombobox.h                        |   137 +
 chalk/ui/wdgapplyprofile.ui                        |   172 +
 chalk/ui/wdgautobrush.ui                           |   355 +
 chalk/ui/wdgautogradient.ui                        |   399 +
 chalk/ui/wdgbirdeye.ui                             |   304 +
 chalk/ui/wdgcolorsettings.ui                       |   357 +
 chalk/ui/wdgcustombrush.ui                         |   199 +
 chalk/ui/wdgcustompalette.ui                       |    88 +
 chalk/ui/wdgcustompattern.ui                       |   156 +
 chalk/ui/wdgdisplaysettings.ui                     |    90 +
 chalk/ui/wdggeneralsettings.ui                     |   183 +
 chalk/ui/wdggridsettings.ui                        |   468 +
 chalk/ui/wdglayerbox.ui                            |   299 +
 chalk/ui/wdglayerproperties.ui                     |   170 +
 chalk/ui/wdgnewimage.ui                            |   435 +
 chalk/ui/wdgpalettechooser.ui                      |   105 +
 chalk/ui/wdgperformancesettings.ui                 |   146 +
 chalk/ui/wdgpressuresettings.ui                    |    66 +
 chalk/ui/wdgselectionoptions.ui                    |    64 +
 chalk/ui/wdgshapeoptions.ui                        |    98 +
 chalk/ui/wdgtabletdevicesettings.ui                |   193 +
 chalk/ui/wdgtabletsettings.ui                      |   104 +
 chalk/ui/wdgtextbrush.ui                           |   158 +
 changes-1.4                                        |    10 +-
 changes-1.5                                        |    16 +-
 configure.files                                    |    26 +-
 configure.in                                       |   292 +-
 doc/chalk/Makefile.am                              |     4 +
 doc/chalk/README.SCREENSHOTS                       |     7 +
 doc/chalk/commands-dialogs.docbook                 |  1411 +
 doc/chalk/commands-menus.docbook                   |  2158 +
 doc/chalk/commands-palettes.docbook                |   769 +
 doc/chalk/commands-toolbars.docbook                |   752 +
 doc/chalk/commands.docbook                         |    14 +
 doc/chalk/createdocument.png                       |   Bin 0 -> 27560 bytes
 doc/chalk/credits.docbook                          |    63 +
 doc/chalk/crocusses-autocontrast.png               |   Bin 0 -> 499566 bytes
 doc/chalk/crocusses-blur.png                       |   Bin 0 -> 468963 bytes
 doc/chalk/crocusses-brightnesscontrast.png         |   Bin 0 -> 546359 bytes
 doc/chalk/crocusses-bumpmap.png                    |   Bin 0 -> 571359 bytes
 doc/chalk/crocusses-coloradjustment.png            |   Bin 0 -> 528837 bytes
 doc/chalk/crocusses-colortoalpha.png               |   Bin 0 -> 415308 bytes
 doc/chalk/crocusses-colortransfer.png              |   Bin 0 -> 555355 bytes
 doc/chalk/crocusses-customconvolution.png          |   Bin 0 -> 554020 bytes
 doc/chalk/crocusses-desaturate.png                 |   Bin 0 -> 406993 bytes
 doc/chalk/crocusses-edgebottom.png                 |   Bin 0 -> 559660 bytes
 doc/chalk/crocusses-edgeleft.png                   |   Bin 0 -> 571228 bytes
 doc/chalk/crocusses-edgeright.png                  |   Bin 0 -> 571084 bytes
 doc/chalk/crocusses-embossall.png                  |   Bin 0 -> 510986 bytes
 doc/chalk/crocusses-embosshorvert.png              |   Bin 0 -> 458936 bytes
 doc/chalk/crocusses-embossvariable.png             |   Bin 0 -> 422056 bytes
 doc/chalk/crocusses-gaussianblur.png               |   Bin 0 -> 530129 bytes
 doc/chalk/crocusses-gaussiannoise.png              |   Bin 0 -> 286299 bytes
 doc/chalk/crocusses-invert.png                     |   Bin 0 -> 539223 bytes
 doc/chalk/crocusses-lenscorrection.png             |   Bin 0 -> 508845 bytes
 doc/chalk/crocusses-maximizechannel.png            |   Bin 0 -> 459662 bytes
 doc/chalk/crocusses-meanremoval.png                |   Bin 0 -> 567175 bytes
 doc/chalk/crocusses-minimizechannel.png            |   Bin 0 -> 425665 bytes
 doc/chalk/crocusses-oilpaint.png                   |   Bin 0 -> 495456 bytes
 doc/chalk/crocusses-pixelize.png                   |   Bin 0 -> 478589 bytes
 doc/chalk/crocusses-raindrops.png                  |   Bin 0 -> 534756 bytes
 doc/chalk/crocusses-randomnoise.png                |   Bin 0 -> 564986 bytes
 doc/chalk/crocusses-randompick.png                 |   Bin 0 -> 519596 bytes
 doc/chalk/crocusses-roundcorners.png               |   Bin 0 -> 539417 bytes
 doc/chalk/crocusses-sharpen.png                    |   Bin 0 -> 553923 bytes
 doc/chalk/crocusses-smalltiles.png                 |   Bin 0 -> 361991 bytes
 doc/chalk/crocusses-sobel.png                      |   Bin 0 -> 471366 bytes
 doc/chalk/crocusses-topedge.png                    |   Bin 0 -> 559862 bytes
 doc/chalk/crocusses-unsharpmask.png                |   Bin 0 -> 428074 bytes
 doc/chalk/crocusses-wave.png                       |   Bin 0 -> 523440 bytes
 doc/chalk/crocusses-waveletnoise.png               |   Bin 0 -> 529842 bytes
 doc/chalk/crocusses.png                            |   Bin 0 -> 793765 bytes
 doc/chalk/developers-plugins.docbook               |  1553 +
 doc/chalk/developers-scripting.docbook             |   534 +
 doc/chalk/developers.docbook                       |    13 +
 doc/chalk/dialogs-addpalette.png                   |   Bin 0 -> 4551 bytes
 doc/chalk/dialogs-blur.png                         |   Bin 0 -> 48397 bytes
 doc/chalk/dialogs-brightnesscontrast.png           |   Bin 0 -> 49053 bytes
 doc/chalk/dialogs-bumpmap.png                      |   Bin 0 -> 67767 bytes
 doc/chalk/dialogs-coloradjustment.png              |   Bin 0 -> 51960 bytes
 doc/chalk/dialogs-colorrange.png                   |   Bin 0 -> 15922 bytes
 doc/chalk/dialogs-colortoalpha.png                 |   Bin 0 -> 87706 bytes
 doc/chalk/dialogs-colortransfer.png                |   Bin 0 -> 95725 bytes
 doc/chalk/dialogs-convertimagetype.png             |   Bin 0 -> 20431 bytes
 doc/chalk/dialogs-convertlayertype.png             |   Bin 0 -> 20122 bytes
 doc/chalk/dialogs-cubism.png                       |   Bin 0 -> 24275 bytes
 doc/chalk/dialogs-customconvolution.png            |   Bin 0 -> 56964 bytes
 doc/chalk/dialogs-documentinformation.png          |   Bin 0 -> 15469 bytes
 doc/chalk/dialogs-dropshadow.png                   |   Bin 0 -> 7698 bytes
 doc/chalk/dialogs-emboss.png                       |   Bin 0 -> 43741 bytes
 doc/chalk/dialogs-filtersgallery.png               |   Bin 0 -> 96050 bytes
 doc/chalk/dialogs-gaussiannoise.png                |   Bin 0 -> 90251 bytes
 doc/chalk/dialogs-histogram.png                    |   Bin 0 -> 16401 bytes
 doc/chalk/dialogs-imageproperties.png              |   Bin 0 -> 7708 bytes
 doc/chalk/dialogs-imagerestoration.png             |   Bin 0 -> 50998 bytes
 doc/chalk/dialogs-imagesize.png                    |   Bin 0 -> 16604 bytes
 doc/chalk/dialogs-layerproperties.png              |   Bin 0 -> 14492 bytes
 doc/chalk/dialogs-layersize.png                    |   Bin 0 -> 13466 bytes
 doc/chalk/dialogs-lenscorrection.png               |   Bin 0 -> 94890 bytes
 doc/chalk/dialogs-newadjustmentlayer.png           |   Bin 0 -> 93986 bytes
 doc/chalk/dialogs-newlayer.png                     |   Bin 0 -> 5868 bytes
 doc/chalk/dialogs-oilpaint.png                     |   Bin 0 -> 37142 bytes
 doc/chalk/dialogs-pixelize.png                     |   Bin 0 -> 16146 bytes
 doc/chalk/dialogs-raindrops.png                    |   Bin 0 -> 45473 bytes
 doc/chalk/dialogs-randomnoise.png                  |   Bin 0 -> 139396 bytes
 doc/chalk/dialogs-randompick.png                   |   Bin 0 -> 91945 bytes
 doc/chalk/dialogs-rotateimage.png                  |   Bin 0 -> 16183 bytes
 doc/chalk/dialogs-rotatelayer.png                  |   Bin 0 -> 20300 bytes
 doc/chalk/dialogs-roundcorners.png                 |   Bin 0 -> 46187 bytes
 doc/chalk/dialogs-separateimage.png                |   Bin 0 -> 7936 bytes
 doc/chalk/dialogs-shearimage.png                   |   Bin 0 -> 9517 bytes
 doc/chalk/dialogs-shearlayer.png                   |   Bin 0 -> 7941 bytes
 doc/chalk/dialogs-smalltiles.png                   |   Bin 0 -> 32127 bytes
 doc/chalk/dialogs-sobel.png                        |   Bin 0 -> 83673 bytes
 doc/chalk/dialogs-substrate.png                    |   Bin 0 -> 22652 bytes
 doc/chalk/dialogs-unsharpmask.png                  |   Bin 0 -> 93324 bytes
 doc/chalk/dialogs-wave.png                         |   Bin 0 -> 99302 bytes
 doc/chalk/dialogs-waveletnoise.png                 |   Bin 0 -> 77064 bytes
 doc/chalk/faq.docbook                              |    51 +
 doc/chalk/index.docbook                            |   138 +
 doc/chalk/installation.docbook                     |    73 +
 doc/chalk/introduction.docbook                     |   153 +
 doc/chalk/mainscreen.png                           |   Bin 0 -> 79116 bytes
 doc/chalk/mountains-burn.png                       |   Bin 0 -> 160961 bytes
 doc/chalk/mountains-color.png                      |   Bin 0 -> 192281 bytes
 doc/chalk/mountains-darken.png                     |   Bin 0 -> 159111 bytes
 doc/chalk/mountains-divide.png                     |   Bin 0 -> 173190 bytes
 doc/chalk/mountains-dodge.png                      |   Bin 0 -> 173312 bytes
 doc/chalk/mountains-hue.png                        |   Bin 0 -> 234147 bytes
 doc/chalk/mountains-lighten.png                    |   Bin 0 -> 149118 bytes
 doc/chalk/mountains-multiply.png                   |   Bin 0 -> 172594 bytes
 doc/chalk/mountains-normal.png                     |   Bin 0 -> 3514 bytes
 doc/chalk/mountains-original.png                   |   Bin 0 -> 238432 bytes
 doc/chalk/mountains-overlay.png                    |   Bin 0 -> 249222 bytes
 doc/chalk/mountains-saturation.png                 |   Bin 0 -> 231772 bytes
 doc/chalk/mountains-screen.png                     |   Bin 0 -> 172229 bytes
 doc/chalk/mountains-value.png                      |   Bin 0 -> 218819 bytes
 doc/chalk/mountains.png                            |   Bin 0 -> 975941 bytes
 doc/chalk/newimage.png                             |   Bin 0 -> 29884 bytes
 doc/chalk/palettes-colors-gray.png                 |   Bin 0 -> 1426 bytes
 doc/chalk/palettes-colors-hsv.png                  |   Bin 0 -> 10419 bytes
 doc/chalk/palettes-colors-palettes.png             |   Bin 0 -> 3356 bytes
 doc/chalk/palettes-colors-rgb.png                  |   Bin 0 -> 1841 bytes
 doc/chalk/palettes-colors-watercolors.png          |   Bin 0 -> 3031 bytes
 doc/chalk/palettes-controlbox-bezier.png           |   Bin 0 -> 2961 bytes
 doc/chalk/palettes-controlbox-brush.png            |   Bin 0 -> 3644 bytes
 doc/chalk/palettes-controlbox-colorpicker.png      |   Bin 0 -> 7578 bytes
 doc/chalk/palettes-controlbox-contiguousfill.png   |   Bin 0 -> 5642 bytes
 doc/chalk/palettes-controlbox-crop.png             |   Bin 0 -> 4123 bytes
 doc/chalk/palettes-controlbox-duplicate.png        |   Bin 0 -> 5857 bytes
 doc/chalk/palettes-controlbox-ellipse.png          |   Bin 0 -> 3444 bytes
 doc/chalk/palettes-controlbox-fill.png             |   Bin 0 -> 5468 bytes
 doc/chalk/palettes-controlbox-gradient.png         |   Bin 0 -> 6695 bytes
 doc/chalk/palettes-controlbox-histogram.png        |   Bin 0 -> 1597 bytes
 doc/chalk/palettes-controlbox-line.png             |   Bin 0 -> 3815 bytes
 doc/chalk/palettes-controlbox-overview.png         |   Bin 0 -> 20949 bytes
 doc/chalk/palettes-controlbox-paintwithfilters.png |   Bin 0 -> 7826 bytes
 doc/chalk/palettes-controlbox-polygon.png          |   Bin 0 -> 4286 bytes
 doc/chalk/palettes-controlbox-polyline.png         |   Bin 0 -> 3815 bytes
 doc/chalk/palettes-controlbox-rectangle.png        |   Bin 0 -> 3444 bytes
 doc/chalk/palettes-controlbox-select.png           |   Bin 0 -> 1538 bytes
 doc/chalk/palettes-controlbox-selectcontiguous.png |   Bin 0 -> 3525 bytes
 doc/chalk/palettes-controlbox-selectmagnetic.png   |   Bin 0 -> 3765 bytes
 doc/chalk/palettes-controlbox-selectsimilar.png    |   Bin 0 -> 2806 bytes
 doc/chalk/palettes-controlbox-star.png             |   Bin 0 -> 5078 bytes
 doc/chalk/palettes-controlbox-text.png             |   Bin 0 -> 4120 bytes
 doc/chalk/palettes-controlbox-transform.png        |   Bin 0 -> 1529 bytes
 doc/chalk/palettes-layers-layers.png               |   Bin 0 -> 2825 bytes
 doc/chalk/palettes-layers-scriptsmanager.png       |   Bin 0 -> 10082 bytes
 doc/chalk/preferences-color.png                    |   Bin 0 -> 9181 bytes
 doc/chalk/preferences-display.png                  |   Bin 0 -> 2053 bytes
 doc/chalk/preferences-general.png                  |   Bin 0 -> 4016 bytes
 doc/chalk/preferences-grid.png                     |   Bin 0 -> 4554 bytes
 doc/chalk/preferences-performance.png              |   Bin 0 -> 2846 bytes
 doc/chalk/preferences-sidebar.png                  |   Bin 0 -> 8953 bytes
 doc/chalk/preferences-tablet.png                   |   Bin 0 -> 3391 bytes
 doc/chalk/settings.docbook                         |   229 +
 doc/chalk/tool-bezier-example.png                  |   Bin 0 -> 3300 bytes
 doc/chalk/tool-bezier-example2.png                 |   Bin 0 -> 3588 bytes
 doc/chalk/tool-bezier-example3.png                 |   Bin 0 -> 8637 bytes
 doc/chalk/tool-bezier.png                          |   Bin 0 -> 862 bytes
 doc/chalk/tool-brush.png                           |   Bin 0 -> 759 bytes
 doc/chalk/tool-colorpicker.png                     |   Bin 0 -> 821 bytes
 doc/chalk/tool-contiguousfill.png                  |   Bin 0 -> 1197 bytes
 doc/chalk/tool-crop.png                            |   Bin 0 -> 902 bytes
 doc/chalk/tool-duplicate.png                       |   Bin 0 -> 1235 bytes
 doc/chalk/tool-ellipse.png                         |   Bin 0 -> 885 bytes
 doc/chalk/tool-eraseselection.png                  |   Bin 0 -> 1178 bytes
 doc/chalk/tool-gradient.png                        |   Bin 0 -> 481 bytes
 doc/chalk/tool-line.png                            |   Bin 0 -> 574 bytes
 doc/chalk/tool-move.png                            |   Bin 0 -> 883 bytes
 doc/chalk/tool-paintselection.png                  |   Bin 0 -> 1073 bytes
 doc/chalk/tool-paintwithfilters-example.png        |   Bin 0 -> 236144 bytes
 doc/chalk/tool-paintwithfilters.png                |   Bin 0 -> 882 bytes
 doc/chalk/tool-pan.png                             |   Bin 0 -> 913 bytes
 doc/chalk/tool-perspectivegrid.png                 |   Bin 0 -> 1044 bytes
 doc/chalk/tool-perspectivetransform.png            |   Bin 0 -> 883 bytes
 doc/chalk/tool-polygon.png                         |   Bin 0 -> 898 bytes
 doc/chalk/tool-polyline.png                        |   Bin 0 -> 708 bytes
 doc/chalk/tool-rectangle.png                       |   Bin 0 -> 539 bytes
 doc/chalk/tool-selectbezier.png                    |   Bin 0 -> 797 bytes
 doc/chalk/tool-selectcontiguous.png                |   Bin 0 -> 876 bytes
 doc/chalk/tool-selectelliptical.png                |   Bin 0 -> 775 bytes
 doc/chalk/tool-selectmagnetic.png                  |   Bin 0 -> 1123 bytes
 doc/chalk/tool-selectoutline.png                   |   Bin 0 -> 927 bytes
 doc/chalk/tool-selectpolygonal.png                 |   Bin 0 -> 939 bytes
 doc/chalk/tool-selectrectangular.png               |   Bin 0 -> 637 bytes
 doc/chalk/tool-selectsimilar.png                   |   Bin 0 -> 835 bytes
 doc/chalk/tool-star.png                            |   Bin 0 -> 1042 bytes
 doc/chalk/tool-text.png                            |   Bin 0 -> 1008 bytes
 doc/chalk/tool-transform.png                       |   Bin 0 -> 616 bytes
 doc/chalk/tool-zoom.png                            |   Bin 0 -> 981 bytes
 .../toolbar-brushes-brushshapes-autobrush.png      |   Bin 0 -> 6981 bytes
 .../toolbar-brushes-brushshapes-custombrush.png    |   Bin 0 -> 24320 bytes
 .../toolbar-brushes-brushshapes-predefined.png     |   Bin 0 -> 5756 bytes
 doc/chalk/toolbar-brushes-gradients.png            |   Bin 0 -> 12138 bytes
 .../toolbar-brushes-patterns-custompattern.png     |   Bin 0 -> 18845 bytes
 doc/chalk/toolbar-brushes-patterns.png             |   Bin 0 -> 37517 bytes
 doc/chalk/toolbar-brushesandstuff.png              |   Bin 0 -> 4514 bytes
 doc/chalk/toolbar-chalk.png                        |   Bin 0 -> 21661 bytes
 doc/chalk/toolbar-edit.png                         |   Bin 0 -> 1852 bytes
 doc/chalk/toolbar-file.png                         |   Bin 0 -> 3617 bytes
 doc/chalk/toolbar-navigation.png                   |   Bin 0 -> 1196 bytes
 doc/chalk/toolbar-transformationtools.png          |   Bin 0 -> 2339 bytes
 doc/chalk/toolbars-button-zoomin.png               |   Bin 0 -> 1079 bytes
 doc/chalk/toolbars-button-zoomout.png              |   Bin 0 -> 1040 bytes
 doc/chalk/tutorial-quick-starts.docbook            |   183 +
 doc/chalk/tutorial-quick-starts1.png               |   Bin 0 -> 517486 bytes
 doc/chalk/tutorial-quick-starts10.png              |   Bin 0 -> 5261 bytes
 doc/chalk/tutorial-quick-starts11.png              |   Bin 0 -> 15273 bytes
 doc/chalk/tutorial-quick-starts12.png              |   Bin 0 -> 64871 bytes
 doc/chalk/tutorial-quick-starts2.png               |   Bin 0 -> 13703 bytes
 doc/chalk/tutorial-quick-starts3.png               |   Bin 0 -> 376212 bytes
 doc/chalk/tutorial-quick-starts4.png               |   Bin 0 -> 5868 bytes
 doc/chalk/tutorial-quick-starts5.png               |   Bin 0 -> 251715 bytes
 doc/chalk/tutorial-quick-starts6.png               |   Bin 0 -> 45704 bytes
 doc/chalk/tutorial-quick-starts7.png               |   Bin 0 -> 73296 bytes
 doc/chalk/tutorial-quick-starts8.png               |   Bin 0 -> 3636 bytes
 doc/chalk/tutorial-quick-starts9.png               |   Bin 0 -> 7115 bytes
 doc/chalk/tutorial-select-layer-1.png              |   Bin 0 -> 99976 bytes
 doc/chalk/tutorial-select-layer-10.png             |   Bin 0 -> 21980 bytes
 doc/chalk/tutorial-select-layer-11.png             |   Bin 0 -> 28349 bytes
 doc/chalk/tutorial-select-layer-12.png             |   Bin 0 -> 2908 bytes
 doc/chalk/tutorial-select-layer-13.png             |   Bin 0 -> 5912 bytes
 doc/chalk/tutorial-select-layer-2.png              |   Bin 0 -> 7974 bytes
 doc/chalk/tutorial-select-layer-3.png              |   Bin 0 -> 17499 bytes
 doc/chalk/tutorial-select-layer-4.png              |   Bin 0 -> 3852 bytes
 doc/chalk/tutorial-select-layer-5.png              |   Bin 0 -> 5555 bytes
 doc/chalk/tutorial-select-layer-6.png              |   Bin 0 -> 14353 bytes
 doc/chalk/tutorial-select-layer-7.png              |   Bin 0 -> 5173 bytes
 doc/chalk/tutorial-select-layer-8.png              |   Bin 0 -> 6463 bytes
 doc/chalk/tutorial-select-layer-9.png              |   Bin 0 -> 21072 bytes
 doc/chalk/tutorial-select-layer-sample.png         |   Bin 0 -> 5905 bytes
 doc/chalk/tutorial-select-layer.docbook            |   263 +
 doc/chalk/tutorial-starting.docbook                |   117 +
 doc/chalk/tutorial-tablet-1.png                    |   Bin 0 -> 99770 bytes
 doc/chalk/tutorial-tablet-2.png                    |   Bin 0 -> 27896 bytes
 doc/chalk/tutorial-tablet-3.png                    |   Bin 0 -> 33492 bytes
 doc/chalk/tutorial-tablet.docbook                  |   141 +
 doc/chalk/tutorial.docbook                         |    14 +
 doc/chalk/using-colorspaces.docbook                |   149 +
 doc/chalk/using-filters.docbook                    |   923 +
 doc/chalk/using-images.docbook                     |    66 +
 doc/chalk/using-layers.docbook                     |   620 +
 doc/chalk/using-selections-1.png                   |   Bin 0 -> 115987 bytes
 doc/chalk/using-selections-2.png                   |   Bin 0 -> 128193 bytes
 doc/chalk/using-selections-3.png                   |   Bin 0 -> 131771 bytes
 doc/chalk/using-selections-4.png                   |   Bin 0 -> 29987 bytes
 doc/chalk/using-selections-5.png                   |   Bin 0 -> 24734 bytes
 doc/chalk/using-selections-6.png                   |   Bin 0 -> 194321 bytes
 doc/chalk/using-selections.docbook                 |   200 +
 doc/chalk/using-views.docbook                      |   167 +
 doc/kchart/index.docbook                           |     7 +-
 doc/kivio/working.docbook                          |     2 +-
 doc/koffice/index.docbook                          |     3 +-
 doc/koshell/index.docbook                          |     5 +-
 doc/kword/index.docbook                            |     3 +-
 filters/Makefile.am                                |     2 +-
 filters/chalk/Makefile.am                          |    34 +
 filters/chalk/configure.in.in                      |    66 +
 filters/chalk/gmagick/Makefile.am                  |    44 +
 filters/chalk/gmagick/chalk_magick.desktop         |    57 +
 filters/chalk/gmagick/chalk_magick_export.desktop  |    55 +
 filters/chalk/gmagick/chalk_magick_import.desktop  |    61 +
 filters/chalk/gmagick/configure.in.bot             |    23 +
 .../chalk/gmagick/kis_image_magick_converter.cc    |  1142 +
 filters/chalk/gmagick/kis_image_magick_converter.h |   104 +
 filters/chalk/gmagick/magickexport.cpp             |    78 +
 filters/chalk/gmagick/magickexport.h               |    37 +
 filters/chalk/gmagick/magickimport.cpp             |   105 +
 filters/chalk/gmagick/magickimport.h               |    37 +
 filters/chalk/jpeg/Makefile.am                     |    51 +
 filters/chalk/jpeg/chalk_jpeg.desktop              |    58 +
 filters/chalk/jpeg/chalk_jpeg_export.desktop       |    52 +
 filters/chalk/jpeg/chalk_jpeg_import.desktop       |    52 +
 filters/chalk/jpeg/configure.in.bot                |     7 +
 filters/chalk/jpeg/iccjpeg.c                       |   270 +
 filters/chalk/jpeg/iccjpeg.h                       |    99 +
 filters/chalk/jpeg/kis_jpeg_converter.cc           |   542 +
 filters/chalk/jpeg/kis_jpeg_converter.h            |    91 +
 filters/chalk/jpeg/kis_jpeg_export.cc              |   152 +
 filters/chalk/jpeg/kis_jpeg_export.h               |    35 +
 filters/chalk/jpeg/kis_jpeg_import.cc              |   105 +
 filters/chalk/jpeg/kis_jpeg_import.h               |    34 +
 filters/chalk/jpeg/kis_wdg_options_jpeg.ui         |   149 +
 filters/chalk/libkisexif/Makefile.am               |    20 +
 filters/chalk/libkisexif/kis_exif_io.cpp           |   177 +
 filters/chalk/libkisexif/kis_exif_io.h             |    45 +
 filters/chalk/magick/Makefile.am                   |    44 +
 filters/chalk/magick/chalk_magick.desktop          |    58 +
 filters/chalk/magick/chalk_magick_export.desktop   |    55 +
 filters/chalk/magick/chalk_magick_import.desktop   |    61 +
 filters/chalk/magick/configure.in.bot              |    15 +
 filters/chalk/magick/kis_image_magick_converter.cc |  1087 +
 filters/chalk/magick/kis_image_magick_converter.h  |   104 +
 filters/chalk/magick/magickexport.cpp              |    78 +
 filters/chalk/magick/magickexport.h                |    37 +
 filters/chalk/magick/magickimport.cpp              |   105 +
 filters/chalk/magick/magickimport.h                |    37 +
 filters/chalk/openexr/Makefile.am                  |    51 +
 filters/chalk/openexr/chalk_openexr.desktop        |    57 +
 filters/chalk/openexr/chalk_openexr_export.desktop |    52 +
 filters/chalk/openexr/chalk_openexr_import.desktop |    52 +
 filters/chalk/openexr/configure.in.bot             |     9 +
 filters/chalk/openexr/kis_openexr_export.cpp       |   155 +
 filters/chalk/openexr/kis_openexr_export.h         |    38 +
 filters/chalk/openexr/kis_openexr_import.cpp       |   160 +
 filters/chalk/openexr/kis_openexr_import.h         |    38 +
 filters/chalk/pdf/Makefile.am                      |    30 +
 filters/chalk/pdf/chalk_pdf.desktop                |    63 +
 filters/chalk/pdf/chalk_pdf_import.desktop         |    51 +
 filters/chalk/pdf/configure.in.bot                 |     7 +
 filters/chalk/pdf/configure.in.in                  |     4 +
 filters/chalk/pdf/kis_pdf_import.cpp               |   158 +
 filters/chalk/pdf/kis_pdf_import.h                 |    35 +
 filters/chalk/pdf/kis_pdf_import_widget.cpp        |   147 +
 filters/chalk/pdf/kis_pdf_import_widget.h          |    55 +
 filters/chalk/pdf/pdfimportwidgetbase.ui           |   321 +
 filters/chalk/png/Makefile.am                      |    44 +
 filters/chalk/png/chalk_png.desktop                |    57 +
 filters/chalk/png/chalk_png_export.desktop         |    51 +
 filters/chalk/png/chalk_png_import.desktop         |    51 +
 filters/chalk/png/configure.in.bot                 |     8 +
 filters/chalk/png/kis_png_converter.cc             |   794 +
 filters/chalk/png/kis_png_converter.h              |    82 +
 filters/chalk/png/kis_png_export.cc                |   124 +
 filters/chalk/png/kis_png_export.h                 |    35 +
 filters/chalk/png/kis_png_import.cc                |   105 +
 filters/chalk/png/kis_png_import.h                 |    34 +
 filters/chalk/png/kis_wdg_options_png.ui           |   183 +
 filters/chalk/raw/Makefile.am                      |    35 +
 filters/chalk/raw/chalk_raw.desktop                |    57 +
 filters/chalk/raw/chalk_raw_import.desktop         |    51 +
 filters/chalk/raw/dcraw.1                          |   182 +
 filters/chalk/raw/dcraw.c                          |  5999 ++
 filters/chalk/raw/kis_raw_import.cpp               |   630 +
 filters/chalk/raw/kis_raw_import.h                 |    71 +
 filters/chalk/raw/wdgrawimport.ui                  |   496 +
 filters/chalk/tiff/Makefile.am                     |    55 +
 filters/chalk/tiff/chalk_tiff.desktop              |    63 +
 filters/chalk/tiff/chalk_tiff_export.desktop       |    52 +
 filters/chalk/tiff/chalk_tiff_import.desktop       |    52 +
 filters/chalk/tiff/configure.in.bot                |     7 +
 filters/chalk/tiff/kis_dlg_options_tiff.cpp        |   134 +
 filters/chalk/tiff/kis_dlg_options_tiff.h          |    45 +
 filters/chalk/tiff/kis_tiff_converter.cc           |   677 +
 filters/chalk/tiff/kis_tiff_converter.h            |    94 +
 filters/chalk/tiff/kis_tiff_export.cc              |   123 +
 filters/chalk/tiff/kis_tiff_export.h               |    35 +
 filters/chalk/tiff/kis_tiff_import.cc              |   105 +
 filters/chalk/tiff/kis_tiff_import.h               |    34 +
 filters/chalk/tiff/kis_tiff_reader.cc              |   121 +
 filters/chalk/tiff/kis_tiff_reader.h               |   206 +
 filters/chalk/tiff/kis_tiff_stream.cc              |   164 +
 filters/chalk/tiff/kis_tiff_stream.h               |    81 +
 filters/chalk/tiff/kis_tiff_writer_visitor.cpp     |   237 +
 filters/chalk/tiff/kis_tiff_writer_visitor.h       |    53 +
 filters/chalk/tiff/kis_tiff_ycbcr_reader.cc        |   170 +
 filters/chalk/tiff/kis_tiff_ycbcr_reader.h         |    73 +
 filters/chalk/tiff/kis_wdg_options_tiff.ui         |   741 +
 filters/chalk/tiff/kis_ycbcr_colorspace.h          |    27 +
 filters/chalk/xcf/Makefile.am                      |    42 +
 filters/chalk/xcf/chalk_xcf_export.desktop         |    52 +
 filters/chalk/xcf/chalk_xcf_import.desktop         |    52 +
 filters/chalk/xcf/xcf/README                       |     2 +
 filters/chalk/xcf/xcf/xcf-load.cc                  |  1740 +
 filters/chalk/xcf/xcf/xcf-load.h                   |    27 +
 filters/chalk/xcf/xcf/xcf-private.h                |    95 +
 filters/chalk/xcf/xcf/xcf-read.cc                  |   118 +
 filters/chalk/xcf/xcf/xcf-read.h                   |    37 +
 filters/chalk/xcf/xcf/xcf-save.cc                  |  1826 +
 filters/chalk/xcf/xcf/xcf-save.h                   |    29 +
 filters/chalk/xcf/xcf/xcf-seek.cc                  |    79 +
 filters/chalk/xcf/xcf/xcf-seek.h                   |    30 +
 filters/chalk/xcf/xcf/xcf-write.cc                 |   104 +
 filters/chalk/xcf/xcf/xcf-write.h                  |    39 +
 filters/chalk/xcf/xcfexport.cpp                    |    78 +
 filters/chalk/xcf/xcfexport.h                      |    37 +
 filters/chalk/xcf/xcfimport.cpp                    |    99 +
 filters/chalk/xcf/xcfimport.h                      |    37 +
 filters/configure.in.mid                           |     4 +-
 filters/filterstatus.xml                           |    36 +-
 filters/kspread/gnumeric/gnumericimport.cc         |     6 +-
 filters/tests/global-filter-test.sh                |     8 +-
 karbon/CHANGES                                     |     2 +-
 karbon/GRAPHICS_MEETING                            |     2 +-
 karbon/TODO                                        |     2 +-
 karbon/karbon_factory.cc                           |     4 +-
 karbon/tools/vcurvefit.cc                          |     2 +-
 karbon/tools/vdefaulttools.cc                      |     2 +-
 karbon/tools/vellipsetool.cc                       |     2 +-
 karbon/tools/vellipsetool.h                        |     2 +-
 karbon/tools/vpenciltool.cc                        |     2 +-
 karbon/tools/vpolygontool.cc                       |     2 +-
 karbon/tools/vpolygontool.h                        |     2 +-
 karbon/tools/vpolylinetool.cc                      |     2 +-
 karbon/tools/vrectangletool.cc                     |     2 +-
 karbon/tools/vrectangletool.h                      |     2 +-
 karbon/tools/vroundrecttool.cc                     |     2 +-
 karbon/tools/vroundrecttool.h                      |     2 +-
 karbon/tools/vshapetool.cc                         |     4 +-
 karbon/tools/vsinustool.cc                         |     2 +-
 karbon/tools/vsinustool.h                          |     2 +-
 karbon/tools/vspiraltool.cc                        |     2 +-
 karbon/tools/vspiraltool.h                         |     2 +-
 karbon/tools/vstartool.cc                          |     2 +-
 karbon/tools/vstartool.h                           |     2 +-
 karbon/widgets/vruler.h                            |     2 +-
 kchart/kdchart/KDChartAxisParams.h                 |     4 +-
 kchart/kdchart/KDChartParams.h                     |     6 +-
 kchart/kdchart/KDChartPropertySet.h                |     4 +-
 kchart/kdchart/KDChartTableBase.cpp                |     4 +-
 kchart/kdchart/KDChartTableBase.h                  |     2 +-
 kexi/3rdparty/kolibs/koGlobal.cc                   |     2 +-
 kexi/main/keximainwindowimpl.cpp                   |     2 +-
 kexi/migration/mysql/mysqlmigrate.cpp              |     2 +-
 kexi/widget/kexibrowser.cpp                        |     2 +-
 kivio/kiviopart/stencilbardockmanager.cpp          |    16 +-
 kivio/kiviopart/stencilbardockmanager.h            |     8 +-
 kplato/Makefile.am                                 |     2 +-
 kspread/kspread_editors.cc                         |     2 +-
 .../scripting/kspreadcore/kspreadcoremodule.h      |     4 +-
 kword/mailmerge/sql/KWMySqlCursor.h                |     4 +-
 kword/mailmerge/sql/KWQtSqlEasyFilter.cpp          |    12 +-
 kword/mailmerge/sql/KWQtSqlEasyFilter.h            |    10 +-
 kword/mailmerge/sql/KWQtSqlMailMergeOpen.cpp       |    20 +-
 kword/mailmerge/sql/KWQtSqlMailMergeOpen.h         |    20 +-
 .../mailmerge/sql/KWQtSqlPowerSerialDataSource.cpp |    58 +-
 kword/mailmerge/sql/KWQtSqlPowerSerialDataSource.h |    32 +-
 kword/mailmerge/sql/KWQtSqlSerialDataSource.cpp    |    50 +-
 kword/mailmerge/sql/KWQtSqlSerialDataSource.h      |    30 +-
 .../mailmerge/sql/KWQtSqlSerialDataSourceBase.cpp  |    22 +-
 kword/mailmerge/sql/KWQtSqlSerialDataSourceBase.h  |    18 +-
 kword/mailmerge/sql/qtsqldatasourceeditor.ui.h     |     2 +-
 lib/configure.in.mid                               |     4 +-
 lib/kofficecore/KoGlobal.cpp                       |     2 +-
 lib/kofficecore/tests/filterchain_test.cpp         |     6 +-
 lib/kofficecore/tests/koxmlreadertest.cpp          |     2 +-
 lib/kopainter/koIconChooser.h                      |     2 +-
 lib/kopainter/ko_rgb_widget.cc                     |     2 +-
 lib/kopainter/kogradientmanager.cc                 |     4 +-
 lib/kopainter/kogradientmanager.h                  |     2 +-
 lib/kotext/KoTextZoomHandler.cpp                   |     2 +-
 lib/kross/test/testcase.rb                         |     2 +-
 .../kde33/vnd.oasis.opendocument.image.desktop     |     2 +-
 plugins/scan/Makefile.am                           |     6 +-
 plugins/scan/scan-chalk.rc                         |     9 +
 subdirs                                            |     2 +-
 tools/kfile-plugins/koffice/kfile_koffice.cpp      |     2 +-
 tools/quickprint/Makefile.am                       |     2 +-
 tools/quickprint/chalk_konqi.desktop               |    63 +
 tools/thumbnail/kofficethumbnail.desktop           |     2 +-
 2074 files changed, 389424 insertions(+), 437 deletions(-)
 create mode 100644 chalk/AUTHORS
 create mode 100644 chalk/ChangeLog
 create mode 100644 chalk/HACKING
 create mode 100644 chalk/IMAGE_LIBRARIES
 create mode 100644 chalk/Makefile.am
 create mode 100644 chalk/README
 create mode 100644 chalk/TODO
 create mode 100644 chalk/UIcomments
 create mode 100644 chalk/chalk.desktop
 create mode 100644 chalk/chalk.rc
 create mode 100644 chalk/chalk_part_init.cc
 create mode 100644 chalk/chalk_readonly.rc
 create mode 100644 chalk/chalkcolor/Makefile.am
 create mode 100644 chalk/chalkcolor/README
 create mode 100644 chalk/chalkcolor/TODO
 create mode 100644 chalk/chalkcolor/chalk_colorspace.desktop
 create mode 100644 chalk/chalkcolor/colorspaces/Makefile.am
 create mode 100644 chalk/chalkcolor/colorspaces/kis_alpha_colorspace.cc
 create mode 100644 chalk/chalkcolor/colorspaces/kis_alpha_colorspace.h
 create mode 100644 chalk/chalkcolor/colorspaces/kis_lab_colorspace.cc
 create mode 100644 chalk/chalkcolor/colorspaces/kis_lab_colorspace.h
 create mode 100644 chalk/chalkcolor/colorspaces/kis_xyz_colorspace.cc
 create mode 100644 chalk/chalkcolor/colorspaces/kis_xyz_colorspace.h
 create mode 100644 chalk/chalkcolor/kis_abstract_colorspace.cc
 create mode 100644 chalk/chalkcolor/kis_abstract_colorspace.h
 create mode 100644 chalk/chalkcolor/kis_basic_histogram_producers.cc
 create mode 100644 chalk/chalkcolor/kis_basic_histogram_producers.h
 create mode 100644 chalk/chalkcolor/kis_channelinfo.h
 create mode 100644 chalk/chalkcolor/kis_color.cc
 create mode 100644 chalk/chalkcolor/kis_color.h
 create mode 100644 chalk/chalkcolor/kis_color_conversions.cc
 create mode 100644 chalk/chalkcolor/kis_color_conversions.h
 create mode 100644 chalk/chalkcolor/kis_colorspace.cc
 create mode 100644 chalk/chalkcolor/kis_colorspace.h
 create mode 100644 chalk/chalkcolor/kis_colorspace_factory_registry.cc
 create mode 100644 chalk/chalkcolor/kis_colorspace_factory_registry.h
 create mode 100644 chalk/chalkcolor/kis_colorspace_iface.cc
 create mode 100644 chalk/chalkcolor/kis_colorspace_iface.h
 create mode 100644 chalk/chalkcolor/kis_composite_op.cc
 create mode 100644 chalk/chalkcolor/kis_composite_op.h
 create mode 100644 chalk/chalkcolor/kis_f16half_base_colorspace.cc
 create mode 100644 chalk/chalkcolor/kis_f16half_base_colorspace.h
 create mode 100644 chalk/chalkcolor/kis_f32_base_colorspace.cc
 create mode 100644 chalk/chalkcolor/kis_f32_base_colorspace.h
 create mode 100644 chalk/chalkcolor/kis_histogram_producer.cc
 create mode 100644 chalk/chalkcolor/kis_histogram_producer.h
 create mode 100644 chalk/chalkcolor/kis_profile.cc
 create mode 100644 chalk/chalkcolor/kis_profile.h
 create mode 100644 chalk/chalkcolor/kis_u16_base_colorspace.cc
 create mode 100644 chalk/chalkcolor/kis_u16_base_colorspace.h
 create mode 100644 chalk/chalkcolor/kis_u8_base_colorspace.cc
 create mode 100644 chalk/chalkcolor/kis_u8_base_colorspace.h
 create mode 100644 chalk/chalkcolor/tests/Makefile.am
 create mode 100644 chalk/chalkcolor/tests/kis_color_conversions_tester.cpp
 create mode 100644 chalk/chalkcolor/tests/kis_color_conversions_tester.h
 create mode 100644 chalk/chalkpart.desktop
 create mode 100644 chalk/colorspaces/Makefile.am
 create mode 100644 chalk/colorspaces/README
 create mode 100644 chalk/colorspaces/cmyk_u16/Makefile.am
 create mode 100644 chalk/colorspaces/cmyk_u16/chalk_cmyk_u16_plugin.desktop
 create mode 100644 chalk/colorspaces/cmyk_u16/cmyk_u16_plugin.cc
 create mode 100644 chalk/colorspaces/cmyk_u16/cmyk_u16_plugin.h
 create mode 100644 chalk/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.cc
 create mode 100644 chalk/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.h
 create mode 100644 chalk/colorspaces/cmyk_u8/Makefile.am
 create mode 100644 chalk/colorspaces/cmyk_u8/chalkcmykplugin.desktop
 create mode 100644 chalk/colorspaces/cmyk_u8/cmyk_plugin.cc
 create mode 100644 chalk/colorspaces/cmyk_u8/cmyk_plugin.h
 create mode 100644 chalk/colorspaces/cmyk_u8/cmykplugin.rc
 create mode 100644 chalk/colorspaces/cmyk_u8/composite.h
 create mode 100644 chalk/colorspaces/cmyk_u8/kis_cmyk_colorspace.cc
 create mode 100644 chalk/colorspaces/cmyk_u8/kis_cmyk_colorspace.h
 create mode 100644 chalk/colorspaces/cmyk_u8/templates/.directory
 create mode 100644 chalk/colorspaces/cmyk_u8/templates/Makefile.am
 create mode 100644 chalk/colorspaces/cmyk_u8/templates/cr48-action-template_cmyk_empty.png
 create mode 100644 chalk/colorspaces/cmyk_u8/templates/crsc-action-template_cmyk_empty.svgz
 create mode 100644 chalk/colorspaces/cmyk_u8/templates/white_2000x800.desktop
 create mode 100644 chalk/colorspaces/cmyk_u8/templates/white_2000x800.kra
 create mode 100644 chalk/colorspaces/gray_u16/Makefile.am
 create mode 100644 chalk/colorspaces/gray_u16/chalk_gray_u16_plugin.desktop
 create mode 100644 chalk/colorspaces/gray_u16/gray_u16_plugin.cc
 create mode 100644 chalk/colorspaces/gray_u16/gray_u16_plugin.h
 create mode 100644 chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.cc
 create mode 100644 chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.h
 create mode 100644 chalk/colorspaces/gray_u8/Makefile.am
 create mode 100644 chalk/colorspaces/gray_u8/chalkgrayplugin.desktop
 create mode 100644 chalk/colorspaces/gray_u8/gray_plugin.cc
 create mode 100644 chalk/colorspaces/gray_u8/gray_plugin.h
 create mode 100644 chalk/colorspaces/gray_u8/grayplugin.rc
 create mode 100644 chalk/colorspaces/gray_u8/kis_gray_colorspace.cc
 create mode 100644 chalk/colorspaces/gray_u8/kis_gray_colorspace.h
 create mode 100644 chalk/colorspaces/gray_u8/templates/.directory
 create mode 100644 chalk/colorspaces/gray_u8/templates/Makefile.am
 create mode 100644 chalk/colorspaces/gray_u8/templates/cr48-action-template_gray_empty.png
 create mode 100644 chalk/colorspaces/gray_u8/templates/crsc-action-template_gray_empty.svgz
 create mode 100644 chalk/colorspaces/gray_u8/templates/white_640x480.desktop
 create mode 100644 chalk/colorspaces/gray_u8/templates/white_640x480.kra
 create mode 100644 chalk/colorspaces/gray_u8/tests/Makefile.am
 create mode 100644 chalk/colorspaces/gray_u8/tests/kis_strategy_colorspace_grayscale_tester.cpp
 create mode 100644 chalk/colorspaces/gray_u8/tests/kis_strategy_colorspace_grayscale_tester.h
 create mode 100644 chalk/colorspaces/lms_f32/Makefile.am
 create mode 100644 chalk/colorspaces/lms_f32/chalk_lms_f32_plugin.desktop
 create mode 100644 chalk/colorspaces/lms_f32/kis_lms_f32_colorspace.cc
 create mode 100644 chalk/colorspaces/lms_f32/kis_lms_f32_colorspace.h
 create mode 100644 chalk/colorspaces/lms_f32/lms_f32_plugin.cc
 create mode 100644 chalk/colorspaces/lms_f32/lms_f32_plugin.h
 create mode 100644 chalk/colorspaces/lms_f32/lms_f32_plugin.rc
 create mode 100644 chalk/colorspaces/rgb_f16half/Makefile.am
 create mode 100644 chalk/colorspaces/rgb_f16half/chalk_rgb_f16half_plugin.desktop
 create mode 100644 chalk/colorspaces/rgb_f16half/kis_rgb_f16half_colorspace.cc
 create mode 100644 chalk/colorspaces/rgb_f16half/kis_rgb_f16half_colorspace.h
 create mode 100644 chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.cc
 create mode 100644 chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.h
 create mode 100644 chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.rc
 create mode 100644 chalk/colorspaces/rgb_f16half/tests/Makefile.am
 create mode 100644 chalk/colorspaces/rgb_f16half/tests/kis_rgb_f16half_colorspace_tester.cc
 create mode 100644 chalk/colorspaces/rgb_f16half/tests/kis_rgb_f16half_colorspace_tester.h
 create mode 100644 chalk/colorspaces/rgb_f32/Makefile.am
 create mode 100644 chalk/colorspaces/rgb_f32/chalk_rgb_f32_plugin.desktop
 create mode 100644 chalk/colorspaces/rgb_f32/kis_rgb_f32_colorspace.cc
 create mode 100644 chalk/colorspaces/rgb_f32/kis_rgb_f32_colorspace.h
 create mode 100644 chalk/colorspaces/rgb_f32/rgb_f32_plugin.cc
 create mode 100644 chalk/colorspaces/rgb_f32/rgb_f32_plugin.h
 create mode 100644 chalk/colorspaces/rgb_f32/rgb_f32_plugin.rc
 create mode 100644 chalk/colorspaces/rgb_f32/tests/Makefile.am
 create mode 100644 chalk/colorspaces/rgb_f32/tests/kis_strategy_colorspace_rgb_f32_tester.cc
 create mode 100644 chalk/colorspaces/rgb_f32/tests/kis_strategy_colorspace_rgb_f32_tester.h
 create mode 100644 chalk/colorspaces/rgb_u16/Makefile.am
 create mode 100644 chalk/colorspaces/rgb_u16/chalk_rgb_u16_plugin.desktop
 create mode 100644 chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc
 create mode 100644 chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.h
 create mode 100644 chalk/colorspaces/rgb_u16/rgb_u16_plugin.cc
 create mode 100644 chalk/colorspaces/rgb_u16/rgb_u16_plugin.h
 create mode 100644 chalk/colorspaces/rgb_u16/tests/Makefile.am
 create mode 100644 chalk/colorspaces/rgb_u16/tests/kis_strategy_colorspace_rgb_u16_tester.cc
 create mode 100644 chalk/colorspaces/rgb_u16/tests/kis_strategy_colorspace_rgb_u16_tester.h
 create mode 100644 chalk/colorspaces/rgb_u8/Makefile.am
 create mode 100644 chalk/colorspaces/rgb_u8/chalkrgbplugin.desktop
 create mode 100644 chalk/colorspaces/rgb_u8/composite.h
 create mode 100644 chalk/colorspaces/rgb_u8/kis_rgb_colorspace.cc
 create mode 100644 chalk/colorspaces/rgb_u8/kis_rgb_colorspace.h
 create mode 100644 chalk/colorspaces/rgb_u8/rgb_plugin.cc
 create mode 100644 chalk/colorspaces/rgb_u8/rgb_plugin.h
 create mode 100644 chalk/colorspaces/rgb_u8/rgbplugin.rc
 create mode 100644 chalk/colorspaces/rgb_u8/templates/.directory
 create mode 100644 chalk/colorspaces/rgb_u8/templates/Makefile.am
 create mode 100644 chalk/colorspaces/rgb_u8/templates/cr48-action-template_rgb_empty.png
 create mode 100644 chalk/colorspaces/rgb_u8/templates/crsc-action-template_rgb_empty.svgz
 create mode 100644 chalk/colorspaces/rgb_u8/templates/transparent_1024x768.desktop
 create mode 100644 chalk/colorspaces/rgb_u8/templates/transparent_1024x768.kra
 create mode 100644 chalk/colorspaces/rgb_u8/templates/transparent_1280x1024.desktop
 create mode 100644 chalk/colorspaces/rgb_u8/templates/transparent_1280x1024.kra
 create mode 100644 chalk/colorspaces/rgb_u8/templates/transparent_1600x1200.desktop
 create mode 100644 chalk/colorspaces/rgb_u8/templates/transparent_1600x1200.kra
 create mode 100644 chalk/colorspaces/rgb_u8/templates/transparent_640x480.desktop
 create mode 100644 chalk/colorspaces/rgb_u8/templates/transparent_640x480.kra
 create mode 100644 chalk/colorspaces/rgb_u8/templates/white_1024x768.desktop
 create mode 100644 chalk/colorspaces/rgb_u8/templates/white_1024x768.kra
 create mode 100644 chalk/colorspaces/rgb_u8/templates/white_1280x1024.desktop
 create mode 100644 chalk/colorspaces/rgb_u8/templates/white_1280x1024.kra
 create mode 100644 chalk/colorspaces/rgb_u8/templates/white_1600x1200.desktop
 create mode 100644 chalk/colorspaces/rgb_u8/templates/white_1600x1200.kra
 create mode 100644 chalk/colorspaces/rgb_u8/templates/white_640x480.desktop
 create mode 100644 chalk/colorspaces/rgb_u8/templates/white_640x480.kra
 create mode 100644 chalk/colorspaces/rgb_u8/tests/Makefile.am
 create mode 100644 chalk/colorspaces/rgb_u8/tests/kis_strategy_colorspace_rgb_tester.cpp
 create mode 100644 chalk/colorspaces/rgb_u8/tests/kis_strategy_colorspace_rgb_tester.h
 create mode 100644 chalk/colorspaces/wet/Makefile.am
 create mode 100644 chalk/colorspaces/wet/chalkwetplugin.desktop
 create mode 100644 chalk/colorspaces/wet/kis_texture_filter.cc
 create mode 100644 chalk/colorspaces/wet/kis_texture_filter.h
 create mode 100644 chalk/colorspaces/wet/kis_texture_painter.cc
 create mode 100644 chalk/colorspaces/wet/kis_texture_painter.h
 create mode 100644 chalk/colorspaces/wet/kis_wet_colorspace.cc
 create mode 100644 chalk/colorspaces/wet/kis_wet_colorspace.h
 create mode 100644 chalk/colorspaces/wet/kis_wet_palette_widget.cc
 create mode 100644 chalk/colorspaces/wet/kis_wet_palette_widget.h
 create mode 100644 chalk/colorspaces/wet/kis_wetness_visualisation_filter.cc
 create mode 100644 chalk/colorspaces/wet/kis_wetness_visualisation_filter.h
 create mode 100644 chalk/colorspaces/wet/kis_wetop.cc
 create mode 100644 chalk/colorspaces/wet/kis_wetop.h
 create mode 100644 chalk/colorspaces/wet/todo
 create mode 100644 chalk/colorspaces/wet/wdgpressure.ui
 create mode 100644 chalk/colorspaces/wet/wet_plugin.cc
 create mode 100644 chalk/colorspaces/wet/wet_plugin.h
 create mode 100644 chalk/colorspaces/wet/wetdreams/Makefile
 create mode 100644 chalk/colorspaces/wet/wetdreams/wetmain.c
 create mode 100644 chalk/colorspaces/wet/wetdreams/wetpaint.c
 create mode 100644 chalk/colorspaces/wet/wetdreams/wetpaint.h
 create mode 100644 chalk/colorspaces/wet/wetdreams/wetphysics.c
 create mode 100644 chalk/colorspaces/wet/wetdreams/wetphysics.h
 create mode 100644 chalk/colorspaces/wet/wetdreams/wetpix.c
 create mode 100644 chalk/colorspaces/wet/wetdreams/wetpix.h
 create mode 100644 chalk/colorspaces/wet/wetdreams/wettexture.c
 create mode 100644 chalk/colorspaces/wet/wetdreams/wettexture.h
 create mode 100644 chalk/colorspaces/wet/wetphysicsfilter.cc
 create mode 100644 chalk/colorspaces/wet/wetphysicsfilter.h
 create mode 100644 chalk/colorspaces/wet/wetplugin.rc
 create mode 100644 chalk/colorspaces/wetsticky/Makefile.am
 create mode 100644 chalk/colorspaces/wetsticky/README
 create mode 100644 chalk/colorspaces/wetsticky/TODO
 create mode 100644 chalk/colorspaces/wetsticky/brushop/Makefile.am
 create mode 100644 chalk/colorspaces/wetsticky/brushop/README
 create mode 100644 chalk/colorspaces/wetsticky/brushop/chalkwsbrushpaintop.desktop
 create mode 100644 chalk/colorspaces/wetsticky/brushop/kis_wsbrushop.cc
 create mode 100644 chalk/colorspaces/wetsticky/brushop/kis_wsbrushop.h
 create mode 100644 chalk/colorspaces/wetsticky/brushop/wetpaintbrush.png
 create mode 100644 chalk/colorspaces/wetsticky/brushop/wsbrushpaintop_plugin.cc
 create mode 100644 chalk/colorspaces/wetsticky/brushop/wsbrushpaintop_plugin.h
 create mode 100644 chalk/colorspaces/wetsticky/chalkwsplugin.desktop
 create mode 100644 chalk/colorspaces/wetsticky/kis_wet_sticky_colorspace.cc
 create mode 100644 chalk/colorspaces/wetsticky/kis_wet_sticky_colorspace.h
 create mode 100644 chalk/colorspaces/wetsticky/kis_ws_engine_filter.cc
 create mode 100644 chalk/colorspaces/wetsticky/kis_ws_engine_filter.h
 create mode 100644 chalk/colorspaces/wetsticky/wet_sticky_plugin.cc
 create mode 100644 chalk/colorspaces/wetsticky/wet_sticky_plugin.h
 create mode 100644 chalk/colorspaces/wetsticky/ws/GNU
 create mode 100644 chalk/colorspaces/wetsticky/ws/GNU Public Licence.txt
 create mode 100644 chalk/colorspaces/wetsticky/ws/README
 create mode 100644 chalk/colorspaces/wetsticky/ws/TODO
 create mode 100644 chalk/colorspaces/wetsticky/ws/after.jpg
 create mode 100644 chalk/colorspaces/wetsticky/ws/anim.c
 create mode 100644 chalk/colorspaces/wetsticky/ws/before.jpg
 create mode 100644 chalk/colorspaces/wetsticky/ws/canvas.c
 create mode 100644 chalk/colorspaces/wetsticky/ws/canvas.h
 create mode 100644 chalk/colorspaces/wetsticky/ws/cmap.c
 create mode 100644 chalk/colorspaces/wetsticky/ws/constants.h
 create mode 100644 chalk/colorspaces/wetsticky/ws/engine.c
 create mode 100644 chalk/colorspaces/wetsticky/ws/engine.h
 create mode 100644 chalk/colorspaces/wetsticky/ws/engine3.c
 create mode 100644 chalk/colorspaces/wetsticky/ws/load_ppm.c
 create mode 100644 chalk/colorspaces/wetsticky/ws/main.c
 create mode 100644 chalk/colorspaces/wetsticky/ws/makefile
 create mode 100644 chalk/colorspaces/wetsticky/ws/mona.pgm
 create mode 100644 chalk/colorspaces/wetsticky/ws/ogl_interface.c
 create mode 100644 chalk/colorspaces/wetsticky/ws/test2.jpg
 create mode 100644 chalk/colorspaces/wetsticky/ws/test3.jpg
 create mode 100644 chalk/colorspaces/wetsticky/ws/types.h
 create mode 100644 chalk/colorspaces/wetsticky/ws/win_interface.h
 create mode 100644 chalk/colorspaces/wetsticky/ws/x_interface.c
 create mode 100644 chalk/colorspaces/wetsticky/wstool.ui
 create mode 100644 chalk/colorspaces/ycbcr_u16/Makefile.am
 create mode 100644 chalk/colorspaces/ycbcr_u16/chalk_ycbcr_u16_plugin.desktop
 create mode 100644 chalk/colorspaces/ycbcr_u16/kis_ycbcr_u16_colorspace.cc
 create mode 100644 chalk/colorspaces/ycbcr_u16/kis_ycbcr_u16_colorspace.h
 create mode 100644 chalk/colorspaces/ycbcr_u16/ycbcr_u16_plugin.cc
 create mode 100644 chalk/colorspaces/ycbcr_u16/ycbcr_u16_plugin.h
 create mode 100644 chalk/colorspaces/ycbcr_u8/Makefile.am
 create mode 100644 chalk/colorspaces/ycbcr_u8/chalk_ycbcr_u8_plugin.desktop
 create mode 100644 chalk/colorspaces/ycbcr_u8/kis_ycbcr_u8_colorspace.cc
 create mode 100644 chalk/colorspaces/ycbcr_u8/kis_ycbcr_u8_colorspace.h
 create mode 100644 chalk/colorspaces/ycbcr_u8/ycbcr_u8_plugin.cc
 create mode 100644 chalk/colorspaces/ycbcr_u8/ycbcr_u8_plugin.h
 create mode 100644 chalk/configure.in.bot
 create mode 100644 chalk/configure.in.in
 create mode 100644 chalk/core/Makefile.am
 create mode 100755 chalk/core/createdcop.py
 create mode 100644 chalk/core/kis_adjustment_layer.cc
 create mode 100644 chalk/core/kis_adjustment_layer.h
 create mode 100644 chalk/core/kis_alpha_mask.cc
 create mode 100644 chalk/core/kis_alpha_mask.h
 create mode 100644 chalk/core/kis_autobrush_resource.cc
 create mode 100644 chalk/core/kis_autobrush_resource.h
 create mode 100644 chalk/core/kis_autogradient_resource.cc
 create mode 100644 chalk/core/kis_autogradient_resource.h
 create mode 100644 chalk/core/kis_background.cc
 create mode 100644 chalk/core/kis_background.h
 create mode 100644 chalk/core/kis_basic_math_toolbox.cpp
 create mode 100644 chalk/core/kis_basic_math_toolbox.h
 create mode 100644 chalk/core/kis_boundary.cc
 create mode 100644 chalk/core/kis_boundary.h
 create mode 100644 chalk/core/kis_brush.cc
 create mode 100644 chalk/core/kis_brush.h
 create mode 100644 chalk/core/kis_change_profile_visitor.h
 create mode 100644 chalk/core/kis_colorspace_convert_visitor.h
 create mode 100644 chalk/core/kis_command.cc
 create mode 100644 chalk/core/kis_command.h
 create mode 100644 chalk/core/kis_convolution_painter.cc
 create mode 100644 chalk/core/kis_convolution_painter.h
 create mode 100644 chalk/core/kis_crop_visitor.h
 create mode 100644 chalk/core/kis_datamanager.h
 create mode 100644 chalk/core/kis_exif_info.cc
 create mode 100644 chalk/core/kis_exif_info.h
 create mode 100644 chalk/core/kis_exif_value.cc
 create mode 100644 chalk/core/kis_exif_value.h
 create mode 100644 chalk/core/kis_fill_painter.cc
 create mode 100644 chalk/core/kis_fill_painter.h
 create mode 100644 chalk/core/kis_filter.cc
 create mode 100644 chalk/core/kis_filter.h
 create mode 100644 chalk/core/kis_filter_config_widget.cc
 create mode 100644 chalk/core/kis_filter_config_widget.h
 create mode 100644 chalk/core/kis_filter_configuration.cc
 create mode 100644 chalk/core/kis_filter_configuration.h
 create mode 100644 chalk/core/kis_filter_registry.cc
 create mode 100644 chalk/core/kis_filter_registry.h
 create mode 100644 chalk/core/kis_filter_strategy.cc
 create mode 100644 chalk/core/kis_filter_strategy.h
 create mode 100644 chalk/core/kis_gradient.cc
 create mode 100644 chalk/core/kis_gradient.h
 create mode 100644 chalk/core/kis_gradient_painter.cc
 create mode 100644 chalk/core/kis_gradient_painter.h
 create mode 100644 chalk/core/kis_group_layer.cc
 create mode 100644 chalk/core/kis_group_layer.h
 create mode 100644 chalk/core/kis_histogram.cc
 create mode 100644 chalk/core/kis_histogram.h
 create mode 100644 chalk/core/kis_image.cc
 create mode 100644 chalk/core/kis_image.h
 create mode 100644 chalk/core/kis_image_iface.cc
 create mode 100644 chalk/core/kis_image_iface.h
 create mode 100644 chalk/core/kis_imagepipe_brush.cc
 create mode 100644 chalk/core/kis_imagepipe_brush.h
 create mode 100644 chalk/core/kis_iterator.cc
 create mode 100644 chalk/core/kis_iterator.h
 create mode 100644 chalk/core/kis_iteratorpixeltrait.h
 create mode 100644 chalk/core/kis_iterators_pixel.cc
 create mode 100644 chalk/core/kis_iterators_pixel.h
 create mode 100644 chalk/core/kis_layer.cc
 create mode 100644 chalk/core/kis_layer.h
 create mode 100644 chalk/core/kis_layer_visitor.h
 create mode 100644 chalk/core/kis_math_toolbox.cpp
 create mode 100644 chalk/core/kis_math_toolbox.h
 create mode 100644 chalk/core/kis_merge_visitor.h
 create mode 100644 chalk/core/kis_meta_registry.cc
 create mode 100644 chalk/core/kis_meta_registry.h
 create mode 100644 chalk/core/kis_nameserver.cc
 create mode 100644 chalk/core/kis_nameserver.h
 create mode 100644 chalk/core/kis_paint_device.cc
 create mode 100644 chalk/core/kis_paint_device.h
 create mode 100644 chalk/core/kis_paint_device_action.h
 create mode 100644 chalk/core/kis_paint_device_iface.cc
 create mode 100644 chalk/core/kis_paint_device_iface.h
 create mode 100644 chalk/core/kis_paint_layer.cc
 create mode 100644 chalk/core/kis_paint_layer.h
 create mode 100644 chalk/core/kis_painter.cc
 create mode 100644 chalk/core/kis_painter.h
 create mode 100644 chalk/core/kis_paintop.cc
 create mode 100644 chalk/core/kis_paintop.h
 create mode 100644 chalk/core/kis_paintop_registry.cc
 create mode 100644 chalk/core/kis_paintop_registry.h
 create mode 100644 chalk/core/kis_palette.cc
 create mode 100644 chalk/core/kis_palette.h
 create mode 100644 chalk/core/kis_part_layer_iface.h
 create mode 100644 chalk/core/kis_pattern.cc
 create mode 100644 chalk/core/kis_pattern.h
 create mode 100644 chalk/core/kis_perspective_grid.cpp
 create mode 100644 chalk/core/kis_perspective_grid.h
 create mode 100644 chalk/core/kis_perspective_math.cpp
 create mode 100644 chalk/core/kis_perspective_math.h
 create mode 100644 chalk/core/kis_perspectivetransform_worker.cpp
 create mode 100644 chalk/core/kis_perspectivetransform_worker.h
 create mode 100644 chalk/core/kis_point.h
 create mode 100644 chalk/core/kis_random_accessor.cpp
 create mode 100644 chalk/core/kis_random_accessor.h
 create mode 100644 chalk/core/kis_random_sub_accessor.cpp
 create mode 100644 chalk/core/kis_random_sub_accessor.h
 create mode 100644 chalk/core/kis_rect.cc
 create mode 100644 chalk/core/kis_rect.h
 create mode 100644 chalk/core/kis_resource.cc
 create mode 100644 chalk/core/kis_resource.h
 create mode 100644 chalk/core/kis_rotate_visitor.cc
 create mode 100644 chalk/core/kis_rotate_visitor.h
 create mode 100644 chalk/core/kis_scale_visitor.cc
 create mode 100644 chalk/core/kis_scale_visitor.h
 create mode 100644 chalk/core/kis_selected_transaction.cc
 create mode 100644 chalk/core/kis_selected_transaction.h
 create mode 100644 chalk/core/kis_selection.cc
 create mode 100644 chalk/core/kis_selection.h
 create mode 100644 chalk/core/kis_shear_visitor.h
 create mode 100644 chalk/core/kis_strategy_move.cc
 create mode 100644 chalk/core/kis_strategy_move.h
 create mode 100644 chalk/core/kis_substrate.h
 create mode 100644 chalk/core/kis_thread.h
 create mode 100644 chalk/core/kis_thread_pool.cc
 create mode 100644 chalk/core/kis_thread_pool.h
 create mode 100644 chalk/core/kis_transaction.cc
 create mode 100644 chalk/core/kis_transaction.h
 create mode 100644 chalk/core/kis_transform_visitor.h
 create mode 100644 chalk/core/kis_transform_worker.cc
 create mode 100644 chalk/core/kis_transform_worker.h
 create mode 100644 chalk/core/kis_types.h
 create mode 100644 chalk/core/kis_vec.cc
 create mode 100644 chalk/core/kis_vec.h
 create mode 100644 chalk/core/tests/Makefile.am
 create mode 100644 chalk/core/tests/kis_filter_configuration_tester.cc
 create mode 100644 chalk/core/tests/kis_filter_configuration_tester.h
 create mode 100644 chalk/core/tests/kis_image_tester.cpp
 create mode 100644 chalk/core/tests/kis_image_tester.h
 create mode 100644 chalk/core/tests/kis_integer_maths_tester.cpp
 create mode 100644 chalk/core/tests/kis_integer_maths_tester.h
 create mode 100644 chalk/core/tiles/Makefile.am
 create mode 100644 chalk/core/tiles/kis_memento.cc
 create mode 100644 chalk/core/tiles/kis_memento.h
 create mode 100644 chalk/core/tiles/kis_tile.cc
 create mode 100644 chalk/core/tiles/kis_tile.h
 create mode 100644 chalk/core/tiles/kis_tile_global.h
 create mode 100644 chalk/core/tiles/kis_tiled_random_accessor.cc
 create mode 100644 chalk/core/tiles/kis_tiled_random_accessor.h
 create mode 100644 chalk/core/tiles/kis_tileddatamanager.cc
 create mode 100644 chalk/core/tiles/kis_tileddatamanager.h
 create mode 100644 chalk/core/tiles/kis_tiledhlineiterator.cc
 create mode 100644 chalk/core/tiles/kis_tilediterator.cc
 create mode 100644 chalk/core/tiles/kis_tilediterator.h
 create mode 100644 chalk/core/tiles/kis_tiledrectiterator.cc
 create mode 100644 chalk/core/tiles/kis_tiledvlineiterator.cc
 create mode 100644 chalk/core/tiles/kis_tilemanager.cc
 create mode 100644 chalk/core/tiles/kis_tilemanager.h
 create mode 100644 chalk/core/tiles/tests/Makefile.am
 create mode 100644 chalk/core/tiles/tests/kis_tiled_data_tester.cpp
 create mode 100644 chalk/core/tiles/tests/kis_tiled_data_tester.h
 create mode 100644 chalk/data/Makefile.am
 create mode 100644 chalk/data/README
 create mode 100644 chalk/data/brushes/10x10square.gbr
 create mode 100644 chalk/data/brushes/10x10squareBlur.gbr
 create mode 100644 chalk/data/brushes/11circle.gbr
 create mode 100644 chalk/data/brushes/11fcircle.gbr
 create mode 100644 chalk/data/brushes/13circle.gbr
 create mode 100644 chalk/data/brushes/13fcircle.gbr
 create mode 100644 chalk/data/brushes/15circle.gbr
 create mode 100644 chalk/data/brushes/15fcircle.gbr
 create mode 100644 chalk/data/brushes/17circle.gbr
 create mode 100644 chalk/data/brushes/17fcircle.gbr
 create mode 100644 chalk/data/brushes/19circle.gbr
 create mode 100644 chalk/data/brushes/19fcircle.gbr
 create mode 100644 chalk/data/brushes/1circle.gbr
 create mode 100644 chalk/data/brushes/20x20square.gbr
 create mode 100644 chalk/data/brushes/20x20squareBlur.gbr
 create mode 100644 chalk/data/brushes/3circle.gbr
 create mode 100644 chalk/data/brushes/3fcircle.gbr
 create mode 100644 chalk/data/brushes/5circle.gbr
 create mode 100644 chalk/data/brushes/5fcircle.gbr
 create mode 100644 chalk/data/brushes/5x5square.gbr
 create mode 100644 chalk/data/brushes/5x5squareBlur.gbr
 create mode 100644 chalk/data/brushes/7circle.gbr
 create mode 100644 chalk/data/brushes/7fcircle.gbr
 create mode 100644 chalk/data/brushes/9circle.gbr
 create mode 100644 chalk/data/brushes/9fcircle.gbr
 create mode 100644 chalk/data/brushes/BRUSHES.README
 create mode 100644 chalk/data/brushes/COPYING
 create mode 100644 chalk/data/brushes/DStar11.gbr
 create mode 100644 chalk/data/brushes/DStar17.gbr
 create mode 100644 chalk/data/brushes/DStar25.gbr
 create mode 100644 chalk/data/brushes/Makefile.am
 create mode 100644 chalk/data/brushes/SketchBrush-16.gih
 create mode 100644 chalk/data/brushes/SketchBrush-32.gih
 create mode 100644 chalk/data/brushes/SketchBrush-64.gih
 create mode 100644 chalk/data/brushes/callig1.gbr
 create mode 100644 chalk/data/brushes/callig2.gbr
 create mode 100644 chalk/data/brushes/callig3.gbr
 create mode 100644 chalk/data/brushes/callig4.gbr
 create mode 100644 chalk/data/brushes/confetti.gbr
 create mode 100644 chalk/data/brushes/confetti.gih
 create mode 100644 chalk/data/brushes/cursor.gbr
 create mode 100644 chalk/data/brushes/cursor_big_lb.gbr
 create mode 100644 chalk/data/brushes/cursor_big_lw.gbr
 create mode 100644 chalk/data/brushes/cursor_big_rb.gbr
 create mode 100644 chalk/data/brushes/cursor_big_rw.gbr
 create mode 100644 chalk/data/brushes/cursor_lw.gbr
 create mode 100644 chalk/data/brushes/cursor_resize_diag_1.gbr
 create mode 100644 chalk/data/brushes/cursor_resize_diag_2.gbr
 create mode 100644 chalk/data/brushes/cursor_resize_hor.gbr
 create mode 100644 chalk/data/brushes/cursor_resize_vert.gbr
 create mode 100644 chalk/data/brushes/cursor_rw.gbr
 create mode 100644 chalk/data/brushes/cursor_small_lb.gbr
 create mode 100644 chalk/data/brushes/cursor_small_lw.gbr
 create mode 100644 chalk/data/brushes/cursor_small_rb.gbr
 create mode 100644 chalk/data/brushes/cursor_small_rw.gbr
 create mode 100644 chalk/data/brushes/cursor_tiny_lw.gbr
 create mode 100644 chalk/data/brushes/cursor_tiny_rw.gbr
 create mode 100644 chalk/data/brushes/cursor_up.gbr
 create mode 100644 chalk/data/brushes/dunes.gbr
 create mode 100644 chalk/data/brushes/feltpen.gih
 create mode 100644 chalk/data/brushes/galaxy.gbr
 create mode 100644 chalk/data/brushes/galaxy_big.gbr
 create mode 100644 chalk/data/brushes/galaxy_small.gbr
 create mode 100644 chalk/data/brushes/hsparks.gih
 create mode 100644 chalk/data/brushes/pepper.gbr
 create mode 100644 chalk/data/brushes/pixel.gbr
 create mode 100644 chalk/data/brushes/vine.gih
 create mode 100644 chalk/data/chalk_filter.desktop
 create mode 100644 chalk/data/chalk_paintop.desktop
 create mode 100644 chalk/data/chalk_plugin.desktop
 create mode 100644 chalk/data/chalk_tool.desktop
 create mode 100644 chalk/data/gradients/Abstract_1.ggr
 create mode 100644 chalk/data/gradients/Abstract_2.ggr
 create mode 100644 chalk/data/gradients/Abstract_3.ggr
 create mode 100644 chalk/data/gradients/Aneurism.ggr
 create mode 100644 chalk/data/gradients/Blinds.ggr
 create mode 100644 chalk/data/gradients/Blue_Green.ggr
 create mode 100644 chalk/data/gradients/Browns.ggr
 create mode 100644 chalk/data/gradients/Brushed_Aluminium.ggr
 create mode 100644 chalk/data/gradients/Burning_Paper.ggr
 create mode 100644 chalk/data/gradients/Burning_Transparency.ggr
 create mode 100644 chalk/data/gradients/CD.ggr
 create mode 100644 chalk/data/gradients/CD_Half.ggr
 create mode 100644 chalk/data/gradients/Caribbean_Blues.ggr
 create mode 100644 chalk/data/gradients/Coffee.ggr
 create mode 100644 chalk/data/gradients/Cold_Steel.ggr
 create mode 100644 chalk/data/gradients/Cold_Steel_2.ggr
 create mode 100644 chalk/data/gradients/Crown_molding.ggr
 create mode 100644 chalk/data/gradients/Dark_1.ggr
 create mode 100644 chalk/data/gradients/Deep_Sea.ggr
 create mode 100644 chalk/data/gradients/Default.ggr
 create mode 100644 chalk/data/gradients/Flare_Glow_Angular_1.ggr
 create mode 100644 chalk/data/gradients/Flare_Glow_Radial_1.ggr
 create mode 100644 chalk/data/gradients/Flare_Glow_Radial_2.ggr
 create mode 100644 chalk/data/gradients/Flare_Glow_Radial_3.ggr
 create mode 100644 chalk/data/gradients/Flare_Glow_Radial_4.ggr
 create mode 100644 chalk/data/gradients/Flare_Radial_101.ggr
 create mode 100644 chalk/data/gradients/Flare_Radial_102.ggr
 create mode 100644 chalk/data/gradients/Flare_Radial_103.ggr
 create mode 100644 chalk/data/gradients/Flare_Rays_Radial_1.ggr
 create mode 100644 chalk/data/gradients/Flare_Rays_Radial_2.ggr
 create mode 100644 chalk/data/gradients/Flare_Rays_Size_1.ggr
 create mode 100644 chalk/data/gradients/Flare_Sizefac_101.ggr
 create mode 100644 chalk/data/gradients/Four_bars.ggr
 create mode 100644 chalk/data/gradients/French_flag.ggr
 create mode 100644 chalk/data/gradients/French_flag_smooth.ggr
 create mode 100644 chalk/data/gradients/Full_saturation_spectrum_CCW.ggr
 create mode 100644 chalk/data/gradients/Full_saturation_spectrum_CW.ggr
 create mode 100644 chalk/data/gradients/German_flag.ggr
 create mode 100644 chalk/data/gradients/German_flag_smooth.ggr
 create mode 100644 chalk/data/gradients/Golden.ggr
 create mode 100644 chalk/data/gradients/Greens.ggr
 create mode 100644 chalk/data/gradients/Horizon_1.ggr
 create mode 100644 chalk/data/gradients/Horizon_2.ggr
 create mode 100644 chalk/data/gradients/Incandescent.ggr
 create mode 100644 chalk/data/gradients/Land_1.ggr
 create mode 100644 chalk/data/gradients/Land_and_Sea.ggr
 create mode 100644 chalk/data/gradients/Makefile.am
 create mode 100644 chalk/data/gradients/Metallic_Something.ggr
 create mode 100644 chalk/data/gradients/Mexican_flag.ggr
 create mode 100644 chalk/data/gradients/Mexican_flag_smooth.ggr
 create mode 100644 chalk/data/gradients/Nauseating_Headache.ggr
 create mode 100644 chalk/data/gradients/Neon_Cyan.ggr
 create mode 100644 chalk/data/gradients/Neon_Green.ggr
 create mode 100644 chalk/data/gradients/Neon_Yellow.ggr
 create mode 100644 chalk/data/gradients/Pastel_Rainbow.ggr
 create mode 100644 chalk/data/gradients/Pastels.ggr
 create mode 100644 chalk/data/gradients/Purples.ggr
 create mode 100644 chalk/data/gradients/Radial_Eyeball_Blue.ggr
 create mode 100644 chalk/data/gradients/Radial_Eyeball_Brown.ggr
 create mode 100644 chalk/data/gradients/Radial_Eyeball_Green.ggr
 create mode 100644 chalk/data/gradients/Radial_Glow_1.ggr
 create mode 100644 chalk/data/gradients/Radial_Rainbow_Hoop.ggr
 create mode 100644 chalk/data/gradients/Romanian_flag.ggr
 create mode 100644 chalk/data/gradients/Romanian_flag_smooth.ggr
 create mode 100644 chalk/data/gradients/Rounded_edge.ggr
 create mode 100644 chalk/data/gradients/Shadows_1.ggr
 create mode 100644 chalk/data/gradients/Shadows_2.ggr
 create mode 100644 chalk/data/gradients/Shadows_3.ggr
 create mode 100644 chalk/data/gradients/Skyline.ggr
 create mode 100644 chalk/data/gradients/Skyline_polluted.ggr
 create mode 100644 chalk/data/gradients/Square_Wood_Frame.ggr
 create mode 100644 chalk/data/gradients/Sunrise.ggr
 create mode 100644 chalk/data/gradients/Three_bars_sin.ggr
 create mode 100644 chalk/data/gradients/Tropical_Colors.ggr
 create mode 100644 chalk/data/gradients/Tube_Red.ggr
 create mode 100644 chalk/data/gradients/Wood_1.ggr
 create mode 100644 chalk/data/gradients/Wood_2.ggr
 create mode 100644 chalk/data/gradients/Yellow_Contrast.ggr
 create mode 100644 chalk/data/gradients/Yellow_Orange.ggr
 create mode 100644 chalk/data/images/Azay-Le-Rideau.jpg
 create mode 100644 chalk/data/images/Makefile.am
 create mode 100644 chalk/data/images/WeyDesc.png
 create mode 100644 chalk/data/images/evenings.jpg
 create mode 100644 chalk/data/images/hakonepa.jpg
 create mode 100644 chalk/data/images/hiro_awate.jpg
 create mode 100644 chalk/data/images/paintbrush.png
 create mode 100644 chalk/data/images/previewfilter.png
 create mode 100644 chalk/data/palettes/40_Colors.gpl
 create mode 100644 chalk/data/palettes/Anchor.gpl
 create mode 100644 chalk/data/palettes/Bears.gpl
 create mode 100644 chalk/data/palettes/Bgold.gpl
 create mode 100644 chalk/data/palettes/Blues.gpl
 create mode 100644 chalk/data/palettes/Borders.gpl
 create mode 100644 chalk/data/palettes/Browns_And_Yellows.gpl
 create mode 100644 chalk/data/palettes/Caramel.gpl
 create mode 100644 chalk/data/palettes/Cascade.gpl
 create mode 100644 chalk/data/palettes/China.gpl
 create mode 100644 chalk/data/palettes/Coldfire.gpl
 create mode 100644 chalk/data/palettes/Cool_Colors.gpl
 create mode 100644 chalk/data/palettes/Cranes.gpl
 create mode 100644 chalk/data/palettes/DMC.gpl
 create mode 100644 chalk/data/palettes/Dark_pastels.gpl
 create mode 100644 chalk/data/palettes/Default.gpl
 create mode 100644 chalk/data/palettes/Ega.gpl
 create mode 100644 chalk/data/palettes/Firecode.gpl
 create mode 100644 chalk/data/palettes/Gold.gpl
 create mode 100644 chalk/data/palettes/GrayViolet.gpl
 create mode 100644 chalk/data/palettes/Grayblue.gpl
 create mode 100644 chalk/data/palettes/Grays.gpl
 create mode 100644 chalk/data/palettes/Greens.gpl
 create mode 100644 chalk/data/palettes/Hilite.gpl
 create mode 100644 chalk/data/palettes/Khaki.gpl
 create mode 100644 chalk/data/palettes/Lights.gpl
 create mode 100644 chalk/data/palettes/Madeira.gpl
 create mode 100644 chalk/data/palettes/Makefile.am
 create mode 100644 chalk/data/palettes/Muted.gpl
 create mode 100644 chalk/data/palettes/Named_Colors.gpl
 create mode 100644 chalk/data/palettes/News3.gpl
 create mode 100644 chalk/data/palettes/Op2.gpl
 create mode 100644 chalk/data/palettes/Paintjet.gpl
 create mode 100644 chalk/data/palettes/Pantone_Coated_Approx.gpl
 create mode 100644 chalk/data/palettes/Pastels.gpl
 create mode 100644 chalk/data/palettes/Plasma.gpl
 create mode 100644 chalk/data/palettes/Reds.gpl
 create mode 100644 chalk/data/palettes/Reds_And_Purples.gpl
 create mode 100644 chalk/data/palettes/Royal.gpl
 create mode 100644 chalk/data/palettes/Topographic.gpl
 create mode 100644 chalk/data/palettes/Visibone.gpl
 create mode 100644 chalk/data/palettes/Visibone_2.gpl
 create mode 100644 chalk/data/palettes/Volcano.gpl
 create mode 100644 chalk/data/palettes/Warm_Colors.gpl
 create mode 100644 chalk/data/palettes/Web.gpl
 create mode 100644 chalk/data/palettes/new_kde.gpl
 create mode 100644 chalk/data/patterns/3dgreen.pat
 create mode 100644 chalk/data/patterns/Craters.pat
 create mode 100644 chalk/data/patterns/Makefile.am
 create mode 100644 chalk/data/patterns/Moonfoot.pat
 create mode 100644 chalk/data/patterns/Stripes1px.pat
 create mode 100644 chalk/data/patterns/Stripes2px.pat
 create mode 100644 chalk/data/patterns/amethyst.pat
 create mode 100644 chalk/data/patterns/bark.pat
 create mode 100644 chalk/data/patterns/blue.pat
 create mode 100644 chalk/data/patterns/bluegrid.pat
 create mode 100644 chalk/data/patterns/bluesquares.pat
 create mode 100644 chalk/data/patterns/blueweb.pat
 create mode 100644 chalk/data/patterns/brick.pat
 create mode 100644 chalk/data/patterns/burlap.pat
 create mode 100644 chalk/data/patterns/burlwood.pat
 create mode 100644 chalk/data/patterns/choc_swirl.pat
 create mode 100644 chalk/data/patterns/corkboard.pat
 create mode 100644 chalk/data/patterns/cracked.pat
 create mode 100644 chalk/data/patterns/crinklepaper.pat
 create mode 100644 chalk/data/patterns/electric.pat
 create mode 100644 chalk/data/patterns/fibers.pat
 create mode 100644 chalk/data/patterns/granite1.pat
 create mode 100644 chalk/data/patterns/ground1.pat
 create mode 100644 chalk/data/patterns/ice.pat
 create mode 100644 chalk/data/patterns/java.pat
 create mode 100644 chalk/data/patterns/leather.pat
 create mode 100644 chalk/data/patterns/leaves.pat
 create mode 100644 chalk/data/patterns/leopard.pat
 create mode 100644 chalk/data/patterns/lightning.pat
 create mode 100644 chalk/data/patterns/marble1.pat
 create mode 100644 chalk/data/patterns/marble2.pat
 create mode 100644 chalk/data/patterns/marble3.pat
 create mode 100644 chalk/data/patterns/nops.pat
 create mode 100644 chalk/data/patterns/paper.pat
 create mode 100644 chalk/data/patterns/parque1.pat
 create mode 100644 chalk/data/patterns/parque2.pat
 create mode 100644 chalk/data/patterns/parque3.pat
 create mode 100644 chalk/data/patterns/pastel.pat
 create mode 100644 chalk/data/patterns/pine.pat
 create mode 100644 chalk/data/patterns/pink_marble.pat
 create mode 100644 chalk/data/patterns/pool.pat
 create mode 100644 chalk/data/patterns/qube1.pat
 create mode 100644 chalk/data/patterns/rain.pat
 create mode 100644 chalk/data/patterns/recessed.pat
 create mode 100644 chalk/data/patterns/redcube.pat
 create mode 100644 chalk/data/patterns/rock.pat
 create mode 100644 chalk/data/patterns/sky.pat
 create mode 100644 chalk/data/patterns/slate.pat
 create mode 100644 chalk/data/patterns/sm_squares.pat
 create mode 100644 chalk/data/patterns/starfield.pat
 create mode 100644 chalk/data/patterns/stone33.pat
 create mode 100644 chalk/data/patterns/terra.pat
 create mode 100644 chalk/data/patterns/walnut.pat
 create mode 100644 chalk/data/patterns/warning.pat
 create mode 100644 chalk/data/patterns/wood1.pat
 create mode 100644 chalk/data/patterns/wood2.pat
 create mode 100644 chalk/data/patterns/wood3.pat
 create mode 100644 chalk/data/patterns/wood4.pat
 create mode 100644 chalk/data/patterns/wood5.pat
 create mode 100644 chalk/data/profiles/Adobe.icm
 create mode 100644 chalk/data/profiles/Apple.icm
 create mode 100644 chalk/data/profiles/CIE.icm
 create mode 100644 chalk/data/profiles/CMY.icm
 create mode 100644 chalk/data/profiles/ColorMatch.icm
 create mode 100644 chalk/data/profiles/Makefile.am
 create mode 100644 chalk/data/profiles/NTSC.icm
 create mode 100644 chalk/data/profiles/PAL.icm
 create mode 100644 chalk/data/profiles/README
 create mode 100644 chalk/data/profiles/SMPTE-C.icm
 create mode 100644 chalk/data/profiles/WideGamut.icm
 create mode 100644 chalk/data/profiles/cmyk.icm
 create mode 100644 chalk/data/profiles/fogra27l.icm
 create mode 100644 chalk/data/profiles/lcmslabi.icm
 create mode 100644 chalk/data/profiles/lcmsxyzi.icm
 create mode 100644 chalk/data/profiles/monoscnr.icm
 create mode 100644 chalk/data/profiles/sRGB.icm
 create mode 100644 chalk/data/profiles/srgb_color_space_profile.icm
 create mode 100644 chalk/data/profiles/srgbspac.icm
 create mode 100644 chalk/data/profiles/tifflab8spac.icm
 create mode 100644 chalk/data/profiles/ycc601.icm
 create mode 100644 chalk/data/profiles/ycc709.icm
 create mode 100644 chalk/data/templates/.directory
 create mode 100644 chalk/design.h
 create mode 100644 chalk/doc/DESIGN.obsolete
 create mode 100644 chalk/doc/Developing Chalk Plugins.odt
 create mode 100644 chalk/doc/autoextending paintdevices
 create mode 100644 chalk/doc/background_paper.txt
 create mode 100644 chalk/doc/brush.txt
 create mode 100644 chalk/doc/chalk-features
 create mode 100644 chalk/doc/chalk.kpr
 create mode 100644 chalk/doc/chalk.pdf
 create mode 100644 chalk/doc/chalk.xmi
 create mode 100644 chalk/doc/channels_masks_selections
 create mode 100644 chalk/doc/colordiff
 create mode 100644 chalk/doc/colorspaces.xmi
 create mode 100644 chalk/doc/colorstrategyAPI
 create mode 100644 chalk/doc/controller.xmi
 create mode 100644 chalk/doc/coordinates.txt
 create mode 100644 chalk/doc/dirty.txt
 create mode 100644 chalk/doc/doc-outline
 create mode 100644 chalk/doc/histograms.xmi
 create mode 100644 chalk/doc/hooks
 create mode 100644 chalk/doc/howtofilters.txt
 create mode 100644 chalk/doc/impexp.txt
 create mode 100644 chalk/doc/large_files
 create mode 100644 chalk/doc/layersupdatesignals.flw
 create mode 100644 chalk/doc/manual/chalk.kwd
 create mode 100644 chalk/doc/oasis
 create mode 100644 chalk/doc/paint_device.txt
 create mode 100644 chalk/doc/palettedesign.txt
 create mode 100644 chalk/doc/plugins.txt
 create mode 100644 chalk/doc/profiles.txt
 create mode 100644 chalk/doc/resolution.txt
 create mode 100644 chalk/doc/scripts/dcop.py
 create mode 100644 chalk/doc/sdk
 create mode 100644 chalk/doc/selections
 create mode 100644 chalk/doc/the preview widget
 create mode 100644 chalk/doc/transform_undo.txt
 create mode 100644 chalk/dtd/Makefile.am
 create mode 100644 chalk/dtd/chalk.dtd
 create mode 100755 chalk/extracti18n.pl
 create mode 100644 chalk/main.cc
 create mode 100644 chalk/pics/Makefile.am
 create mode 100644 chalk/pics/chalk.svg
 create mode 100644 chalk/pics/deletelayer.png
 create mode 100644 chalk/pics/height.png
 create mode 100644 chalk/pics/hi128-app-chalk.png
 create mode 100644 chalk/pics/hi16-app-chalk.png
 create mode 100644 chalk/pics/hi22-app-chalk.png
 create mode 100644 chalk/pics/hi32-app-chalk.png
 create mode 100644 chalk/pics/hi48-app-chalk.png
 create mode 100644 chalk/pics/hi64-app-chalk.png
 create mode 100644 chalk/pics/linked.png
 create mode 100644 chalk/pics/locked.png
 create mode 100644 chalk/pics/lowerlayer.png
 create mode 100644 chalk/pics/newlayer.png
 create mode 100644 chalk/pics/novisible.png
 create mode 100644 chalk/pics/raiselayer.png
 create mode 100644 chalk/pics/shade.png
 create mode 100644 chalk/pics/tablet.png
 create mode 100644 chalk/pics/tool_screenshot.png
 create mode 100644 chalk/pics/unlinked.png
 create mode 100644 chalk/pics/unlocked.png
 create mode 100644 chalk/pics/visible.png
 create mode 100644 chalk/pics/width.png
 create mode 100644 chalk/plugins/Makefile.am
 create mode 100644 chalk/plugins/README
 create mode 100644 chalk/plugins/configure.in.in
 create mode 100644 chalk/plugins/filters/Makefile.am
 create mode 100644 chalk/plugins/filters/blur/Makefile.am
 create mode 100644 chalk/plugins/filters/blur/blur.cc
 create mode 100644 chalk/plugins/filters/blur/blur.h
 create mode 100644 chalk/plugins/filters/blur/chalkblurfilter.desktop
 create mode 100644 chalk/plugins/filters/blur/kis_blur_filter.cc
 create mode 100644 chalk/plugins/filters/blur/kis_blur_filter.h
 create mode 100644 chalk/plugins/filters/blur/kis_wdg_blur.cc
 create mode 100644 chalk/plugins/filters/blur/kis_wdg_blur.h
 create mode 100644 chalk/plugins/filters/blur/wdgblur.ui
 create mode 100644 chalk/plugins/filters/bumpmap/Makefile.am
 create mode 100644 chalk/plugins/filters/bumpmap/bumpmap.cc
 create mode 100644 chalk/plugins/filters/bumpmap/bumpmap.h
 create mode 100644 chalk/plugins/filters/bumpmap/chalkbumpmapfilter.desktop
 create mode 100644 chalk/plugins/filters/bumpmap/wdgbumpmap.ui
 create mode 100644 chalk/plugins/filters/cimg/.kdev_ignore
 create mode 100644 chalk/plugins/filters/cimg/CImg.h
 create mode 100644 chalk/plugins/filters/cimg/Makefile.am
 create mode 100644 chalk/plugins/filters/cimg/chalkcimg.desktop
 create mode 100644 chalk/plugins/filters/cimg/kis_cimg_filter.cc
 create mode 100644 chalk/plugins/filters/cimg/kis_cimg_filter.h
 create mode 100644 chalk/plugins/filters/cimg/kis_cimg_plugin.cc
 create mode 100644 chalk/plugins/filters/cimg/kis_cimg_plugin.h
 create mode 100644 chalk/plugins/filters/cimg/kis_cimgconfig_widget.cc
 create mode 100644 chalk/plugins/filters/cimg/kis_cimgconfig_widget.h
 create mode 100644 chalk/plugins/filters/cimg/wdg_cimg.ui
 create mode 100644 chalk/plugins/filters/colorify/Colorify.cpp
 create mode 100644 chalk/plugins/filters/colorify/Colorify.h
 create mode 100644 chalk/plugins/filters/colorify/KisWdgColorify.cpp
 create mode 100644 chalk/plugins/filters/colorify/KisWdgColorify.h
 create mode 100644 chalk/plugins/filters/colorify/Makefile.am
 create mode 100644 chalk/plugins/filters/colorify/WdgColorifyBase.ui
 create mode 100644 chalk/plugins/filters/colorify/chalkcolorifyfilter.desktop
 create mode 100644 chalk/plugins/filters/colors/Makefile.am
 create mode 100644 chalk/plugins/filters/colors/chalkextensioncolorsfilters.desktop
 create mode 100644 chalk/plugins/filters/colors/colors.cc
 create mode 100644 chalk/plugins/filters/colors/colors.h
 create mode 100644 chalk/plugins/filters/colors/kis_color_to_alpha.cc
 create mode 100644 chalk/plugins/filters/colors/kis_color_to_alpha.h
 create mode 100644 chalk/plugins/filters/colors/kis_minmax_filters.cc
 create mode 100644 chalk/plugins/filters/colors/kis_minmax_filters.h
 create mode 100644 chalk/plugins/filters/colors/kis_wdg_color_to_alpha.cc
 create mode 100644 chalk/plugins/filters/colors/kis_wdg_color_to_alpha.h
 create mode 100644 chalk/plugins/filters/colors/wdgcolortoalphabase.ui
 create mode 100644 chalk/plugins/filters/colorsfilters/Makefile.am
 create mode 100644 chalk/plugins/filters/colorsfilters/chalkcolorsfilter.desktop
 create mode 100644 chalk/plugins/filters/colorsfilters/colorsfilters.cc
 create mode 100644 chalk/plugins/filters/colorsfilters/colorsfilters.h
 create mode 100644 chalk/plugins/filters/colorsfilters/kis_brightness_contrast_filter.cc
 create mode 100644 chalk/plugins/filters/colorsfilters/kis_brightness_contrast_filter.h
 create mode 100644 chalk/plugins/filters/colorsfilters/kis_perchannel_filter.cc
 create mode 100644 chalk/plugins/filters/colorsfilters/kis_perchannel_filter.h
 create mode 100644 chalk/plugins/filters/colorsfilters/wdg_brightness_contrast.ui
 create mode 100644 chalk/plugins/filters/colorsfilters/wdg_perchannel.ui
 create mode 100644 chalk/plugins/filters/convolutionfilters/Makefile.am
 create mode 100644 chalk/plugins/filters/convolutionfilters/chalkconvolutionfilters.desktop
 create mode 100644 chalk/plugins/filters/convolutionfilters/convolutionfilters.cc
 create mode 100644 chalk/plugins/filters/convolutionfilters/convolutionfilters.h
 create mode 100644 chalk/plugins/filters/convolutionfilters/kis_convolution_filter.cc
 create mode 100644 chalk/plugins/filters/convolutionfilters/kis_convolution_filter.h
 create mode 100644 chalk/plugins/filters/convolutionfilters/kis_custom_convolution_filter.cc
 create mode 100644 chalk/plugins/filters/convolutionfilters/kis_custom_convolution_filter.h
 create mode 100644 chalk/plugins/filters/convolutionfilters/kis_custom_convolution_filter_configuration_base_widget.ui
 create mode 100644 chalk/plugins/filters/convolutionfilters/kis_custom_convolution_filter_configuration_widget.cc
 create mode 100644 chalk/plugins/filters/convolutionfilters/kis_custom_convolution_filter_configuration_widget.h
 create mode 100644 chalk/plugins/filters/cubismfilter/Makefile.am
 create mode 100644 chalk/plugins/filters/cubismfilter/chalkcubismfilter.desktop
 create mode 100644 chalk/plugins/filters/cubismfilter/kis_cubism_filter.cc
 create mode 100644 chalk/plugins/filters/cubismfilter/kis_cubism_filter.h
 create mode 100644 chalk/plugins/filters/cubismfilter/kis_cubism_filter_plugin.cc
 create mode 100644 chalk/plugins/filters/cubismfilter/kis_cubism_filter_plugin.h
 create mode 100644 chalk/plugins/filters/cubismfilter/kis_polygon.cc
 create mode 100644 chalk/plugins/filters/cubismfilter/kis_polygon.h
 create mode 100644 chalk/plugins/filters/embossfilter/Makefile.am
 create mode 100644 chalk/plugins/filters/embossfilter/chalkembossfilter.desktop
 create mode 100644 chalk/plugins/filters/embossfilter/kis_emboss_filter.cc
 create mode 100644 chalk/plugins/filters/embossfilter/kis_emboss_filter.h
 create mode 100644 chalk/plugins/filters/embossfilter/kis_emboss_filter_plugin.cc
 create mode 100644 chalk/plugins/filters/embossfilter/kis_emboss_filter_plugin.h
 create mode 100644 chalk/plugins/filters/example/Makefile.am
 create mode 100644 chalk/plugins/filters/example/chalkexample.desktop
 create mode 100644 chalk/plugins/filters/example/example.cc
 create mode 100644 chalk/plugins/filters/example/example.h
 create mode 100644 chalk/plugins/filters/fastcolortransfer/Makefile.am
 create mode 100644 chalk/plugins/filters/fastcolortransfer/chalkfastcolortransfer.desktop
 create mode 100644 chalk/plugins/filters/fastcolortransfer/fastcolortransfer.cc
 create mode 100644 chalk/plugins/filters/fastcolortransfer/fastcolortransfer.h
 create mode 100644 chalk/plugins/filters/fastcolortransfer/kis_wdg_fastcolortransfer.cpp
 create mode 100644 chalk/plugins/filters/fastcolortransfer/kis_wdg_fastcolortransfer.h
 create mode 100644 chalk/plugins/filters/fastcolortransfer/wdgfastcolortransfer.ui
 create mode 100644 chalk/plugins/filters/halftone/kis_halftone.cpp
 create mode 100644 chalk/plugins/filters/halftone/kis_halftone.h
 create mode 100644 chalk/plugins/filters/imageenhancement/Makefile.am
 create mode 100644 chalk/plugins/filters/imageenhancement/chalkimageenhancement.desktop
 create mode 100644 chalk/plugins/filters/imageenhancement/imageenhancement.cpp
 create mode 100644 chalk/plugins/filters/imageenhancement/imageenhancement.h
 create mode 100644 chalk/plugins/filters/imageenhancement/kis_simple_noise_reducer.cpp
 create mode 100644 chalk/plugins/filters/imageenhancement/kis_simple_noise_reducer.h
 create mode 100644 chalk/plugins/filters/imageenhancement/kis_wavelet_noise_reduction.cpp
 create mode 100644 chalk/plugins/filters/imageenhancement/kis_wavelet_noise_reduction.h
 create mode 100644 chalk/plugins/filters/lenscorrectionfilter/Makefile.am
 create mode 100644 chalk/plugins/filters/lenscorrectionfilter/chalklenscorrectionfilter.desktop
 create mode 100644 chalk/plugins/filters/lenscorrectionfilter/kis_wdg_lens_correction.cpp
 create mode 100644 chalk/plugins/filters/lenscorrectionfilter/kis_wdg_lens_correction.h
 create mode 100644 chalk/plugins/filters/lenscorrectionfilter/lenscorrectionfilter.cc
 create mode 100644 chalk/plugins/filters/lenscorrectionfilter/lenscorrectionfilter.h
 create mode 100644 chalk/plugins/filters/lenscorrectionfilter/wdglenscorrectionoptions.ui
 create mode 100644 chalk/plugins/filters/levelfilter/Makefile.am
 create mode 100644 chalk/plugins/filters/levelfilter/chalklevelfilter.desktop
 create mode 100644 chalk/plugins/filters/levelfilter/kgradientslider.cc
 create mode 100644 chalk/plugins/filters/levelfilter/kgradientslider.h
 create mode 100644 chalk/plugins/filters/levelfilter/kis_level_filter.cc
 create mode 100644 chalk/plugins/filters/levelfilter/kis_level_filter.h
 create mode 100644 chalk/plugins/filters/levelfilter/levelfilter.cc
 create mode 100644 chalk/plugins/filters/levelfilter/levelfilter.h
 create mode 100644 chalk/plugins/filters/levelfilter/wdg_level.ui
 create mode 100644 chalk/plugins/filters/noisefilter/Makefile.am
 create mode 100644 chalk/plugins/filters/noisefilter/chalknoisefilter.desktop
 create mode 100644 chalk/plugins/filters/noisefilter/kis_wdg_noise.cpp
 create mode 100644 chalk/plugins/filters/noisefilter/kis_wdg_noise.h
 create mode 100644 chalk/plugins/filters/noisefilter/noisefilter.cc
 create mode 100644 chalk/plugins/filters/noisefilter/noisefilter.h
 create mode 100644 chalk/plugins/filters/noisefilter/wdgnoiseoptions.ui
 create mode 100644 chalk/plugins/filters/oilpaintfilter/Makefile.am
 create mode 100644 chalk/plugins/filters/oilpaintfilter/chalkoilpaintfilter.desktop
 create mode 100644 chalk/plugins/filters/oilpaintfilter/kis_oilpaint_filter.cc
 create mode 100644 chalk/plugins/filters/oilpaintfilter/kis_oilpaint_filter.h
 create mode 100644 chalk/plugins/filters/oilpaintfilter/kis_oilpaint_filter_plugin.cc
 create mode 100644 chalk/plugins/filters/oilpaintfilter/kis_oilpaint_filter_plugin.h
 create mode 100644 chalk/plugins/filters/pixelizefilter/Makefile.am
 create mode 100644 chalk/plugins/filters/pixelizefilter/chalkpixelizefilter.desktop
 create mode 100644 chalk/plugins/filters/pixelizefilter/kis_pixelize_filter.cc
 create mode 100644 chalk/plugins/filters/pixelizefilter/kis_pixelize_filter.h
 create mode 100644 chalk/plugins/filters/pixelizefilter/kis_pixelize_filter_plugin.cc
 create mode 100644 chalk/plugins/filters/pixelizefilter/kis_pixelize_filter_plugin.h
 create mode 100644 chalk/plugins/filters/raindropsfilter/Makefile.am
 create mode 100644 chalk/plugins/filters/raindropsfilter/chalkraindropsfilter.desktop
 create mode 100644 chalk/plugins/filters/raindropsfilter/kis_raindrops_filter.cc
 create mode 100644 chalk/plugins/filters/raindropsfilter/kis_raindrops_filter.h
 create mode 100644 chalk/plugins/filters/raindropsfilter/kis_raindrops_filter_plugin.cc
 create mode 100644 chalk/plugins/filters/raindropsfilter/kis_raindrops_filter_plugin.h
 create mode 100644 chalk/plugins/filters/randompickfilter/Makefile.am
 create mode 100644 chalk/plugins/filters/randompickfilter/chalkrandompickfilter.desktop
 create mode 100644 chalk/plugins/filters/randompickfilter/kis_wdg_random_pick.cpp
 create mode 100644 chalk/plugins/filters/randompickfilter/kis_wdg_random_pick.h
 create mode 100644 chalk/plugins/filters/randompickfilter/randompickfilter.cc
 create mode 100644 chalk/plugins/filters/randompickfilter/randompickfilter.h
 create mode 100644 chalk/plugins/filters/randompickfilter/wdgrandompickoptions.ui
 create mode 100644 chalk/plugins/filters/roundcorners/Makefile.am
 create mode 100644 chalk/plugins/filters/roundcorners/chalkroundcornersfilter.desktop
 create mode 100644 chalk/plugins/filters/roundcorners/kis_round_corners_filter.cc
 create mode 100644 chalk/plugins/filters/roundcorners/kis_round_corners_filter.h
 create mode 100644 chalk/plugins/filters/roundcorners/kis_round_corners_filter_plugin.cc
 create mode 100644 chalk/plugins/filters/roundcorners/kis_round_corners_filter_plugin.h
 create mode 100644 chalk/plugins/filters/smalltilesfilter/Makefile.am
 create mode 100644 chalk/plugins/filters/smalltilesfilter/chalksmalltilesfilter.desktop
 create mode 100644 chalk/plugins/filters/smalltilesfilter/kis_small_tiles_filter.cc
 create mode 100644 chalk/plugins/filters/smalltilesfilter/kis_small_tiles_filter.h
 create mode 100644 chalk/plugins/filters/smalltilesfilter/kis_small_tiles_filter_plugin.cc
 create mode 100644 chalk/plugins/filters/smalltilesfilter/kis_small_tiles_filter_plugin.h
 create mode 100644 chalk/plugins/filters/sobelfilter/Makefile.am
 create mode 100644 chalk/plugins/filters/sobelfilter/chalksobelfilter.desktop
 create mode 100644 chalk/plugins/filters/sobelfilter/kis_sobel_filter.cc
 create mode 100644 chalk/plugins/filters/sobelfilter/kis_sobel_filter.h
 create mode 100644 chalk/plugins/filters/sobelfilter/kis_sobel_filter_plugin.cc
 create mode 100644 chalk/plugins/filters/sobelfilter/kis_sobel_filter_plugin.h
 create mode 100644 chalk/plugins/filters/threadtest/Makefile.am
 create mode 100644 chalk/plugins/filters/threadtest/chalkthreadtest.desktop
 create mode 100644 chalk/plugins/filters/threadtest/threadtest.cc
 create mode 100644 chalk/plugins/filters/threadtest/threadtest.h
 create mode 100644 chalk/plugins/filters/unsharp/Makefile.am
 create mode 100644 chalk/plugins/filters/unsharp/chalkunsharpfilter.desktop
 create mode 100644 chalk/plugins/filters/unsharp/kis_unsharp_filter.cc
 create mode 100644 chalk/plugins/filters/unsharp/kis_unsharp_filter.h
 create mode 100644 chalk/plugins/filters/unsharp/kis_wdg_unsharp.cc
 create mode 100644 chalk/plugins/filters/unsharp/kis_wdg_unsharp.h
 create mode 100644 chalk/plugins/filters/unsharp/unsharp.cc
 create mode 100644 chalk/plugins/filters/unsharp/unsharp.h
 create mode 100644 chalk/plugins/filters/unsharp/wdgunsharp.ui
 create mode 100644 chalk/plugins/filters/wavefilter/Makefile.am
 create mode 100644 chalk/plugins/filters/wavefilter/chalkwavefilter.desktop
 create mode 100644 chalk/plugins/filters/wavefilter/kis_wdg_wave.cpp
 create mode 100644 chalk/plugins/filters/wavefilter/kis_wdg_wave.h
 create mode 100644 chalk/plugins/filters/wavefilter/wavefilter.cc
 create mode 100644 chalk/plugins/filters/wavefilter/wavefilter.h
 create mode 100644 chalk/plugins/filters/wavefilter/wdgwaveoptions.ui
 create mode 100644 chalk/plugins/paintops/Makefile.am
 create mode 100644 chalk/plugins/paintops/defaultpaintops/Makefile.am
 create mode 100644 chalk/plugins/paintops/defaultpaintops/README
 create mode 100644 chalk/plugins/paintops/defaultpaintops/airbrush.png
 create mode 100644 chalk/plugins/paintops/defaultpaintops/chalkdefaultpaintops.desktop
 create mode 100644 chalk/plugins/paintops/defaultpaintops/defaultpaintops_plugin.cc
 create mode 100644 chalk/plugins/paintops/defaultpaintops/defaultpaintops_plugin.h
 create mode 100644 chalk/plugins/paintops/defaultpaintops/eraser.png
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_airbrushop.cc
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_airbrushop.h
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_brushop.cc
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_brushop.h
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_convolveop.cc
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_convolveop.h
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_dlgbrushcurvecontrol.ui
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_duplicateop.cc
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_duplicateop.h
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_eraseop.cc
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_eraseop.h
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_penop.cc
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_penop.h
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_smudgeop.cc
 create mode 100644 chalk/plugins/paintops/defaultpaintops/kis_smudgeop.h
 create mode 100644 chalk/plugins/paintops/defaultpaintops/paintbrush.png
 create mode 100644 chalk/plugins/paintops/defaultpaintops/pencil.png
 create mode 100644 chalk/plugins/paintops/defaultpaintops/src/README
 create mode 100644 chalk/plugins/paintops/defaultpaintops/src/pencil_01.svg
 create mode 100644 chalk/plugins/paintops/defaultpaintops/src/pencil_jonathan_dietrich_01.svg
 create mode 100644 chalk/plugins/paintops/defaultpaintops/src/pennello_mauro_olivo_01.svg
 create mode 100644 chalk/plugins/tools/Makefile.am
 create mode 100644 chalk/plugins/tools/defaulttools/Makefile.am
 create mode 100644 chalk/plugins/tools/defaulttools/chalkdefaulttools.desktop
 create mode 100644 chalk/plugins/tools/defaulttools/closedhand_cursor.xpm
 create mode 100644 chalk/plugins/tools/defaulttools/default_tools.cc
 create mode 100644 chalk/plugins/tools/defaulttools/default_tools.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_brush.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_brush.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_colorpicker.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_colorpicker.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_duplicate.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_duplicate.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_ellipse.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_ellipse.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_fill.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_fill.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_gradient.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_gradient.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_line.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_line.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_move.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_move.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_pan.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_pan.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_rectangle.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_rectangle.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_text.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_text.h
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_zoom.cc
 create mode 100644 chalk/plugins/tools/defaulttools/kis_tool_zoom.h
 create mode 100644 chalk/plugins/tools/defaulttools/openhand_cursor.xpm
 create mode 100644 chalk/plugins/tools/defaulttools/tool_color_fill.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_colorpicker.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_duplicate.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_duplicate_cursor.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_ellipse.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_ellipse_cursor.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_fill_cursor.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_freehand.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_freehand_cursor.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_gradient.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_gradient_cursor.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_line.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_line_cursor.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_move.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_pan.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_rectangle.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_rectangle_cursor.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_text.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_text_cursor.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_zoom.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_zoom_minus_cursor.png
 create mode 100644 chalk/plugins/tools/defaulttools/tool_zoom_plus_cursor.png
 create mode 100644 chalk/plugins/tools/defaulttools/wdgcolorpicker.ui
 create mode 100644 chalk/plugins/tools/selectiontools/Makefile.am
 create mode 100644 chalk/plugins/tools/selectiontools/chalkselectiontools.desktop
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_move_selection.cc
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_move_selection.h
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_brush.cc
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_brush.h
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_contiguous.cc
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_contiguous.h
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_elliptical.cc
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_elliptical.h
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_eraser.cc
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_eraser.h
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_outline.cc
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_outline.h
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_polygonal.cc
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_polygonal.h
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_rectangular.cc
 create mode 100644 chalk/plugins/tools/selectiontools/kis_tool_select_rectangular.h
 create mode 100644 chalk/plugins/tools/selectiontools/selection_tools.cc
 create mode 100644 chalk/plugins/tools/selectiontools/selection_tools.h
 create mode 100644 chalk/plugins/tools/selectiontools/tool_brush_selection.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_brush_selection.svg
 create mode 100644 chalk/plugins/tools/selectiontools/tool_brush_selection_cursor.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_contiguous_selection.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_contiguous_selection_cursor.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_elliptical_selection.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_elliptical_selection.svg
 create mode 100644 chalk/plugins/tools/selectiontools/tool_elliptical_selection_cursor.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_eraser_selection.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_eraser_selection.svg
 create mode 100644 chalk/plugins/tools/selectiontools/tool_eraser_selection_cursor.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_outline_selection.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_outline_selection.svg
 create mode 100644 chalk/plugins/tools/selectiontools/tool_outline_selection_cursor.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_polygonal_selection.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_polygonal_selection.svg
 create mode 100644 chalk/plugins/tools/selectiontools/tool_polygonal_selection_cursor.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_rect_selection.png
 create mode 100644 chalk/plugins/tools/selectiontools/tool_rect_selection.svg
 create mode 100644 chalk/plugins/tools/selectiontools/tool_rectangular_selection_cursor.png
 create mode 100644 chalk/plugins/tools/tool_crop/Makefile.am
 create mode 100644 chalk/plugins/tools/tool_crop/chalktoolcrop.desktop
 create mode 100644 chalk/plugins/tools/tool_crop/kis_tool_crop.cc
 create mode 100644 chalk/plugins/tools/tool_crop/kis_tool_crop.h
 create mode 100644 chalk/plugins/tools/tool_crop/tool_crop.cc
 create mode 100644 chalk/plugins/tools/tool_crop/tool_crop.h
 create mode 100644 chalk/plugins/tools/tool_crop/tool_crop.png
 create mode 100644 chalk/plugins/tools/tool_crop/tool_crop_cursor.png
 create mode 100644 chalk/plugins/tools/tool_crop/wdg_tool_crop.ui
 create mode 100644 chalk/plugins/tools/tool_curves/Makefile.am
 create mode 100644 chalk/plugins/tools/tool_curves/chalktoolcurves.desktop
 create mode 100644 chalk/plugins/tools/tool_curves/kis_curve_framework.cc
 create mode 100644 chalk/plugins/tools/tool_curves/kis_curve_framework.h
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_bezier.cc
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_bezier.h
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_bezier_paint.cc
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_bezier_paint.h
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_bezier_select.cc
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_bezier_select.h
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_curve.cc
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_curve.h
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_example.cc
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_example.h
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_moutline.cc
 create mode 100644 chalk/plugins/tools/tool_curves/kis_tool_moutline.h
 create mode 100644 chalk/plugins/tools/tool_curves/tool_bezier_cursor.png
 create mode 100644 chalk/plugins/tools/tool_curves/tool_bezier_paint.png
 create mode 100644 chalk/plugins/tools/tool_curves/tool_bezier_select.png
 create mode 100644 chalk/plugins/tools/tool_curves/tool_curve_dragging.png
 create mode 100644 chalk/plugins/tools/tool_curves/tool_curves.cc
 create mode 100644 chalk/plugins/tools/tool_curves/tool_curves.h
 create mode 100644 chalk/plugins/tools/tool_curves/tool_example.png
 create mode 100644 chalk/plugins/tools/tool_curves/tool_example_cursor.png
 create mode 100644 chalk/plugins/tools/tool_curves/tool_moutline.png
 create mode 100644 chalk/plugins/tools/tool_curves/tool_moutline_cursor.png
 create mode 100644 chalk/plugins/tools/tool_curves/tool_moutline_editing.png
 create mode 100644 chalk/plugins/tools/tool_curves/wdg_tool_example.ui
 create mode 100644 chalk/plugins/tools/tool_filter/Makefile.am
 create mode 100644 chalk/plugins/tools/tool_filter/chalktoolfilter.desktop
 create mode 100644 chalk/plugins/tools/tool_filter/kis_filterop.cc
 create mode 100644 chalk/plugins/tools/tool_filter/kis_filterop.h
 create mode 100644 chalk/plugins/tools/tool_filter/kis_tool_filter.cc
 create mode 100644 chalk/plugins/tools/tool_filter/kis_tool_filter.h
 create mode 100644 chalk/plugins/tools/tool_filter/tool_filter.cc
 create mode 100644 chalk/plugins/tools/tool_filter/tool_filter.h
 create mode 100644 chalk/plugins/tools/tool_filter/tool_filter.png
 create mode 100644 chalk/plugins/tools/tool_filter/tool_filter.svg
 create mode 100644 chalk/plugins/tools/tool_filter/tool_filter_cursor.png
 create mode 100644 chalk/plugins/tools/tool_perspectivegrid/Makefile.am
 create mode 100644 chalk/plugins/tools/tool_perspectivegrid/chalktoolperspectivegrid.desktop
 create mode 100644 chalk/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc
 create mode 100644 chalk/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.h
 create mode 100644 chalk/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.cc
 create mode 100644 chalk/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.h
 create mode 100644 chalk/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.png
 create mode 100644 chalk/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.svg
 create mode 100644 chalk/plugins/tools/tool_perspectivetransform/Makefile.am
 create mode 100644 chalk/plugins/tools/tool_perspectivetransform/chalktoolperspectivetransform.desktop
 create mode 100644 chalk/plugins/tools/tool_perspectivetransform/kis_tool_perspectivetransform.cc
 create mode 100644 chalk/plugins/tools/tool_perspectivetransform/kis_tool_perspectivetransform.h
 create mode 100644 chalk/plugins/tools/tool_perspectivetransform/tool_perspectivetransform.cc
 create mode 100644 chalk/plugins/tools/tool_perspectivetransform/tool_perspectivetransform.h
 create mode 100644 chalk/plugins/tools/tool_perspectivetransform/tool_perspectivetransform.png
 create mode 100644 chalk/plugins/tools/tool_perspectivetransform/tool_perspectivetransform.svg
 create mode 100644 chalk/plugins/tools/tool_polygon/Makefile.am
 create mode 100644 chalk/plugins/tools/tool_polygon/chalktoolpolygon.desktop
 create mode 100644 chalk/plugins/tools/tool_polygon/kis_tool_polygon.cc
 create mode 100644 chalk/plugins/tools/tool_polygon/kis_tool_polygon.h
 create mode 100644 chalk/plugins/tools/tool_polygon/tool_polygon.cc
 create mode 100644 chalk/plugins/tools/tool_polygon/tool_polygon.h
 create mode 100644 chalk/plugins/tools/tool_polygon/tool_polygon.png
 create mode 100644 chalk/plugins/tools/tool_polygon/tool_polygon_cursor.png
 create mode 100644 chalk/plugins/tools/tool_polyline/Makefile.am
 create mode 100644 chalk/plugins/tools/tool_polyline/chalktoolpolyline.desktop
 create mode 100644 chalk/plugins/tools/tool_polyline/kis_tool_polyline.cc
 create mode 100644 chalk/plugins/tools/tool_polyline/kis_tool_polyline.h
 create mode 100644 chalk/plugins/tools/tool_polyline/polyline.png
 create mode 100644 chalk/plugins/tools/tool_polyline/tool_polyline.cc
 create mode 100644 chalk/plugins/tools/tool_polyline/tool_polyline.h
 create mode 100644 chalk/plugins/tools/tool_polyline/tool_polyline_cursor.png
 create mode 100644 chalk/plugins/tools/tool_selectsimilar/Makefile.am
 create mode 100644 chalk/plugins/tools/tool_selectsimilar/chalktoolselectsimilar.desktop
 create mode 100644 chalk/plugins/tools/tool_selectsimilar/kis_tool_selectsimilar.cc
 create mode 100644 chalk/plugins/tools/tool_selectsimilar/kis_tool_selectsimilar.h
 create mode 100644 chalk/plugins/tools/tool_selectsimilar/selectsimilar.cc
 create mode 100644 chalk/plugins/tools/tool_selectsimilar/selectsimilar.h
 create mode 100644 chalk/plugins/tools/tool_selectsimilar/tool_similar_selection.png
 create mode 100644 chalk/plugins/tools/tool_selectsimilar/tool_similar_selection.svg
 create mode 100644 chalk/plugins/tools/tool_selectsimilar/tool_similar_selection_minus_cursor.png
 create mode 100644 chalk/plugins/tools/tool_selectsimilar/tool_similar_selection_plus_cursor.png
 create mode 100644 chalk/plugins/tools/tool_star/Makefile.am
 create mode 100644 chalk/plugins/tools/tool_star/chalktoolstar.desktop
 create mode 100644 chalk/plugins/tools/tool_star/kis_tool_star.cc
 create mode 100644 chalk/plugins/tools/tool_star/kis_tool_star.h
 create mode 100644 chalk/plugins/tools/tool_star/tool_star.cc
 create mode 100644 chalk/plugins/tools/tool_star/tool_star.h
 create mode 100644 chalk/plugins/tools/tool_star/tool_star.png
 create mode 100644 chalk/plugins/tools/tool_star/tool_star_cursor.png
 create mode 100644 chalk/plugins/tools/tool_star/wdg_tool_star.ui
 create mode 100644 chalk/plugins/tools/tool_transform/Makefile.am
 create mode 100644 chalk/plugins/tools/tool_transform/chalktooltransform.desktop
 create mode 100644 chalk/plugins/tools/tool_transform/kis_tool_transform.cc
 create mode 100644 chalk/plugins/tools/tool_transform/kis_tool_transform.h
 create mode 100644 chalk/plugins/tools/tool_transform/rotate_cursor.xpm
 create mode 100644 chalk/plugins/tools/tool_transform/tool_transform.cc
 create mode 100644 chalk/plugins/tools/tool_transform/tool_transform.h
 create mode 100644 chalk/plugins/tools/tool_transform/tool_transform.png
 create mode 100644 chalk/plugins/tools/tool_transform/wdg_tool_transform.ui
 create mode 100644 chalk/plugins/viewplugins/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/colorrange/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/colorrange/chalkcolorrange.desktop
 create mode 100644 chalk/plugins/viewplugins/colorrange/colorrange.cc
 create mode 100644 chalk/plugins/viewplugins/colorrange/colorrange.h
 create mode 100644 chalk/plugins/viewplugins/colorrange/colorrange.rc
 create mode 100644 chalk/plugins/viewplugins/colorrange/dlg_colorrange.cc
 create mode 100644 chalk/plugins/viewplugins/colorrange/dlg_colorrange.h
 create mode 100644 chalk/plugins/viewplugins/colorrange/wdg_colorrange.ui
 create mode 100644 chalk/plugins/viewplugins/colorspaceconversion/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/colorspaceconversion/chalkcolorspaceconversion.desktop
 create mode 100644 chalk/plugins/viewplugins/colorspaceconversion/colorspaceconversion.cc
 create mode 100644 chalk/plugins/viewplugins/colorspaceconversion/colorspaceconversion.h
 create mode 100644 chalk/plugins/viewplugins/colorspaceconversion/colorspaceconversion.rc
 create mode 100644 chalk/plugins/viewplugins/colorspaceconversion/dlg_colorspaceconversion.cc
 create mode 100644 chalk/plugins/viewplugins/colorspaceconversion/dlg_colorspaceconversion.h
 create mode 100644 chalk/plugins/viewplugins/colorspaceconversion/wdgconvertcolorspace.ui
 create mode 100644 chalk/plugins/viewplugins/dropshadow/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/dropshadow/chalkdropshadow.desktop
 create mode 100644 chalk/plugins/viewplugins/dropshadow/dlg_dropshadow.cc
 create mode 100644 chalk/plugins/viewplugins/dropshadow/dlg_dropshadow.h
 create mode 100644 chalk/plugins/viewplugins/dropshadow/dropshadow.rc
 create mode 100644 chalk/plugins/viewplugins/dropshadow/kis_dropshadow.cc
 create mode 100644 chalk/plugins/viewplugins/dropshadow/kis_dropshadow.h
 create mode 100644 chalk/plugins/viewplugins/dropshadow/kis_dropshadow_plugin.cc
 create mode 100644 chalk/plugins/viewplugins/dropshadow/kis_dropshadow_plugin.h
 create mode 100644 chalk/plugins/viewplugins/dropshadow/wdg_dropshadow.ui
 create mode 100644 chalk/plugins/viewplugins/filtersgallery/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/filtersgallery/chalkfiltersgallery.desktop
 create mode 100644 chalk/plugins/viewplugins/filtersgallery/chalkfiltersgallery.rc
 create mode 100644 chalk/plugins/viewplugins/filtersgallery/filters_gallery.cc
 create mode 100644 chalk/plugins/viewplugins/filtersgallery/filters_gallery.h
 create mode 100644 chalk/plugins/viewplugins/filtersgallery/kis_dlg_filtersgallery.cc
 create mode 100644 chalk/plugins/viewplugins/filtersgallery/kis_dlg_filtersgallery.h
 create mode 100644 chalk/plugins/viewplugins/filtersgallery/kis_wdg_filtersgallery.ui
 create mode 100644 chalk/plugins/viewplugins/histogram/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/histogram/chalkhistogram.desktop
 create mode 100644 chalk/plugins/viewplugins/histogram/dlg_histogram.cc
 create mode 100644 chalk/plugins/viewplugins/histogram/dlg_histogram.h
 create mode 100644 chalk/plugins/viewplugins/histogram/histogram.cc
 create mode 100644 chalk/plugins/viewplugins/histogram/histogram.h
 create mode 100644 chalk/plugins/viewplugins/histogram/histogram.rc
 create mode 100644 chalk/plugins/viewplugins/histogram/kis_histogram_widget.cc
 create mode 100644 chalk/plugins/viewplugins/histogram/kis_histogram_widget.h
 create mode 100644 chalk/plugins/viewplugins/histogram/wdghistogram.ui
 create mode 100644 chalk/plugins/viewplugins/histogram_docker/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/histogram_docker/chalkhistogramdocker.desktop
 create mode 100644 chalk/plugins/viewplugins/histogram_docker/chalkhistogramdocker.rc
 create mode 100644 chalk/plugins/viewplugins/histogram_docker/histogramdocker.cc
 create mode 100644 chalk/plugins/viewplugins/histogram_docker/histogramdocker.h
 create mode 100644 chalk/plugins/viewplugins/histogram_docker/kis_accumulating_producer.cc
 create mode 100644 chalk/plugins/viewplugins/histogram_docker/kis_accumulating_producer.h
 create mode 100644 chalk/plugins/viewplugins/histogram_docker/kis_cachedhistogram.cc
 create mode 100644 chalk/plugins/viewplugins/histogram_docker/kis_cachedhistogram.h
 create mode 100644 chalk/plugins/viewplugins/histogram_docker/kis_imagerasteredcache.cc
 create mode 100644 chalk/plugins/viewplugins/histogram_docker/kis_imagerasteredcache.h
 create mode 100644 chalk/plugins/viewplugins/history_docker/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/history_docker/chalkhistorydocker.desktop
 create mode 100644 chalk/plugins/viewplugins/history_docker/historydocker.cc
 create mode 100644 chalk/plugins/viewplugins/history_docker/historydocker.h
 create mode 100644 chalk/plugins/viewplugins/imagesize/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/imagesize/chalkimagesize.desktop
 create mode 100644 chalk/plugins/viewplugins/imagesize/configure.in.in
 create mode 100644 chalk/plugins/viewplugins/imagesize/dlg_imagesize.cc
 create mode 100644 chalk/plugins/viewplugins/imagesize/dlg_imagesize.h
 create mode 100644 chalk/plugins/viewplugins/imagesize/dlg_layersize.cc
 create mode 100644 chalk/plugins/viewplugins/imagesize/dlg_layersize.h
 create mode 100644 chalk/plugins/viewplugins/imagesize/imagesize.cc
 create mode 100644 chalk/plugins/viewplugins/imagesize/imagesize.h
 create mode 100644 chalk/plugins/viewplugins/imagesize/imagesize.rc
 create mode 100644 chalk/plugins/viewplugins/imagesize/wdg_imagesize.ui
 create mode 100644 chalk/plugins/viewplugins/imagesize/wdg_layersize.ui
 create mode 100644 chalk/plugins/viewplugins/imagesize/wdg_resolution.ui
 create mode 100644 chalk/plugins/viewplugins/modify_selection/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/modify_selection/chalkmodifyselection.desktop
 create mode 100644 chalk/plugins/viewplugins/modify_selection/dlg_border_selection.cc
 create mode 100644 chalk/plugins/viewplugins/modify_selection/dlg_border_selection.h
 create mode 100644 chalk/plugins/viewplugins/modify_selection/dlg_grow_selection.cc
 create mode 100644 chalk/plugins/viewplugins/modify_selection/dlg_grow_selection.h
 create mode 100644 chalk/plugins/viewplugins/modify_selection/dlg_shrink_selection.cc
 create mode 100644 chalk/plugins/viewplugins/modify_selection/dlg_shrink_selection.h
 create mode 100644 chalk/plugins/viewplugins/modify_selection/modify_selection.cc
 create mode 100644 chalk/plugins/viewplugins/modify_selection/modify_selection.h
 create mode 100644 chalk/plugins/viewplugins/modify_selection/modify_selection.rc
 create mode 100644 chalk/plugins/viewplugins/modify_selection/wdg_border_selection.ui
 create mode 100644 chalk/plugins/viewplugins/modify_selection/wdg_grow_selection.ui
 create mode 100644 chalk/plugins/viewplugins/modify_selection/wdg_shrink_selection.ui
 create mode 100644 chalk/plugins/viewplugins/performancetest/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/performancetest/chalkperftest.desktop
 create mode 100644 chalk/plugins/viewplugins/performancetest/dlg_perftest.cc
 create mode 100644 chalk/plugins/viewplugins/performancetest/dlg_perftest.h
 create mode 100644 chalk/plugins/viewplugins/performancetest/perftest.cc
 create mode 100644 chalk/plugins/viewplugins/performancetest/perftest.h
 create mode 100644 chalk/plugins/viewplugins/performancetest/perftest.rc
 create mode 100644 chalk/plugins/viewplugins/performancetest/wdg_perftest.ui
 create mode 100644 chalk/plugins/viewplugins/rotateimage/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/rotateimage/chalkrotateimage.desktop
 create mode 100644 chalk/plugins/viewplugins/rotateimage/dlg_rotateimage.cc
 create mode 100644 chalk/plugins/viewplugins/rotateimage/dlg_rotateimage.h
 create mode 100644 chalk/plugins/viewplugins/rotateimage/rotateimage.cc
 create mode 100644 chalk/plugins/viewplugins/rotateimage/rotateimage.h
 create mode 100644 chalk/plugins/viewplugins/rotateimage/rotateimage.rc
 create mode 100644 chalk/plugins/viewplugins/rotateimage/wdg_rotateimage.ui
 create mode 100644 chalk/plugins/viewplugins/screenshot/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/screenshot/chalkscreenshot.desktop
 create mode 100644 chalk/plugins/viewplugins/screenshot/ksnapshot.cpp
 create mode 100644 chalk/plugins/viewplugins/screenshot/ksnapshot.h
 create mode 100644 chalk/plugins/viewplugins/screenshot/ksnapshotwidget.ui
 create mode 100644 chalk/plugins/viewplugins/screenshot/ksnapshotwidget.ui.h
 create mode 100644 chalk/plugins/viewplugins/screenshot/main.cpp
 create mode 100644 chalk/plugins/viewplugins/screenshot/regiongrabber.cpp
 create mode 100644 chalk/plugins/viewplugins/screenshot/regiongrabber.h
 create mode 100644 chalk/plugins/viewplugins/screenshot/screenshot-chalk.rc
 create mode 100644 chalk/plugins/viewplugins/screenshot/screenshot-kpresenter.rc
 create mode 100644 chalk/plugins/viewplugins/screenshot/screenshot-kword.rc
 create mode 100644 chalk/plugins/viewplugins/screenshot/screenshot.cpp
 create mode 100644 chalk/plugins/viewplugins/screenshot/screenshot.h
 create mode 100644 chalk/plugins/viewplugins/scripting/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/chalkcoremodule.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/chalkcoremodule.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_brush.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_brush.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_color.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_color.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_doc.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_doc.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_filter.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_filter.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_filter_configuration.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_filter_configuration.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_histogram.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_histogram.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_image.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_image.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_iterator.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_paint_layer.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_paint_layer.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_painter.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_painter.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_pattern.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_pattern.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_script_progress.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_script_progress.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_wavelet.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkcore/krs_wavelet.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkscripting.desktop
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkscripting/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkscripting/kis_script_monitor.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkscripting/kis_script_monitor.h
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkscripting/kis_script_progress.cpp
 create mode 100644 chalk/plugins/viewplugins/scripting/chalkscripting/kis_script_progress.h
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/python/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/python/invert.py
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/python/invertpython.rc
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/python/reshapehisto.py
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/python/reshapehisto.rc
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/changecs.rb
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/changecs.rc
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/filterstest.rb
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/filterstest.rc
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/invert.rb
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/invertruby.rc
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/randompaint.rb
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/randompaint.rc
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/torture-filters.rb
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/torture-filters.rc
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/torture-painting.rb
 create mode 100644 chalk/plugins/viewplugins/scripting/samples/ruby/torture-painting.rc
 create mode 100644 chalk/plugins/viewplugins/scripting/scripting.cc
 create mode 100644 chalk/plugins/viewplugins/scripting/scripting.h
 create mode 100644 chalk/plugins/viewplugins/scripting/scripting.rc
 create mode 100644 chalk/plugins/viewplugins/selectopaque/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/selectopaque/chalkselectopaque.desktop
 create mode 100644 chalk/plugins/viewplugins/selectopaque/selectopaque.cc
 create mode 100644 chalk/plugins/viewplugins/selectopaque/selectopaque.h
 create mode 100644 chalk/plugins/viewplugins/selectopaque/selectopaque.rc
 create mode 100644 chalk/plugins/viewplugins/separate_channels/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/separate_channels/chalkseparatechannels.desktop
 create mode 100644 chalk/plugins/viewplugins/separate_channels/dlg_separate.cc
 create mode 100644 chalk/plugins/viewplugins/separate_channels/dlg_separate.h
 create mode 100644 chalk/plugins/viewplugins/separate_channels/imageseparate.rc
 create mode 100644 chalk/plugins/viewplugins/separate_channels/kis_channel_separator.cc
 create mode 100644 chalk/plugins/viewplugins/separate_channels/kis_channel_separator.h
 create mode 100644 chalk/plugins/viewplugins/separate_channels/kis_separate_channels_plugin.cc
 create mode 100644 chalk/plugins/viewplugins/separate_channels/kis_separate_channels_plugin.h
 create mode 100644 chalk/plugins/viewplugins/separate_channels/wdg_separations.ui
 create mode 100644 chalk/plugins/viewplugins/shearimage/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/shearimage/chalkshearimage.desktop
 create mode 100644 chalk/plugins/viewplugins/shearimage/dlg_shearimage.cc
 create mode 100644 chalk/plugins/viewplugins/shearimage/dlg_shearimage.h
 create mode 100644 chalk/plugins/viewplugins/shearimage/shearimage.cc
 create mode 100644 chalk/plugins/viewplugins/shearimage/shearimage.h
 create mode 100644 chalk/plugins/viewplugins/shearimage/shearimage.rc
 create mode 100644 chalk/plugins/viewplugins/shearimage/wdg_shearimage.ui
 create mode 100644 chalk/plugins/viewplugins/substrate/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/substrate/chalksubstrate.desktop
 create mode 100644 chalk/plugins/viewplugins/substrate/dlg_substrate.cc
 create mode 100644 chalk/plugins/viewplugins/substrate/dlg_substrate.h
 create mode 100644 chalk/plugins/viewplugins/substrate/kis_repeating_substrate.cc
 create mode 100644 chalk/plugins/viewplugins/substrate/kis_repeating_substrate.h
 create mode 100644 chalk/plugins/viewplugins/substrate/substrate.cc
 create mode 100644 chalk/plugins/viewplugins/substrate/substrate.h
 create mode 100644 chalk/plugins/viewplugins/substrate/substrate.rc
 create mode 100644 chalk/plugins/viewplugins/substrate/wdgsubstrate.ui
 create mode 100644 chalk/plugins/viewplugins/variations/Makefile.am
 create mode 100644 chalk/plugins/viewplugins/variations/chalkvariations.desktop
 create mode 100644 chalk/plugins/viewplugins/variations/dlg_variations.cc
 create mode 100644 chalk/plugins/viewplugins/variations/dlg_variations.h
 create mode 100644 chalk/plugins/viewplugins/variations/variations.cc
 create mode 100644 chalk/plugins/viewplugins/variations/variations.h
 create mode 100644 chalk/plugins/viewplugins/variations/variations.rc
 create mode 100644 chalk/plugins/viewplugins/variations/wdg_variations.ui
 create mode 100644 chalk/sdk/Makefile.am
 create mode 100644 chalk/sdk/kis_annotation.h
 create mode 100644 chalk/sdk/kis_canvas_controller.h
 create mode 100644 chalk/sdk/kis_canvas_observer.h
 create mode 100644 chalk/sdk/kis_canvas_subject.h
 create mode 100644 chalk/sdk/kis_debug_areas.h
 create mode 100644 chalk/sdk/kis_generic_registry.h
 create mode 100644 chalk/sdk/kis_global.h
 create mode 100644 chalk/sdk/kis_id.h
 create mode 100644 chalk/sdk/kis_integer_maths.h
 create mode 100644 chalk/sdk/kis_progress_display_interface.h
 create mode 100644 chalk/sdk/kis_progress_subject.cc
 create mode 100644 chalk/sdk/kis_progress_subject.h
 create mode 100644 chalk/sdk/kis_shared_ptr_vector.h
 create mode 100644 chalk/sdk/kis_undo_adapter.h
 create mode 100644 chalk/todo-1.6
 create mode 100644 chalk/ui/Makefile.am
 create mode 100644 chalk/ui/imageviewer.cc
 create mode 100644 chalk/ui/imageviewer.h
 create mode 100644 chalk/ui/kcurve.cc
 create mode 100644 chalk/ui/kcurve.h
 create mode 100644 chalk/ui/kis_aboutdata.h
 create mode 100644 chalk/ui/kis_autobrush.cc
 create mode 100644 chalk/ui/kis_autobrush.h
 create mode 100644 chalk/ui/kis_autogradient.cc
 create mode 100644 chalk/ui/kis_autogradient.h
 create mode 100644 chalk/ui/kis_birdeye_box.cc
 create mode 100644 chalk/ui/kis_birdeye_box.h
 create mode 100644 chalk/ui/kis_boundary_painter.cc
 create mode 100644 chalk/ui/kis_boundary_painter.h
 create mode 100644 chalk/ui/kis_brush_chooser.cc
 create mode 100644 chalk/ui/kis_brush_chooser.h
 create mode 100644 chalk/ui/kis_button_event.h
 create mode 100644 chalk/ui/kis_button_press_event.h
 create mode 100644 chalk/ui/kis_button_release_event.h
 create mode 100644 chalk/ui/kis_canvas.cc
 create mode 100644 chalk/ui/kis_canvas.h
 create mode 100644 chalk/ui/kis_canvas_painter.cc
 create mode 100644 chalk/ui/kis_canvas_painter.h
 create mode 100644 chalk/ui/kis_clipboard.cc
 create mode 100644 chalk/ui/kis_clipboard.h
 create mode 100644 chalk/ui/kis_cmb_composite.cc
 create mode 100644 chalk/ui/kis_cmb_composite.h
 create mode 100644 chalk/ui/kis_cmb_idlist.cc
 create mode 100644 chalk/ui/kis_cmb_idlist.h
 create mode 100644 chalk/ui/kis_color_cup.cc
 create mode 100644 chalk/ui/kis_color_cup.h
 create mode 100644 chalk/ui/kis_config.cc
 create mode 100644 chalk/ui/kis_config.h
 create mode 100644 chalk/ui/kis_controlframe.cc
 create mode 100644 chalk/ui/kis_controlframe.h
 create mode 100644 chalk/ui/kis_cursor.cc
 create mode 100644 chalk/ui/kis_cursor.h
 create mode 100644 chalk/ui/kis_custom_brush.cc
 create mode 100644 chalk/ui/kis_custom_brush.h
 create mode 100644 chalk/ui/kis_custom_image_widget.cc
 create mode 100644 chalk/ui/kis_custom_image_widget.h
 create mode 100644 chalk/ui/kis_custom_palette.cc
 create mode 100644 chalk/ui/kis_custom_palette.h
 create mode 100644 chalk/ui/kis_custom_pattern.cc
 create mode 100644 chalk/ui/kis_custom_pattern.h
 create mode 100644 chalk/ui/kis_dlg_adj_layer_props.cc
 create mode 100644 chalk/ui/kis_dlg_adj_layer_props.h
 create mode 100644 chalk/ui/kis_dlg_adjustment_layer.cc
 create mode 100644 chalk/ui/kis_dlg_adjustment_layer.h
 create mode 100644 chalk/ui/kis_dlg_apply_profile.cc
 create mode 100644 chalk/ui/kis_dlg_apply_profile.h
 create mode 100644 chalk/ui/kis_dlg_image_properties.cc
 create mode 100644 chalk/ui/kis_dlg_image_properties.h
 create mode 100644 chalk/ui/kis_dlg_layer_properties.cc
 create mode 100644 chalk/ui/kis_dlg_layer_properties.h
 create mode 100644 chalk/ui/kis_dlg_new_layer.cc
 create mode 100644 chalk/ui/kis_dlg_new_layer.h
 create mode 100644 chalk/ui/kis_dlg_preferences.cc
 create mode 100644 chalk/ui/kis_dlg_preferences.h
 create mode 100644 chalk/ui/kis_doc.cc
 create mode 100644 chalk/ui/kis_doc.h
 create mode 100644 chalk/ui/kis_doc_iface.cc
 create mode 100644 chalk/ui/kis_doc_iface.h
 create mode 100644 chalk/ui/kis_double_click_event.h
 create mode 100644 chalk/ui/kis_double_widget.cc
 create mode 100644 chalk/ui/kis_double_widget.h
 create mode 100644 chalk/ui/kis_event.h
 create mode 100644 chalk/ui/kis_factory.cc
 create mode 100644 chalk/ui/kis_factory.h
 create mode 100644 chalk/ui/kis_filter_manager.cc
 create mode 100644 chalk/ui/kis_filter_manager.h
 create mode 100644 chalk/ui/kis_filters_listview.cc
 create mode 100644 chalk/ui/kis_filters_listview.h
 create mode 100644 chalk/ui/kis_gradient_chooser.cc
 create mode 100644 chalk/ui/kis_gradient_chooser.h
 create mode 100644 chalk/ui/kis_gradient_slider_widget.cc
 create mode 100644 chalk/ui/kis_gradient_slider_widget.h
 create mode 100644 chalk/ui/kis_grid_drawer.cpp
 create mode 100644 chalk/ui/kis_grid_drawer.h
 create mode 100644 chalk/ui/kis_grid_manager.cpp
 create mode 100644 chalk/ui/kis_grid_manager.h
 create mode 100644 chalk/ui/kis_histogram_view.cc
 create mode 100644 chalk/ui/kis_histogram_view.h
 create mode 100644 chalk/ui/kis_icon_item.cc
 create mode 100644 chalk/ui/kis_icon_item.h
 create mode 100644 chalk/ui/kis_iconwidget.cc
 create mode 100644 chalk/ui/kis_iconwidget.h
 create mode 100644 chalk/ui/kis_import_catcher.cc
 create mode 100644 chalk/ui/kis_import_catcher.h
 create mode 100644 chalk/ui/kis_input_device.cc
 create mode 100644 chalk/ui/kis_input_device.h
 create mode 100644 chalk/ui/kis_int_spinbox.cc
 create mode 100644 chalk/ui/kis_int_spinbox.h
 create mode 100644 chalk/ui/kis_itemchooser.cc
 create mode 100644 chalk/ui/kis_itemchooser.h
 create mode 100644 chalk/ui/kis_label_cursor_pos.cc
 create mode 100644 chalk/ui/kis_label_cursor_pos.h
 create mode 100644 chalk/ui/kis_label_progress.cc
 create mode 100644 chalk/ui/kis_label_progress.h
 create mode 100644 chalk/ui/kis_label_zoom.cc
 create mode 100644 chalk/ui/kis_label_zoom.h
 create mode 100644 chalk/ui/kis_layerbox.cc
 create mode 100644 chalk/ui/kis_layerbox.h
 create mode 100644 chalk/ui/kis_layerlist.cc
 create mode 100644 chalk/ui/kis_layerlist.h
 create mode 100644 chalk/ui/kis_load_visitor.h
 create mode 100644 chalk/ui/kis_matrix_widget.ui
 create mode 100644 chalk/ui/kis_matrix_widget.ui.h
 create mode 100644 chalk/ui/kis_move_event.h
 create mode 100644 chalk/ui/kis_multi_bool_filter_widget.cc
 create mode 100644 chalk/ui/kis_multi_bool_filter_widget.h
 create mode 100644 chalk/ui/kis_multi_double_filter_widget.cc
 create mode 100644 chalk/ui/kis_multi_double_filter_widget.h
 create mode 100644 chalk/ui/kis_multi_integer_filter_widget.cc
 create mode 100644 chalk/ui/kis_multi_integer_filter_widget.h
 create mode 100644 chalk/ui/kis_opengl_canvas.cc
 create mode 100644 chalk/ui/kis_opengl_canvas.h
 create mode 100644 chalk/ui/kis_opengl_canvas_painter.cc
 create mode 100644 chalk/ui/kis_opengl_canvas_painter.h
 create mode 100644 chalk/ui/kis_opengl_image_context.cc
 create mode 100644 chalk/ui/kis_opengl_image_context.h
 create mode 100644 chalk/ui/kis_paintop_box.cc
 create mode 100644 chalk/ui/kis_paintop_box.h
 create mode 100644 chalk/ui/kis_palette_view.cc
 create mode 100644 chalk/ui/kis_palette_view.h
 create mode 100644 chalk/ui/kis_palette_widget.cc
 create mode 100644 chalk/ui/kis_palette_widget.h
 create mode 100644 chalk/ui/kis_part_layer.cc
 create mode 100644 chalk/ui/kis_part_layer.h
 create mode 100644 chalk/ui/kis_part_layer_handler.cc
 create mode 100644 chalk/ui/kis_part_layer_handler.h
 create mode 100644 chalk/ui/kis_pattern_chooser.cc
 create mode 100644 chalk/ui/kis_pattern_chooser.h
 create mode 100644 chalk/ui/kis_perspective_grid_manager.cpp
 create mode 100644 chalk/ui/kis_perspective_grid_manager.h
 create mode 100644 chalk/ui/kis_populate_visitor.h
 create mode 100644 chalk/ui/kis_previewdialog.cc
 create mode 100644 chalk/ui/kis_previewdialog.h
 create mode 100644 chalk/ui/kis_previewwidget.cc
 create mode 100644 chalk/ui/kis_previewwidget.h
 create mode 100644 chalk/ui/kis_previewwidgetbase.ui
 create mode 100644 chalk/ui/kis_qpaintdevice_canvas.cc
 create mode 100644 chalk/ui/kis_qpaintdevice_canvas.h
 create mode 100644 chalk/ui/kis_qpaintdevice_canvas_painter.cc
 create mode 100644 chalk/ui/kis_qpaintdevice_canvas_painter.h
 create mode 100644 chalk/ui/kis_resource_mediator.cc
 create mode 100644 chalk/ui/kis_resource_mediator.h
 create mode 100644 chalk/ui/kis_resourceserver.cc
 create mode 100644 chalk/ui/kis_resourceserver.h
 create mode 100644 chalk/ui/kis_ruler.cc
 create mode 100644 chalk/ui/kis_ruler.h
 create mode 100644 chalk/ui/kis_save_visitor.h
 create mode 100644 chalk/ui/kis_savexml_visitor.h
 create mode 100644 chalk/ui/kis_selection_manager.cc
 create mode 100644 chalk/ui/kis_selection_manager.h
 create mode 100644 chalk/ui/kis_selection_options.cc
 create mode 100644 chalk/ui/kis_selection_options.h
 create mode 100644 chalk/ui/kis_text_brush.cc
 create mode 100644 chalk/ui/kis_text_brush.h
 create mode 100644 chalk/ui/kis_tool.cc
 create mode 100644 chalk/ui/kis_tool.h
 create mode 100644 chalk/ui/kis_tool_controller.h
 create mode 100644 chalk/ui/kis_tool_dummy.cc
 create mode 100644 chalk/ui/kis_tool_dummy.h
 create mode 100644 chalk/ui/kis_tool_factory.h
 create mode 100644 chalk/ui/kis_tool_freehand.cc
 create mode 100644 chalk/ui/kis_tool_freehand.h
 create mode 100644 chalk/ui/kis_tool_manager.cc
 create mode 100644 chalk/ui/kis_tool_manager.h
 create mode 100644 chalk/ui/kis_tool_non_paint.cc
 create mode 100644 chalk/ui/kis_tool_non_paint.h
 create mode 100644 chalk/ui/kis_tool_paint.cc
 create mode 100644 chalk/ui/kis_tool_paint.h
 create mode 100644 chalk/ui/kis_tool_registry.cc
 create mode 100644 chalk/ui/kis_tool_registry.h
 create mode 100644 chalk/ui/kis_tool_shape.cc
 create mode 100644 chalk/ui/kis_tool_shape.h
 create mode 100644 chalk/ui/kis_tool_types.h
 create mode 100644 chalk/ui/kis_view.cc
 create mode 100644 chalk/ui/kis_view.h
 create mode 100644 chalk/ui/kis_view_iface.cc
 create mode 100644 chalk/ui/kis_view_iface.h
 create mode 100644 chalk/ui/kobirdeyepanel.cpp
 create mode 100644 chalk/ui/kobirdeyepanel.h
 create mode 100644 chalk/ui/layerlist.cpp
 create mode 100644 chalk/ui/layerlist.h
 create mode 100644 chalk/ui/squeezedcombobox.cpp
 create mode 100644 chalk/ui/squeezedcombobox.h
 create mode 100644 chalk/ui/wdgapplyprofile.ui
 create mode 100644 chalk/ui/wdgautobrush.ui
 create mode 100644 chalk/ui/wdgautogradient.ui
 create mode 100644 chalk/ui/wdgbirdeye.ui
 create mode 100644 chalk/ui/wdgcolorsettings.ui
 create mode 100644 chalk/ui/wdgcustombrush.ui
 create mode 100644 chalk/ui/wdgcustompalette.ui
 create mode 100644 chalk/ui/wdgcustompattern.ui
 create mode 100644 chalk/ui/wdgdisplaysettings.ui
 create mode 100644 chalk/ui/wdggeneralsettings.ui
 create mode 100644 chalk/ui/wdggridsettings.ui
 create mode 100644 chalk/ui/wdglayerbox.ui
 create mode 100644 chalk/ui/wdglayerproperties.ui
 create mode 100644 chalk/ui/wdgnewimage.ui
 create mode 100644 chalk/ui/wdgpalettechooser.ui
 create mode 100644 chalk/ui/wdgperformancesettings.ui
 create mode 100644 chalk/ui/wdgpressuresettings.ui
 create mode 100644 chalk/ui/wdgselectionoptions.ui
 create mode 100644 chalk/ui/wdgshapeoptions.ui
 create mode 100644 chalk/ui/wdgtabletdevicesettings.ui
 create mode 100644 chalk/ui/wdgtabletsettings.ui
 create mode 100644 chalk/ui/wdgtextbrush.ui
 create mode 100644 doc/chalk/Makefile.am
 create mode 100644 doc/chalk/README.SCREENSHOTS
 create mode 100644 doc/chalk/commands-dialogs.docbook
 create mode 100644 doc/chalk/commands-menus.docbook
 create mode 100644 doc/chalk/commands-palettes.docbook
 create mode 100644 doc/chalk/commands-toolbars.docbook
 create mode 100644 doc/chalk/commands.docbook
 create mode 100644 doc/chalk/createdocument.png
 create mode 100644 doc/chalk/credits.docbook
 create mode 100644 doc/chalk/crocusses-autocontrast.png
 create mode 100644 doc/chalk/crocusses-blur.png
 create mode 100644 doc/chalk/crocusses-brightnesscontrast.png
 create mode 100644 doc/chalk/crocusses-bumpmap.png
 create mode 100644 doc/chalk/crocusses-coloradjustment.png
 create mode 100644 doc/chalk/crocusses-colortoalpha.png
 create mode 100644 doc/chalk/crocusses-colortransfer.png
 create mode 100644 doc/chalk/crocusses-customconvolution.png
 create mode 100644 doc/chalk/crocusses-desaturate.png
 create mode 100644 doc/chalk/crocusses-edgebottom.png
 create mode 100644 doc/chalk/crocusses-edgeleft.png
 create mode 100644 doc/chalk/crocusses-edgeright.png
 create mode 100644 doc/chalk/crocusses-embossall.png
 create mode 100644 doc/chalk/crocusses-embosshorvert.png
 create mode 100644 doc/chalk/crocusses-embossvariable.png
 create mode 100644 doc/chalk/crocusses-gaussianblur.png
 create mode 100644 doc/chalk/crocusses-gaussiannoise.png
 create mode 100644 doc/chalk/crocusses-invert.png
 create mode 100644 doc/chalk/crocusses-lenscorrection.png
 create mode 100644 doc/chalk/crocusses-maximizechannel.png
 create mode 100644 doc/chalk/crocusses-meanremoval.png
 create mode 100644 doc/chalk/crocusses-minimizechannel.png
 create mode 100644 doc/chalk/crocusses-oilpaint.png
 create mode 100644 doc/chalk/crocusses-pixelize.png
 create mode 100644 doc/chalk/crocusses-raindrops.png
 create mode 100644 doc/chalk/crocusses-randomnoise.png
 create mode 100644 doc/chalk/crocusses-randompick.png
 create mode 100644 doc/chalk/crocusses-roundcorners.png
 create mode 100644 doc/chalk/crocusses-sharpen.png
 create mode 100644 doc/chalk/crocusses-smalltiles.png
 create mode 100644 doc/chalk/crocusses-sobel.png
 create mode 100644 doc/chalk/crocusses-topedge.png
 create mode 100644 doc/chalk/crocusses-unsharpmask.png
 create mode 100644 doc/chalk/crocusses-wave.png
 create mode 100644 doc/chalk/crocusses-waveletnoise.png
 create mode 100644 doc/chalk/crocusses.png
 create mode 100644 doc/chalk/developers-plugins.docbook
 create mode 100644 doc/chalk/developers-scripting.docbook
 create mode 100644 doc/chalk/developers.docbook
 create mode 100644 doc/chalk/dialogs-addpalette.png
 create mode 100644 doc/chalk/dialogs-blur.png
 create mode 100644 doc/chalk/dialogs-brightnesscontrast.png
 create mode 100644 doc/chalk/dialogs-bumpmap.png
 create mode 100644 doc/chalk/dialogs-coloradjustment.png
 create mode 100644 doc/chalk/dialogs-colorrange.png
 create mode 100644 doc/chalk/dialogs-colortoalpha.png
 create mode 100644 doc/chalk/dialogs-colortransfer.png
 create mode 100644 doc/chalk/dialogs-convertimagetype.png
 create mode 100644 doc/chalk/dialogs-convertlayertype.png
 create mode 100644 doc/chalk/dialogs-cubism.png
 create mode 100644 doc/chalk/dialogs-customconvolution.png
 create mode 100644 doc/chalk/dialogs-documentinformation.png
 create mode 100644 doc/chalk/dialogs-dropshadow.png
 create mode 100644 doc/chalk/dialogs-emboss.png
 create mode 100644 doc/chalk/dialogs-filtersgallery.png
 create mode 100644 doc/chalk/dialogs-gaussiannoise.png
 create mode 100644 doc/chalk/dialogs-histogram.png
 create mode 100644 doc/chalk/dialogs-imageproperties.png
 create mode 100644 doc/chalk/dialogs-imagerestoration.png
 create mode 100644 doc/chalk/dialogs-imagesize.png
 create mode 100644 doc/chalk/dialogs-layerproperties.png
 create mode 100644 doc/chalk/dialogs-layersize.png
 create mode 100644 doc/chalk/dialogs-lenscorrection.png
 create mode 100644 doc/chalk/dialogs-newadjustmentlayer.png
 create mode 100644 doc/chalk/dialogs-newlayer.png
 create mode 100644 doc/chalk/dialogs-oilpaint.png
 create mode 100644 doc/chalk/dialogs-pixelize.png
 create mode 100644 doc/chalk/dialogs-raindrops.png
 create mode 100644 doc/chalk/dialogs-randomnoise.png
 create mode 100644 doc/chalk/dialogs-randompick.png
 create mode 100644 doc/chalk/dialogs-rotateimage.png
 create mode 100644 doc/chalk/dialogs-rotatelayer.png
 create mode 100644 doc/chalk/dialogs-roundcorners.png
 create mode 100644 doc/chalk/dialogs-separateimage.png
 create mode 100644 doc/chalk/dialogs-shearimage.png
 create mode 100644 doc/chalk/dialogs-shearlayer.png
 create mode 100644 doc/chalk/dialogs-smalltiles.png
 create mode 100644 doc/chalk/dialogs-sobel.png
 create mode 100644 doc/chalk/dialogs-substrate.png
 create mode 100644 doc/chalk/dialogs-unsharpmask.png
 create mode 100644 doc/chalk/dialogs-wave.png
 create mode 100644 doc/chalk/dialogs-waveletnoise.png
 create mode 100644 doc/chalk/faq.docbook
 create mode 100644 doc/chalk/index.docbook
 create mode 100644 doc/chalk/installation.docbook
 create mode 100644 doc/chalk/introduction.docbook
 create mode 100644 doc/chalk/mainscreen.png
 create mode 100644 doc/chalk/mountains-burn.png
 create mode 100644 doc/chalk/mountains-color.png
 create mode 100644 doc/chalk/mountains-darken.png
 create mode 100644 doc/chalk/mountains-divide.png
 create mode 100644 doc/chalk/mountains-dodge.png
 create mode 100644 doc/chalk/mountains-hue.png
 create mode 100644 doc/chalk/mountains-lighten.png
 create mode 100644 doc/chalk/mountains-multiply.png
 create mode 100644 doc/chalk/mountains-normal.png
 create mode 100644 doc/chalk/mountains-original.png
 create mode 100644 doc/chalk/mountains-overlay.png
 create mode 100644 doc/chalk/mountains-saturation.png
 create mode 100644 doc/chalk/mountains-screen.png
 create mode 100644 doc/chalk/mountains-value.png
 create mode 100644 doc/chalk/mountains.png
 create mode 100644 doc/chalk/newimage.png
 create mode 100644 doc/chalk/palettes-colors-gray.png
 create mode 100644 doc/chalk/palettes-colors-hsv.png
 create mode 100644 doc/chalk/palettes-colors-palettes.png
 create mode 100644 doc/chalk/palettes-colors-rgb.png
 create mode 100644 doc/chalk/palettes-colors-watercolors.png
 create mode 100644 doc/chalk/palettes-controlbox-bezier.png
 create mode 100644 doc/chalk/palettes-controlbox-brush.png
 create mode 100644 doc/chalk/palettes-controlbox-colorpicker.png
 create mode 100644 doc/chalk/palettes-controlbox-contiguousfill.png
 create mode 100644 doc/chalk/palettes-controlbox-crop.png
 create mode 100644 doc/chalk/palettes-controlbox-duplicate.png
 create mode 100644 doc/chalk/palettes-controlbox-ellipse.png
 create mode 100644 doc/chalk/palettes-controlbox-fill.png
 create mode 100644 doc/chalk/palettes-controlbox-gradient.png
 create mode 100644 doc/chalk/palettes-controlbox-histogram.png
 create mode 100644 doc/chalk/palettes-controlbox-line.png
 create mode 100644 doc/chalk/palettes-controlbox-overview.png
 create mode 100644 doc/chalk/palettes-controlbox-paintwithfilters.png
 create mode 100644 doc/chalk/palettes-controlbox-polygon.png
 create mode 100644 doc/chalk/palettes-controlbox-polyline.png
 create mode 100644 doc/chalk/palettes-controlbox-rectangle.png
 create mode 100644 doc/chalk/palettes-controlbox-select.png
 create mode 100644 doc/chalk/palettes-controlbox-selectcontiguous.png
 create mode 100644 doc/chalk/palettes-controlbox-selectmagnetic.png
 create mode 100644 doc/chalk/palettes-controlbox-selectsimilar.png
 create mode 100644 doc/chalk/palettes-controlbox-star.png
 create mode 100644 doc/chalk/palettes-controlbox-text.png
 create mode 100644 doc/chalk/palettes-controlbox-transform.png
 create mode 100644 doc/chalk/palettes-layers-layers.png
 create mode 100644 doc/chalk/palettes-layers-scriptsmanager.png
 create mode 100644 doc/chalk/preferences-color.png
 create mode 100644 doc/chalk/preferences-display.png
 create mode 100644 doc/chalk/preferences-general.png
 create mode 100644 doc/chalk/preferences-grid.png
 create mode 100644 doc/chalk/preferences-performance.png
 create mode 100644 doc/chalk/preferences-sidebar.png
 create mode 100644 doc/chalk/preferences-tablet.png
 create mode 100644 doc/chalk/settings.docbook
 create mode 100644 doc/chalk/tool-bezier-example.png
 create mode 100644 doc/chalk/tool-bezier-example2.png
 create mode 100644 doc/chalk/tool-bezier-example3.png
 create mode 100644 doc/chalk/tool-bezier.png
 create mode 100644 doc/chalk/tool-brush.png
 create mode 100644 doc/chalk/tool-colorpicker.png
 create mode 100644 doc/chalk/tool-contiguousfill.png
 create mode 100644 doc/chalk/tool-crop.png
 create mode 100644 doc/chalk/tool-duplicate.png
 create mode 100644 doc/chalk/tool-ellipse.png
 create mode 100644 doc/chalk/tool-eraseselection.png
 create mode 100644 doc/chalk/tool-gradient.png
 create mode 100644 doc/chalk/tool-line.png
 create mode 100644 doc/chalk/tool-move.png
 create mode 100644 doc/chalk/tool-paintselection.png
 create mode 100644 doc/chalk/tool-paintwithfilters-example.png
 create mode 100644 doc/chalk/tool-paintwithfilters.png
 create mode 100644 doc/chalk/tool-pan.png
 create mode 100644 doc/chalk/tool-perspectivegrid.png
 create mode 100644 doc/chalk/tool-perspectivetransform.png
 create mode 100644 doc/chalk/tool-polygon.png
 create mode 100644 doc/chalk/tool-polyline.png
 create mode 100644 doc/chalk/tool-rectangle.png
 create mode 100644 doc/chalk/tool-selectbezier.png
 create mode 100644 doc/chalk/tool-selectcontiguous.png
 create mode 100644 doc/chalk/tool-selectelliptical.png
 create mode 100644 doc/chalk/tool-selectmagnetic.png
 create mode 100644 doc/chalk/tool-selectoutline.png
 create mode 100644 doc/chalk/tool-selectpolygonal.png
 create mode 100644 doc/chalk/tool-selectrectangular.png
 create mode 100644 doc/chalk/tool-selectsimilar.png
 create mode 100644 doc/chalk/tool-star.png
 create mode 100644 doc/chalk/tool-text.png
 create mode 100644 doc/chalk/tool-transform.png
 create mode 100644 doc/chalk/tool-zoom.png
 create mode 100644 doc/chalk/toolbar-brushes-brushshapes-autobrush.png
 create mode 100644 doc/chalk/toolbar-brushes-brushshapes-custombrush.png
 create mode 100644 doc/chalk/toolbar-brushes-brushshapes-predefined.png
 create mode 100644 doc/chalk/toolbar-brushes-gradients.png
 create mode 100644 doc/chalk/toolbar-brushes-patterns-custompattern.png
 create mode 100644 doc/chalk/toolbar-brushes-patterns.png
 create mode 100644 doc/chalk/toolbar-brushesandstuff.png
 create mode 100644 doc/chalk/toolbar-chalk.png
 create mode 100644 doc/chalk/toolbar-edit.png
 create mode 100644 doc/chalk/toolbar-file.png
 create mode 100644 doc/chalk/toolbar-navigation.png
 create mode 100644 doc/chalk/toolbar-transformationtools.png
 create mode 100644 doc/chalk/toolbars-button-zoomin.png
 create mode 100644 doc/chalk/toolbars-button-zoomout.png
 create mode 100644 doc/chalk/tutorial-quick-starts.docbook
 create mode 100644 doc/chalk/tutorial-quick-starts1.png
 create mode 100644 doc/chalk/tutorial-quick-starts10.png
 create mode 100644 doc/chalk/tutorial-quick-starts11.png
 create mode 100644 doc/chalk/tutorial-quick-starts12.png
 create mode 100644 doc/chalk/tutorial-quick-starts2.png
 create mode 100644 doc/chalk/tutorial-quick-starts3.png
 create mode 100644 doc/chalk/tutorial-quick-starts4.png
 create mode 100644 doc/chalk/tutorial-quick-starts5.png
 create mode 100644 doc/chalk/tutorial-quick-starts6.png
 create mode 100644 doc/chalk/tutorial-quick-starts7.png
 create mode 100644 doc/chalk/tutorial-quick-starts8.png
 create mode 100644 doc/chalk/tutorial-quick-starts9.png
 create mode 100644 doc/chalk/tutorial-select-layer-1.png
 create mode 100644 doc/chalk/tutorial-select-layer-10.png
 create mode 100644 doc/chalk/tutorial-select-layer-11.png
 create mode 100644 doc/chalk/tutorial-select-layer-12.png
 create mode 100644 doc/chalk/tutorial-select-layer-13.png
 create mode 100644 doc/chalk/tutorial-select-layer-2.png
 create mode 100644 doc/chalk/tutorial-select-layer-3.png
 create mode 100644 doc/chalk/tutorial-select-layer-4.png
 create mode 100644 doc/chalk/tutorial-select-layer-5.png
 create mode 100644 doc/chalk/tutorial-select-layer-6.png
 create mode 100644 doc/chalk/tutorial-select-layer-7.png
 create mode 100644 doc/chalk/tutorial-select-layer-8.png
 create mode 100644 doc/chalk/tutorial-select-layer-9.png
 create mode 100644 doc/chalk/tutorial-select-layer-sample.png
 create mode 100644 doc/chalk/tutorial-select-layer.docbook
 create mode 100644 doc/chalk/tutorial-starting.docbook
 create mode 100644 doc/chalk/tutorial-tablet-1.png
 create mode 100644 doc/chalk/tutorial-tablet-2.png
 create mode 100644 doc/chalk/tutorial-tablet-3.png
 create mode 100644 doc/chalk/tutorial-tablet.docbook
 create mode 100644 doc/chalk/tutorial.docbook
 create mode 100644 doc/chalk/using-colorspaces.docbook
 create mode 100644 doc/chalk/using-filters.docbook
 create mode 100644 doc/chalk/using-images.docbook
 create mode 100644 doc/chalk/using-layers.docbook
 create mode 100644 doc/chalk/using-selections-1.png
 create mode 100644 doc/chalk/using-selections-2.png
 create mode 100644 doc/chalk/using-selections-3.png
 create mode 100644 doc/chalk/using-selections-4.png
 create mode 100644 doc/chalk/using-selections-5.png
 create mode 100644 doc/chalk/using-selections-6.png
 create mode 100644 doc/chalk/using-selections.docbook
 create mode 100644 doc/chalk/using-views.docbook
 create mode 100644 filters/chalk/Makefile.am
 create mode 100644 filters/chalk/configure.in.in
 create mode 100644 filters/chalk/gmagick/Makefile.am
 create mode 100644 filters/chalk/gmagick/chalk_magick.desktop
 create mode 100644 filters/chalk/gmagick/chalk_magick_export.desktop
 create mode 100644 filters/chalk/gmagick/chalk_magick_import.desktop
 create mode 100644 filters/chalk/gmagick/configure.in.bot
 create mode 100644 filters/chalk/gmagick/kis_image_magick_converter.cc
 create mode 100644 filters/chalk/gmagick/kis_image_magick_converter.h
 create mode 100644 filters/chalk/gmagick/magickexport.cpp
 create mode 100644 filters/chalk/gmagick/magickexport.h
 create mode 100644 filters/chalk/gmagick/magickimport.cpp
 create mode 100644 filters/chalk/gmagick/magickimport.h
 create mode 100644 filters/chalk/jpeg/Makefile.am
 create mode 100644 filters/chalk/jpeg/chalk_jpeg.desktop
 create mode 100644 filters/chalk/jpeg/chalk_jpeg_export.desktop
 create mode 100644 filters/chalk/jpeg/chalk_jpeg_import.desktop
 create mode 100644 filters/chalk/jpeg/configure.in.bot
 create mode 100644 filters/chalk/jpeg/iccjpeg.c
 create mode 100644 filters/chalk/jpeg/iccjpeg.h
 create mode 100644 filters/chalk/jpeg/kis_jpeg_converter.cc
 create mode 100644 filters/chalk/jpeg/kis_jpeg_converter.h
 create mode 100644 filters/chalk/jpeg/kis_jpeg_export.cc
 create mode 100644 filters/chalk/jpeg/kis_jpeg_export.h
 create mode 100644 filters/chalk/jpeg/kis_jpeg_import.cc
 create mode 100644 filters/chalk/jpeg/kis_jpeg_import.h
 create mode 100644 filters/chalk/jpeg/kis_wdg_options_jpeg.ui
 create mode 100644 filters/chalk/libkisexif/Makefile.am
 create mode 100644 filters/chalk/libkisexif/kis_exif_io.cpp
 create mode 100644 filters/chalk/libkisexif/kis_exif_io.h
 create mode 100644 filters/chalk/magick/Makefile.am
 create mode 100644 filters/chalk/magick/chalk_magick.desktop
 create mode 100644 filters/chalk/magick/chalk_magick_export.desktop
 create mode 100644 filters/chalk/magick/chalk_magick_import.desktop
 create mode 100644 filters/chalk/magick/configure.in.bot
 create mode 100644 filters/chalk/magick/kis_image_magick_converter.cc
 create mode 100644 filters/chalk/magick/kis_image_magick_converter.h
 create mode 100644 filters/chalk/magick/magickexport.cpp
 create mode 100644 filters/chalk/magick/magickexport.h
 create mode 100644 filters/chalk/magick/magickimport.cpp
 create mode 100644 filters/chalk/magick/magickimport.h
 create mode 100644 filters/chalk/openexr/Makefile.am
 create mode 100644 filters/chalk/openexr/chalk_openexr.desktop
 create mode 100644 filters/chalk/openexr/chalk_openexr_export.desktop
 create mode 100644 filters/chalk/openexr/chalk_openexr_import.desktop
 create mode 100644 filters/chalk/openexr/configure.in.bot
 create mode 100644 filters/chalk/openexr/kis_openexr_export.cpp
 create mode 100644 filters/chalk/openexr/kis_openexr_export.h
 create mode 100644 filters/chalk/openexr/kis_openexr_import.cpp
 create mode 100644 filters/chalk/openexr/kis_openexr_import.h
 create mode 100644 filters/chalk/pdf/Makefile.am
 create mode 100644 filters/chalk/pdf/chalk_pdf.desktop
 create mode 100644 filters/chalk/pdf/chalk_pdf_import.desktop
 create mode 100644 filters/chalk/pdf/configure.in.bot
 create mode 100644 filters/chalk/pdf/configure.in.in
 create mode 100644 filters/chalk/pdf/kis_pdf_import.cpp
 create mode 100644 filters/chalk/pdf/kis_pdf_import.h
 create mode 100644 filters/chalk/pdf/kis_pdf_import_widget.cpp
 create mode 100644 filters/chalk/pdf/kis_pdf_import_widget.h
 create mode 100644 filters/chalk/pdf/pdfimportwidgetbase.ui
 create mode 100644 filters/chalk/png/Makefile.am
 create mode 100644 filters/chalk/png/chalk_png.desktop
 create mode 100644 filters/chalk/png/chalk_png_export.desktop
 create mode 100644 filters/chalk/png/chalk_png_import.desktop
 create mode 100644 filters/chalk/png/configure.in.bot
 create mode 100644 filters/chalk/png/kis_png_converter.cc
 create mode 100644 filters/chalk/png/kis_png_converter.h
 create mode 100644 filters/chalk/png/kis_png_export.cc
 create mode 100644 filters/chalk/png/kis_png_export.h
 create mode 100644 filters/chalk/png/kis_png_import.cc
 create mode 100644 filters/chalk/png/kis_png_import.h
 create mode 100644 filters/chalk/png/kis_wdg_options_png.ui
 create mode 100644 filters/chalk/raw/Makefile.am
 create mode 100644 filters/chalk/raw/chalk_raw.desktop
 create mode 100644 filters/chalk/raw/chalk_raw_import.desktop
 create mode 100644 filters/chalk/raw/dcraw.1
 create mode 100644 filters/chalk/raw/dcraw.c
 create mode 100644 filters/chalk/raw/kis_raw_import.cpp
 create mode 100644 filters/chalk/raw/kis_raw_import.h
 create mode 100644 filters/chalk/raw/wdgrawimport.ui
 create mode 100644 filters/chalk/tiff/Makefile.am
 create mode 100644 filters/chalk/tiff/chalk_tiff.desktop
 create mode 100644 filters/chalk/tiff/chalk_tiff_export.desktop
 create mode 100644 filters/chalk/tiff/chalk_tiff_import.desktop
 create mode 100644 filters/chalk/tiff/configure.in.bot
 create mode 100644 filters/chalk/tiff/kis_dlg_options_tiff.cpp
 create mode 100644 filters/chalk/tiff/kis_dlg_options_tiff.h
 create mode 100644 filters/chalk/tiff/kis_tiff_converter.cc
 create mode 100644 filters/chalk/tiff/kis_tiff_converter.h
 create mode 100644 filters/chalk/tiff/kis_tiff_export.cc
 create mode 100644 filters/chalk/tiff/kis_tiff_export.h
 create mode 100644 filters/chalk/tiff/kis_tiff_import.cc
 create mode 100644 filters/chalk/tiff/kis_tiff_import.h
 create mode 100644 filters/chalk/tiff/kis_tiff_reader.cc
 create mode 100644 filters/chalk/tiff/kis_tiff_reader.h
 create mode 100644 filters/chalk/tiff/kis_tiff_stream.cc
 create mode 100644 filters/chalk/tiff/kis_tiff_stream.h
 create mode 100644 filters/chalk/tiff/kis_tiff_writer_visitor.cpp
 create mode 100644 filters/chalk/tiff/kis_tiff_writer_visitor.h
 create mode 100644 filters/chalk/tiff/kis_tiff_ycbcr_reader.cc
 create mode 100644 filters/chalk/tiff/kis_tiff_ycbcr_reader.h
 create mode 100644 filters/chalk/tiff/kis_wdg_options_tiff.ui
 create mode 100644 filters/chalk/tiff/kis_ycbcr_colorspace.h
 create mode 100644 filters/chalk/xcf/Makefile.am
 create mode 100644 filters/chalk/xcf/chalk_xcf_export.desktop
 create mode 100644 filters/chalk/xcf/chalk_xcf_import.desktop
 create mode 100644 filters/chalk/xcf/xcf/README
 create mode 100644 filters/chalk/xcf/xcf/xcf-load.cc
 create mode 100644 filters/chalk/xcf/xcf/xcf-load.h
 create mode 100644 filters/chalk/xcf/xcf/xcf-private.h
 create mode 100644 filters/chalk/xcf/xcf/xcf-read.cc
 create mode 100644 filters/chalk/xcf/xcf/xcf-read.h
 create mode 100644 filters/chalk/xcf/xcf/xcf-save.cc
 create mode 100644 filters/chalk/xcf/xcf/xcf-save.h
 create mode 100644 filters/chalk/xcf/xcf/xcf-seek.cc
 create mode 100644 filters/chalk/xcf/xcf/xcf-seek.h
 create mode 100644 filters/chalk/xcf/xcf/xcf-write.cc
 create mode 100644 filters/chalk/xcf/xcf/xcf-write.h
 create mode 100644 filters/chalk/xcf/xcfexport.cpp
 create mode 100644 filters/chalk/xcf/xcfexport.h
 create mode 100644 filters/chalk/xcf/xcfimport.cpp
 create mode 100644 filters/chalk/xcf/xcfimport.h
 create mode 100644 plugins/scan/scan-chalk.rc
 create mode 100644 tools/quickprint/chalk_konqi.desktop

diff --git a/Doxyfile.temp b/Doxyfile.temp
index 6f60392b7..bb8dc58bc 100644
--- a/Doxyfile.temp
+++ b/Doxyfile.temp
@@ -61,7 +61,7 @@ INPUT                  = example \
                          koshell \
                          kplato \
                          kpresenter \
-			 krita \
+			 chalk \
 			 kspread kugar kword lib 
 FILE_PATTERNS          = *.h
 RECURSIVE              = YES
diff --git a/README b/README
index e979baed2..67fa61580 100644
--- a/README
+++ b/README
@@ -25,7 +25,7 @@ The applications currently included in KOffice are:
   Flowcharting program
 - Kexi
   Integrated data management
-- Krita
+- Chalk
   A pixel graphics tool
 - KFormula
   A mathematical formula editor
diff --git a/README.APPS b/README.APPS
index 6e76e0b20..ebdafae4f 100644
--- a/README.APPS
+++ b/README.APPS
@@ -18,7 +18,7 @@ in the 1.6 cycle:
 - lib/kross
 - kchart
 - kexi
-- krita
+- chalk
 - kdgantt
 - kplato
 - doc
diff --git a/README.PACKAGERS b/README.PACKAGERS
index af3849903..98791fa9c 100644
--- a/README.PACKAGERS
+++ b/README.PACKAGERS
@@ -18,7 +18,7 @@ Table Of Contents
 1. Database drivers (MySQL, PostgreSQL)
 2. Development files
  2.1. KexiDB development files
- 2.2. Krita development files 
+ 2.2. Chalk development files 
 3. Scripting support
 4. Microsoft Access Import (optional, recommended)
 5. Quick command-line tests of Kexi installation
@@ -78,13 +78,13 @@ The files are:
 The installation can be tested by building the MS Access import plugin
 as described in the Microsoft Access import plugin section below.
 
-2.2. Krita development files 
+2.2. Chalk development files 
 
-Location: koffice/krita/core, koffice/krita/sdk,
-koffice/krita/kritacolor, koffice/krita/ui
+Location: koffice/chalk/core, koffice/chalk/sdk,
+koffice/chalk/chalkcolor, koffice/chalk/ui
 
 These directories contain header files that are installed and can be
-used by plugin developers to extend Krita with new tools, colorspaces,
+used by plugin developers to extend Chalk with new tools, colorspaces,
 paint-ops and more.  If your distribution packages development files
 separately, it may be a good idea to make a package with these headers.
 
@@ -93,7 +93,7 @@ separately, it may be a good idea to make a package with these headers.
 --------------------
 
 Preliminary support for Ruby and Python scripting is available for
-Krita and Kexi.
+Chalk and Kexi.
 It can be disabled by passing the '--disable-scripting' option to
 'configure'.
 
@@ -131,15 +131,15 @@ For example, the Python scripting package may contain:
   share/apps/kexi/scripts/importxhtml/ImportXHTML.rc
   share/apps/kexi/scripts/projectdocumentor/ProjectDocumentor.py
   share/apps/kexi/scripts/projectdocumentor/ProjectDocumentor.rc
-  share/apps/krita/scripts/invert.py
-  share/apps/krita/scripts/reshapehisto.py
+  share/apps/chalk/scripts/invert.py
+  share/apps/chalk/scripts/reshapehisto.py
 
 and the Ruby scripting package may contain:
   lib/kde3/krossruby.so
   lib/kde3/krossruby.la
-  share/apps/krita/scripts/ruby/invert.rb
-  share/apps/krita/scripts/ruby/changecs.rb
-  share/apps/krita/scripts/ruby/randompaint.rb
+  share/apps/chalk/scripts/ruby/invert.rb
+  share/apps/chalk/scripts/ruby/changecs.rb
+  share/apps/chalk/scripts/ruby/randompaint.rb
 
 
 4. Microsoft Access Import (optional, recommended)
diff --git a/chalk/AUTHORS b/chalk/AUTHORS
new file mode 100644
index 000000000..3ef41cdea
--- /dev/null
+++ b/chalk/AUTHORS
@@ -0,0 +1,20 @@
+Adrian Page <Adrian.Page@tesco.net>
+Andrew Richards <physajr@phys.canterbury.ac.nz>
+Bart Coppens <kde@bartcoppens.be>
+Boudewijn Rempt <boud@valdyas.org>
+Carsten Pfeiffer <pfeiffer@kde.org>
+Casper Boemann <cbr@boemann.dk>
+Cyrille Berger <cyb@lepi.org>
+Danny Allen <dannya40uk@yahoo.co.uk>
+Dirk Schoenberger <dirk.schoenberger@sz-online.de>
+Gábor Lehel <illissius@gmail.com>
+John Califf <jcaliff@compuzone.net>
+Matthias Elter <elter@kde.org>
+Melchior Franz <melchior@kde.org>
+Michael Koch <koch@kde.org>
+Michael Thaler <michael.thaler@ph.tum.de> 
+Patrick Julien <freak@codepimps.org>
+Roger Larsson <roger.larsson@norran.net>
+Sven Langkamp <longamp@reallygood.de>
+
+Current maintainer: Boudewijn Rempt <boud@valdyas.org>
diff --git a/chalk/ChangeLog b/chalk/ChangeLog
new file mode 100644
index 000000000..15793398e
--- /dev/null
+++ b/chalk/ChangeLog
@@ -0,0 +1 @@
+We really should use cvs2changelog or something like that...
diff --git a/chalk/HACKING b/chalk/HACKING
new file mode 100644
index 000000000..c6f4ba66a
--- /dev/null
+++ b/chalk/HACKING
@@ -0,0 +1,93 @@
+Since 1999, people have been hacking on Chalk. Everyone brought their
+own coding style, their own code conventions, their own likes and
+dislikes. Me, (Boudewijn that is), I like indents of four spaces, and
+no scope prefixes for variables. However, in the interests of
+consistency, these are the rules new code should adhere to:
+
+
+Indentation
+
+	With four spaces. Use the default Java indentation
+	style of (X)Emacs or KDevelop -- also for brace placement.
+
+Includes
+
+	Avoid as much as possible #includes in header files; use forward declarations
+	of classes.
+
+Initializers
+
+	Avoid as much as possible initializers in the body of the constructor. Use
+	initializer lists instead.
+
+Scope prefixes
+
+	Use only m_ for class-level variables. No other scope prefixes; no g_, l_,
+	no 'p' for pointer variables.
+
+Shared pointers
+
+	Use shared pointers wherever possible.
+
+Getter/setter
+
+	Chalk doesn't use Qt's properties -- yet. If you want to introduce use of
+	properties, convert any and all classes in Chalk before committing.
+
+	Getter/setters are named 'x() for getters and setX(int x) for setters. If you
+	come across violations of this rule, change the code.	
+
+Class naming
+
+	If you use a well-known design pattern, name the class according to the design
+	pattern. All files should start with 'kis_', all classes with the 'Kis' prefix.
+	In filenames, separate words with an underscore; in classnames use capital letters. 
+	Example: kis_new_class.h/KisNewClass.
+
+	The only exception to this rule are interfaces.
+	Example: kis_tool.h/KisToolInterface.
+
+Function naming
+
+	Functions should be named in camelBackedFashion, to conform to Qt's standards.
+	If you encounter functions in c_style_like_this, feel free to rename. Also:
+	verbNoun -- i.e., rotateLayer, not layer_rotate. The latter is a true c-ism,
+	introduced by a language that needs to prefix the 'class' name to every function
+	in order to have something that not quite OO.
+
+Variable/Parameter names
+
+	Variable/parameter names start with an undercast letter. A name composed of different
+	words is done in camelBackedStyle.
+
+Designer
+
+	Chalk has started to use designer. All dialogs and all widgets that have a tqlayout
+	manager must be done in designer. We don't add code nor add signal/slot connections
+	in designer
+
+Enums
+
+	All enums should be prefixed with 'enum'.
+
+Namespaces
+
+	Currently, we only use anonymous (right term?) namespaces for things like undo
+	commands. For the rest, some classes have a 'Kis' prefix, others don't. This should
+	be made consistent, and we might want to use namespaces to keep all of Chalk
+	inside.
+
+Files and classes
+
+	It's preferred (and strongly preferred) to have only one class per .h/.cpp file.
+	(Which is logical, because otherwise you won't be able to keep to the naming scheme.)
+
+Spaces
+
+	Keep the source airy and open. (However, maybe I was wrong in wanting spaces around ->...)
+
+Slots and Q_SIGNALS
+
+	Prefix Q_SLOTS with slot and Q_SIGNALS with sig: slotUpdateSelection, sigSelectionUpdated.
+
+Boudewijn Rempt
\ No newline at end of file
diff --git a/chalk/IMAGE_LIBRARIES b/chalk/IMAGE_LIBRARIES
new file mode 100644
index 000000000..f2f0c1dc1
--- /dev/null
+++ b/chalk/IMAGE_LIBRARIES
@@ -0,0 +1,259 @@
+WARNING: OBSOLETE (Chalk's internal code has become much better by now)
+
+From time to time, people come up with the suggestion to use an
+existing imaging library with Chalk, to replace our own core. This
+file contains a list of all libraries known to me, and a short
+evaluation. 
+
+Perhaps, one day, we will decide to either use an existing library, or
+remodel our core after one of those. Of the libraries present, except
+for our own Chalk, Vigra look like it's the best bet from a technical
+point of view, with Vips a good runner-up.
+
+
+* Chalk  (http://koffice.kde.org/chalk)
+
+Chalk contains its own 2D image library, consisting of the tile
+manager, the layer classes and KisPainter. We really should separate
+this 2d lib from the interface code, and put it in a real lib with 
+a well-defined interface.
+
+Advantages:
+
+	- Already works
+	- Optimized for interactive work
+	- Allows different colour models
+	- Uses GraphicsMagick or ImageMagick for loading and saving.
+
+Disadvantages:
+	
+	- Does not work well with different channel depths
+	- Not integrated with CMS
+	- TileManager complicated and slow for pixel reading and
+	  writing.
+	  
+* Gimp (http://www.gimp.org)
+
+The Gimp contains a complex core that allows interactive painting of
+images with a channel depth of 8 bits.
+
+Advantages:
+
+	- Well tested, very complete
+	- Optimized for interactive usage
+
+Disadvantages:
+
+	- Written in C.
+	- Not readily available as a library.
+	- Depends on glib and gtk
+	- 8-bit only
+	- No colour models
+	- Has problems handling really large images
+
+* Vigra (http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/)
+
+Vigra is a C++ imaging library written by Ullrich Koetthe to
+demonstrate his Phd thesis on flexible image algorithms.
+
+Advantages:
+
+	- Supports very large images
+	- Supports colour models
+	- Supports different bit depths through templating
+	- C++
+	- Relatively small
+	- Relatively well-documented
+
+Disadvantages:
+
+	- License incompatible with GPL?
+	- Not optimized for interactive use
+	- Unsure about future development since this was a research
+	  project.
+
+* Vips (http://www.vips.ecs.soton.ac.uk/)
+
+Vips is a C library with a C++ layer. It has been designed for
+handling very large images, mainly in the context of research into
+paintings in museums like the National Gallery. It comes with a gtk2
+gui.
+
+Advantages:
+
+	- Handles very large images
+	- Handles colour models
+	- Handles different bit depths
+	- C++ interface
+
+Disadvantages:
+
+	- Not optimized for paintbox type apps (even though it is
+	  possible).
+	- Very large.
+
+* VXL (http://vxl.sourceforge.net/)
+
+VXL is a collection of small libraries that are used for compution
+vision and imaging purposes in an academic setting.
+
+Advantages:
+
+	- Handles very large images
+	- C++
+
+Disadvantages:
+
+	- Not recently updated
+	- Comes with its own core libraries that replace standard C++
+	- Optimized for simple rgb images.
+	- No license at all
+	- Badly documented
+
+* CImg (http://cimg.sourceforge.net/)
+
+CImg is a very cool, very small library that offers some extremely
+innovative image effects, like inpainting of damaged or noise images.
+
+Advantages:
+	
+	- Small
+	- GPL
+	- Cool stuff
+
+Disadvantages:
+
+	- Everything, including GUI stuff, in one header file.
+	- badly documented.
+
+
+* Gegl (http://www.gegl.org/)
+
+Gegl was intended to become the Gimp 2.0 core, but development had
+stalled so much that the move to Gegl didn't happen before Gimp 2.0.
+However, the Thawte millionaire whose name has escaped me, has
+promised to support gegl development financially, freeing the
+developer to work full-time on it. It is, more or less, an attempt to
+write a templated library in C++ with the help of a custom language to
+describe image operations.
+
+Advantages:
+	
+	- It's got money behind it
+	- Small
+	- Optimized for interactive use
+
+Disadvantages:
+
+	- Not finished yet
+	- C
+	- Complex hack around the fact that C is a low-level language
+
+* libart_lgpl (http://www.levien.com/libart/)
+
+Libart isn't really an image library, but rather a canvas that can be
+used to paint images on. It is optimized for vector graphics, and is
+used by Karbon to render tqshapes before display.
+
+Advantages:
+
+	- Raph Levien is really good at this stuff, so libart is
+	  quality
+
+Disadvantages:
+
+	- C
+	- It isn't an image library, really
+
+
+* java2D (http://java.sun.com/j2se/1.4.2/docs/guide/2d/index.html)
+
+
+Java2D is more or less complete library to write a paint app around.
+It offers image types, colour spaces, kernel convolutions and text.
+It's in Java, of course, and the free re-implementation is not done
+yet, and besides, is based around Cairo.
+
+Advantages:
+	
+	- Neat OO design
+	- Complete
+
+Disadvantages:
+
+	- Java
+	- Not free
+	- Has some legacy cruft.
+
+* ImageMagick/GraphicsMagick (http://imagemagick.org/, http://www.graphicsmagick.org/)
+
+GraphicsMagick is ImageMagick with a different license, and a
+focus on API stability. GM and IM now also differ slightly in terms of
+features offered. Chalk used to be based around IM (which can still be
+seen in many places in the code). The IM core was dropped in favour of
+the present core because it turned out that IM was not re-entrant,
+making it hard to use in an interactive application.
+
+Advantages:
+
+	- Mature
+	- C++ interface
+	- Full-featured
+	- RGB and CMYK (but not more)
+	- License compatible with Chalk
+	- Under active development
+
+Disadvantages:
+
+	- Bit-depth a compile-time option
+	- Not re-entrant: not optimized for interactive use.
+
+* Paintlib2 (http://www.paintlib.de/paintlib/)
+
+A portable (windows/Linux) library for image loading, manipulation and
+saving. The same kind of thing as IM/GM, but not quite as mature.
+
+Advantages:
+
+Disadvantages:
+ 	
+	- No support for larger bit depths per channel
+	- Windows (bmp) centric
+	- Development seems to have stopped in 2000
+
+
+* Antigrain (http://www.antigrain.com/)
+
+Antigrain is a graphics lib that specializes in high-quality anti-aliasing. It can be 
+useful to mine for algorithms, but is mainly a library to render vector data to bitmaps,
+just like libart or cairo.
+
+Advantages:
+
+	- High quality algorithms
+	- Completely free license.
+	- Colour-space agnostic
+
+Disadvantages:
+
+	- Not a complete 2D library
+	- self-admittedly complex and hard to use.
+	- No support for greater bit-depths.
+
+* The Visualization Toolkit (VTK, http://public.kitware.com/VTK/)
+
+A very big C++ library for 2d and 3d image processing and visualisation. It's
+too big to easily evaluate for me.
+
+Advantages
+	
+	- It is used in other Qt applications, like Julius
+	- Probably very good
+
+Disadvantages
+
+	- The book is very expensive
+	- Uses its own make equivalent, CMake
+	- Very large
+
+* Java Advanced Imaging
diff --git a/chalk/Makefile.am b/chalk/Makefile.am
new file mode 100644
index 000000000..246c5bb10
--- /dev/null
+++ b/chalk/Makefile.am
@@ -0,0 +1,47 @@
+INCLUDES  = $(KOFFICE_INCLUDES) $(KOPAINTER_INCLUDES) $(all_includes)
+
+## The common lib, shared between the part, the plugins, and the filters
+lib_LTLIBRARIES = libchalkcommon.la
+libchalkcommon_la_SOURCES = dummy.cc
+libchalkcommon_la_LDFLAGS = $(all_libraries) $(LIB_QT) -version-info 1:0 -no-undefined
+libchalkcommon_la_LIBADD = sdk/libchalksdk.la core/libchalkimage.la ui/libchalkui.la chalkcolor/libchalkcolor.la $(LCMS_LIBS) $(LIB_KOFFICEUI) $(LIB_KOPAINTER) $(LIB_KOPALETTE) $(LIB_XINPUTEXT)
+
+## The part
+kde_module_LTLIBRARIES = libchalkpart.la
+libchalkpart_la_SOURCES = chalk_part_init.cc
+libchalkpart_la_LDFLAGS = $(all_libraries) $(LIB_QT) -L../lib/kofficecore/.libs/ -lkofficecore -L../lib/kofficeui/.libs/ -lkofficeui -L../lib/store/.libs/ -lkstore -L../chalk/ui/.libs -lchalkui -module $(KDE_PLUGIN)
+libchalkpart_la_LIBADD = libchalkcommon.la
+
+METASOURCES = AUTO
+
+## The kdeinit loadable module and executable
+kdeinit_LTLIBRARIES = chalk.la
+bin_PROGRAMS =
+chalk_la_SOURCES = main.cc
+chalk_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT)
+chalk_la_LIBADD = $(LIB_KOFFICECORE)
+
+xdg_apps_DATA = chalk.desktop
+kdemimedir = $(kde_mimedir)/application
+
+rcdir = $(kde_datadir)/chalk
+rc_DATA = chalk.rc chalk_readonly.rc
+
+SUBDIRS = sdk chalkcolor core ui . dtd colorspaces plugins data pics 
+# Needed to compile libchalkcommon.la, which has no source files to itself
+# but everything in static libs.
+dummy.cc:
+	echo > dummy.cc
+
+messages: rc.cpp
+	$(EXTRACTRC) `find . -name \*.ui` >> rc.cpp
+	$(EXTRACTRC) `find . -name \*.rc` >> rc.cpp
+	perl extracti18n.pl > i18ndata
+	$(XGETTEXT) i18ndata rc.cpp `find . -name \*.cc -o -name \*.h -o -name \*.cpp` ui/kis_aboutdata.h -o $(podir)/chalk.pot
+	rm -f i18ndata
+
+DOXYGEN_EXCLUDE = CImg.h colorspaces plugins chalkcolor/colorspaces core/tiles
+include $(top_srcdir)/admin/Doxyfile.am
+
+kde_services_DATA = chalkpart.desktop
+
diff --git a/chalk/README b/chalk/README
new file mode 100644
index 000000000..6155f2773
--- /dev/null
+++ b/chalk/README
@@ -0,0 +1,13 @@
+Chalk
+
+Chalk is a paint application for bitmap images. It's also, according to
+the Dictionary of Phrase and Fable:
+
+The first of four Hindu periods contained in the great Yuga, when the
+genius of Truth and Right, in the form of bull, stood firm on his four
+feet, and man gained nothing by iniquity.
+
+In the Mahabharata, the name 'chalk' is used in a context where this
+can be translated with 'perfect' - the perfect age.
+
+Chalk is Swedish for chalk (or pencil?) and rita means "to write".
diff --git a/chalk/TODO b/chalk/TODO
new file mode 100644
index 000000000..7cd95e6b9
--- /dev/null
+++ b/chalk/TODO
@@ -0,0 +1,181 @@
+After 1.5 cleanups
+
+* Move core/ui class private members to d-pointers
+* Selections, adj. masks, wetness, heigh masks (all 8-bit mask ideas)
+  as sublayers to paint layers, and make them movable between layers
+  and x,y, toggle on/off.
+* Fix KisFilter::colorSpaceIndependence/worksWith overlap
+* Add api & gui to exclude channels from compositing
+* Add a mechanism for cspaces to start long-running filters when a paintdev
+  is created -- and a gui to turn that on and off, perhaps something analogous
+  to a channels box
+* Make set of filter categories extensible
+* BUG 121975: selections and group layers.
+* Add end poly entry to the popup menu when the poly tool is active (note:
+  make this more generically useful for tools. Great idea by David Herman
+* Paint direct should be paint directly
+          
+UI stuff:
+
+* color picker: top combo should be as wide as the whole widget; the widget is a bit too big,
+  we should try to make the listview a lot smaller. Maybe just use labels here?
+* The edit palette dialog two-step should be changed into a single dialog
+          
+Code organization
+
+Transform tool (CBR)
+
+	* Implement native integer versions for bell, bspline, lanczos3 and mitchell filters
+	* The option widget should be connected
+	* Figure out why scaling down produces sum of weights <255 (Hermite filter)
+	* Implement gui, create cursors and update visitor for shearing
+
+Integration
+
+	* A chalk document embedded in KWord has the wrong scaling and transparency
+	* A chalk document embedded in another document prints at the wrong place
+	* Embedded KOffice objects don't paint themselves correctly
+	* There is currently no kimgio module for Chalk images: implement one by
+	  saving a rendered png image into the chalk file and extracting that from
+	  kimgio. (Saving of a png image in .kra files is done; now we just need to 
+          add the kimgio file)
+        * There is no easy way to get back from editing an embedded document (if the image is larger
+          than the window)
+          
+Colorspace independence (found with the test colorstrategy)
+
+	* Check and double check the cms capabilities: especially the use of
+          profiles in the render/convert/edit paths.
+	* Merge grayscale layers back into one color image.
+    
+Core
+
+     * The fill painter (and perhaps other paitners, too) should call addDirtyRect, and the floodfill
+          tool should use that rect to blit and notify the image, instead of notifying the complete image.s
+	* Fix image resolution handling (zooming, pixel-for-pixel, 100% == zoomed to dpi/xdpi etc.)
+	* Loading and saving of selections
+	* Anti-aliased filling (requires some simple colorspace function to merge 2 Pixels)
+	* Load/save configuration of everything user-settable.
+	* Long painter operations (e.g., convolution painter) should use the
+          progressbar and be cancelable.
+    * Color adjustment filters seem to have a problem with partially selected pixels
+
+File Format:
+
+	* Save & load all annotations in .kra files
+	* Save & load more information, like PNG comments, gamma information, etc
+
+
+Import/Export
+
+    * Fix gimp XCF PSD and import/export (ImageMagick hacking...)
+	* Fix imports to import metadata.
+
+User Interface
+    * Add an explanatory textframe to the scaling filter combobox.
+    * Add a good crosshair cursor and a crosshair cursor that extends to the rulers.
+    * Add a cheatsheet widget that integrates with knewstuff to have tutorials that people
+      can download and follow from Chalk.
+    * Add opacity widget (One that grows more white or transparent (showing those gray blocks) based on the
+	  input)
+    * Add out-of-gamut selection
+    * Fix layout problems in tool option widgets.
+    * Disable dragging the toolbox from dock position to dock position (see Karbon)
+    * Disable all relevant actions when a layer is locked or invisible. See bug #90456. Show locked status of current layer in statusbar.
+    * Add link check to new image dialog to sync width and height
+    * The description field in color settings is empty
+    * Implement the following dialogs / widgets:
+		    - Variations (#Boudewijn)
+		    - Gradient: remove the autogradient dialog and make into a proper
+				gradient dialog, and allow saving gradients.
+
+    * Show which tool is associated with which pointer (mouse, stylus, eraser, other stylusses) In the statusbar.
+    * Allow guides to be disabled. Allow diagonal guides (useful for perspective drawings) Bug #108398
+    * Allow snapping to guides.
+    * Create templates for often-used image formats. Add save-as-template
+    * Add deselect with rmb -- maybe also selectable actions with other tools on rmb?
+    * Fix crop tool: when pressing shift, keep aspect ratio, implement gray mask.
+	  (Michael Thaler)
+    * Allow shape tools to be filled with gradients
+
+	Dockers
+		* Tabs in dockers drag-and-droppable (vector of docker
+		  windows, create new docker if tab dropped outside existing
+		  docker window)
+		* Add bird's eye view tab to dockers.
+		* Add action (macro) docker
+		* Add navigation/zoom docker
+		* Add history docker
+
+    * Doing a copy of a selection, but having the wrong layer selected gives 
+      me an empty selection (all transparent).  Pressing paste should say so 
+      (popup) instead of creating a new useless layer.
+    * the selection tools should allow pressing shift to go to 'substract' 
+      mode without adjusting the combobox for the current tool.  (a different 
+      pointer would be nice as well)
+
+    * Pressing save for the first time gives me the 'save document as' dialog 
+      which is set to 'png' as default file format.
+      I suggest to set the default format (in the "save as" dialog) to the chalk 
+      format for any image that has more then 1 layer.  
+
+
+Selections
+
+    * On shearing, the whole image is mirrored, not the selected
+	  bits.
+    * Add opacity slider to selection painting tools so you can
+          select something 50%.
+
+Profiles
+
+	* Add an input profile combobox to the import image & scan dialogs
+	* Add an export profile combobox to the export image/print dialogs
+    * Add loading and saving of profiles associated with images in .chalk 
+          files.
+    * Export profiles in tiff, png and jpg (this and the previous item
+      depend on ImageMagick or GraphicsMagick supporting this in some way.)
+    * Support out-of-gamut warning indications for parts of an image 
+      containing unprintable colours (no idea how to implement this). -> this
+      is pretty easy with lcms
+	* preferences dialog can show non-existent profile for the monitor profile -> confusing
+
+
+Tools
+
+	* Zoom tool should zoom out when alt is pressed. Show zoom-minus cursor in that case
+	* Implement the following tools or paintops: 
+		    - fix airbrush tool (add rate option, add increase
+		      of brush size if kept in one place)
+		    - color changer, smudge tool,sharpen tool, blur
+		      tool, dodge tool, burn tool, sponge tool (These
+		      last are perhaps more generally: painting with
+		      filters tool)
+		    - stamp tool (paint with patttern/image selection) (#Cyrille)
+		    - Text tool (use kotext with a transparent background here?)
+		    - Measure tool
+	            - calligraphic pen tool
+ 
+	* Pressure sensivitize all relevant tools (e.g. line tool)
+    * Add resize slider to freehand tools that resizes the mean brush size.
+	* Implement path tools (Michael Thaler?)
+	* Sumi-e brush tool
+	* Natural media tools (chalk, ink, oil, watercolour -- fun!)
+
+Plugins
+
+	* As many filters as possible :-)
+
+Modules
+
+	* Add color models for HSV, YUV etc.
+	* Add Wet & Sticky model (in progress already)
+	* Implement Curtiss et. al. for watercolour (Levien, wet dreams. In progress)
+	* The composite ops in RGB -> composite.h do not take mask into account
+	 - this goes for COPY and CLEAR in grayscale also
+
+Printing
+
+	* No use of the resolution parameter (but the resolution dialog is still only a .ui file and not implemented at all)
+	* Use gutenprint or something better for image printing.
+
diff --git a/chalk/UIcomments b/chalk/UIcomments
new file mode 100644
index 000000000..1b9242408
--- /dev/null
+++ b/chalk/UIcomments
@@ -0,0 +1,59 @@
+Color palettes ;
+
+You can drag a color from the preview swatches but it is changing the
+selected one at click and since dropping drops on the selected one, the 
+concept of duplicating the foreground to the background by dragging is 
+impossible.  I suggest to do selecting of foreground/background color on 
+mouse release instead.
+
+<BSAR: I don't understand this at all -- not sure what you're talking about.>
+
+Selections
+
+When you did a 'select all' and then create a selection nothing happens 
+since you can't select more then you already did.  For that reason I 
+suggest to make select all and deselect lead to a similar situation where 
+adding a selection or substracting one will be smart and do make the 
+result of that select or deselect visible.  In either case selecting a 
+part in both a fully selected and fully deselected image should lead to 
+the same result.
+
+<BSAR: not going to do this: in the next release, it will be
+always clear whether there's a selection because we're going to show it as a
+child layer. For now, determining whether the extent of a selection is as big
+as the extent of a layer, and whether the whole selection is completely 100%
+selected is going to be too expensive>
+
+
+Thomas Zander
+
+
+Missing tooltips (Carsten N.)
+
+LEGEND: NTAA No Tooltip At All
+ 
+Missing tooltips:
+ 
+KComboBox in the toolbar (the with 'Pixel Brush' for example)
+ 
+Overview-widget: NTAA
+ 
+Histogram: No Tooltip. Well, there is nothing but the histogram, there should be at least something...
+ 
+Context-Widgets of the tools:
+ 
+Star: NTAA
+ 
+Brush: NTAA
+ 
+Line: NTAA
+ 
+Rectangle: NTAA
+ 
+Ellispse: NTAA
+ 
+Polygone: NTAA
+ 
+Polyline: NTAA
+ 
+Duplicate Brush: NTAA
diff --git a/chalk/chalk.desktop b/chalk/chalk.desktop
new file mode 100644
index 000000000..e711f75bc
--- /dev/null
+++ b/chalk/chalk.desktop
@@ -0,0 +1,95 @@
+[Desktop Entry]
+Name=Chalk
+Name[hi]=के-रिता
+Name[km]= Chalk
+Name[lo]=ກຣິຕາ
+Name[ne]=क्रिता
+Exec=chalk %U
+DocPath=chalk/index.html
+Comment=Edit and paint images
+Comment[bg]=Редактиране и оцветяване на изображения
+Comment[ca]=Edita i pinta imatges
+Comment[da]=Redigér og mal billeder
+Comment[de]=Bilder zeichnen und bearbeiten
+Comment[el]=Επεξεργασία και ζωγραφική εικόνων
+Comment[eo]=Redakti kaj pentri bildojn
+Comment[es]=Editar y pintar imágenes
+Comment[et]=Piltide töötlemine ja joonistamine
+Comment[fa]=ویرایش و رنگ‌آمیزی تصاویر
+Comment[fi]=Muokkaa ja maalaa kuvia
+Comment[fr]=Création et retouche d'images
+Comment[fy]=Ofbyldings bewurkje en skilderje
+Comment[gl]=Edita e pinta imaxes
+Comment[he]=עריכה וצביעת תמונות
+Comment[hu]=Képek szerkesztése
+Comment[it]=Modifica e disegna immagini
+Comment[ja]=描画と画像の編集
+Comment[km]=កែសម្រួល និង​គូរ​រូបភាព
+Comment[lv]=Labot un zīmēt attēlus
+Comment[nb]=Rediger og mal bilder
+Comment[nds]=Biller malen un bewerken
+Comment[ne]=छविहरू सम्पादन र पेन्ट गर्नुहोस्
+Comment[nl]=Afbeeldingen bewerken en schilderen
+Comment[pl]=Edycja i tworzenie obrazków
+Comment[pt]=Editar e pintar as imagens
+Comment[pt_BR]=Editar e pintar as imagens
+Comment[ru]=Растровые рисунки
+Comment[se]=Doaimmat ja mále govaid
+Comment[sk]=Editivať a maľovať obrázky
+Comment[sl]=Urejajte in ustvarjajte slike
+Comment[sr]=Уређујте и правите слике
+Comment[sr@Latn]=Uređujte i pravite slike
+Comment[sv]=Redigera och måla bilder
+Comment[uk]=Створення і редагування зображень
+Comment[uz]=Rasm bilan ishlash dasturi
+Comment[uz@cyrillic]=Расм билан ишлаш дастури
+Comment[zh_TW]=編輯與畫圖片
+GenericName=Painting and Image Editing
+GenericName[bg]=Редактор на графични изображения
+GenericName[ca]=Programa d'edició d'imatges
+GenericName[da]=Maling & billedredigering
+GenericName[de]=Mal- und Bildbearbeitungsprogramm
+GenericName[el]=Επεξεργασία και ζωγραφική εικόνων
+GenericName[eo]=Pentrado kaj Bildredaktado
+GenericName[es]=Pintura y edición de imágenes
+GenericName[et]=Joonistamine ja pilditöötlus
+GenericName[fa]=رنگ‌آمیزی و ویرایش تصویر
+GenericName[fi]=Maalaus ja kuvankäsittely
+GenericName[fr]=Peinture et retouche d'images
+GenericName[fy]=Ofbyldingsmanupilaasje
+GenericName[ga]=Péinteáil agus Eagarthóireacht Íomhánna
+GenericName[gl]=Debuxo e Edición de Imaxes
+GenericName[he]=טיפול ועריכת תמונות
+GenericName[hu]=Rajzoló és képszerkesztő
+GenericName[is]=Málun og myndsýsl
+GenericName[it]=Disegno e modifica di immagini
+GenericName[ja]=描画と画像編集
+GenericName[km]=គូរ​គំនូរ និង​កែសម្រួល​រូបភាព
+GenericName[lv]=Zīmēšana un attēlu apstrāde
+GenericName[nb]=Program for maling og bilderedigering
+GenericName[nds]=Malen un Biller bewerken
+GenericName[ne]=पेन्टिङ्ग र छवि सम्पादन
+GenericName[nl]=Afbeeldingsmanipulatie
+GenericName[pl]=Edycja zdjęć oraz rysunków
+GenericName[pt]=Pintura e Manipulação de Imagens
+GenericName[pt_BR]=Pintura e Edição de Imagens
+GenericName[ru]=Растровые изображения
+GenericName[se]=Málen- ja govvagieđaheapmi
+GenericName[sk]=Program pre úpravu a maľovanie obrázkov
+GenericName[sl]=Slikanje in urejanje slik
+GenericName[sr]=Цртање и уређивање слика
+GenericName[sr@Latn]=Crtanje i uređivanje slika
+GenericName[sv]=Målning och bildredigering
+GenericName[uk]=Малювання і редагування зображень
+GenericName[uz]=Rasmlar bilan ishlaydigan dastur
+GenericName[uz@cyrillic]=Расмлар билан ишлайдиган дастур
+GenericName[zh_CN]=绘图和图像编辑
+GenericName[zh_TW]=繪圖與影像編輯
+MimeType=application/x-chalk
+Type=Application
+Icon=chalk
+Categories=Qt;KDE;Graphics;
+X-KDE-NativeMimeType=application/x-chalk
+X-KDE-StartupNotify=true
+X-DCOP-ServiceType=Multi
+X-Chalk-Version=2
diff --git a/chalk/chalk.rc b/chalk/chalk.rc
new file mode 100644
index 000000000..323ef2f54
--- /dev/null
+++ b/chalk/chalk.rc
@@ -0,0 +1,199 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd" ><kpartgui name="Chalk" version="15">
+
+<MenuBar>
+ <Menu name="Edit"><text>&amp;Edit</text>
+  <Action name="koffice_undo"/>
+  <Action name="koffice_redo"/>
+  <Separator/>
+  <Action name="cut"/>
+  <Action name="copy"/>
+  <Action name="copy_merged"/>
+  <Action name="paste"/>
+  <Action name="paste_new"/>
+  <Action name="clear"/>
+  <Action name="fill_selection_foreground_color"/>
+  <Action name="fill_selection_background_color"/>
+  <Action name="fill_selection_pattern"/>
+  <Separator/>
+  <Action name="revert"/>
+  <Separator/>
+  <Menu name="Resources"><text>&amp;Resources</text>
+   <Action name="add_palette"/>
+   <Action name="edit_palette"/>
+  </Menu>
+ </Menu>
+
+ <Menu name="View"><text>&amp;View</text>
+  <Action name="fullscreen"/>
+  <Separator/>
+  <Action name="view_newview"/>
+  <ActionList name="view_closeallviews"/>
+  <Separator/>
+  <ActionList name="view_split"/>
+  <Action name="zoom_in"/>
+  <Action name="zoom_out"/>
+  <Action name="actual_pixels"/>
+  <Action name="actual_size"/>
+  <Action name="fit_to_canvas"/>
+  <Separator/>
+  <Action name="view_ruler"/>
+  <!--Action name="view_guidelines"/-->
+  <Separator/>
+  <Action name="view_toggle_grid" />
+  <Menu name="view_fast_grid_config"><text>Grid Spacing</text>
+   <Action name="view_fast_grid_1x1" />
+   <Action name="view_fast_grid_2x2" />
+   <Action name="view_fast_grid_5x5" />
+   <Action name="view_fast_grid_10x10" />
+   <Action name="view_fast_grid_20x20" />
+   <Action name="view_fast_grid_40x40" />
+  </Menu>
+  <Seperator/>
+  <Action name="view_toggle_perspective_grid" />
+  <Action name="view_clear_perspective_grid" />
+  <Separator/>
+  <Action name="view_palette_action_menu"/>
+  <Separator/>
+  <Action name="refresh_canvas"/>
+ </Menu>
+
+
+<Menu name="Image"><text>&amp;Image</text>
+  <Action name="img_properties"/>
+  <Action name="resizeimgtolayer"/>
+  <Action name="duplicate_image"/>
+</Menu>
+
+<Menu name="Layer"><text>&amp;Layer</text>
+  <Menu name="LayerNew"><text>New</text>
+  	<Action name="insert_layer"/>
+	<Action name="insert_part_layer"/>
+        <Action name="insert_adjustment_layer"/>
+  	<Action name="insert_image_as_layer"/>
+  	<Action name="cut_selection_to_new_layer"/>
+  	<Action name="copy_selection_to_new_layer"/>
+  </Menu>	
+  <Action name="remove_layer"/>
+  <Action name="duplicate_layer"/>
+  <Action name="hide_layer"/>
+  <Action name="link_layer"/>
+  <Separator/>
+  <Menu name="LayerNew"><text>Mask</text>
+    <Action name="create_mask"/>
+    <Action name="mask_fromsel"/>
+    <Action name="mask_tosel"/>
+    <Action name="apply_mask"/>
+    <Action name="remove_mask"/>
+    <Seperator/>
+    <Action name="edit_mask"/>
+    <Action name="show_mask"/>
+  </Menu>
+  <Separator/>
+  <Action name="raiselayer"/>
+  <Action name="lowerlayer"/>
+  <Action name="toplayer"/>
+  <Action name="bottomlayer"/>
+  <Separator/>
+  <Action name="resizelayertoowner"/>
+  <Separator/>
+  <Action name="save_layer_as_image"/>
+  <Action name="layer_to_image"/>
+<Separator/>
+  <Action name="mirrorLayerX"/>
+  <Action name="mirrorLayerY"/>
+  <Separator/>
+  <Action name="layer_properties"/>
+  <Separator/>
+  <Action name="merge_layer"/>
+  <Action name="flatten_image"/>
+</Menu>
+
+
+<Menu name="Select"><text>Sele&amp;ct</text>
+    <Action name="select_all"/>
+    <Action name="deselect"/>
+    <Action name="reselect"/>
+    <Action name="invert"/>
+    <Separator/>
+    <Action name="feather"/>
+   <Action name = "grow"/>
+   <Action name = "similar"/>
+   <Separator/>
+   <Action name="toggle_display_selection"/>
+</Menu>
+
+<Menu name="Filter"><text>Filte&amp;r</text>
+	<Action name="filter_apply_again"/>
+	<Separator/>
+    <Action name="adjust_filters"/>
+	<Action name="artistic_filters"/>
+	<Action name="blur_filters"/>
+	<Action name="color_filters"/>
+	<Action name="decor_filters"/>
+	<Action name="edge_filters"/>
+	<Action name="enhance_filters"/>
+	<Action name="emboss_filters"/>
+    <Action name="map_filters"/>
+    <Action name="nonphotorealistic_filters"/>
+	<Action name="misc_filters"/>
+</Menu>
+
+<Menu name="Tools"><text>&amp;Tools</text>
+</Menu>
+
+
+<Menu name="settings"><text>Settings</text>
+  <Separator group="settings_show"/>
+  <Action name="preferences" group="settings_configure"/>
+</Menu>
+
+</MenuBar>
+
+<ToolBar name="edit_toolbar" position="top"><Text>Edit</Text>
+  <Action name="koffice_undo"/>
+  <Action name="koffice_redo"/>
+  <Separator/>
+  <Action name="cut"/>
+  <Action name="copy"/>
+  <Action name="remove"/>
+  <Action name="scrap_selection"/>
+  <Action name="paste_special"/>
+</ToolBar>
+
+<ToolBar name="navigation" position="top"><Text>Navigation</Text>
+  <Action name="refresh_canvas"/>
+  <Action name="zoom_in"/>
+  <Action name="zoom_out"/>
+</ToolBar>
+
+<ToolBar name="ToolBox" position="left">
+    <Text>Chalk</Text>
+</ToolBar>
+
+<ToolBar name="BrushesAndStuff" position="top">
+     <Text>Brushes and Stuff</Text>
+     <Action name="brushes"/>
+     <Action name="gradients"/>
+     <Action name="patterns"/>
+     <Separator/>
+     <Action name="paintops"/>
+     <Action name="paintop_options"/>
+</ToolBar>
+
+<Menu name="image_popup">
+ <Action name="select_all"/>
+ <Action name="deselect"/>
+ <Action name="invert"/>
+ <Separator/>
+ <Action name="duplicate_layer"/>
+ <Separator/>
+ <Action name="koffice_undo"/>
+ <Action name="koffice_redo"/>
+ <Separator/>
+ <Action name="cut"/>
+ <Action name="copy"/>
+ <Action name="paste"/>
+ <Action name="paste_new"/>
+</Menu>
+
+</kpartgui>
diff --git a/chalk/chalk_part_init.cc b/chalk/chalk_part_init.cc
new file mode 100644
index 000000000..b56919749
--- /dev/null
+++ b/chalk/chalk_part_init.cc
@@ -0,0 +1,23 @@
+/*
+ *  kis_part_init.cc - part of Krayon
+ *
+ *  Copyright (c) 1999 Matthias Elter <elter@kde.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "ui/kis_factory.h"
+
+
+K_EXPORT_COMPONENT_FACTORY( libchalkpart, KisFactory )
diff --git a/chalk/chalk_readonly.rc b/chalk/chalk_readonly.rc
new file mode 100644
index 000000000..bfe8a233e
--- /dev/null
+++ b/chalk/chalk_readonly.rc
@@ -0,0 +1,35 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd" ><kpartgui name="Chalk" version="1">
+
+<MenuBar>
+ <Menu name="edit"><text>Edit</text>
+  <Separator/>
+  <Action name="copy"/>
+  <Separator/>
+  <Action name="select_all"/>
+  <Action name="select_none"/>
+  <Action name="flip_selection"/>  
+ </Menu>
+
+ <Menu name="view"><text>View</text>
+  <Action name="zoom_in"/>
+  <Action name="zoom_out"/>
+ </Menu>
+
+<Menu name="Layer"><text>Layer</text>
+  <Action name="hide_layer"/>
+  <Action name="previous_layer"/>  
+  <Action name="next_layer"/>
+</Menu>
+
+</MenuBar>
+
+<ToolBar name="edit" position="top"><Text>Edit</Text>
+  <Action name="copy"/>
+</ToolBar>
+
+<ToolBar name="navigation" position="top"><Text>Navigation</Text>
+  <Action name="zoom_in"/>
+  <Action name="zoom_out"/>
+</ToolBar>
+
+</kpartgui>
diff --git a/chalk/chalkcolor/Makefile.am b/chalk/chalkcolor/Makefile.am
new file mode 100644
index 000000000..9ec16a40c
--- /dev/null
+++ b/chalk/chalkcolor/Makefile.am
@@ -0,0 +1,45 @@
+# all_includes must remain last!
+INCLUDES  = $(KOFFICE_INCLUDES) \
+    -I$(srcdir) \
+    -I$(srcdir)/../sdk \
+    -I$(srcdir)/colorspaces \
+    $(OPENEXR_CFLAGS) \
+    $(all_includes)
+
+lib_LTLIBRARIES = libchalkcolor.la
+
+if have_openexr
+OPENEXR_SOURCES=kis_f16half_base_colorspace.cc
+endif
+
+libchalkcolor_la_SOURCES = kis_color.cc kis_colorspace.cc \
+	kis_colorspace_iface.cc kis_colorspace_iface.skel kis_composite_op.cc kis_profile.cc \
+	kis_histogram_producer.cc kis_basic_histogram_producers.cc kis_abstract_colorspace.cc \
+	kis_colorspace_factory_registry.cc kis_color_conversions.cc kis_u8_base_colorspace.cc \
+	kis_u16_base_colorspace.cc kis_f32_base_colorspace.cc $(OPENEXR_SOURCES)
+
+libchalkcolor_la_LDFLAGS = -version-info 1:0:0 -no-undefined $(all_libraries)
+libchalkcolor_la_LIBADD  = colorspaces/libchalkcolorspaces.la $(LCMS_LIBS) $(LIB_KPARTS) $(LIB_KDECORE) $(LIB_QT) $(OPENEXR_LIBS)
+
+include_HEADERS =  \
+    kis_channelinfo.h \
+    kis_color.h \
+    kis_colorspace.h \
+    kis_composite_op.h \
+    kis_profile.h \
+    kis_histogram_producer.h \
+    kis_basic_histogram_producers.h kis_u8_base_colorspace.h kis_u16_base_colorspace.h kis_f16half_base_colorspace.h kis_f32_base_colorspace.h \
+    kis_colorspace_factory_registry.h kis_abstract_colorspace.h
+
+
+if include_kunittest_tests
+TESTSDIR = tests
+endif
+
+SUBDIRS = colorspaces . $(TESTSDIR)
+
+kde_servicetypes_DATA =  chalk_colorspace.desktop
+
+METASOURCES = AUTO
+
+
diff --git a/chalk/chalkcolor/README b/chalk/chalkcolor/README
new file mode 100644
index 000000000..f80e05209
--- /dev/null
+++ b/chalk/chalkcolor/README
@@ -0,0 +1,4 @@
+The color library is a wrapper around lcms and provides colorspaces
+that can do things to arrays of bytes that represent pixels. The
+number of colorspaces is extensible with plugins. The colorspace
+registry is responsible for loading the colorspace plugins.
diff --git a/chalk/chalkcolor/TODO b/chalk/chalkcolor/TODO
new file mode 100644
index 000000000..81bc56c16
--- /dev/null
+++ b/chalk/chalkcolor/TODO
@@ -0,0 +1,11 @@
+This library is still dependent upon chalk/sdk for some headers. This
+should be changed. The headers concerned are:
+
+kis_id.h
+kis_global.h
+kis_annotation.h
+kis_integer_maths.h
+
+Additionally, there is a problem with the histogram producers: those are
+tied to the individual base colorspaces, but also need iterators, so they
+are in core for the moment.
diff --git a/chalk/chalkcolor/chalk_colorspace.desktop b/chalk/chalkcolor/chalk_colorspace.desktop
new file mode 100644
index 000000000..7379a273a
--- /dev/null
+++ b/chalk/chalkcolor/chalk_colorspace.desktop
@@ -0,0 +1,38 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=Chalk/ColorSpace
+Comment=A module implementing a complete colorspace for use with libchalkcolor
+Comment[bg]=Модул, реализиращ пълна цветова гама за употреба с libchalkcolor
+Comment[ca]=Un mòdul que implementa un complet espai de colors per a usar-lo amb libchalkcolor
+Comment[cy]=Modiwl sy'n gweithredoli gofod lliw cyflawn i'w ddefnyddio efo libchalkcolor
+Comment[da]=Et modul som implementerer et fuldstændigt farverum til brug med libchalkcolor
+Comment[de]=Ein Modul, das einen kompletten Farbraum zur Benutzung mit libchalkcolor implementiert
+Comment[el]=Ένα άρθρωμα που υλοποιεί έναν πλήρη χρωματικό χώρο για χρήση με το libchalkcolor
+Comment[en_GB]=A module implementing a complete colourspace for use with libchalkcolor
+Comment[es]=Un módulo que implementa un espacio de color completo para usar con libchalkcolor
+Comment[et]=Täielikku värviruumi teostav moodul (teegile libchalkcolor)
+Comment[fa]=پیمانه‌ای که فضای رنگ کاملی برای استفاده با libchalkcolor پیاده می‌کند
+Comment[fr]=Un module implantant un espace de couleurs complet à utiliser avec libchalkcolor
+Comment[fy]=In module dy in folslein kleurgebiet ymplementearret dat brûkt wurde kin mei libchalkcolor
+Comment[gl]=Un módulo que implemente un espazo de cor completo para usar con libchalkcolor
+Comment[hu]=Teljes színteret megvalósító modul a libchalkcolor programkönyvtárhoz
+Comment[is]=Eining með fullu litasvæði til notkunar með libchalkcolor
+Comment[it]=Un modulo che implementa uno spazio dei colori completo per usarlo con libchalkcolor
+Comment[km]=ម៉ូឌុល​ដែល​អនុវត្ត​ប្រភេទ​ពណ៌​ពេញលេញ ដើម្បី​ប្រើ​ជាមួយ libchalkcolor
+Comment[nb]=En modul som implementerer et komplett fargerom til bruk med libchalkcolor
+Comment[nds]=En Moduul, dat en helen Klörenruum för den Bruuk mit libchalkcolor inbuut
+Comment[ne]=लिबक्रितारङसँग प्रयोग गर्नका लागि सम्पूर्ण रङ खालीस्थानलाई मोड्युललाई औजार बनाइदै
+Comment[nl]=Een module die een volledig kleurgebied implementeert dat gebruikt kan worden met libchalkcolor
+Comment[pl]=Moduł implementujący kompletną przestrzeń barw do użytku z libchalkcolor
+Comment[pt]=Um módulo que implementa um espaço de cores completo para usar com a 'libchalkcolor'
+Comment[pt_BR]=Um módulo que implementa um espaço de cores completo para usar com a 'libchalkcolor'
+Comment[ru]=Полная поддержка цветовых пространств в libchalkcolor
+Comment[sk]=Modul ktorý poskytuje úplný farebný priestor pre použitie s libchalkcolor
+Comment[sl]=Modul, v katerem je izveden celoten barvni prostor za uporabo z libchalkcolor
+Comment[sr]=Модул који имплементира потпун простор боја за употребу са libchalkcolor
+Comment[sr@Latn]=Modul koji implementira potpun prostor boja za upotrebu sa libchalkcolor
+Comment[sv]=En modul som implementerar en fullständig färgrymd för användning med libchalkcolor
+Comment[uk]=Модуль впровадження повного простору кольорів для вжитку з libchalkcolor
+Comment[zh_TW]=實作完整色彩空間以使用 libchalkcolor 的模組
+[PropertyDef::X-Chalk-Version]
+Type=int
diff --git a/chalk/chalkcolor/colorspaces/Makefile.am b/chalk/chalkcolor/colorspaces/Makefile.am
new file mode 100644
index 000000000..90f75d290
--- /dev/null
+++ b/chalk/chalkcolor/colorspaces/Makefile.am
@@ -0,0 +1,20 @@
+INCLUDES  = -I$(srcdir)/.. \
+	-I$(srcdir)/../../sdk \
+	$(KOFFICE_INCLUDES) \
+	 $(all_includes)
+
+noinst_LTLIBRARIES = libchalkcolorspaces.la
+
+libchalkcolorspaces_la_SOURCES = \
+	kis_alpha_colorspace.cc \
+	kis_lab_colorspace.cc 
+
+noinst_HEADERS = \
+    kis_alpha_colorspace.h  \
+    kis_lab_colorspace.h
+
+libchalkcolorspaces_la_LIBADD = $(OPENEXR_LIBS)
+
+libchalkcolorspaces_la_METASOURCES = AUTO
+
+
diff --git a/chalk/chalkcolor/colorspaces/kis_alpha_colorspace.cc b/chalk/chalkcolor/colorspaces/kis_alpha_colorspace.cc
new file mode 100644
index 000000000..4b54556f2
--- /dev/null
+++ b/chalk/chalkcolor/colorspaces/kis_alpha_colorspace.cc
@@ -0,0 +1,296 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <limits.h>
+#include <stdlib.h>
+
+#include <tqimage.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include <config.h>
+
+#include LCMS_HEADER
+
+#include "kis_alpha_colorspace.h"
+#include "kis_u8_base_colorspace.h"
+#include "kis_channelinfo.h"
+#include "kis_id.h"
+#include "kis_integer_maths.h"
+
+namespace {
+    const TQ_UINT8 PIXEL_MASK = 0;
+}
+
+KisAlphaColorSpace::KisAlphaColorSpace(KisColorSpaceFactoryRegistry * tqparent,
+                                       KisProfile *p) :
+    KisU8BaseColorSpace(KisID("ALPHA", i18n("Alpha tqmask")),  TYPE_GRAY_8, icSigGrayData, tqparent, p)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), 0, KisChannelInfo::ALPHA, KisChannelInfo::UINT8));
+    m_alphaPos = 0;
+}
+
+KisAlphaColorSpace::~KisAlphaColorSpace()
+{
+}
+
+void KisAlphaColorSpace::fromTQColor(const TQColor& /*c*/, TQ_UINT8 *dst, KisProfile * /*profile*/)
+{
+    dst[PIXEL_MASK] = OPACITY_OPAQUE;
+}
+
+void KisAlphaColorSpace::fromTQColor(const TQColor& /*c*/, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * /*profile*/)
+{
+    dst[PIXEL_MASK] = opacity;
+}
+
+void KisAlphaColorSpace::getAlpha(const TQ_UINT8 *pixel, TQ_UINT8 *alpha) const
+{
+    *alpha = *pixel;
+}
+
+void KisAlphaColorSpace::toTQColor(const TQ_UINT8 */*src*/, TQColor *c, KisProfile * /*profile*/)
+{
+    c->setRgb(255, 255, 255);
+}
+
+void KisAlphaColorSpace::toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * /*profile*/)
+{
+    c->setRgb(255, 255, 255);
+    *opacity = src[PIXEL_MASK];
+}
+
+TQ_UINT8 KisAlphaColorSpace::difference(const TQ_UINT8 *src1, const TQ_UINT8 *src2)
+{
+    // Arithmetic operands smaller than int are converted to int automatically
+    return TQABS(src2[PIXEL_MASK] - src1[PIXEL_MASK]);
+}
+
+void KisAlphaColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    if (nColors > 0) {
+        TQ_UINT32 total = 0;
+
+        while(nColors)
+        {
+            nColors--;
+            total += *colors[nColors] * weights[nColors];
+        }
+        *dst = total / 255;
+    }
+}
+
+TQValueVector<KisChannelInfo *> KisAlphaColorSpace::channels() const
+{
+    return m_channels;
+}
+
+bool KisAlphaColorSpace::convertPixelsTo(const TQ_UINT8 *src,
+                     TQ_UINT8 *dst, KisAbstractColorSpace * dstColorSpace,
+                     TQ_UINT32 numPixels,
+                     TQ_INT32 /*renderingIntent*/)
+{
+    // No lcms trickery here, we are only a opacity channel
+    TQ_INT32 size = dstColorSpace->pixelSize();
+
+    TQ_UINT32 j = 0;
+    TQ_UINT32 i = 0;
+
+    while ( i < numPixels ) {
+
+        dstColorSpace->fromTQColor(TQt::red, OPACITY_OPAQUE - *(src + i), (dst + j));
+
+        i += 1;
+        j += size;
+
+    }
+    return true;
+
+}
+
+
+//XXX bitblt of ColorSpaceAlpha does not take tqmask into consideration as this is probably not
+// used ever
+void KisAlphaColorSpace::bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dststride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op)
+{
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+     TQ_INT32 i;
+    TQ_INT32 linesize;
+
+    if (rows <= 0 || cols <= 0)
+        return;
+    switch (op.op()) {
+    case COMPOSITE_COPY:
+        compositeCopy(dst, dststride, src, srcRowStride, srcAlphaMask, tqmaskRowStride, rows, cols, opacity);
+        return;
+    case COMPOSITE_CLEAR:
+        linesize = sizeof(TQ_UINT8) * cols;
+        d = dst;
+        while (rows-- > 0) {
+            memset(d, OPACITY_TRANSPARENT, linesize);
+            d += dststride;
+        }
+        return;
+    case COMPOSITE_ERASE:
+        while (rows-- > 0) {
+            d = dst;
+            s = src;
+
+            for (i = cols; i > 0; i--, d ++, s ++) {
+                if (d[PIXEL_MASK] < s[PIXEL_MASK]) {
+                    continue;
+                }
+                else {
+                    d[PIXEL_MASK] = s[PIXEL_MASK];
+                }
+
+            }
+
+            dst += dststride;
+            src += srcRowStride;
+        }
+        return;
+    case COMPOSITE_SUBTRACT:
+        while (rows-- > 0) {
+            d = dst;
+            s = src;
+
+            for (i = cols; i > 0; i--, d++, s++) {
+                if (d[PIXEL_MASK] <= s[PIXEL_MASK]) {
+                    d[PIXEL_MASK] = MIN_SELECTED;
+                } else {
+                    d[PIXEL_MASK] -= s[PIXEL_MASK];
+                }
+            }
+
+            dst += dststride;
+            src += srcRowStride;
+        }
+        return;
+    case COMPOSITE_ALPHA_DARKEN: 
+        while (rows-- > 0) {
+            d = dst;
+            s = src;
+            for (i = cols; i > 0; i--, d++, s++) {
+                if (s[PIXEL_MASK] == OPACITY_TRANSPARENT)
+                    continue;
+                int srcAlpha = (s[PIXEL_MASK] * opacity + UINT8_MAX / 2) / UINT8_MAX;
+                if (srcAlpha > d[PIXEL_MASK])
+                    d[PIXEL_MASK] = srcAlpha;
+            }
+            dst += dststride;
+            src += srcRowStride;
+        }
+        return;
+    case COMPOSITE_OVER:
+    default:
+        if (opacity == OPACITY_TRANSPARENT)
+            return;
+        if (opacity != OPACITY_OPAQUE) {
+            while (rows-- > 0) {
+                d = dst;
+                s = src;
+                for (i = cols; i > 0; i--, d++, s++) {
+                    if (s[PIXEL_MASK] == OPACITY_TRANSPARENT)
+                        continue;
+                    int srcAlpha = (s[PIXEL_MASK] * opacity + UINT8_MAX / 2) / UINT8_MAX;
+                    d[PIXEL_MASK] = (d[PIXEL_MASK] * (UINT8_MAX - srcAlpha) + srcAlpha * UINT8_MAX + UINT8_MAX / 2) / UINT8_MAX;
+                }
+                dst += dststride;
+                src += srcRowStride;
+            }
+        }
+        else {
+            while (rows-- > 0) {
+                d = dst;
+                s = src;
+                for (i = cols; i > 0; i--, d++, s++) {
+                    if (s[PIXEL_MASK] == OPACITY_TRANSPARENT)
+                        continue;
+                    if (d[PIXEL_MASK] == OPACITY_TRANSPARENT || s[PIXEL_MASK] == OPACITY_OPAQUE) {
+                        memcpy(d, s, 1);
+                        continue;
+                    }
+                    int srcAlpha = s[PIXEL_MASK];
+                    d[PIXEL_MASK] = (d[PIXEL_MASK] * (UINT8_MAX - srcAlpha) + srcAlpha * UINT8_MAX + UINT8_MAX / 2) / UINT8_MAX;
+                }
+                dst += dststride;
+                src += srcRowStride;
+            }
+        }
+
+    }
+}
+
+KisCompositeOpList KisAlphaColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+
+    return list;
+}
+
+TQString KisAlphaColorSpace::channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < nChannels());
+    TQ_UINT32 channelPosition = m_channels[channelIndex]->pos();
+
+    return TQString().setNum(pixel[channelPosition]);
+}
+
+TQString KisAlphaColorSpace::normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < nChannels());
+    TQ_UINT32 channelPosition = m_channels[channelIndex]->pos();
+
+    return TQString().setNum(static_cast<float>(pixel[channelPosition]) / UINT8_MAX);
+}
+
+
+void KisAlphaColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const
+{
+    TQ_INT32 totalAlpha = 0;
+
+    while (nColors--)
+    {
+        TQ_INT32 weight = *kernelValues;
+
+        if (weight != 0) {
+            totalAlpha += (*colors)[PIXEL_MASK] * weight;
+        }
+        colors++;
+        kernelValues++;
+    }
+
+    if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+        dst[PIXEL_MASK] = CLAMP((totalAlpha/ factor) + offset, 0, TQ_UINT8_MAX);
+    }
+}
diff --git a/chalk/chalkcolor/colorspaces/kis_alpha_colorspace.h b/chalk/chalkcolor/colorspaces/kis_alpha_colorspace.h
new file mode 100644
index 000000000..dd4f39163
--- /dev/null
+++ b/chalk/chalkcolor/colorspaces/kis_alpha_colorspace.h
@@ -0,0 +1,93 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_COLORSPACE_ALPHA_H_
+#define KIS_COLORSPACE_ALPHA_H_
+
+#include <tqcolor.h>
+
+#include "kis_global.h"
+#include "kis_u8_base_colorspace.h"
+
+/**
+ * The alpha tqmask is a special color strategy that treats all pixels as
+ * alpha value with a colour common to the tqmask. The default color is white.
+ */
+class KisAlphaColorSpace : public KisU8BaseColorSpace {
+public:
+    KisAlphaColorSpace(KisColorSpaceFactoryRegistry * tqparent,
+                       KisProfile *p);
+    virtual ~KisAlphaColorSpace();
+
+public:
+    virtual bool willDegrade(ColorSpaceIndependence)
+        {
+            return false;
+        };
+
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile * profile = 0);
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * profile = 0);
+
+    virtual void getAlpha(const TQ_UINT8 *pixel, TQ_UINT8 *alpha) const;
+
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * profile = 0);
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile = 0);
+
+    virtual TQ_UINT8 difference(const TQ_UINT8 *src1, const TQ_UINT8 *src2);
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const { return 1; };
+    virtual TQ_UINT32 nColorChannels() const { return 0; };
+    virtual TQ_UINT32 pixelSize() const { return 1; };
+
+    virtual TQString channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+    virtual TQString normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
+
+protected:
+
+    /**
+     * Convert a byte array of srcLen pixels *src to the specified color space
+     * and put the converted bytes into the prepared byte array *dst.
+     *
+     * Returns false if the conversion failed, true if it succeeded
+     */
+    virtual bool convertPixelsTo(const TQ_UINT8 *src,
+                     TQ_UINT8 *dst, KisAbstractColorSpace * dstColorSpace,
+                     TQ_UINT32 numPixels,
+                     TQ_INT32 renderingIntent = INTENT_PERCEPTUAL);
+
+
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dststride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+    KisCompositeOpList userVisiblecompositeOps() const;
+
+};
+
+#endif // KIS_COLORSPACE_ALPHA_H_
diff --git a/chalk/chalkcolor/colorspaces/kis_lab_colorspace.cc b/chalk/chalkcolor/colorspaces/kis_lab_colorspace.cc
new file mode 100644
index 000000000..829b4f273
--- /dev/null
+++ b/chalk/chalkcolor/colorspaces/kis_lab_colorspace.cc
@@ -0,0 +1,571 @@
+ /*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <limits.h>
+#include <stdlib.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_lab_colorspace.h"
+#include "kis_color_conversions.h"
+#include "kis_integer_maths.h"
+
+KisLabColorSpace::KisLabColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p)
+    : KisU16BaseColorSpace(KisID("LABA", i18n("L*a*b* (16-bit integer/channel)")),
+        COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(2)|EXTRA_SH(1),
+         icSigLabData, tqparent, p)
+
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Lightness"), i18n("L"), CHANNEL_L * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16), TQColor(100,100,100)));
+    m_channels.push_back(new KisChannelInfo(i18n("a*"), i18n("a"), CHANNEL_A * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16), TQColor(150,150,150)));
+    m_channels.push_back(new KisChannelInfo(i18n("b*"), i18n("b"), CHANNEL_B * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16), TQColor(200,200,200)));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), CHANNEL_ALPHA * sizeof(TQ_UINT16), KisChannelInfo::ALPHA, KisChannelInfo::UINT16, sizeof(TQ_UINT16)));
+
+    m_alphaPos = CHANNEL_ALPHA * sizeof(TQ_UINT16);
+
+    init();
+}
+
+KisLabColorSpace::~KisLabColorSpace()
+{
+}
+
+TQ_UINT8 * KisLabColorSpace::toLabA16(const TQ_UINT8 * data, const TQ_UINT32 nPixels) const
+{
+    TQ_UINT8 * pixels = new TQ_UINT8[nPixels * pixelSize()];
+    memcpy( pixels,  data,  nPixels * pixelSize() );
+    return pixels;
+}
+
+TQ_UINT8 * KisLabColorSpace::fromLabA16(const TQ_UINT8 * labData, const TQ_UINT32 nPixels) const
+{
+    TQ_UINT8 * pixels = new TQ_UINT8[nPixels * pixelSize()];
+    memcpy( pixels, labData,  nPixels * pixelSize() );
+    return pixels;
+}
+
+TQ_UINT8 KisLabColorSpace::difference(const TQ_UINT8 *src1, const TQ_UINT8 *src2)
+{
+    cmsCIELab labF1, labF2;
+
+    if (getAlpha(src1) == OPACITY_TRANSPARENT || getAlpha(src2) == OPACITY_TRANSPARENT)
+        return (getAlpha(src1) == getAlpha(src2) ? 0 : 255);
+
+    cmsLabEncoded2Float(&labF1, (WORD *)src1);
+    cmsLabEncoded2Float(&labF2, (WORD *)src2);
+    double diff = cmsDeltaE(&labF1, &labF2);
+    if(diff>255)
+        return 255;
+    else
+        return TQ_INT8(diff);
+}
+
+void KisLabColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    TQ_UINT32 totalLightness = 0, totalAlpha = 0;
+    TQ_UINT32 totala = 0, totalb = 0;
+
+    while (nColors--)
+    {
+        const Pixel *color = reinterpret_cast<const Pixel *>( *colors );
+        TQ_UINT32 alphaTimesWeight = UINT8_MULT(color->alpha, *weights);
+
+        totalLightness += color->lightness * alphaTimesWeight;
+        totala += color->a * alphaTimesWeight;
+        totalb += color->b * alphaTimesWeight;
+        totalAlpha += alphaTimesWeight;
+
+        weights++;
+        colors++;
+    }
+
+    if (totalAlpha > UINT16_MAX) {
+        totalAlpha = UINT16_MAX;
+    }
+
+    ((Pixel *)dst)->alpha = totalAlpha;
+
+    if (totalAlpha > 0) {
+        totalLightness /= totalAlpha;
+        totala /= totalAlpha;
+        totalb /= totalAlpha;
+    } // else the values are already 0 too
+
+    if (totalLightness > MAX_CHANNEL_L) {
+        totalLightness = MAX_CHANNEL_L;
+    }
+
+    ((Pixel *)dst)->lightness = totalLightness;
+
+    if (totala > MAX_CHANNEL_AB) {
+        totala = MAX_CHANNEL_AB;
+    }
+
+    ((Pixel *)dst)->a = totala;
+
+    if (totalb > MAX_CHANNEL_AB) {
+        totalb = MAX_CHANNEL_AB;
+    }
+
+    ((Pixel *)dst)->b = totalb;
+}
+
+void KisLabColorSpace::invertColor(TQ_UINT8 * src, TQ_INT32 nPixels)
+{
+    TQ_UINT32 psize = pixelSize();
+
+    while (nPixels--)
+    {
+        Pixel * s = reinterpret_cast<Pixel *>( src );
+
+        s->lightness = MAX_CHANNEL_L - s->lightness;
+        s->a = MAX_CHANNEL_AB - s->a;
+        s->b = MAX_CHANNEL_AB - s->b;
+
+        src += psize;
+    }
+}
+
+void KisLabColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags,
+                                      TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const
+{
+    TQ_INT32 totalL = 0, totalA = 0, totalB = 0, totalAlpha = 0;
+
+    while ( nColors -- )
+    {
+        const Pixel * pixel = reinterpret_cast<const Pixel *>( *colors );
+        TQ_INT32 weight = *kernelValues;
+        if ( weight != 0 ) {
+            totalL += pixel->lightness * weight;
+            totalA += pixel->a * weight;
+            totalB += pixel->b * weight;
+            totalAlpha += pixel->alpha * weight;
+        }
+        colors++;
+        kernelValues++;
+    }
+
+
+    Pixel * p = reinterpret_cast< Pixel *>( dst );
+
+    if (channelFlags & KisChannelInfo::FLAG_COLOR) {
+        p->lightness = CLAMP( ( totalL / factor) + offset, 0, TQ_UINT16_MAX);
+        p->a = CLAMP( ( totalA / factor) + offset, 0, TQ_UINT16_MAX);
+        p->b = CLAMP( ( totalB / factor) + offset, 0, TQ_UINT16_MAX);
+    }
+    if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+        p->alpha = CLAMP((totalAlpha/ factor) + offset, 0, TQ_UINT16_MAX);
+    }
+
+}
+
+void KisLabColorSpace::darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const
+{
+    // XXX: Is the 255 right for u16 colorspaces?
+    TQ_UINT32 pSize = pixelSize();
+    while ( nPixels-- ) {
+        const Pixel * s = reinterpret_cast<const Pixel*>( src );
+        Pixel * d = reinterpret_cast<Pixel*>( dst );
+
+        if ( compensate ) {
+            d->lightness = static_cast<TQ_UINT16>( ( s->lightness * shade ) / ( compensation * 255 ) );
+        }
+        else {
+            d->lightness = static_cast<TQ_UINT16>( s->lightness * shade / 255 );
+        }
+        d->a = s->a;
+        d->b = s->b;
+        d->alpha = s->alpha;
+
+        src += pSize;
+        dst += pSize;
+    }
+}
+
+
+TQValueVector<KisChannelInfo *> KisLabColorSpace::channels() const
+{
+    return m_channels;
+}
+
+TQ_UINT32 KisLabColorSpace::nChannels() const
+{
+    return NUM_CHANNELS;
+}
+
+TQ_UINT32 KisLabColorSpace::nColorChannels() const
+{
+    return NUM_COLOR_CHANNELS;
+}
+
+TQ_UINT32 KisLabColorSpace::pixelSize() const
+{
+    return sizeof(Pixel);
+}
+
+void KisLabColorSpace::getSingleChannelPixel(TQ_UINT8 *dst, const TQ_UINT8 *src, TQ_UINT32 channelIndex)
+{
+    if (channelIndex < NUM_CHANNELS) {
+
+        const Pixel *srcPixel = reinterpret_cast<const Pixel *>(src);
+        Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+        switch (channelIndex) {
+        case CHANNEL_L:
+            dstPixel->lightness = srcPixel->lightness;
+            dstPixel->a = CHANNEL_AB_ZERO_OFFSET;
+            dstPixel->b = CHANNEL_AB_ZERO_OFFSET;
+            dstPixel->alpha = U16_OPACITY_TRANSPARENT;
+            break;
+        case CHANNEL_A:
+            dstPixel->lightness = MAX_CHANNEL_L / 2;
+            dstPixel->a = srcPixel->a;
+            dstPixel->b = CHANNEL_AB_ZERO_OFFSET;
+            dstPixel->alpha = U16_OPACITY_TRANSPARENT;
+            break;
+        case CHANNEL_B:
+            dstPixel->lightness = MAX_CHANNEL_L / 2;
+            dstPixel->a = CHANNEL_AB_ZERO_OFFSET;
+            dstPixel->b = srcPixel->b;
+            dstPixel->alpha = U16_OPACITY_TRANSPARENT;
+            break;
+        case CHANNEL_ALPHA:
+            dstPixel->lightness = MAX_CHANNEL_L / 2;
+            dstPixel->a = CHANNEL_AB_ZERO_OFFSET;
+            dstPixel->b = CHANNEL_AB_ZERO_OFFSET;
+            dstPixel->alpha = srcPixel->alpha;
+            break;
+        }
+    }
+}
+
+void KisLabColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    while (rows > 0) {
+        const Pixel *src = reinterpret_cast<const Pixel *>(srcRowStart);
+        Pixel *dst = reinterpret_cast<Pixel *>(dstRowStart);
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            TQ_UINT16 srcAlpha = src->alpha;
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                if (*tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, *tqmask);
+                }
+                tqmask++;
+            }
+
+            if (srcAlpha != U16_OPACITY_TRANSPARENT) {
+
+                if (opacity != U16_OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, opacity);
+                }
+
+                if (srcAlpha == U16_OPACITY_OPAQUE) {
+                    memcpy(dst, src, sizeof(Pixel));
+                } else {
+                    TQ_UINT16 dstAlpha = dst->alpha;
+
+                    TQ_UINT16 srcBlend;
+
+                    if (dstAlpha == U16_OPACITY_OPAQUE) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        TQ_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                        dst->alpha = newAlpha;
+
+                        if (newAlpha != 0) {
+                            srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha);
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend == U16_OPACITY_OPAQUE) {
+                        memcpy(dst, src, sizeof(Pixel));
+                    } else {
+/*printf("blend is %d\n", srcBlend);
+printf("%d %d %d\n", src->lightness, src->a, src->b);
+printf("%d %d %d\n", dst->lightness, dst->a, dst->b);
+*/
+                        dst->lightness = UINT16_BLEND(src->lightness, dst->lightness, srcBlend);
+                        dst->a = UINT16_BLEND(src->a, dst->a, srcBlend);
+                        dst->b = UINT16_BLEND(src->b, dst->b, srcBlend);
+//printf("%d %d %d\n", dst->lightness, dst->a, dst->b);
+                    }
+                }
+            }
+
+            columns--;
+            src++;
+            dst++;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart) {
+            tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+}
+
+void KisLabColorSpace::compositeErase(TQ_UINT8 *dst,
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src,
+            TQ_INT32 srcRowSize,
+            const TQ_UINT8 *srcAlphaMask,
+            TQ_INT32 tqmaskRowStride,
+            TQ_INT32 rows,
+            TQ_INT32 cols,
+            TQ_UINT16 /*opacity*/)
+{
+    while (rows-- > 0)
+    {
+        const Pixel *s = reinterpret_cast<const Pixel *>(src);
+        Pixel *d = reinterpret_cast<Pixel *>(dst);
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (TQ_INT32 i = cols; i > 0; i--, s++, d++)
+        {
+            TQ_UINT16 srcAlpha = s->alpha;
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_BLEND(srcAlpha, U16_OPACITY_OPAQUE, UINT8_TO_UINT16(U8_tqmask));
+                }
+                tqmask++;
+            }
+            d->alpha = UINT16_MULT(srcAlpha, d->alpha);
+        }
+
+        dst += dstRowSize;
+        src += srcRowSize;
+        if(srcAlphaMask) {
+            srcAlphaMask += tqmaskRowStride;
+        }
+    }
+}
+
+void KisLabColorSpace::bitBlt(TQ_UINT8 *dst,
+                      TQ_INT32 dstRowStride,
+                      const TQ_UINT8 *src,
+                      TQ_INT32 srcRowStride,
+                      const TQ_UINT8 *tqmask,
+                      TQ_INT32 tqmaskRowStride,
+                      TQ_UINT8 U8_opacity,
+                      TQ_INT32 rows,
+                      TQ_INT32 cols,
+                      const KisCompositeOp& op)
+{
+    TQ_UINT16 opacity = UINT8_TO_UINT16(U8_opacity);
+
+    switch (op.op()) {
+    case COMPOSITE_UNDEF:
+        // Undefined == no composition
+        break;
+    case COMPOSITE_OVER:
+        compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_IN:
+        //compositeIn(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_OUT:
+        //compositeOut(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ATOP:
+        //compositeAtop(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_XOR:
+        //compositeXor(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_PLUS:
+        //compositePlus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MINUS:
+        //compositeMinus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ADD:
+        //compositeAdd(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SUBTRACT:
+        //compositeSubtract(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIFF:
+        //compositeDiff(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MULT:
+        //compositeMultiply(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIVIDE:
+        //compositeDivide(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BUMPMAP:
+        //compositeBumpmap(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY:
+        compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, U8_opacity);
+        break;
+    case COMPOSITE_COPY_RED:
+        //compositeCopyRed(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_GREEN:
+        //compositeCopyGreen(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_BLUE:
+        //compositeCopyBlue(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_OPACITY:
+        //compositeCopyOpacity(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_CLEAR:
+        //compositeClear(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISSOLVE:
+        //compositeDissolve(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISPLACE:
+        //compositeDisplace(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#if 0
+    case COMPOSITE_MODULATE:
+        compositeModulate(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_THRESHOLD:
+        compositeThreshold(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#endif
+    case COMPOSITE_NO:
+        // No composition.
+        break;
+    case COMPOSITE_DARKEN:
+        //compositeDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LIGHTEN:
+        //compositeLighten(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_HUE:
+        //compositeHue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SATURATION:
+        //compositeSaturation(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_VALUE:
+        //compositeValue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLOR:
+        //compositeColor(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLORIZE:
+        //compositeColorize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LUMINIZE:
+        //compositeLuminize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SCREEN:
+        //compositeScreen(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_OVERLAY:
+        //compositeOverlay(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ERASE:
+        compositeErase(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DODGE:
+        //compositeDodge(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BURN:
+        //compositeBurn(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ALPHA_DARKEN:
+        abstractCompositeAlphaDarken<TQ_UINT16, U16Mult, Uint8ToU16, U16OpacityTest,
+                    CHANNEL_ALPHA, NUM_COLOR_CHANNELS, NUM_CHANNELS>(
+                    dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride,
+                    rows, cols, opacity, U16Mult(), Uint8ToU16(), U16OpacityTest());
+        break;
+    default:
+        break;
+    }
+}
+
+KisCompositeOpList KisLabColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    list.append(KisCompositeOp(COMPOSITE_ALPHA_DARKEN));
+
+    return list;
+}
+
+TQString KisLabColorSpace::channelValueText(const TQ_UINT8 *U8_pixel, TQ_UINT32 channelIndex) const
+{
+    const Pixel *pix = reinterpret_cast<const Pixel *>(U8_pixel);
+    Q_ASSERT(channelIndex < nChannels());
+    switch(channelIndex)
+    {
+        case CHANNEL_L:
+            return TQString().setNum(pix->lightness);
+        case CHANNEL_A:
+            return TQString().setNum(pix->a);
+        case CHANNEL_B:
+            return TQString().setNum(pix->b);
+        case CHANNEL_ALPHA:
+            return TQString().setNum(pix->alpha);
+        default:
+            return TQString("Error");
+    }
+}
+
+TQString KisLabColorSpace::normalisedChannelValueText(const TQ_UINT8 *U8_pixel, TQ_UINT32 channelIndex) const
+{
+    const Pixel *pix = reinterpret_cast<const Pixel *>(U8_pixel);
+    Q_ASSERT(channelIndex < nChannels());
+
+    // These convert from lcms encoded format to standard ranges.
+
+    switch(channelIndex)
+    {
+        case CHANNEL_L:
+            return TQString().setNum(100.0 * static_cast<float>(pix->lightness) / MAX_CHANNEL_L);
+        case CHANNEL_A:
+            return TQString().setNum(100.0 * ((static_cast<float>(pix->a) - CHANNEL_AB_ZERO_OFFSET) / MAX_CHANNEL_AB));
+        case CHANNEL_B:
+            return TQString().setNum(100.0 * ((static_cast<float>(pix->b) - CHANNEL_AB_ZERO_OFFSET) / MAX_CHANNEL_AB));
+        case CHANNEL_ALPHA:
+            return TQString().setNum(100.0 * static_cast<float>(pix->alpha) / UINT16_MAX);
+        default:
+            return TQString("Error");
+    }
+}
+
diff --git a/chalk/chalkcolor/colorspaces/kis_lab_colorspace.h b/chalk/chalkcolor/colorspaces/kis_lab_colorspace.h
new file mode 100644
index 000000000..eeab55cfd
--- /dev/null
+++ b/chalk/chalkcolor/colorspaces/kis_lab_colorspace.h
@@ -0,0 +1,153 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_STRATEGY_COLORSPACE_LAB_H_
+#define KIS_STRATEGY_COLORSPACE_LAB_H_
+
+#include <tqcolor.h>
+
+#include <klocale.h>
+
+#include "kis_global.h"
+#include "kis_integer_maths.h"
+#include "kis_u16_base_colorspace.h"
+
+class KisLabColorSpace : public KisU16BaseColorSpace {
+public:
+    KisLabColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p);
+    virtual ~KisLabColorSpace();
+
+public:
+
+    /**
+     * Return a COPY of the provided data. This method is provided to provide consistency,
+     * but you really don't want to be calling it.
+     */
+    virtual TQ_UINT8 * toLabA16(const TQ_UINT8 * data, const TQ_UINT32 nPixels) const;
+
+    /**
+     * Return a COPY of the provided data. This method is provided for consistency,
+     * but you really don't want to call it.
+     */
+    virtual TQ_UINT8 * fromLabA16(const TQ_UINT8 * labData, const TQ_UINT32 nPixels) const;
+
+
+
+    virtual bool willDegrade(ColorSpaceIndependence independence)
+        {
+            if (independence == TO_RGBA8) 
+                return true;
+            else
+                return false;
+        };
+
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const;
+    virtual TQ_UINT32 nColorChannels() const;
+    virtual TQ_UINT32 pixelSize() const;
+
+    virtual TQString channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+    virtual TQString normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+    virtual void getSingleChannelPixel(TQ_UINT8 *dstPixel, const TQ_UINT8 *srcPixel, TQ_UINT32 channelIndex);
+
+    virtual TQ_UINT8 difference(const TQ_UINT8 *src1, const TQ_UINT8 *src2);
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
+    
+    virtual void darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const;
+
+    virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+protected:
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dstRowStride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+/*
+    void compositeMultiply(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDivide(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeScreen(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeOverlay(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDodge(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeBurn(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeLighten(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeHue(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeSaturation(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeValue(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeColor(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+*/
+    void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+
+private:
+    struct Pixel {
+        TQ_UINT16 lightness;
+        TQ_UINT16 a;
+        TQ_UINT16 b;
+        TQ_UINT16 alpha;
+    };
+    static const TQ_UINT16 U16_OPACITY_OPAQUE = UINT16_MAX;
+    static const TQ_UINT16 U16_OPACITY_TRANSPARENT = UINT16_MIN;
+
+    static const TQ_UINT32 NUM_CHANNELS = 4;
+    static const TQ_UINT32 NUM_COLOR_CHANNELS = 3;
+
+    static const TQ_UINT32 CHANNEL_L = 0;
+    static const TQ_UINT32 CHANNEL_A = 1;
+    static const TQ_UINT32 CHANNEL_B = 2;
+    static const TQ_UINT32 CHANNEL_ALPHA = 3;
+
+    static const TQ_UINT32 MAX_CHANNEL_L = 0xff00;
+    static const TQ_UINT32 MAX_CHANNEL_AB = 0xffff;
+    static const TQ_UINT32 CHANNEL_AB_ZERO_OFFSET = 0x8000;
+
+    friend class KisLabColorSpaceTester;
+};
+
+class KisLabColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const { return KisID("LABA", i18n("L*a*b* (16-bit integer/channel)")); };
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() { return (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(2)|EXTRA_SH(1)); };
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return icSigLabData; };
+    
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisLabColorSpace(tqparent, p); };
+
+    virtual TQString defaultProfile() { return "Lab built-in - (lcms internal)"; };
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_LAB_H_
diff --git a/chalk/chalkcolor/colorspaces/kis_xyz_colorspace.cc b/chalk/chalkcolor/colorspaces/kis_xyz_colorspace.cc
new file mode 100644
index 000000000..98ccead03
--- /dev/null
+++ b/chalk/chalkcolor/colorspaces/kis_xyz_colorspace.cc
@@ -0,0 +1,624 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#include <limits.h>
+#include <stdlib.h>
+
+#include <config.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+
+#include <klocale.h>
+#include <kdebug.h>
+
+#include "kis_abstract_colorspace.h"
+#include "kis_u16_base_colorspace.h"
+#include "kis_xyz_colorspace.h"
+#include "kis_integer_maths.h"
+
+#define downscale(quantum)  (quantum) //((unsigned char) ((quantum)/257UL))
+#define upscale(value)  (value) // ((TQ_UINT8) (257UL*(value)))
+
+// XXX: Maybe use TYPE_XYZ_DBL for an extra stimulating performance hit? People shouldn't depend
+//      on this fallback...
+
+KisXyzColorSpace::KisXyzColorSpace(KisColorSpaceFactoryRegistry * tqparent,
+                                   KisProfile *p) :
+    KisU16BaseColorSpace(KisID("XYZA", i18n("XYZ/Alpha")), (COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(2)|EXTRA_SH(1)), icSigCmykData, tqparent, p)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("X"), i18n("X"), 0, KisChannelInfo::COLOR, KisChannelInfo::UINT8));
+    m_channels.push_back(new KisChannelInfo(i18n("Y"), i18n("Y"), 1, KisChannelInfo::COLOR, KisChannelInfo::UINT8));
+    m_channels.push_back(new KisChannelInfo(i18n("Z"), i18n("Z"), 2, KisChannelInfo::COLOR, KisChannelInfo::UINT8));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), 4, KisChannelInfo::ALPHA, KisChannelInfo::UINT8));
+
+    m_alphaPos = PIXEL_ALPHA * sizeof(TQ_UINT16);
+
+    init();
+}
+
+
+KisXyzColorSpace::~KisXyzColorSpace()
+{
+}
+
+
+TQValueVector<KisChannelInfo *> KisXyzColorSpace::channels() const
+{
+    return m_channels;
+}
+
+TQ_UINT32 KisXyzColorSpace::nChannels() const
+{
+    return xyz::MAX_CHANNEL_XYZA;
+}
+
+TQ_UINT32 KisXyzColorSpace::nColorChannels() const
+{
+    return xyz::MAX_CHANNEL_XYZ;
+}
+
+TQ_UINT32 KisXyzColorSpace::pixelSize() const
+{
+    return xyz::MAX_CHANNEL_XYZA * sizeof(TQ_UINT16);
+}
+
+KisColorAdjustment * KisXyzColorSpace::createBrightnessContrastAdjustment(TQ_UINT16 *transferValues)
+{
+    return 0;
+}
+
+void KisXyzColorSpace::applyAdjustment(const TQ_UINT8 *src, TQ_UINT8 *dst, KisColorAdjustment *, TQ_INT32 nPixels)
+{
+}
+
+void KisXyzColorSpace::invertColor(TQ_UINT8 * src, TQ_INT32 nPixels)
+{
+    TQ_INT32 pSize = pixelSize();
+    
+    while (nPixels--)
+    {
+        TQ_UINT16 * p = reinterpret_cast<TQ_UINT16 *>(src);
+        p[PIXEL_X] = UINT16_MAX - p[PIXEL_X];
+        p[PIXEL_Y] = UINT16_MAX - p[PIXEL_Y];
+        p[PIXEL_Z] = UINT16_MAX - p[PIXEL_Z];
+        src += pSize;
+    }
+}
+
+void KisXyzColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+}
+
+void KisXyzColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nPixels) const
+{
+}
+
+void KisXyzColorSpace::darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const
+{
+}
+
+TQ_UINT8 KisXyzColorSpace::intensity8(const TQ_UINT8 * src) const
+{
+    return 0;
+}
+
+void KisXyzColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT16 *src = reinterpret_cast<const TQ_UINT16 *>(srcRowStart);
+        TQ_UINT16 *dst = reinterpret_cast<TQ_UINT16 *>(dstRowStart);
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            TQ_UINT16 srcAlpha = src[PIXEL_ALPHA];
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, UINT8_TO_UINT16(U8_tqmask));
+                }
+                tqmask++;
+            }
+
+            if (srcAlpha != U16_OPACITY_TRANSPARENT) {
+
+                if (opacity != U16_OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, opacity);
+                }
+
+                if (srcAlpha == U16_OPACITY_OPAQUE) {
+                    memcpy(dst, src, xyz::MAX_CHANNEL_XYZA * sizeof(TQ_UINT16));
+                } else {
+                    TQ_UINT16 dstAlpha = dst[PIXEL_ALPHA];
+
+                    TQ_UINT16 srcBlend;
+
+                    if (dstAlpha == U16_OPACITY_OPAQUE) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        TQ_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                        dst[PIXEL_ALPHA] = newAlpha;
+
+                        if (newAlpha != 0) {
+                            srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha);
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend == U16_OPACITY_OPAQUE) {
+                        memcpy(dst, src, xyz::MAX_CHANNEL_XYZ * sizeof(TQ_UINT16));
+                    } else {
+                        dst[PIXEL_X] = UINT16_BLEND(src[PIXEL_X], dst[PIXEL_X], srcBlend);
+                        dst[PIXEL_Y] = UINT16_BLEND(src[PIXEL_Y], dst[PIXEL_Y], srcBlend);
+                        dst[PIXEL_Z] = UINT16_BLEND(src[PIXEL_Z], dst[PIXEL_Z], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += xyz::MAX_CHANNEL_XYZA;
+            dst += xyz::MAX_CHANNEL_XYZA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart) {
+            tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+}
+
+#define COMMON_COMPOSITE_OP_PROLOG() \
+    while (rows > 0) { \
+    \
+        const TQ_UINT16 *src = reinterpret_cast<const TQ_UINT16 *>(srcRowStart); \
+        TQ_UINT16 *dst = reinterpret_cast<TQ_UINT16 *>(dstRowStart); \
+        TQ_INT32 columns = numColumns; \
+        const TQ_UINT8 *tqmask = tqmaskRowStart; \
+    \
+        while (columns > 0) { \
+    \
+            TQ_UINT16 srcAlpha = src[PIXEL_ALPHA]; \
+            TQ_UINT16 dstAlpha = dst[PIXEL_ALPHA]; \
+    \
+            srcAlpha = TQMIN(srcAlpha, dstAlpha); \
+    \
+            if (tqmask != 0) { \
+                TQ_UINT8 U8_tqmask = *tqmask; \
+    \
+                if (U8_tqmask != OPACITY_OPAQUE) { \
+                    srcAlpha = UINT16_MULT(srcAlpha, UINT8_TO_UINT16(U8_tqmask)); \
+                } \
+                tqmask++; \
+            } \
+    \
+            if (srcAlpha != U16_OPACITY_TRANSPARENT) { \
+    \
+                if (opacity != U16_OPACITY_OPAQUE) { \
+                    srcAlpha = UINT16_MULT(srcAlpha, opacity); \
+                } \
+    \
+                TQ_UINT16 srcBlend; \
+    \
+                if (dstAlpha == U16_OPACITY_OPAQUE) { \
+                    srcBlend = srcAlpha; \
+                } else { \
+                    TQ_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha); \
+                    dst[PIXEL_ALPHA] = newAlpha; \
+    \
+                    if (newAlpha != 0) { \
+                        srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha); \
+                    } else { \
+                        srcBlend = srcAlpha; \
+                    } \
+                }
+
+#define COMMON_COMPOSITE_OP_EPILOG() \
+            } \
+    \
+            columns--; \
+            src += xyz::MAX_CHANNEL_XYZA; \
+            dst += xyz::MAX_CHANNEL_XYZA; \
+        } \
+    \
+        rows--; \
+        srcRowStart += srcRowStride; \
+        dstRowStart += dstRowStride; \
+        if(tqmaskRowStart) { \
+            tqmaskRowStart += tqmaskRowStride; \
+        } \
+    }
+
+void KisXyzColorSpace::compositeMultiply(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+
+        for (int channel = 0; channel < xyz::MAX_CHANNEL_XYZ; channel++) {
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = UINT16_MULT(srcColor, dstColor);
+
+            dst[channel] = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisXyzColorSpace::compositeDivide(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < xyz::MAX_CHANNEL_XYZ; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN((dstColor * (UINT16_MAX + 1u) + (srcColor / 2u)) / (1u + srcColor), UINT16_MAX);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisXyzColorSpace::compositeScreen(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < xyz::MAX_CHANNEL_XYZ; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = UINT16_MAX - UINT16_MULT(UINT16_MAX - dstColor, UINT16_MAX - srcColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisXyzColorSpace::compositeOverlay(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < xyz::MAX_CHANNEL_XYZ; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = UINT16_MULT(dstColor, dstColor + 2u * UINT16_MULT(srcColor, UINT16_MAX - dstColor));
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisXyzColorSpace::compositeDodge(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < xyz::MAX_CHANNEL_XYZ; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN((dstColor * (UINT16_MAX + 1u)) / (UINT16_MAX + 1u - srcColor), UINT16_MAX);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisXyzColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < xyz::MAX_CHANNEL_XYZ; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN(((UINT16_MAX - dstColor) * (UINT16_MAX + 1u)) / (srcColor + 1u), UINT16_MAX);
+            srcColor = CLAMP(UINT16_MAX - srcColor, 0u, UINT16_MAX);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisXyzColorSpace::compositeDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < xyz::MAX_CHANNEL_XYZ; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN(srcColor, dstColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisXyzColorSpace::compositeLighten(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < xyz::MAX_CHANNEL_XYZ; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMAX(srcColor, dstColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+
+
+void KisXyzColorSpace::compositeErase(TQ_UINT8 *dst,
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src,
+            TQ_INT32 srcRowSize,
+            const TQ_UINT8 *srcAlphaMask,
+            TQ_INT32 tqmaskRowStride,
+            TQ_INT32 rows,
+            TQ_INT32 cols,
+            TQ_UINT16 /*opacity*/)
+{
+    while (rows-- > 0)
+    {
+        const Pixel *s = reinterpret_cast<const Pixel *>(src);
+        Pixel *d = reinterpret_cast<Pixel *>(dst);
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (TQ_INT32 i = cols; i > 0; i--, s++, d++)
+        {
+            TQ_UINT16 srcAlpha = s -> alpha;
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_BLEND(srcAlpha, U16_OPACITY_OPAQUE, UINT8_TO_UINT16(U8_tqmask));
+                }
+                tqmask++;
+            }
+            d -> alpha = UINT16_MULT(srcAlpha, d -> alpha);
+        }
+
+        dst += dstRowSize;
+        src += srcRowSize;
+        if(srcAlphaMask) {
+            srcAlphaMask += tqmaskRowStride;
+        }
+    }
+}
+
+void KisXyzColorSpace::bitBlt(TQ_UINT8 *dst,
+                      TQ_INT32 dstRowStride,
+                      const TQ_UINT8 *src,
+                      TQ_INT32 srcRowStride,
+                      const TQ_UINT8 *tqmask,
+                      TQ_INT32 tqmaskRowStride,
+                      TQ_UINT8 U8_opacity,
+                      TQ_INT32 rows,
+                      TQ_INT32 cols,
+                      const KisCompositeOp& op)
+{
+    TQ_UINT16 opacity = UINT8_TO_UINT16(U8_opacity);
+
+    switch (op.op()) {
+    case COMPOSITE_UNDEF:
+        // Undefined == no composition
+        break;
+    case COMPOSITE_OVER:
+        compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_IN:
+        //compositeIn(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+    case COMPOSITE_OUT:
+        //compositeOut(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ATOP:
+        //compositeAtop(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_XOR:
+        //compositeXor(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_PLUS:
+        //compositePlus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MINUS:
+        //compositeMinus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ADD:
+        //compositeAdd(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SUBTRACT:
+        //compositeSubtract(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIFF:
+        //compositeDiff(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MULT:
+        compositeMultiply(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIVIDE:
+        compositeDivide(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BUMPMAP:
+        //compositeBumpmap(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY:
+        compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, U8_opacity);
+        break;
+    case COMPOSITE_COPY_RED:
+        //compositeCopyRed(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_GREEN:
+        //compositeCopyGreen(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_BLUE:
+        //compositeCopyBlue(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_OPACITY:
+        //compositeCopyOpacity(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_CLEAR:
+        //compositeClear(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISSOLVE:
+        //compositeDissolve(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISPLACE:
+        //compositeDisplace(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#if 0
+    case COMPOSITE_MODULATE:
+        compositeModulate(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_THRESHOLD:
+        compositeThreshold(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#endif
+    case COMPOSITE_NO:
+        // No composition.
+        break;
+    case COMPOSITE_DARKEN:
+        compositeDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LIGHTEN:
+        compositeLighten(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_HUE:
+        //compositeHue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SATURATION:
+        //compositeSaturation(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_VALUE:
+        //compositeValue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLOR:
+        //compositeColor(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLORIZE:
+        //compositeColorize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LUMINIZE:
+        //compositeLuminize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SCREEN:
+        compositeScreen(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_OVERLAY:
+        compositeOverlay(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ERASE:
+        compositeErase(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DODGE:
+        compositeDodge(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BURN:
+        compositeBurn(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ALPHA_DARKEN:
+        abstractCompositeAlphaDarken<TQ_UINT16, U16Mult, Uint8ToU16, U16OpacityTest,
+                    PIXEL_ALPHA, xyz::MAX_CHANNEL_XYZ, xyz::MAX_CHANNEL_XYZA>(
+                    dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride,
+                    rows, cols, opacity, U16Mult(), Uint8ToU16(), U16OpacityTest());
+        break;
+    default:
+        break;
+    }
+}
+
+KisCompositeOpList KisXyzColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    list.append(KisCompositeOp(COMPOSITE_ALPHA_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_MULT));
+    list.append(KisCompositeOp(COMPOSITE_BURN));
+    list.append(KisCompositeOp(COMPOSITE_DODGE));
+    list.append(KisCompositeOp(COMPOSITE_DIVIDE));
+    list.append(KisCompositeOp(COMPOSITE_SCREEN));
+    list.append(KisCompositeOp(COMPOSITE_OVERLAY));
+    list.append(KisCompositeOp(COMPOSITE_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_LIGHTEN));
+
+    return list;
+}
+
+
diff --git a/chalk/chalkcolor/colorspaces/kis_xyz_colorspace.h b/chalk/chalkcolor/colorspaces/kis_xyz_colorspace.h
new file mode 100644
index 000000000..2f7c3efda
--- /dev/null
+++ b/chalk/chalkcolor/colorspaces/kis_xyz_colorspace.h
@@ -0,0 +1,112 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS__COLORSPACE_XYZ_H_
+#define KIS__COLORSPACE_XYZ_H_
+
+#include <tqcolor.h>
+
+#include "kis_global.h"
+#include "kis_integer_maths.h"
+#include "kis_u16_base_colorspace.h"
+
+namespace xyz {
+    const TQ_INT32 MAX_CHANNEL_XYZ = 3;
+    const TQ_INT32 MAX_CHANNEL_XYZA = 4;
+}
+
+
+
+class KisXyzColorSpace : public KisU16BaseColorSpace {
+
+public:
+
+    struct Pixel {
+        TQ_UINT16 X;
+        TQ_UINT16 Y;
+        TQ_UINT16 Z;
+        TQ_UINT16 alpha;
+    };
+
+public:
+    KisXyzColorSpace(KisColorSpaceFactoryRegistry * tqparent,
+                     KisProfile *p);
+    virtual ~KisXyzColorSpace();
+
+    virtual bool willDegrade(ColorSpaceIndependence independence)
+        {
+            if (independence == TO_RGBA8)
+                return true;
+            else
+                return false;
+        };
+public:
+    // Pixel manipulation
+    virtual KisColorAdjustment *createBrightnessContrastAdjustment(TQ_UINT16 *transferValues);
+    virtual void applyAdjustment(const TQ_UINT8 *src, TQ_UINT8 *dst, KisColorAdjustment *, TQ_INT32 nPixels);
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nPixels) const;
+    virtual void darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const;
+    virtual TQ_UINT8 intensity8(const TQ_UINT8 * src) const;
+
+    // Information about the colorstrategy
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const;
+    virtual TQ_UINT32 nColorChannels() const;
+    virtual TQ_UINT32 pixelSize() const;
+
+
+    // Composition
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dststride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+    KisCompositeOpList userVisiblecompositeOps() const;
+
+protected:
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeMultiply(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDivide(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeScreen(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeOverlay(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDodge(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeBurn(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeLighten(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+
+private:
+
+    static const TQ_UINT8 PIXEL_X = 0;
+    static const TQ_UINT8 PIXEL_Y = 1;
+    static const TQ_UINT8 PIXEL_Z = 2;
+    static const TQ_UINT8 PIXEL_ALPHA = 3;
+
+    TQ_UINT8 * m_qcolordata; // A small buffer for conversion from and to qcolor.
+
+};
+
+#endif // KIS__COLORSPACE_XYZ_H_
diff --git a/chalk/chalkcolor/kis_abstract_colorspace.cc b/chalk/chalkcolor/kis_abstract_colorspace.cc
new file mode 100644
index 000000000..a19b9d69c
--- /dev/null
+++ b/chalk/chalkcolor/kis_abstract_colorspace.cc
@@ -0,0 +1,762 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <tqimage.h>
+
+#include <kdebug.h>
+#include <kconfig.h>
+
+#include "kis_abstract_colorspace.h"
+#include "kis_global.h"
+#include "kis_profile.h"
+#include "kis_id.h"
+#include "kis_integer_maths.h"
+#include "kis_color_conversions.h"
+#include "kis_colorspace_factory_registry.h"
+#include "kis_channelinfo.h"
+
+class KisColorAdjustmentImpl : public KisColorAdjustment
+{
+    public:
+
+    KisColorAdjustmentImpl() : KisColorAdjustment()
+        {
+            csProfile = 0;
+            transform = 0;
+            profiles[0] = 0;
+            profiles[1] = 0;
+            profiles[2] = 0;
+        };
+
+    ~KisColorAdjustmentImpl() {
+
+        if (transform)
+            cmsDeleteTransform(transform);
+        if (profiles[0] && profiles[0] != csProfile)
+            cmsCloseProfile(profiles[0]);
+        if(profiles[1] && profiles[1] != csProfile)
+            cmsCloseProfile(profiles[1]);
+        if(profiles[2] && profiles[2] != csProfile)
+            cmsCloseProfile(profiles[2]);
+    }
+
+    cmsHPROFILE csProfile;
+    cmsHPROFILE profiles[3];
+    cmsHTRANSFORM transform;
+};
+
+KisAbstractColorSpace::KisAbstractColorSpace(const KisID& id,
+                                             DWORD cmType,
+                                             icColorSpaceSignature colorSpaceSignature,
+                                             KisColorSpaceFactoryRegistry * tqparent,
+                                             KisProfile *p)
+    : m_parent( tqparent )
+    , m_profile( p )
+    , m_id( id )
+    , m_cmType( cmType )
+    , m_colorSpaceSignature( colorSpaceSignature )
+{
+    m_alphaPos = -1;
+    m_alphaSize = -1;
+    m_qcolordata = 0;
+    m_lastUsedDstColorSpace = 0;
+    m_lastUsedTransform = 0;
+    m_lastRGBProfile = 0;
+    m_lastToRGB = 0;
+    m_lastFromRGB = 0;
+    m_defaultFromRGB = 0;
+    m_defaultToRGB = 0;
+    m_defaultFromLab = 0;
+    m_defaultToLab = 0;
+}
+
+void KisAbstractColorSpace::init()
+{
+    // Default pixel buffer for TQColor conversion
+    m_qcolordata = new TQ_UINT8[3];
+    Q_CHECK_PTR(m_qcolordata);
+
+    if (m_profile == 0) return;
+
+    // For conversions from default rgb
+    m_lastFromRGB = cmsCreate_sRGBProfile();
+
+    m_defaultFromRGB = cmsCreateTransform(m_lastFromRGB, TYPE_BGR_8,
+                                          m_profile->profile(), m_cmType,
+                                          INTENT_PERCEPTUAL, 0);
+
+    m_defaultToRGB =  cmsCreateTransform(m_profile->profile(), m_cmType,
+                                         m_lastFromRGB, TYPE_BGR_8,
+                                         INTENT_PERCEPTUAL, 0);
+
+    cmsHPROFILE hLab  = cmsCreateLabProfile(NULL);
+
+    m_defaultFromLab = cmsCreateTransform(hLab, TYPE_Lab_16, m_profile->profile(), m_cmType,
+                                          INTENT_PERCEPTUAL, 0);
+
+    m_defaultToLab = cmsCreateTransform(m_profile->profile(), m_cmType, hLab, TYPE_Lab_16,
+                                        INTENT_PERCEPTUAL, 0);
+}
+
+KisAbstractColorSpace::~KisAbstractColorSpace()
+{
+}
+
+
+
+void KisAbstractColorSpace::fromTQColor(const TQColor& color, TQ_UINT8 *dst, KisProfile * profile)
+{
+    m_qcolordata[2] = color.red();
+    m_qcolordata[1] = color.green();
+    m_qcolordata[0] = color.blue();
+
+
+    if (profile == 0) {
+	    // Default sRGB
+	    if (!m_defaultFromRGB) return;
+
+	    cmsDoTransform(m_defaultFromRGB, m_qcolordata, dst, 1);
+    }
+    else {
+    	if (m_lastFromRGB == 0 || (m_lastFromRGB != 0 && m_lastRGBProfile != profile->profile())) {
+	        m_lastFromRGB = cmsCreateTransform(profile->profile(), TYPE_BGR_8,
+					       m_profile->profile(), m_cmType,
+					       INTENT_PERCEPTUAL, 0);
+	        m_lastRGBProfile = profile->profile();
+
+	    }
+    	cmsDoTransform(m_lastFromRGB, m_qcolordata, dst, 1);
+    }
+
+    setAlpha(dst, OPACITY_OPAQUE, 1);
+}
+
+void KisAbstractColorSpace::fromTQColor(const TQColor& color, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * profile)
+{
+    fromTQColor(color, dst, profile);
+    setAlpha(dst, opacity, 1);
+}
+
+void KisAbstractColorSpace::toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * profile)
+{
+    if (profile == 0) {
+	// Default sRGB transform
+        if (!m_defaultToRGB) return;
+    	cmsDoTransform(m_defaultToRGB, const_cast <TQ_UINT8 *>(src), m_qcolordata, 1);
+    }
+    else {
+	    if (m_lastToRGB == 0 || (m_lastToRGB != 0 && m_lastRGBProfile != profile->profile())) {
+	        m_lastToRGB = cmsCreateTransform(m_profile->profile(), m_cmType,
+                                                 profile->profile(), TYPE_BGR_8,
+                                                 INTENT_PERCEPTUAL, 0);
+	        m_lastRGBProfile = profile->profile();
+	    }
+	    cmsDoTransform(m_lastToRGB, const_cast <TQ_UINT8 *>(src), m_qcolordata, 1);
+    }
+    c->setRgb(m_qcolordata[2], m_qcolordata[1], m_qcolordata[0]);
+}
+
+void KisAbstractColorSpace::toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile)
+{
+    toTQColor(src, c, profile);
+    *opacity = getAlpha(src);
+}
+
+void KisAbstractColorSpace::toLabA16(const TQ_UINT8 * src, TQ_UINT8 * dst, const TQ_UINT32 nPixels) const
+{
+    if ( m_defaultToLab == 0 ) return;
+
+    cmsDoTransform( m_defaultToLab, const_cast<TQ_UINT8 *>( src ), dst, nPixels );
+}
+
+void KisAbstractColorSpace::fromLabA16(const TQ_UINT8 * src, TQ_UINT8 * dst, const TQ_UINT32 nPixels) const
+{
+    if ( m_defaultFromLab == 0 ) return;
+
+    cmsDoTransform( m_defaultFromLab,  const_cast<TQ_UINT8 *>( src ), dst,  nPixels );
+}
+
+
+void KisAbstractColorSpace::getSingleChannelPixel(TQ_UINT8 *dstPixel, const TQ_UINT8 *srcPixel, TQ_UINT32 channelIndex)
+{
+    if (channelIndex < m_channels.count()) {
+
+        fromTQColor(TQt::black, OPACITY_TRANSPARENT, dstPixel);
+
+        const KisChannelInfo *channelInfo = m_channels[channelIndex];
+        memcpy(dstPixel + channelInfo->pos(), srcPixel + channelInfo->pos(), channelInfo->size());
+    }
+}
+
+bool KisAbstractColorSpace::convertPixelsTo(const TQ_UINT8 * src,
+					    TQ_UINT8 * dst,
+					    KisColorSpace * dstColorSpace,
+					    TQ_UINT32 numPixels,
+					    TQ_INT32 renderingIntent)
+{
+    if (dstColorSpace->colorSpaceType() == colorSpaceType()
+        && dstColorSpace->getProfile() == getProfile())
+    {
+        if (src!= dst)
+            memcpy (dst, src, numPixels * pixelSize());
+
+        return true;
+    }
+
+    cmsHTRANSFORM tf = 0;
+
+    TQ_INT32 srcPixelSize = pixelSize();
+    TQ_INT32 dstPixelSize = dstColorSpace->pixelSize();
+
+    if (m_lastUsedTransform != 0 && m_lastUsedDstColorSpace != 0) {
+        if (dstColorSpace->colorSpaceType() == m_lastUsedDstColorSpace->colorSpaceType() &&
+            dstColorSpace->getProfile() == m_lastUsedDstColorSpace->getProfile()) {
+            tf = m_lastUsedTransform;
+        }
+    }
+
+    if (!tf && m_profile && dstColorSpace->getProfile()) {
+
+        if (!m_transforms.tqcontains(dstColorSpace)) {
+            tf = createTransform(dstColorSpace,
+				 m_profile,
+				 dstColorSpace->getProfile(),
+				 renderingIntent);
+            if (tf) {
+		// XXX: Should we clear the transform cache if it gets too big?
+		m_transforms[dstColorSpace] = tf;
+            }
+        }
+        else {
+            tf = m_transforms[dstColorSpace];
+        }
+
+        if ( tf ) {
+            m_lastUsedTransform = tf;
+            m_lastUsedDstColorSpace = dstColorSpace;
+        }
+    }
+
+    if (tf) {
+
+        cmsDoTransform(tf, const_cast<TQ_UINT8 *>(src), dst, numPixels);
+
+        // Lcms does nothing to the destination alpha channel so we must convert that manually.
+        while (numPixels > 0) {
+            TQ_UINT8 alpha = getAlpha(src);
+            dstColorSpace->setAlpha(dst, alpha, 1);
+
+            src += srcPixelSize;
+            dst += dstPixelSize;
+            numPixels--;
+        }
+
+        return true;
+    }
+
+    // Last resort fallback. This will be removed when this class is renamed KisLCMSColorSpace after 1.5.
+    while (numPixels > 0) {
+        TQColor color;
+        TQ_UINT8 opacity;
+
+        toTQColor(src, &color, &opacity);
+        dstColorSpace->fromTQColor(color, opacity, dst);
+
+        src += srcPixelSize;
+        dst += dstPixelSize;
+        numPixels--;
+    }
+
+    return true;
+}
+
+
+KisColorAdjustment *KisAbstractColorSpace::createBrightnessContrastAdjustment(TQ_UINT16 *transferValues)
+{
+    if (!m_profile) return 0;
+
+    LPGAMMATABLE transferFunctions[3];
+    transferFunctions[0] = cmsBuildGamma(256, 1.0);
+    transferFunctions[1] = cmsBuildGamma(256, 1.0);
+    transferFunctions[2] = cmsBuildGamma(256, 1.0);
+
+    for(int i =0; i < 256; i++)
+        transferFunctions[0]->GammaTable[i] = transferValues[i];
+
+    KisColorAdjustmentImpl *adj = new KisColorAdjustmentImpl;
+    adj->profiles[1] = cmsCreateLinearizationDeviceLink(icSigLabData, transferFunctions);
+    cmsSetDeviceClass(adj->profiles[1], icSigAbstractClass);
+
+    adj->profiles[0] = m_profile->profile();
+    adj->profiles[2] = m_profile->profile();
+    adj->transform  = cmsCreateMultiprofileTransform(adj->profiles, 3, m_cmType, m_cmType, INTENT_PERCEPTUAL, 0);
+    adj->csProfile = m_profile->profile();
+    return adj;
+}
+
+typedef struct {
+                double Saturation;
+
+} BCHSWADJUSTS, *LPBCHSWADJUSTS;
+
+
+static int desaturateSampler(register WORD In[], register WORD Out[], register LPVOID /*Cargo*/)
+{
+    cmsCIELab LabIn, LabOut;
+    cmsCIELCh LChIn, LChOut;
+    //LPBCHSWADJUSTS bchsw = (LPBCHSWADJUSTS) Cargo;
+
+    cmsLabEncoded2Float(&LabIn, In);
+
+    cmsLab2LCh(&LChIn, &LabIn);
+
+    // Do some adjusts on LCh
+    LChOut.L = LChIn.L;
+    LChOut.C = 0;//LChIn.C + bchsw->Saturation;
+    LChOut.h = LChIn.h;
+
+    cmsLCh2Lab(&LabOut, &LChOut);
+
+    // Back to encoded
+    cmsFloat2LabEncoded(Out, &LabOut);
+
+    return TRUE;
+}
+
+KisColorAdjustment *KisAbstractColorSpace::createDesaturateAdjustment()
+{
+    if (!m_profile) return 0;
+
+    KisColorAdjustmentImpl *adj = new KisColorAdjustmentImpl;
+
+    adj->profiles[0] = m_profile->profile();
+    adj->profiles[2] = m_profile->profile();
+    adj->csProfile = m_profile->profile();
+
+     LPLUT Lut;
+     BCHSWADJUSTS bchsw;
+
+     bchsw.Saturation = -25;
+
+     adj->profiles[1] = _cmsCreateProfilePlaceholder();
+     if (!adj->profiles[1]) // can't allocate
+        return NULL;
+
+     cmsSetDeviceClass(adj->profiles[1], icSigAbstractClass);
+     cmsSetColorSpace(adj->profiles[1], icSigLabData);
+     cmsSetPCS(adj->profiles[1], icSigLabData);
+
+     cmsSetRenderingIntent(adj->profiles[1], INTENT_PERCEPTUAL);
+
+     // Creates a LUT with 3D grid only
+     Lut = cmsAllocLUT();
+
+     cmsAlloc3DGrid(Lut, 32, 3, 3);
+
+     if (!cmsSample3DGrid(Lut, desaturateSampler, static_cast<LPVOID>(&bchsw), 0)) {
+         // Shouldn't reach here
+         cmsFreeLUT(Lut);
+         cmsCloseProfile(adj->profiles[1]);
+         return NULL;
+     }
+
+    // Create tags
+
+    cmsAddTag(adj->profiles[1], icSigDeviceMfgDescTag,      (LPVOID) "(chalk internal)");
+    cmsAddTag(adj->profiles[1], icSigProfileDescriptionTag, (LPVOID) "chalk saturation abstract profile");
+    cmsAddTag(adj->profiles[1], icSigDeviceModelDescTag,    (LPVOID) "saturation built-in");
+
+    cmsAddTag(adj->profiles[1], icSigMediaWhitePointTag, (LPVOID) cmsD50_XYZ());
+
+    cmsAddTag(adj->profiles[1], icSigAToB0Tag, (LPVOID) Lut);
+
+    // LUT is already on virtual profile
+    cmsFreeLUT(Lut);
+
+    adj->transform  = cmsCreateMultiprofileTransform(adj->profiles, 3, m_cmType, m_cmType, INTENT_PERCEPTUAL, 0);
+
+    return adj;
+}
+
+KisColorAdjustment *KisAbstractColorSpace::createPerChannelAdjustment(TQ_UINT16 **transferValues)
+{
+    if (!m_profile) return 0;
+
+    LPGAMMATABLE *transferFunctions = new LPGAMMATABLE[nColorChannels()+1];
+
+    for(uint ch=0; ch < nColorChannels(); ch++) {
+        transferFunctions[ch] = cmsBuildGamma(256, 1.0);
+        for(uint i =0; i < 256; i++) {
+            transferFunctions[ch]->GammaTable[i] = transferValues[ch][i];
+        }
+    }
+
+    KisColorAdjustmentImpl *adj = new KisColorAdjustmentImpl;
+    adj->profiles[0] = cmsCreateLinearizationDeviceLink(colorSpaceSignature(), transferFunctions);
+    adj->profiles[1] = NULL;
+    adj->profiles[2] = NULL;
+    adj->csProfile = m_profile->profile();
+    adj->transform  = cmsCreateTransform(adj->profiles[0], m_cmType, NULL, m_cmType, INTENT_PERCEPTUAL, 0);
+
+    delete [] transferFunctions;
+
+    return adj;
+}
+
+
+void KisAbstractColorSpace::applyAdjustment(const TQ_UINT8 *src, TQ_UINT8 *dst, KisColorAdjustment *adjustment, TQ_INT32 nPixels)
+{
+    KisColorAdjustmentImpl * adj = dynamic_cast<KisColorAdjustmentImpl*>(adjustment);
+    if (adj)
+        cmsDoTransform(adj->transform, const_cast<TQ_UINT8 *>(src), dst, nPixels);
+}
+
+
+void KisAbstractColorSpace::invertColor(TQ_UINT8 * src, TQ_INT32 nPixels)
+{
+    TQColor c;
+    TQ_UINT8 opacity;
+    TQ_UINT32 psize = pixelSize();
+
+    while (nPixels--)
+    {
+        toTQColor(src, &c, &opacity);
+        c.setRgb(TQ_UINT8_MAX - c.red(), TQ_UINT8_MAX - c.green(), TQ_UINT8_MAX - c.blue());
+        fromTQColor( c, opacity, src);
+
+        src += psize;
+    }
+}
+
+TQ_UINT8 KisAbstractColorSpace::difference(const TQ_UINT8* src1, const TQ_UINT8* src2)
+{
+    if (m_defaultToLab) {
+
+        TQ_UINT8 lab1[8], lab2[8];
+        cmsCIELab labF1, labF2;
+
+        if (getAlpha(src1) == OPACITY_TRANSPARENT || getAlpha(src2) == OPACITY_TRANSPARENT)
+            return (getAlpha(src1) == getAlpha(src2) ? 0 : 255);
+
+        cmsDoTransform( m_defaultToLab, const_cast<TQ_UINT8*>( src1 ), lab1, 1);
+        cmsDoTransform( m_defaultToLab, const_cast<TQ_UINT8*>( src2 ), lab2, 1);
+        cmsLabEncoded2Float(&labF1, (WORD *)lab1);
+        cmsLabEncoded2Float(&labF2, (WORD *)lab2);
+        double diff = cmsDeltaE(&labF1, &labF2);
+        if(diff>255)
+            return 255;
+        else
+            return TQ_INT8(diff);
+    }
+    else {
+        TQColor c1;
+        TQ_UINT8 opacity1;
+        toTQColor(src1, &c1, &opacity1);
+
+        TQColor c2;
+        TQ_UINT8 opacity2;
+        toTQColor(src2, &c2, &opacity2);
+
+        TQ_UINT8 red = abs(c1.red() - c2.red());
+        TQ_UINT8 green = abs(c1.green() - c2.green());
+        TQ_UINT8 blue = abs(c1.blue() - c2.blue());
+        return TQMAX(red, TQMAX(green, blue));
+    }
+}
+
+void KisAbstractColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    TQ_UINT32 totalRed = 0, totalGreen = 0, totalBlue = 0, newAlpha = 0;
+
+    TQColor c;
+    TQ_UINT8 opacity;
+
+    while (nColors--)
+    {
+        // Ugly hack to get around the current constness mess of the colour strategy...
+        const_cast<KisAbstractColorSpace *>(this)->toTQColor(*colors, &c, &opacity);
+
+        TQ_UINT32 alphaTimesWeight = UINT8_MULT(opacity, *weights);
+
+        totalRed += c.red() * alphaTimesWeight;
+        totalGreen += c.green() * alphaTimesWeight;
+        totalBlue += c.blue() * alphaTimesWeight;
+        newAlpha += alphaTimesWeight;
+
+        weights++;
+        colors++;
+    }
+
+    Q_ASSERT(newAlpha <= 255);
+
+    if (newAlpha > 0) {
+        totalRed = UINT8_DIVIDE(totalRed, newAlpha);
+        totalGreen = UINT8_DIVIDE(totalGreen, newAlpha);
+        totalBlue = UINT8_DIVIDE(totalBlue, newAlpha);
+    }
+
+    // Divide by 255.
+    totalRed += 0x80;
+
+    TQ_UINT32 dstRed = ((totalRed >> 8) + totalRed) >> 8;
+    Q_ASSERT(dstRed <= 255);
+
+    totalGreen += 0x80;
+    TQ_UINT32 dstGreen = ((totalGreen >> 8) + totalGreen) >> 8;
+    Q_ASSERT(dstGreen <= 255);
+
+    totalBlue += 0x80;
+    TQ_UINT32 dstBlue = ((totalBlue >> 8) + totalBlue) >> 8;
+    Q_ASSERT(dstBlue <= 255);
+
+    const_cast<KisAbstractColorSpace *>(this)->fromTQColor(TQColor(dstRed, dstGreen, dstBlue), newAlpha, dst);
+}
+
+void KisAbstractColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags,
+                                           TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const
+{
+    TQ_INT32 totalRed = 0, totalGreen = 0, totalBlue = 0, totalAlpha = 0;
+
+    TQColor dstColor;
+    TQ_UINT8 dstOpacity;
+
+    const_cast<KisAbstractColorSpace *>(this)->toTQColor(dst, &dstColor, &dstOpacity);
+
+    while (nColors--)
+    {
+        TQ_INT32 weight = *kernelValues;
+
+        if (weight != 0) {
+            TQColor c;
+            TQ_UINT8 opacity;
+            const_cast<KisAbstractColorSpace *>(this)->toTQColor( *colors, &c, &opacity );
+            totalRed += c.red() * weight;
+            totalGreen += c.green() * weight;
+            totalBlue += c.blue() * weight;
+            totalAlpha += opacity * weight;
+        }
+        colors++;
+        kernelValues++;
+    }
+
+
+    if (channelFlags & KisChannelInfo::FLAG_COLOR) {
+        const_cast<KisAbstractColorSpace *>(this)->fromTQColor(TQColor(CLAMP((totalRed / factor) + offset, 0, TQ_UINT8_MAX),
+                                        CLAMP((totalGreen / factor) + offset, 0, TQ_UINT8_MAX),
+                                        CLAMP((totalBlue / factor) + offset, 0, TQ_UINT8_MAX)),
+            dstOpacity,
+            dst);
+    }
+    if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+        const_cast<KisAbstractColorSpace *>(this)->fromTQColor(dstColor, CLAMP((totalAlpha/ factor) + offset, 0, TQ_UINT8_MAX), dst);
+    }
+
+}
+
+void KisAbstractColorSpace::darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const
+{
+    if (m_defaultToLab) {
+        TQ_UINT16 * labcache = new TQ_UINT16[nPixels * 4];
+        cmsDoTransform( m_defaultToLab, const_cast<TQ_UINT8*>( src ), reinterpret_cast<TQ_UINT8*>( labcache ), nPixels );
+        for ( int i = 0; i < nPixels * 4; ++i ) {
+            if ( compensate ) {
+                labcache[i] = static_cast<TQ_UINT16>( ( labcache[i] * shade ) / ( compensation * 255 ) );
+            }
+            else {
+                labcache[i] = static_cast<TQ_UINT16>( labcache[i] * shade  / 255 );
+            }
+        }
+        cmsDoTransform( m_defaultFromLab, reinterpret_cast<TQ_UINT8*>( labcache ), dst, nPixels );
+
+        // Copy alpha
+        for ( int i = 0; i < nPixels; ++i ) {
+            TQ_UINT8 alpha = getAlpha( src );
+            setAlpha( dst, alpha, 1 );
+        }
+        delete [] labcache;
+    }
+    else {
+
+        TQColor c;
+        TQ_INT32 psize = pixelSize();
+
+        for (int i = 0; i < nPixels; ++i) {
+
+            const_cast<KisAbstractColorSpace *>(this)->toTQColor(src + (i * psize), &c);
+            TQ_INT32 r, g, b;
+
+            if (compensate) {
+                r = static_cast<TQ_INT32>( TQMIN(255, (c.red() * shade) / (compensation * 255)));
+                g = static_cast<TQ_INT32>( TQMIN(255, (c.green() * shade) / (compensation * 255)));
+                b = static_cast<TQ_INT32>( TQMIN(255, (c.blue() * shade) / (compensation * 255)));
+            }
+            else {
+                r = static_cast<TQ_INT32>( TQMIN(255, (c.red() * shade / 255)));
+                g = static_cast<TQ_INT32>( TQMIN(255, (c.green() * shade / 255)));
+                b = static_cast<TQ_INT32>( TQMIN(255, (c.blue() * shade / 255)));
+            }
+            c.setRgb(r, g, b);
+
+            const_cast<KisAbstractColorSpace *>(this)->fromTQColor( c, dst  + (i * psize));
+        }
+    }
+}
+
+TQ_UINT8 KisAbstractColorSpace::intensity8(const TQ_UINT8 * src) const
+{
+    TQColor c;
+    TQ_UINT8 opacity;
+    const_cast<KisAbstractColorSpace *>(this)->toTQColor(src, &c, &opacity);
+    return static_cast<TQ_UINT8>((c.red() * 0.30 + c.green() * 0.59 + c.blue() * 0.11) + 0.5);
+
+}
+
+
+KisID KisAbstractColorSpace::mathToolboxID() const
+{
+    return KisID("Basic");
+}
+
+void KisAbstractColorSpace::bitBlt(TQ_UINT8 *dst,
+                   TQ_INT32 dststride,
+                   KisColorSpace * srcSpace,
+                   const TQ_UINT8 *src,
+                   TQ_INT32 srcRowStride,
+                   const TQ_UINT8 *srcAlphaMask,
+                   TQ_INT32 tqmaskRowStride,
+                   TQ_UINT8 opacity,
+                   TQ_INT32 rows,
+                   TQ_INT32 cols,
+                   const KisCompositeOp& op)
+{
+    if (rows <= 0 || cols <= 0)
+        return;
+
+    if (this != srcSpace) {
+        TQ_UINT32 len = pixelSize() * rows * cols;
+
+        // If our conversion cache is too small, extend it.
+        if (!m_conversionCache.resize( len, TQGArray::SpeedOptim )) {
+            kdWarning() << "Could not allocate enough memory for the conversion!\n";
+            // XXX: We should do a slow, pixel by pixel bitblt here...
+            abort();
+        }
+
+        for (TQ_INT32 row = 0; row < rows; row++) {
+            srcSpace->convertPixelsTo(src + row * srcRowStride,
+                                        m_conversionCache.data() + row * cols * pixelSize(), this,
+                                        cols);
+        }
+
+        // The old srcRowStride is no longer valid because we converted to the current cs
+        srcRowStride = cols * pixelSize();
+
+        bitBlt(dst,
+               dststride,
+               m_conversionCache.data(),
+               srcRowStride,
+               srcAlphaMask,
+               tqmaskRowStride,
+               opacity,
+               rows,
+               cols,
+               op);
+
+    }
+    else {
+        bitBlt(dst,
+               dststride,
+               src,
+               srcRowStride,
+               srcAlphaMask,
+               tqmaskRowStride,
+               opacity,
+               rows,
+               cols,
+               op);
+    }
+}
+
+TQImage KisAbstractColorSpace::convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                                              KisProfile *dstProfile,
+                                              TQ_INT32 renderingIntent, float /*exposure*/)
+
+{
+    TQImage img = TQImage(width, height, 32, 0, TQImage::LittleEndian);
+    img.setAlphaBuffer( true );
+
+    KisColorSpace * dstCS;
+
+    if (dstProfile)
+        dstCS = m_parent->getColorSpace(KisID("RGBA",""),dstProfile->productName());
+    else
+        dstCS = m_parent->getRGB8();
+
+    if (data)
+        convertPixelsTo(const_cast<TQ_UINT8 *>(data), img.bits(), dstCS, width * height, renderingIntent);
+
+    return img;
+}
+
+
+cmsHTRANSFORM KisAbstractColorSpace::createTransform(KisColorSpace * dstColorSpace,
+                             KisProfile *  srcProfile,
+                             KisProfile *  dstProfile,
+                             TQ_INT32 renderingIntent)
+{
+    KConfig * cfg = KGlobal::config();
+    bool bpCompensation = cfg->readBoolEntry("useBlackPointCompensation", false);
+
+    int flags = 0;
+
+    if (bpCompensation) {
+        flags = cmsFLAGS_BLACKPOINTCOMPENSATION;
+    }
+
+    if (dstColorSpace && dstProfile && srcProfile ) {
+        cmsHTRANSFORM tf = cmsCreateTransform(srcProfile->profile(),
+                              colorSpaceType(),
+                              dstProfile->profile(),
+                              dstColorSpace->colorSpaceType(),
+                              renderingIntent,
+                              flags);
+
+        return tf;
+    }
+    return 0;
+}
+
+void KisAbstractColorSpace::compositeCopy(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 * /*tqmaskRowStart*/, TQ_INT32 /*tqmaskRowStride*/, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    TQ_UINT8 *dst = dstRowStart;
+    const TQ_UINT8 *src = srcRowStart;
+    TQ_INT32 bytesPerPixel = pixelSize();
+
+    while (rows > 0) {
+        memcpy(dst, src, numColumns * bytesPerPixel);
+
+        if (opacity != OPACITY_OPAQUE) {
+            multiplyAlpha(dst, opacity, numColumns);
+        }
+
+        dst += dstRowStride;
+        src += srcRowStride;
+        --rows;
+    }
+}
+
diff --git a/chalk/chalkcolor/kis_abstract_colorspace.h b/chalk/chalkcolor/kis_abstract_colorspace.h
new file mode 100644
index 000000000..75dfd1ef4
--- /dev/null
+++ b/chalk/chalkcolor/kis_abstract_colorspace.h
@@ -0,0 +1,312 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_ABSTRACT_COLORSPACE_H_
+#define KIS_ABSTRACT_COLORSPACE_H_
+
+#include <strings.h>
+
+#include <tqmap.h>
+#include <tqcolor.h>
+#include <tqstringlist.h>
+#include <tqpair.h>
+
+#include "kis_global.h"
+#include "kis_channelinfo.h"
+#include "kis_profile.h"
+#include "kis_id.h"
+#include "kis_composite_op.h"
+#include "kis_colorspace.h"
+#include "koffice_export.h"
+
+
+class TQPainter;
+class KisPixelRO;
+class KisColorSpaceFactoryRegistry;
+
+
+/**
+ * A colorspace strategy is the definition of a certain color model
+ * in Chalk.
+ */
+class KRITA_EXPORT KisAbstractColorSpace : public KisColorSpace {
+
+
+public:
+
+    /**
+     * @param id The unique human and machine readable identifiation of this colorspace
+     * @param cmType the lcms type indentification for this colorspace, may be 0
+     * @param colorSpaceSignature the icc identification for this colorspace, may be 0
+     * @param tqparent the registry that owns this instance
+     * @param profile the profile this colorspace uses for transforms
+     */
+    KisAbstractColorSpace(const KisID & id,
+                          DWORD cmType,
+                          icColorSpaceSignature colorSpaceSignature,
+                          KisColorSpaceFactoryRegistry * tqparent,
+                          KisProfile *profile);
+
+    void init();
+
+    virtual ~KisAbstractColorSpace();
+
+    virtual bool operator==(const KisAbstractColorSpace& rhs) const {
+        return (m_id == rhs.m_id && m_profile == rhs.m_profile);
+    }
+
+
+//================== Information about this color strategy ========================//
+
+public:
+
+
+    //========== Channels =====================================================//
+
+    // Return a vector describing all the channels this color model has.
+    virtual TQValueVector<KisChannelInfo *> channels() const = 0;
+
+    virtual TQ_UINT32 nChannels() const = 0;
+
+    virtual TQ_UINT32 nColorChannels() const = 0;
+
+    virtual TQ_UINT32 nSubstanceChannels() const { return 0; };
+
+    virtual TQ_UINT32 pixelSize() const = 0;
+
+    virtual TQString channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const = 0;
+
+    virtual TQString normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const = 0;
+
+    virtual TQ_UINT8 scaleToU8(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos) = 0;
+
+    virtual TQ_UINT16 scaleToU16(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos) = 0;
+
+    virtual void getSingleChannelPixel(TQ_UINT8 *dstPixel, const TQ_UINT8 *srcPixel, TQ_UINT32 channelIndex);
+
+    //========== Identification ===============================================//
+
+    virtual KisID id() const { return m_id; }
+
+    void setColorSpaceType(TQ_UINT32 type) { m_cmType = type; }
+    TQ_UINT32 colorSpaceType() { return m_cmType; }
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return m_colorSpaceSignature; }
+
+    //========== Capabilities =================================================//
+
+    virtual KisCompositeOpList userVisiblecompositeOps() const = 0;
+
+    /**
+     * Returns true if the colorspace supports channel values outside the 
+     * (normalised) range 0 to 1.
+     */
+    virtual bool hasHighDynamicRange() const { return false; }
+
+    //========== Display profiles =============================================//
+
+    virtual KisProfile * getProfile() const { return m_profile; };
+
+
+//================= Conversion functions ==================================//
+
+
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile * profile = 0);
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * profile = 0);
+
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * profile = 0);
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile = 0);
+
+
+    virtual void toLabA16(const TQ_UINT8 * src, TQ_UINT8 * dst, const TQ_UINT32 nPixels) const;
+    virtual void fromLabA16(const TQ_UINT8 * src, TQ_UINT8 * dst, const TQ_UINT32 nPixels) const;
+
+    virtual TQImage convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                                   KisProfile *  dstProfile,
+                                   TQ_INT32 renderingIntent = INTENT_PERCEPTUAL,
+                                   float exposure = 0.0f);
+
+    virtual bool convertPixelsTo(const TQ_UINT8 * src,
+                                 TQ_UINT8 * dst, KisColorSpace * dstColorSpace,
+                                 TQ_UINT32 numPixels,
+                                 TQ_INT32 renderingIntent = INTENT_PERCEPTUAL);
+
+//============================== Manipulation fucntions ==========================//
+
+
+//
+// The manipulation functions have default implementations that _convert_ the pixel
+// to a TQColor and back. Reimplement these methods in your color strategy!
+//
+    virtual KisColorAdjustment *createBrightnessContrastAdjustment(TQ_UINT16 *transferValues);
+
+    virtual KisColorAdjustment *createDesaturateAdjustment();
+
+    virtual KisColorAdjustment *createPerChannelAdjustment(TQ_UINT16 **transferValues);
+
+    virtual void applyAdjustment(const TQ_UINT8 *src, TQ_UINT8 *dst, KisColorAdjustment *, TQ_INT32 nPixels);
+
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    
+    virtual TQ_UINT8 difference(const TQ_UINT8* src1, const TQ_UINT8* src2);
+
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nPixels) const;
+
+    virtual void darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const;
+
+    virtual TQ_UINT8 intensity8(const TQ_UINT8 * src) const;
+    
+    virtual KisID mathToolboxID() const;
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dststride,
+                KisColorSpace * srcSpace,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+//========================== END of Public API ========================================//
+
+protected:
+
+
+    /**
+     * Compose two byte arrays containing pixels in the same color
+     * model together.
+     */
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dstRowSize,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op) = 0;
+
+    virtual cmsHTRANSFORM createTransform(KisColorSpace * dstColorSpace,
+                          KisProfile *  srcProfile,
+                          KisProfile *  dstProfile,
+                          TQ_INT32 renderingIntent);
+
+    virtual void compositeCopy(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity);
+
+
+    // So I don't need to re-implement it everywhere.
+    template <typename ColorType,
+              typename NativeMult, typename Uint8ToNative, typename NativeOpacityTest,
+              int AlphaPos, int NonAlphaSize, int TotalSize>
+    void abstractCompositeAlphaDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride,
+                                      const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride,
+                                      const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride,
+                                      TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity,
+                                      NativeMult nativeMult, Uint8ToNative uint8ToNative,
+                                      NativeOpacityTest nativeOpacityTest) {
+        while (rows > 0) {
+
+            const ColorType *src = reinterpret_cast<const ColorType*>(srcRowStart);
+            ColorType *dst = reinterpret_cast<ColorType*>(dstRowStart);
+            const TQ_UINT8 *tqmask = tqmaskRowStart;
+            TQ_INT32 columns = numColumns;
+
+            while (columns > 0) {
+
+                ColorType srcAlpha = src[AlphaPos];
+                ColorType dstAlpha = dst[AlphaPos];
+
+                // apply the alphatqmask
+                if(tqmask != 0)
+                {
+                    if(*tqmask != OPACITY_OPAQUE)
+                        srcAlpha = nativeMult(srcAlpha, uint8ToNative(*tqmask));
+                    tqmask++;
+                }
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = nativeMult(srcAlpha, uint8ToNative(opacity));
+                }
+
+                // not transparent
+                if (nativeOpacityTest(srcAlpha) && srcAlpha >= dstAlpha) {
+                    dst[AlphaPos] = srcAlpha;
+                    memcpy(dst, src, NonAlphaSize * sizeof(ColorType));
+                }
+
+                columns--;
+                src += TotalSize;
+                dst += TotalSize;
+            }
+
+            rows--;
+            srcRowStart += srcRowStride;
+            dstRowStart += dstRowStride;
+            if(tqmaskRowStart)
+                tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+
+protected:
+
+    TQStringList m_profileFilenames;
+    TQ_UINT8 * m_qcolordata; // A small buffer for conversion from and to qcolor.
+    TQ_INT32 m_alphaPos; // The position in _bytes_ of the alpha channel
+    TQ_INT32 m_alphaSize; // The width in _bytes_ of the alpha channel
+
+    TQValueVector<KisChannelInfo *> m_channels;
+
+    KisColorSpaceFactoryRegistry * m_parent;
+
+private:
+
+    cmsHTRANSFORM m_defaultToRGB;    // Default transform to 8 bit sRGB
+    cmsHTRANSFORM m_defaultFromRGB;  // Default transform from 8 bit sRGB
+
+    cmsHPROFILE   m_lastRGBProfile;  // Last used profile to transform to/from RGB
+    cmsHTRANSFORM m_lastToRGB;       // Last used transform to transform to RGB
+    cmsHTRANSFORM m_lastFromRGB;     // Last used transform to transform from RGB
+
+    cmsHTRANSFORM m_defaultToLab;
+    cmsHTRANSFORM m_defaultFromLab;
+
+    KisProfile *  m_profile;
+    KisColorSpace *m_lastUsedDstColorSpace;
+    cmsHTRANSFORM m_lastUsedTransform;
+
+    KisID m_id;
+    DWORD m_cmType;                           // The colorspace type as defined by littlecms
+    icColorSpaceSignature m_colorSpaceSignature; // The colorspace signature as defined in icm/icc files
+
+    // cmsHTRANSFORM is a void *, so this should work.
+    typedef TQMap<KisColorSpace *, cmsHTRANSFORM>  TransformMap;
+    TransformMap m_transforms; // Cache for existing transforms
+
+    KisAbstractColorSpace(const KisAbstractColorSpace&);
+    KisAbstractColorSpace& operator=(const KisAbstractColorSpace&);
+
+    TQMemArray<TQ_UINT8> m_conversionCache; // XXX: This will be a bad problem when we have threading.
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_H_
diff --git a/chalk/chalkcolor/kis_basic_histogram_producers.cc b/chalk/chalkcolor/kis_basic_histogram_producers.cc
new file mode 100644
index 000000000..b769a3d3c
--- /dev/null
+++ b/chalk/chalkcolor/kis_basic_histogram_producers.cc
@@ -0,0 +1,484 @@
+/*
+ *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <tqstring.h>
+#include <klocale.h>
+
+#include "config.h"
+
+#ifdef HAVE_OPENEXR
+#include <half.h>
+#endif
+
+#include "kis_global.h"
+#include "kis_basic_histogram_producers.h"
+#include "kis_integer_maths.h"
+#include "kis_channelinfo.h"
+#include "kis_colorspace.h"
+#include "kis_lab_colorspace.h"
+
+KisLabColorSpace* KisGenericLabHistogramProducer::m_labCs = 0;
+
+
+KisBasicHistogramProducer::KisBasicHistogramProducer(const KisID& id, int channels, int nrOfBins, KisColorSpace *cs)
+    : m_channels(channels),
+      m_nrOfBins(nrOfBins),
+      m_colorSpace(cs),
+      m_id(id)
+{
+    m_bins.resize(m_channels);
+    for (int i = 0; i < m_channels; i++)
+        m_bins.at(i).resize(m_nrOfBins);
+    m_outLeft.resize(m_channels);
+    m_outRight.resize(m_channels);
+    m_count = 0;
+    m_from = 0.0;
+    m_width = 1.0;
+}
+
+void KisBasicHistogramProducer::clear() {
+    m_count = 0;
+    for (int i = 0; i < m_channels; i++) {
+        for (int j = 0; j < m_nrOfBins; j++) {
+            m_bins.at(i).at(j) = 0;
+        }
+        m_outRight.at(i) = 0;
+        m_outLeft.at(i) = 0;
+    }
+}
+
+void KisBasicHistogramProducer::makeExternalToInternal() {
+    // This function assumes that the pixel is has no 'gaps'. That is to say: if we start
+    // at byte 0, we can get to the end of the pixel by adding consecutive size()s of
+    // the channels
+    TQValueVector<KisChannelInfo *> c = channels();
+    uint count = c.count();
+    int currentPos = 0;
+
+    for (uint i = 0; i < count; i++) {
+        for (uint j = 0; j < count; j++) {
+            if (c.at(j)->pos() == currentPos) {
+                m_external.append(j);
+                break;
+            }
+        }
+        currentPos += c.at(m_external.at(m_external.count() - 1))->size();
+    }
+}
+
+// ------------ U8 ---------------------
+
+KisBasicU8HistogramProducer::KisBasicU8HistogramProducer(const KisID& id, KisColorSpace *cs)
+    : KisBasicHistogramProducer(id, cs->nChannels(), 256, cs)
+{
+}
+
+TQString KisBasicU8HistogramProducer::positionToString(double pos) const {
+    return TQString("%1").tqarg(static_cast<TQ_UINT8>(pos * UINT8_MAX));
+}
+
+void KisBasicU8HistogramProducer::addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace *cs)
+{
+    if (!pixels) return;
+    if (!cs) return;
+    if (nPixels == 0) return;
+
+    TQ_INT32 pSize = cs->pixelSize();
+
+    if ( selectionMask ) {
+        while (nPixels > 0) {
+            if ( ! (m_skipUnselected && *selectionMask == 0) || (m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT) ) {
+
+                for (int i = 0; i < m_channels; i++) {
+                    m_bins.at(i).at(pixels[i])++;
+                }
+                m_count++;
+
+            }
+
+            pixels += pSize;
+            selectionMask++;
+            nPixels--;
+        }
+    }
+    else {
+        while (nPixels > 0) {
+            if ( ! (m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT) ) {
+
+                for (int i = 0; i < m_channels; i++) {
+                    m_bins.at(i).at(pixels[i])++;
+                }
+                m_count++;
+
+            }
+
+            pixels += pSize;
+            nPixels--;
+        }
+    }
+}
+
+// ------------ U16 ---------------------
+
+KisBasicU16HistogramProducer::KisBasicU16HistogramProducer(const KisID& id, KisColorSpace *cs)
+    : KisBasicHistogramProducer(id, cs->nChannels(), 256, cs)
+{
+}
+
+TQString KisBasicU16HistogramProducer::positionToString(double pos) const
+{
+    return TQString("%1").tqarg(static_cast<TQ_UINT8>(pos * UINT8_MAX));
+}
+
+double KisBasicU16HistogramProducer::maximalZoom() const
+{
+    return 1.0 / 255.0;
+}
+
+void KisBasicU16HistogramProducer::addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace *cs)
+{
+    // The view
+    TQ_UINT16 from = static_cast<TQ_UINT16>(m_from * UINT16_MAX);
+    TQ_UINT16 width = static_cast<TQ_UINT16>(m_width * UINT16_MAX + 0.5); // We include the end
+    TQ_UINT16 to = from + width;
+    double factor = 255.0 / width;
+
+    TQ_INT32 pSize = cs->pixelSize();
+
+    if ( selectionMask ) {
+        TQ_UINT16* pixel = reinterpret_cast<TQ_UINT16*>(pixels);
+        while (nPixels > 0) {
+            if ( ! ((m_skipUnselected && *selectionMask == 0) || (m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT)) ) {
+                for (int i = 0; i < m_channels; i++) {
+                    TQ_UINT16 value = pixel[i];
+                    if (value > to)
+                        m_outRight.at(i)++;
+                    else if (value < from)
+                        m_outLeft.at(i)++;
+                    else
+                        m_bins.at(i).at(static_cast<TQ_UINT8>((value - from) * factor))++;
+                }
+                m_count++;
+            }
+            pixels += pSize;
+            selectionMask++;
+            nPixels--;
+        }
+    }
+    else {
+        while (nPixels > 0) {
+            TQ_UINT16* pixel = reinterpret_cast<TQ_UINT16*>(pixels);
+
+            if ( ! (m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT)) {
+                for (int i = 0; i < m_channels; i++) {
+                    TQ_UINT16 value = pixel[i];
+                    if (value > to)
+                        m_outRight.at(i)++;
+                    else if (value < from)
+                        m_outLeft.at(i)++;
+                    else
+                        m_bins.at(i).at(static_cast<TQ_UINT8>((value - from) * factor))++;
+                }
+                m_count++;
+            }
+            pixels += pSize;
+            nPixels--;
+
+        }
+    }
+}
+
+// ------------ Float32 ---------------------
+KisBasicF32HistogramProducer::KisBasicF32HistogramProducer(const KisID& id, KisColorSpace *cs)
+    : KisBasicHistogramProducer(id, cs->nChannels(), 256, cs)
+{
+}
+
+TQString KisBasicF32HistogramProducer::positionToString(double pos) const {
+    return TQString("%1").tqarg(static_cast<float>(pos)); // XXX I doubt this is correct!
+}
+
+double KisBasicF32HistogramProducer::maximalZoom() const {
+    // XXX What _is_ the maximal zoom here? I don't think there is one with floats, so this seems a fine compromis for the moment
+    return 1.0 / 255.0;
+}
+
+void KisBasicF32HistogramProducer::addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace *cs) {
+    // The view
+    float from = static_cast<float>(m_from);
+    float width = static_cast<float>(m_width);
+    float to = from + width;
+    float factor = 255.0 / width;
+
+    TQ_INT32 pSize = cs->pixelSize();
+
+    if ( selectionMask ) {
+        while (nPixels > 0) {
+
+            float* pixel = reinterpret_cast<float*>(pixels);
+            if ( !((m_skipUnselected && *selectionMask == 0) || (m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT)) ) {
+                for (int i = 0; i < m_channels; i++) {
+                    float value = pixel[i];
+                    if (value > to)
+                        m_outRight.at(i)++;
+                    else if (value < from)
+                        m_outLeft.at(i)++;
+                    else
+                        m_bins.at(i).at(static_cast<TQ_UINT8>((value - from) * factor))++;
+                }
+                m_count++;
+            }
+
+            pixels += pSize;
+            selectionMask++;
+            nPixels--;
+
+        }
+    }
+    else {
+        while (nPixels > 0) {
+
+            float* pixel = reinterpret_cast<float*>(pixels);
+            if ( !(m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT)) {
+                for (int i = 0; i < m_channels; i++) {
+                    float value = pixel[i];
+                    if (value > to)
+                        m_outRight.at(i)++;
+                    else if (value < from)
+                        m_outLeft.at(i)++;
+                    else
+                        m_bins.at(i).at(static_cast<TQ_UINT8>((value - from) * factor))++;
+                }
+                m_count++;
+            }
+
+            pixels += pSize;
+            nPixels--;
+
+        }
+    }
+}
+
+#ifdef HAVE_OPENEXR
+// ------------ Float16 Half ---------------------
+KisBasicF16HalfHistogramProducer::KisBasicF16HalfHistogramProducer(const KisID& id,
+                                                                   KisColorSpace *cs)
+    : KisBasicHistogramProducer(id, cs->nChannels(), 256, cs) {
+}
+
+TQString KisBasicF16HalfHistogramProducer::positionToString(double pos) const {
+    return TQString("%1").tqarg(static_cast<float>(pos)); // XXX I doubt this is correct!
+}
+
+double KisBasicF16HalfHistogramProducer::maximalZoom() const {
+    // XXX What _is_ the maximal zoom here? I don't think there is one with floats, so this seems a fine compromis for the moment
+    return 1.0 / 255.0;
+}
+
+void KisBasicF16HalfHistogramProducer::addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace *cs) {
+    // The view
+    float from = static_cast<float>(m_from);
+    float width = static_cast<float>(m_width);
+    float to = from + width;
+    float factor = 255.0 / width;
+
+    TQ_INT32 pSize = cs->pixelSize();
+    if ( selectionMask ) {
+        while (nPixels > 0) {
+            half* pixel = reinterpret_cast<half*>(pixels);
+            if ( !((m_skipUnselected  && *selectionMask == 0) || (m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT)) ) {
+                for (int i = 0; i < m_channels; i++) {
+                    float value = pixel[i];
+                    if (value > to)
+                        m_outRight.at(i)++;
+                    else if (value < from)
+                        m_outLeft.at(i)++;
+                    else
+                        m_bins.at(i).at(static_cast<TQ_UINT8>((value - from) * factor))++;
+                }
+                m_count++;
+            }
+            pixels += pSize;
+            selectionMask++;
+            nPixels--;
+        }
+    }
+    else {
+        while (nPixels > 0) {
+            half* pixel = reinterpret_cast<half*>(pixels);
+            if ( !(m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT)) {
+                for (int i = 0; i < m_channels; i++) {
+                    float value = pixel[i];
+                    if (value > to)
+                        m_outRight.at(i)++;
+                    else if (value < from)
+                        m_outLeft.at(i)++;
+                    else
+                        m_bins.at(i).at(static_cast<TQ_UINT8>((value - from) * factor))++;
+                }
+                m_count++;
+            }
+            pixels += pSize;
+            nPixels--;
+        }
+    }
+}
+#endif
+
+// ------------ Generic RGB ---------------------
+KisGenericRGBHistogramProducer::KisGenericRGBHistogramProducer()
+    : KisBasicHistogramProducer(KisID("GENRGBHISTO", i18n("Generic RGB Histogram")),
+                                3, 256, 0) {
+    /* we set 0 as colorspece, because we are not based on a specific colorspace. This
+       is no problem for the superclass since we override channels() */
+    m_channelsList.append(new KisChannelInfo(i18n("R"), i18n("R"), 0, KisChannelInfo::COLOR, KisChannelInfo::UINT8, 1, TQColor(255,0,0)));
+    m_channelsList.append(new KisChannelInfo(i18n("G"), i18n("G"), 1, KisChannelInfo::COLOR, KisChannelInfo::UINT8, 1, TQColor(0,255,0)));
+    m_channelsList.append(new KisChannelInfo(i18n("B"), i18n("B"), 2, KisChannelInfo::COLOR, KisChannelInfo::UINT8, 1, TQColor(0,0,255)));
+}
+
+TQValueVector<KisChannelInfo *> KisGenericRGBHistogramProducer::channels() {
+    return m_channelsList;
+}
+
+TQString KisGenericRGBHistogramProducer::positionToString(double pos) const {
+    return TQString("%1").tqarg(static_cast<TQ_UINT8>(pos * UINT8_MAX));
+}
+
+double KisGenericRGBHistogramProducer::maximalZoom() const {
+    return 1.0;
+}
+
+
+void KisGenericRGBHistogramProducer::addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace *cs)
+{
+    for (int i = 0; i < m_channels; i++) {
+        m_outRight.at(i) = 0;
+        m_outLeft.at(i) = 0;
+    }
+
+    TQColor c;
+    TQ_INT32 pSize = cs->pixelSize();
+    if (selectionMask) {
+        while (nPixels > 0) {
+            if ( !((m_skipUnselected  && *selectionMask == 0) || (m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT)) ) {
+                cs->toTQColor(pixels, &c);
+                m_bins.at(0).at(c.red())++;
+                m_bins.at(1).at(c.green())++;
+                m_bins.at(2).at(c.blue())++;
+
+                m_count++;
+            }
+            pixels += pSize;
+            selectionMask++;
+            nPixels--;
+        }
+
+    }
+    else {
+        while (nPixels > 0) {
+
+            if ( !(m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT)) {
+                cs->toTQColor(pixels, &c);
+                m_bins.at(0).at(c.red())++;
+                m_bins.at(1).at(c.green())++;
+                m_bins.at(2).at(c.blue())++;
+
+                m_count++;
+            }
+            pixels += pSize;
+            nPixels--;
+        }
+    }
+}
+
+// ------------ Generic L*a*b* ---------------------
+KisGenericLabHistogramProducer::KisGenericLabHistogramProducer()
+    : KisBasicHistogramProducer(KisID("GENLABHISTO", i18n("L*a*b* Histogram")), 3, 256, 0) {
+    /* we set 0 as colorspace, because we are not based on a specific colorspace. This
+       is no problem for the superclass since we override channels() */
+    m_channelsList.append(new KisChannelInfo(i18n("L*"), i18n("L"), 0, KisChannelInfo::COLOR, KisChannelInfo::UINT8));
+    m_channelsList.append(new KisChannelInfo(i18n("a*"), i18n("a"), 1, KisChannelInfo::COLOR, KisChannelInfo::UINT8));
+    m_channelsList.append(new KisChannelInfo(i18n("b*"), i18n("b"), 2, KisChannelInfo::COLOR, KisChannelInfo::UINT8));
+
+    if (!m_labCs) {
+        KisProfile *labProfile = new KisProfile(cmsCreateLabProfile(NULL));
+        m_labCs = new KisLabColorSpace(0, labProfile);
+    }
+    m_colorSpace = m_labCs;
+}
+KisGenericLabHistogramProducer::~KisGenericLabHistogramProducer()
+{
+    delete m_channelsList[0];
+    delete m_channelsList[1];
+    delete m_channelsList[2];
+}
+
+TQValueVector<KisChannelInfo *> KisGenericLabHistogramProducer::channels() {
+    return m_channelsList;
+}
+
+TQString KisGenericLabHistogramProducer::positionToString(double pos) const {
+    return TQString("%1").tqarg(static_cast<TQ_UINT16>(pos * UINT16_MAX));
+}
+
+double KisGenericLabHistogramProducer::maximalZoom() const {
+    return 1.0;
+}
+
+
+void KisGenericLabHistogramProducer::addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels,  KisColorSpace *cs)
+{
+    for (int i = 0; i < m_channels; i++) {
+        m_outRight.at(i) = 0;
+        m_outLeft.at(i) = 0;
+    }
+
+    TQ_UINT8 dst[8];
+    TQ_INT32 pSize = cs->pixelSize();
+
+    if (selectionMask) {
+        while (nPixels > 0) {
+            if ( !((m_skipUnselected  && *selectionMask == 0) || (m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT)) ) {
+/*
+  cs->toTQColor(pixels, &c);
+  m_bins.at(0).at(c.red())++;
+*/
+                m_count++;
+            }
+            pixels += pSize;
+            selectionMask++;
+            nPixels--;
+        }
+    }
+    else {
+        while (nPixels > 0) {
+            if ( !(m_skipTransparent && cs->getAlpha(pixels) == OPACITY_TRANSPARENT))  {
+
+  cs->convertPixelsTo(pixels, dst, m_colorSpace, 1);
+  m_bins.at(0).at(m_colorSpace->scaleToU8(dst, 0))++;
+  m_bins.at(1).at(m_colorSpace->scaleToU8(dst, 1))++;
+  m_bins.at(2).at(m_colorSpace->scaleToU8(dst, 2))++;
+
+                m_count++;
+            }
+            pixels += pSize;
+            nPixels--;
+        }
+    }
+}
+
diff --git a/chalk/chalkcolor/kis_basic_histogram_producers.h b/chalk/chalkcolor/kis_basic_histogram_producers.h
new file mode 100644
index 000000000..8b913ece8
--- /dev/null
+++ b/chalk/chalkcolor/kis_basic_histogram_producers.h
@@ -0,0 +1,197 @@
+/*
+ *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _KIS_BASIC_HISTOGRAM_PRODUCERS_
+#define _KIS_BASIC_HISTOGRAM_PRODUCERS_
+
+#include <tqvaluevector.h>
+#include <klocale.h>
+
+#include "config.h"
+
+#include "kis_histogram_producer.h"
+#include "kis_colorspace.h"
+#include "kis_id.h"
+
+class KisLabColorSpace;
+
+class KisBasicHistogramProducer : public KisHistogramProducer {
+public:
+    KisBasicHistogramProducer(const KisID& id, int channels, int nrOfBins, KisColorSpace *colorSpace);
+    virtual ~KisBasicHistogramProducer() {}
+
+    virtual void clear();
+
+    virtual void setView(double from, double size) { m_from = from; m_width = size; }
+
+    virtual const KisID& id() const { return m_id; }
+    virtual TQValueVector<KisChannelInfo *> channels() { return m_colorSpace->channels(); }
+    virtual TQ_INT32 numberOfBins() { return m_nrOfBins; }
+    virtual double viewFrom() const { return m_from; }
+    virtual double viewWidth() const { return m_width; }
+
+    virtual TQ_INT32 count() { return m_count; }
+
+    virtual TQ_INT32 getBinAt(int channel, int position)
+        { return m_bins.at(externalToInternal(channel)).at(position); }
+
+    virtual TQ_INT32 outOfViewLeft(int channel)
+        { return m_outLeft.at(externalToInternal(channel)); }
+
+    virtual TQ_INT32 outOfViewRight(int channel)
+        { return m_outRight.at(externalToInternal(channel)); }
+
+protected:
+    /**
+     * The order in which channels() returns is not the same as the internal representation,
+     * that of the pixel internally. This method converts external usage to internal usage.
+     * This method uses some basic assumtpions about the tqlayout of the pixel, so _extremely_
+     * exotic spaces might want to override this (see makeExternalToInternal source for
+     * those assumptions)
+     **/
+    virtual int externalToInternal(int ext) {
+        if (channels().count() > 0 && m_external.count() == 0) // Set up the translation table
+            makeExternalToInternal();
+        return m_external.at(ext);
+    }
+    // not virtual since that is useless: we call it from constructor
+    void makeExternalToInternal();
+    typedef TQValueVector<TQ_UINT32> vBins;
+    TQValueVector<vBins> m_bins;
+    vBins m_outLeft, m_outRight;
+    double m_from, m_width;
+    TQ_INT32 m_count;
+    int m_channels, m_nrOfBins;
+    KisColorSpace *m_colorSpace;
+    KisID m_id;
+    TQValueVector<TQ_INT32> m_external;
+};
+
+class KisBasicU8HistogramProducer : public KisBasicHistogramProducer {
+public:
+    KisBasicU8HistogramProducer(const KisID& id, KisColorSpace *colorSpace);
+    virtual void addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace *colorSpace);
+    virtual TQString positionToString(double pos) const;
+    virtual double maximalZoom() const { return 1.0; }
+};
+
+class KisBasicU16HistogramProducer : public KisBasicHistogramProducer {
+public:
+    KisBasicU16HistogramProducer(const KisID& id, KisColorSpace *colorSpace);
+    virtual void addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace *colorSpace);
+    virtual TQString positionToString(double pos) const;
+    virtual double maximalZoom() const;
+};
+
+class KisBasicF32HistogramProducer : public KisBasicHistogramProducer {
+public:
+    KisBasicF32HistogramProducer(const KisID& id, KisColorSpace *colorSpace);
+    virtual void addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace *colorSpace);
+    virtual TQString positionToString(double pos) const;
+    virtual double maximalZoom() const;
+};
+
+#ifdef HAVE_OPENEXR
+class KisBasicF16HalfHistogramProducer : public KisBasicHistogramProducer {
+public:
+    KisBasicF16HalfHistogramProducer(const KisID& id, KisColorSpace *colorSpace);
+    virtual void addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace *colorSpace);
+    virtual TQString positionToString(double pos) const;
+    virtual double maximalZoom() const;
+};
+#endif
+
+/**
+ * Parametrized on a specific KisHistogramProducer. Its generated producers
+ * will have the same KisID as the factory's. This is acceptable because we can't mix
+ * Factories with Producers in the code because they are incompatible types, and
+ * in the GUI we actually only need a producer's name, not a factory's.
+ */
+template<class T> class KisBasicHistogramProducerFactory : public KisHistogramProducerFactory {
+public:
+    KisBasicHistogramProducerFactory(const KisID& id, KisColorSpace *colorSpace)
+        : KisHistogramProducerFactory(id), m_cs(colorSpace) {}
+    virtual ~KisBasicHistogramProducerFactory() {}
+    virtual KisHistogramProducerSP generate() { return new T(id(), m_cs); }
+    virtual bool isCompatibleWith(KisColorSpace* colorSpace) const { return colorSpace->id() == m_cs->id(); }
+    virtual float preferrednessLevelWith(KisColorSpace* /*colorSpace*/) const { return 1.0; }
+protected:
+    KisColorSpace *m_cs;
+};
+
+/**
+ * This is a Producer (with associated factory) that converts the pixels of the colorspace
+ * to RGB8 with toTQColor, and then does its counting on RGB. This is NOT registered with the
+ * Registry, because it isCompatibleWith all colorspaces, and should only be used in extreme
+ * cases (like no other producer being available
+ **/
+class KisGenericRGBHistogramProducer : public KisBasicHistogramProducer {
+public:
+    KisGenericRGBHistogramProducer();
+    virtual void addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace *colorSpace);
+    virtual TQString positionToString(double pos) const;
+    virtual double maximalZoom() const;
+    virtual TQValueVector<KisChannelInfo *> channels();
+protected:
+    TQValueVector<KisChannelInfo *> m_channelsList;
+};
+
+/** KisGenericRGBHistogramProducer his special Factory that isCompatibleWith everything. */
+class KisGenericRGBHistogramProducerFactory : public KisHistogramProducerFactory {
+public:
+    KisGenericRGBHistogramProducerFactory()
+        : KisHistogramProducerFactory(KisID("GENRGBHISTO", i18n("Generic RGB"))) {}
+    virtual ~KisGenericRGBHistogramProducerFactory() {}
+    virtual KisHistogramProducerSP generate() { return new KisGenericRGBHistogramProducer(); }
+    virtual bool isCompatibleWith(KisColorSpace*) const { return true; }
+    virtual float preferrednessLevelWith(KisColorSpace*) const { return 0.0; }
+};
+
+
+/**
+ * This is a Producer (with associated factory) that converts the pixels of the colorspace
+ * to L*a*b*, and then does its counting.
+ * It isCompatibleWith all colorspaces
+ **/
+class KisGenericLabHistogramProducer : public KisBasicHistogramProducer {
+    public:
+        KisGenericLabHistogramProducer();
+        virtual ~KisGenericLabHistogramProducer();
+        virtual void addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace *colorSpace);
+        virtual TQString positionToString(double pos) const;
+        virtual double maximalZoom() const;
+        virtual TQValueVector<KisChannelInfo *> channels();
+    protected:
+        TQValueVector<KisChannelInfo *> m_channelsList;
+    private:
+        static KisLabColorSpace* m_labCs;
+};
+
+/** KisGenericLabHistogramProducer his special Factory that isCompatibleWith everything. */
+class KisGenericLabHistogramProducerFactory : public KisHistogramProducerFactory {
+    public:
+        KisGenericLabHistogramProducerFactory()
+    : KisHistogramProducerFactory(KisID("GENLABHISTO", i18n("Generic L*a*b*"))) {}
+        virtual ~KisGenericLabHistogramProducerFactory() {}
+        virtual KisHistogramProducerSP generate() { return new KisGenericLabHistogramProducer(); }
+        virtual bool isCompatibleWith(KisColorSpace*) const { return true; }
+        virtual float preferrednessLevelWith(KisColorSpace*) const { return 0.0; }
+};
+
+
+#endif // _KIS_BASIC_HISTOGRAM_PRODUCERS_
diff --git a/chalk/chalkcolor/kis_channelinfo.h b/chalk/chalkcolor/kis_channelinfo.h
new file mode 100644
index 000000000..f8ec83019
--- /dev/null
+++ b/chalk/chalkcolor/kis_channelinfo.h
@@ -0,0 +1,115 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_CHANNELINFO_H_
+#define KIS_CHANNELINFO_H_
+
+#include <tqcolor.h>
+#include "tqstring.h"
+#include "ksharedptr.h"
+
+/** 
+ * This class gives some basic information about a channel,
+ * that is, one of the components that makes up a particular 
+ * pixel.
+ */
+class KisChannelInfo : public KShared {
+public:
+    enum enumChannelType {
+        COLOR, // The channel represents a color
+        ALPHA, // The channel represents the opacity of a pixel
+        SUBSTANCE, // The channel represents a real-world substance like pigments or medium
+        SUBSTRATE // The channel represents a real-world painting substrate like a canvas
+    };
+    
+    enum enumChannelValueType {
+        UINT8,
+        UINT16,
+        FLOAT16,
+        FLOAT32,
+        INT8,
+        INT16,
+        OTHER // Use this if the channel is neither an integer or a float
+    };
+    enum enumChannelFlags {
+        FLAG_COLOR = 1,
+        FLAG_ALPHA = (1 << 1),
+        FLAG_SUBSTANCE = (1 << 2),
+        FLAG_SUBSTRATE = (1 << 3),
+        FLAG_COLOR_AND_ALPHA = FLAG_ALPHA | FLAG_COLOR // HACK to be able to use convolution of color and alpha at the same time
+    };
+
+public:
+    KisChannelInfo() { };
+    /**
+     * @param name The i18n'ed name of this channel ("Red")
+     * @param abbrev A one or two letter abbreviation of the name of this channel ("R")
+     * @param npos the position of the first byte of this channel value in the pixel
+     * @param channelType the type of this channel (color, alpha, etc)
+     * @param channelValueType the datatype of this channel
+     * @param size the size in bytes of this channel 
+     * @param color a color to visually represent this channel by in the gui
+     */
+    KisChannelInfo( const TQString & name, const TQString & abbrev, TQ_INT32 npos, enumChannelType channelType, enumChannelValueType channelValueType, TQ_INT32 size = 1, TQColor color = TQColor(0,0,0))
+        : m_name (name), m_abbrev(abbrev), m_pos (npos), m_channelType(channelType), m_channelValueType(channelValueType), m_size(size), m_color(color) { };
+public:
+    /**
+     * User-friendly name for this channel for presentation purposes in the gui
+     */
+    inline TQString name() const { return m_name; };
+
+    /**
+     * Return the single-letter abbreviation for this channel
+     */
+    inline TQString abbrev() const { return m_abbrev; };
+    /** 
+     * returns the position of the first byte of the channel in the pixel
+     */
+    inline TQ_INT32 pos() const { return m_pos; };
+    
+    /**
+     * returns the number of bytes this channel takes
+     */
+    inline TQ_INT32 size() const { return m_size; };
+
+    /**
+     * returns the type of the channel
+     */
+    inline enumChannelType channelType() const { return m_channelType; };
+    /**
+     * return the type of the value of the channel (float, uint8 or uint16)
+     */
+    inline enumChannelValueType channelValueType() const { return m_channelValueType; };
+    /**
+     * This is a color that can be used to represent this channel in histograms and so.
+     * By default this is black, so keep in mind that many channels might look the same
+     */
+    inline TQColor color() const { return m_color; }
+
+private:
+
+    TQString m_name;
+    TQString m_abbrev;
+    TQ_INT32 m_pos;
+    enumChannelType m_channelType;
+    enumChannelValueType m_channelValueType;
+    TQ_INT32 m_size;
+    TQColor m_color;
+
+};
+
+#endif // KIS_CHANNELINFO_H_
diff --git a/chalk/chalkcolor/kis_color.cc b/chalk/chalkcolor/kis_color.cc
new file mode 100644
index 000000000..7d6acb896
--- /dev/null
+++ b/chalk/chalkcolor/kis_color.cc
@@ -0,0 +1,185 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <tqcolor.h>
+ 
+#include "kdebug.h"
+#include "kis_debug_areas.h"
+#include "kis_color.h"
+#include "kis_profile.h"
+#include "kis_colorspace.h"
+#include "kis_colorspace_factory_registry.h"
+
+KisColor::KisColor()
+{
+    m_data = 0;
+    m_colorSpace = 0;
+}
+
+KisColor::~KisColor()
+{
+    delete [] m_data;
+}
+
+KisColor::KisColor(const TQColor & color, KisColorSpace * colorSpace)
+    : m_colorSpace(colorSpace)
+{
+    Q_ASSERT(color.isValid());
+    Q_ASSERT(colorSpace);
+    
+    m_data = new TQ_UINT8[colorSpace->pixelSize()];
+    memset(m_data, 0, m_colorSpace->pixelSize());
+
+    m_colorSpace->fromTQColor(color, OPACITY_OPAQUE, m_data);
+}
+
+
+KisColor::KisColor(const TQColor & color, TQ_UINT8 alpha, KisColorSpace * colorSpace)
+    : m_colorSpace(colorSpace)
+{
+    Q_ASSERT(color.isValid());
+    Q_ASSERT(colorSpace);
+    m_data = new TQ_UINT8[colorSpace->pixelSize()];
+    memset(m_data, 0, m_colorSpace->pixelSize());
+
+    m_colorSpace->fromTQColor(color, alpha, m_data);
+}
+
+KisColor::KisColor(const TQ_UINT8 * data, KisColorSpace * colorSpace)
+    : m_colorSpace(colorSpace)
+{
+
+    m_data = new TQ_UINT8[colorSpace->pixelSize()];
+    memset(m_data, 0, m_colorSpace->pixelSize());
+    memmove(m_data, data, colorSpace->pixelSize());
+}
+
+
+KisColor::KisColor(const KisColor &src, KisColorSpace * colorSpace)
+    : m_colorSpace(colorSpace)
+{
+    m_data = new TQ_UINT8[colorSpace->pixelSize()];
+    memset(m_data, 0, m_colorSpace->pixelSize());
+
+    src.colorSpace()->convertPixelsTo(src.data(), m_data, colorSpace, 1);
+}
+
+KisColor::KisColor(const KisColor & rhs)
+{
+    if (this == &rhs) return;
+
+    m_colorSpace = rhs.colorSpace();
+    m_data = new TQ_UINT8[m_colorSpace->pixelSize()];
+    memset(m_data, 0, m_colorSpace->pixelSize());
+    memcpy(m_data, rhs.data(), m_colorSpace->pixelSize());
+}
+
+KisColor & KisColor::operator=(const KisColor & rhs)
+{
+    delete [] m_data;
+    m_data = 0;
+    m_colorSpace = rhs.colorSpace();
+
+    if (rhs.m_colorSpace && rhs.m_data) {
+        m_data = new TQ_UINT8[m_colorSpace->pixelSize()];
+        memcpy(m_data, rhs.m_data, m_colorSpace->pixelSize());
+    }
+    return * this;
+}
+
+void KisColor::convertTo(KisColorSpace * cs)
+{
+    //kdDebug(DBG_AREA_CMS) << "Our colormodel: " << m_colorSpace->id().name()
+    //      << ", new colormodel: " << cs->id().name() << "\n";
+
+    if (m_colorSpace == cs)
+        return;
+
+    TQ_UINT8 * m_data2 = new TQ_UINT8[cs->pixelSize()];
+    memset(m_data2, 0, cs->pixelSize());
+
+    m_colorSpace->convertPixelsTo(m_data, m_data2, cs, 1);
+
+    delete [] m_data;
+    m_data = m_data2;
+    m_colorSpace = cs;
+}
+
+
+void KisColor::setColor(TQ_UINT8 * data, KisColorSpace * colorSpace)
+{
+    delete [] m_data;
+    m_data = new TQ_UINT8[colorSpace->pixelSize()];
+    memcpy(m_data, data, colorSpace->pixelSize());
+    m_colorSpace = colorSpace;
+}
+
+// To save the user the trouble of doing color->colorSpace()->toTQColor(color->data(), &c, &a, profile
+void KisColor::toTQColor(TQColor *c) const
+{
+    if (m_colorSpace && m_data) {
+        // XXX (bsar): There must be a better way, but I'm getting hopelessly confused about constness by now
+        KisColorSpace * cs(const_cast<KisColorSpace*>(m_colorSpace));
+
+        cs->toTQColor(m_data, c);
+    }
+}
+
+void KisColor::toTQColor(TQColor *c, TQ_UINT8 *opacity) const
+{
+    if (m_colorSpace && m_data) {
+        // XXX (bsar): There must be a better way, but I'm getting hopelessly confused about constness by now
+        KisColorSpace * cs(const_cast<KisColorSpace*>(m_colorSpace));
+        cs->toTQColor(m_data, c, opacity);
+    }
+}
+
+TQColor KisColor::toTQColor() const
+{
+    TQColor c;
+    toTQColor(&c);
+    return c;
+}
+
+void KisColor::dump() const
+{
+
+    //kdDebug(DBG_AREA_CMS) << "KisColor (" << this << "), " << m_colorSpace->id().name() << "\n";
+    TQValueVector<KisChannelInfo *> channels = m_colorSpace->channels();
+
+    TQValueVector<KisChannelInfo *>::const_iterator begin = channels.begin();
+    TQValueVector<KisChannelInfo *>::const_iterator end = channels.end();
+
+    for (TQValueVector<KisChannelInfo *>::const_iterator it = begin; it != end; ++it)
+    {
+        KisChannelInfo * ch = (*it);
+        // XXX: setNum always takes a byte.
+        if (ch->size() == sizeof(TQ_UINT8)) {
+            // Byte
+            //kdDebug(DBG_AREA_CMS) << "Channel (byte): " << ch->name() << ": " << TQString().setNum(m_data[ch->pos()]) << "\n";
+        }
+        else if (ch->size() == sizeof(TQ_UINT16)) {
+            // Short (may also by an nvidia half)
+            //kdDebug(DBG_AREA_CMS) << "Channel (short): " << ch->name() << ": " << TQString().setNum(*((const TQ_UINT16 *)(m_data+ch->pos())))  << "\n";
+        }
+        else if (ch->size() == sizeof(TQ_UINT32)) {
+            // Integer (may also be float... Find out how to distinguish these!)
+            //kdDebug(DBG_AREA_CMS) << "Channel (int): " << ch->name() << ": " << TQString().setNum(*((const TQ_UINT32 *)(m_data+ch->pos())))  << "\n";
+        }
+    }
+
+}
diff --git a/chalk/chalkcolor/kis_color.h b/chalk/chalkcolor/kis_color.h
new file mode 100644
index 000000000..b7646586e
--- /dev/null
+++ b/chalk/chalkcolor/kis_color.h
@@ -0,0 +1,90 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef _KIS_COLOR_H_
+#define _KIS_COLOR_H_
+
+#include <tqcolor.h>
+#include "ksharedptr.h"
+
+#include "kis_global.h"
+#include "kis_profile.h"
+#include "kis_colorspace.h"
+
+
+/**
+ * A KisColor describes a color in a certain colorspace.
+ *
+ */
+class KisColor {
+
+public:
+    /// Create an empty KisColor. It will be valid, but also black and transparent
+    KisColor();
+
+    virtual ~KisColor();
+
+    /// Create a KisColor from a TQColor. The TQColor is immediately converted to native. The TQColor
+    /// is assumed to have the current monitor profile.
+    KisColor(const TQColor & color, KisColorSpace * colorSpace);
+
+    /// Create a KisColor from a TQColor. The TQColor is immediately converted to native. The TQColor
+    /// is assumed to have the current monitor profile.
+    KisColor(const TQColor & color, TQ_UINT8 alpha, KisColorSpace * colorSpace);
+
+    /// Create a KisColor using a native color strategy. The data is copied.
+    KisColor(const TQ_UINT8 * data, KisColorSpace * colorSpace);
+
+    /// Create a KisColor by converting src into another colorspace
+    KisColor(const KisColor &src, KisColorSpace * colorSpace);
+
+    /// Copy constructor -- deep copies the colors.
+    KisColor(const KisColor & rhs);
+
+    /// Effective C++, item 11
+    KisColor &operator=(const KisColor &);
+
+    /// For easy memcpy'ing etc.
+    TQ_UINT8 * data() const { return m_data; }
+
+    KisColorSpace * colorSpace() const { return m_colorSpace; }
+
+    KisProfile *  profile() const { return m_colorSpace->getProfile(); }
+
+    /// Convert this KisColor to the specified colorspace. If the specified colorspace is the
+    /// same as the original colorspace, do nothing. Returns the converted KisColor.
+    void convertTo(KisColorSpace * cs);
+
+    /// Replace the existing color data, and colorspace with the specified data.
+    void setColor(TQ_UINT8 * data, KisColorSpace * colorSpace = 0);
+
+    /// To save the user the trouble of doing color->colorSpace()->toTQColor(color->data(), &c, &a
+    void toTQColor(TQColor *c) const;
+    void toTQColor(TQColor *c, TQ_UINT8 *opacity) const;
+
+    TQColor toTQColor() const;
+
+    void dump() const;
+
+private:
+
+    TQ_UINT8 * m_data;
+
+    KisColorSpace * m_colorSpace;
+};
+
+#endif
diff --git a/chalk/chalkcolor/kis_color_conversions.cc b/chalk/chalkcolor/kis_color_conversions.cc
new file mode 100644
index 000000000..e517c9f75
--- /dev/null
+++ b/chalk/chalkcolor/kis_color_conversions.cc
@@ -0,0 +1,427 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <cmath>
+
+#include <tqglobal.h>
+
+#include "kis_color_conversions.h"
+
+/**
+ * A number of often-used conversions between color models
+ */
+
+void rgb_to_hsv(int R, int G, int B, int *H, int *S, int *V)
+{
+    unsigned int max = R;
+    unsigned int min = R;
+    unsigned char maxValue = 0; // r = 0, g = 1, b = 2
+
+    // find maximum and minimum RGB values
+    if(static_cast<unsigned int>(G) > max) {
+        max = G;
+        maxValue = 1;
+    }
+    
+    if (static_cast<unsigned int>(B) > max)
+    {
+        max = B;
+        maxValue = 2;
+    }
+
+    if(static_cast<unsigned int>(G) < min)
+        min = G;
+        
+    if(static_cast<unsigned int>(B) < min )
+        min = B;
+
+    int delta = max - min;
+
+    // To prevent division by zero later on.
+    if (delta == 0) delta = 1;
+    
+    *V = max; // value
+    *S = max ? (510 * delta + max) / ( 2 * max) : 0; // saturation
+    
+    // calc hue
+    if(*S == 0)
+        *H = -1; // undefined hue
+    else
+    {
+        switch(maxValue)
+        {
+        case 0:  // red
+            if(G >= B)
+                *H = (120 * (G - B) + delta) / (2 * delta);
+            else
+                *H = (120 * (G - B + delta) + delta) / (2 * delta) + 300;
+            break;
+        case 1:  // green
+            if(B > R)
+                *H = 120 + (120 * (B - R) + delta) / (2 * delta);
+            else
+                *H = 60 + (120 * (B - R + delta) + delta) / (2 * delta);
+            break;
+        case 2:  // blue
+            if(R > G)
+                *H = 240 + (120 * (R - G) + delta) / (2 * delta);
+            else
+                *H = 180 + (120 * (R - G + delta) + delta) / (2 * delta);
+            break;
+        }
+    }
+}
+
+void hsv_to_rgb(int H, int S, int V, int *R, int *G, int *B)
+{
+    *R = *G = *B = V;
+
+    if (S != 0 && H != -1) { // chromatic
+
+        if (H >= 360) {
+            // angle > 360
+            H %= 360;
+        }
+
+        unsigned int f = H % 60;
+        H /= 60;
+        unsigned int p = static_cast<unsigned int>(2*V*(255-S)+255)/510;
+        unsigned int q, t;
+
+        if (H & 1) {
+            q = static_cast<unsigned int>(2 * V * (15300 - S * f) + 15300) / 30600;
+            switch (H) {
+            case 1:
+                *R = static_cast<int>(q);
+                *G = static_cast<int>(V);
+                *B = static_cast<int>(p);
+                break;
+            case 3:
+                *R = static_cast<int>(p);
+                *G = static_cast<int>(q);
+                *B = static_cast<int>(V);
+                break;
+            case 5:
+                *R = static_cast<int>(V);
+                *G = static_cast<int>(p);
+                *B = static_cast<int>(q);
+                break;
+            }
+        } else {
+            t = static_cast<unsigned int>(2 * V * (15300 - (S * (60 - f))) + 15300) / 30600;
+            switch (H) {
+            case 0:
+                *R = static_cast<int>(V);
+                *G = static_cast<int>(t);
+                *B = static_cast<int>(p);
+                break;
+            case 2:
+                *R = static_cast<int>(p);
+                *G = static_cast<int>(V);
+                *B = static_cast<int>(t);
+                break;
+            case 4:
+                *R = static_cast<int>(t);
+                *G = static_cast<int>(p);
+                *B = static_cast<int>(V);
+                break;
+            }
+        }
+    }
+}
+
+#define EPSILON 1e-6
+#define UNDEFINED_HUE -1
+
+void RGBToHSV(float r, float g, float b, float *h, float *s, float *v)
+{
+    float max = TQMAX(r, TQMAX(g, b));
+    float min = TQMIN(r, TQMIN(g, b));
+
+    *v = max;
+
+    if (max > EPSILON) {
+        *s = (max - min) / max;
+    } else {
+        *s = 0;
+    }
+
+    if (*s < EPSILON) {
+        *h = UNDEFINED_HUE;
+    } else {
+        float delta = max - min;
+
+        if (r == max) {
+            *h = (g - b) / delta;
+        } else if (g == max) {
+            *h = 2 + (b - r) / delta;
+        } else {
+            *h = 4 + (r - g) / delta;
+        }
+
+        *h *= 60;
+        if (*h < 0) {
+            *h += 360;
+        }
+    }
+}
+
+void HSVToRGB(float h, float s, float v, float *r, float *g, float *b)
+{
+    if (s < EPSILON || h == UNDEFINED_HUE) {
+        // Achromatic case
+
+        *r = v;
+        *g = v;
+        *b = v;
+    } else {
+        float f, p, q, t;
+        int i;
+
+        if (h > 360 - EPSILON) {
+            h -= 360;
+        }
+
+        h /= 60;
+        i = static_cast<int>(floor(h));
+        f = h - i;
+        p = v * (1 - s);
+        q = v * (1 - (s * f));
+        t = v * (1 - (s * (1 - f)));
+
+        switch (i) {
+        case 0:
+            *r = v;
+            *g = t;
+            *b = p;
+            break;
+        case 1:
+            *r = q;
+            *g = v;
+            *b = p;
+            break;
+        case 2:
+            *r = p;
+            *g = v;
+            *b = t;
+            break;
+        case 3:
+            *r = p;
+            *g = q;
+            *b = v;
+            break;
+        case 4:
+            *r = t;
+            *g = p;
+            *b = v;
+            break;
+        case 5:
+            *r = v;
+            *g = p;
+            *b = q;
+            break;
+        }
+    }
+}
+
+void rgb_to_hls(TQ_UINT8 red, TQ_UINT8 green, TQ_UINT8 blue, float * hue, float * lightness, float * saturation)
+{
+    float r = red / 255.0;
+    float g = green / 255.0;
+    float b = blue / 255.0;
+    float h = 0;
+    float l = 0;
+    float s = 0;
+
+    float max, min, delta;
+
+    max = TQMAX(r, g);
+    max = TQMAX(max, b);
+    
+    min = TQMIN(r, g);
+    min = TQMIN(min, b);
+
+    delta = max - min;
+
+    l = (max + min) / 2;
+
+    if (delta == 0) {
+        // This is a gray, no chroma...
+        h = 0;
+        s = 0;
+    }
+    else {
+        if ( l < 0.5)
+            s = delta / ( max + min );
+        else
+            s = delta / ( 2 - max - min );
+
+        float delta_r, delta_g, delta_b;
+
+        delta_r = (( max - r ) / 6 ) / delta;
+        delta_g = (( max - g ) / 6 ) / delta;
+        delta_b = (( max - b ) / 6 ) / delta;
+
+        if ( r == max )
+            h = delta_b - delta_g;
+        else if ( g == max)
+            h = ( 1.0 / 3 ) + delta_r - delta_b;
+        else if ( b == max)
+            h = ( 2.0 / 3 ) + delta_g - delta_r;
+
+        if (h < 0) h += 1;
+        if (h > 1) h += 1;
+        
+    }
+
+    *hue = h * 360;
+    *saturation = s;
+    *lightness = l;
+}
+
+float hue_value(float n1, float n2, float hue)
+{
+    if (hue > 360 )
+        hue = hue -360;
+    else if (hue < 0 )
+        hue = hue +360;
+    if (hue < 60  )
+        return n1 + (((n2 - n1) * hue) / 60);
+    else if (hue < 180 )
+        return n2;
+    else if (hue < 240 )
+        return n1 + (((n2 - n1) * (240 - hue)) / 60);
+    else return n1;
+}
+
+
+void hls_to_rgb(float h, float l, float s, TQ_UINT8 * r, TQ_UINT8 * g, TQ_UINT8 * b)
+{
+    float m1, m2;
+
+    if (l <= 0.5 )
+        m2 = l * ( 1 + s );
+    else 
+        m2 = l + s - l * s;
+
+    m1 = 2 * l - m2;
+    
+    *r = (TQ_UINT8)(hue_value(m1, m2, h + 120) * 255 + 0.5);
+    *g = (TQ_UINT8)(hue_value(m1, m2, h) * 255 + 0.5);
+    *b = (TQ_UINT8)(hue_value(m1, m2, h - 120) * 255 + 0.5);
+
+}
+
+void rgb_to_hls(TQ_UINT8 r, TQ_UINT8 g, TQ_UINT8 b, int * h, int * l, int * s)
+{
+    float hue, saturation, lightness;
+
+    rgb_to_hls(r, g, b, &hue, &lightness, &saturation);
+    *h = (int)(hue + 0.5);
+    *l = (int)(lightness * 255 + 0.5);
+    *s = (int)(saturation * 255 + 0.5);
+}
+
+void hls_to_rgb(int h, int l, int s, TQ_UINT8 * r, TQ_UINT8 * g, TQ_UINT8 * b)
+{
+    float hue = h;
+    float lightness = l / 255.0;
+    float saturation = s / 255.0;
+
+    hls_to_rgb(hue, lightness, saturation, r, g, b);
+}
+
+/*
+A Fast HSL-to-RGB Transform
+by Ken Fishkin
+from "Graphics Gems", Academic Press, 1990
+*/
+
+void RGBToHSL(float r, float g, float b, float *h, float *s, float *l)
+{
+    float v;
+    float m;
+    float vm;
+    float r2, g2, b2;
+
+    v = TQMAX(r,g);
+    v = TQMAX(v,b);
+    m = TQMIN(r,g);
+    m = TQMIN(m,b);
+
+    if ((*l = (m + v) / 2.0) <= 0.0) {
+        *h = UNDEFINED_HUE;
+        *s = 0;
+        return;
+    }
+    if ((*s = vm = v - m) > 0.0) {
+        *s /= (*l <= 0.5) ? (v + m ) :
+              (2.0 - v - m) ;
+    } else {
+        *h = UNDEFINED_HUE;
+        return;
+    }
+
+
+    r2 = (v - r) / vm;
+    g2 = (v - g) / vm;
+    b2 = (v - b) / vm;
+
+    if (r == v)
+        *h = (g == m ? 5.0 + b2 : 1.0 - g2);
+    else if (g == v)
+        *h = (b == m ? 1.0 + r2 : 3.0 - b2);
+    else
+        *h = (r == m ? 3.0 + g2 : 5.0 - r2);
+
+    *h *= 60;
+}
+
+void HSLToRGB(float h, float sl, float l, float *r, float *g, float *b)
+
+{
+    float v;
+
+    v = (l <= 0.5) ? (l * (1.0 + sl)) : (l + sl - l * sl);
+    if (v <= 0) {
+        *r = *g = *b = 0.0;
+    } else {
+        float m;
+        float sv;
+        int sextant;
+        float fract, vsf, mid1, mid2;
+
+        m = l + l - v;
+        sv = (v - m ) / v;
+        h /= 60.0;
+        sextant = static_cast<int>(h);    
+        fract = h - sextant;
+        vsf = v * sv * fract;
+        mid1 = m + vsf;
+        mid2 = v - vsf;
+        switch (sextant) {
+        case 0: *r = v; *g = mid1; *b = m; break;
+        case 1: *r = mid2; *g = v; *b = m; break;
+        case 2: *r = m; *g = v; *b = mid1; break;
+        case 3: *r = m; *g = mid2; *b = v; break;
+        case 4: *r = mid1; *g = m; *b = v; break;
+        case 5: *r = v; *g = m; *b = mid2; break;
+        }
+    }
+}
+
diff --git a/chalk/chalkcolor/kis_color_conversions.h b/chalk/chalkcolor/kis_color_conversions.h
new file mode 100644
index 000000000..53a476e0c
--- /dev/null
+++ b/chalk/chalkcolor/kis_color_conversions.h
@@ -0,0 +1,49 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _KIS_CONVERSIONS_H_
+#define _KIS_CONVERSIONS_H_
+
+#include <tqglobal.h>
+
+/**
+ * A number of often-used conversions between color models
+ */
+
+// 8-bit integer versions. RGBSL are 0-255, H is 0-360.
+ void rgb_to_hsv(int R, int G, int B, int *H, int *S, int *V);
+ void hsv_to_rgb(int H, int S, int V, int *R, int *G, int *B);
+
+// Floating point versions. RGBSL are 0-1, H is 0-360.
+ void RGBToHSV(float r, float g, float b, float *h, float *s, float *v);
+ void HSVToRGB(float h, float s, float v, float *r, float *g, float *b);
+
+ void RGBToHSL(float r, float g, float b, float *h, float *s, float *l);
+ void HSLToRGB(float h, float sl, float l, float *r, float *g, float *b);
+
+ void rgb_to_hls(TQ_UINT8 r, TQ_UINT8 g, TQ_UINT8 b, float * h, float * l, float * s);
+
+ float hue_value(float n1, float n2, float hue);
+
+ void hls_to_rgb(float h, float l, float s, TQ_UINT8 * r, TQ_UINT8 * g, TQ_UINT8 * b);
+
+ void rgb_to_hls(TQ_UINT8 r, TQ_UINT8 g, TQ_UINT8 b, int * h, int * l, int * s);
+ void hls_to_rgb(int h, int l, int s, TQ_UINT8 * r, TQ_UINT8 * g, TQ_UINT8 * b);
+
+#endif // _KIS_CONVERSIONS_H_
+
diff --git a/chalk/chalkcolor/kis_colorspace.cc b/chalk/chalkcolor/kis_colorspace.cc
new file mode 100644
index 000000000..de0c44cf7
--- /dev/null
+++ b/chalk/chalkcolor/kis_colorspace.cc
@@ -0,0 +1,39 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_colorspace.h"
+#include "kis_colorspace_iface.h"
+
+KisColorSpace::KisColorSpace()
+{
+    m_dcop = 0;
+}
+
+KisColorSpace::~KisColorSpace()
+{
+    delete m_dcop;
+}
+
+DCOPObject * KisColorSpace::dcopObject()
+{
+    if (!m_dcop) {
+        m_dcop = new KisColorSpaceIface(this);
+        Q_CHECK_PTR(m_dcop);
+    }
+    return m_dcop;
+}
diff --git a/chalk/chalkcolor/kis_colorspace.h b/chalk/chalkcolor/kis_colorspace.h
new file mode 100644
index 000000000..6071909c9
--- /dev/null
+++ b/chalk/chalkcolor/kis_colorspace.h
@@ -0,0 +1,450 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_COLORSPACE_H_
+#define KIS_COLORSPACE_H_
+
+#include <config.h>
+#include LCMS_HEADER
+
+#include <tqvaluevector.h>
+#include <tqvaluelist.h>
+
+#include "kis_composite_op.h"
+#include "kis_channelinfo.h"
+
+class DCOPObject;
+
+class KisProfile;
+class KisColorSpaceFactoryRegistry;
+class KisMathToolbox;
+class KisFilter;
+
+class KisColorAdjustment
+{
+public:
+
+    KisColorAdjustment() {};
+    virtual ~KisColorAdjustment() {};
+};
+
+
+enum ColorSpaceIndependence {
+    FULLY_INDEPENDENT,
+    TO_LAB16,
+    TO_RGBA8,
+    TO_RGBA16
+};
+
+/**
+ * A colorspace is the definition of a certain color model
+ * in Chalk. This is the definition of the public API for
+ * colormodels.
+ */
+class KisColorSpace {
+
+
+public:
+
+    KisColorSpace();
+    virtual ~KisColorSpace();
+
+    virtual DCOPObject * dcopObject();
+
+    virtual bool operator==(const KisColorSpace& rhs) const {
+        return id().id() == rhs.id().id();
+    }
+
+    
+public:
+
+    //========== Channels =====================================================//
+
+    /// Return a vector describing all the channels this color model has.
+    virtual TQValueVector<KisChannelInfo *> channels() const = 0;
+
+    /**
+     * The total number of channels for a single pixel in this color model
+     */
+    virtual TQ_UINT32 nChannels() const = 0;
+
+    /**
+     * The total number of color channels (excludes alpha and substance) for a single
+     * pixel in this color model.
+     */
+    virtual TQ_UINT32 nColorChannels() const = 0;
+
+    /**
+     * The total number of substance channels for a single pixel
+     * in this color model
+     */
+    virtual TQ_UINT32 nSubstanceChannels() const { return 0; };
+
+    /**
+     * The size in bytes of a single pixel in this color model
+     */
+    virtual TQ_UINT32 pixelSize() const = 0;
+
+    /**
+     * Return a string with the channel's value suitable for display in the gui.
+     */
+    virtual TQString channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const = 0;
+
+    /**
+     * Return a string with the channel's value with integer
+     * channels normalised to the floating point range 0 to 1, if appropriate.
+     */
+    virtual TQString normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const = 0;
+
+    /**
+     * Convert the value of the channel at the specified position into
+     * an 8-bit value. The position is not the number of bytes, but
+     * the position of the channel as defined in the channel info list.
+     */
+    virtual TQ_UINT8 scaleToU8(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos) = 0;
+
+    /**
+     * Convert the value of the channel at the specified position into
+     * a 16-bit value. This may be upscaling or downscaling, depending
+     * on the defined value of the channel
+     */
+     virtual TQ_UINT16 scaleToU16(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos) = 0;
+
+     /**
+      * Set dstPixel to the pixel containing only the given channel of srcPixel. The remaining channels
+      * should be set to whatever makes sense for 'empty' channels of this colour space,
+      * with the intent being that the pixel should look like it only has the given channel.
+      */
+     virtual void getSingleChannelPixel(TQ_UINT8 *dstPixel, const TQ_UINT8 *srcPixel, TQ_UINT32 channelIndex) = 0;
+
+    //========== Identification ===============================================//
+
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const = 0;
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() = 0;
+
+    virtual icColorSpaceSignature colorSpaceSignature() = 0;
+
+    /**
+     * If false, images in this colorspace will degrade considerably by
+     * functions, tools and filters that have the given measure of colorspace
+     * independence.
+     *
+     * @param independence the measure to which this colorspace will suffer
+     *                     from the manipulations of the tool or filter asking
+     * @return false if no degradation will take place, true if degradation will
+     *         take place
+     */
+    virtual bool willDegrade(ColorSpaceIndependence independence) = 0;
+    
+    //========== Capabilities =================================================//
+
+    /**
+     * Returns the list of user-visible composite ops supported by this colourspace. Internal
+     * ops such as COPY, CLEAR, and ERASE, are not included as these make no sense
+     * for layers in the full image model.
+     */
+    virtual KisCompositeOpList userVisiblecompositeOps() const = 0;
+
+    /**
+     * Returns true if the colorspace supports channel values outside the
+     * (normalised) range 0 to 1.
+     */
+    virtual bool hasHighDynamicRange() const = 0;
+
+
+    //========== Display profiles =============================================//
+
+    /**
+     * Return the profile of this color space. This may be 0
+     */
+    virtual KisProfile * getProfile() const = 0;
+
+//================= Conversion functions ==================================//
+
+
+    /**
+     * The fromTQColor methods take a given color defined as an RGB TQColor
+     * and fills a byte array with the corresponding color in the
+     * the colorspace managed by this strategy.
+     *
+     * @param c the TQColor that will be used to fill dst
+     * @param dst a pointer to a pixel
+     * @param profile the optional profile that describes the color values of TQColor
+     */
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile * profile = 0) = 0;
+
+    /**
+     * The fromTQColor methods take a given color defined as an RGB TQColor
+     * and fills a byte array with the corresponding color in the
+     * the colorspace managed by this strategy.
+     *
+     * @param c the TQColor that will be used to fill dst
+     * @param opacity the opacity of the color
+     * @param dst a pointer to a pixel
+     * @param profile the optional profile that describes the color values of TQColor
+     */
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * profile = 0) = 0;
+
+
+    /**
+     * The toTQColor methods take a byte array that is at least pixelSize() long
+     * and converts the contents to a TQColor, using the given profile as a source
+     * profile and the optional profile as a destination profile.
+     *
+     * @param src a pointer to the source pixel
+     * @param c the TQColor that will be filled with the color at src
+     * @param profile the optional profile that describes the color in c, for instance the monitor profile
+     */
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * profile = 0) = 0;
+
+    /**
+     * The toTQColor methods take a byte array that is at least pixelSize() long
+     * and converts the contents to a TQColor, using the given profile as a source
+     * profile and the option profile as a destination profile.
+     *
+     * @param src a pointer to the source pixel
+     * @param c the TQColor that will be filled with the color at src
+     * @param opacity a pointer to a byte that will be filled with the opacity a src
+     * @param profile the optional profile that describes the color in c, for instance the monitor profile
+     */
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile = 0) = 0;
+
+    /**
+     * Convert the pixels in data to (8-bit BGRA) TQImage using the specified profiles.
+     * The pixels are supposed to be encoded in this color model. The default implementation
+     * will convert the pixels using either the profiles or the default profiles for the
+     * current colorstrategy and the RGBA colorstrategy. If that is not what you want,
+     * or if you think you can do better than lcms, reimplement this methods.
+     *
+     * @param data A pointer to a contiguous memory region containing width * height pixels
+     * @param width in pixels
+     * @param height in pixels
+     * @param dstProfile destination profile
+     * @param renderingIntent the rendering intent
+     * @param exposure The exposure setting for rendering a preview of a high dynamic range image.
+     */
+    virtual TQImage convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                                   KisProfile *  dstProfile, TQ_INT32 renderingIntent = INTENT_PERCEPTUAL,
+                                   float exposure = 0.0f) = 0;
+
+
+    /**
+     * Convert the specified data to Lab. All colorspaces are guaranteed to support this
+     *
+     * @param src the source data
+     * @param dst the destination data
+     * @param nPixels the number of source pixels
+     */
+    virtual void toLabA16(const TQ_UINT8 * src, TQ_UINT8 * dst, const TQ_UINT32 nPixels) const = 0;
+
+    /**
+     * Convert the specified data from Lab. to this colorspace. All colorspaces are
+     * guaranteed to support this.
+     *
+     * @param src the pixels in 16 bit lab format
+     * @param dst the destination data
+     * @param nPixels the number of pixels in the array
+     */
+    virtual void fromLabA16(const TQ_UINT8 * src, TQ_UINT8 * dst, const TQ_UINT32 nPixels) const = 0;
+
+    /**
+     * Convert a byte array of srcLen pixels *src to the specified color space
+     * and put the converted bytes into the prepared byte array *dst. 
+     *
+     * Returns false if the conversion failed, true if it succeeded
+     */
+    virtual bool convertPixelsTo(const TQ_UINT8 * src,
+                                 TQ_UINT8 * dst, KisColorSpace * dstColorSpace,
+                                 TQ_UINT32 numPixels,
+                                 TQ_INT32 renderingIntent = INTENT_PERCEPTUAL) = 0;
+
+//============================== Manipulation functions ==========================//
+
+
+//
+// The manipulation functions have default implementations that _convert_ the pixel
+// to a TQColor and back. Reimplement these methods in your color strategy!
+//
+
+    /**
+    * Get the alpha value of the given pixel, downscaled to an 8-bit value.
+    */
+    virtual TQ_UINT8 getAlpha(const TQ_UINT8 * pixel) const = 0;
+
+    /**
+     * Set the alpha channel of the given run of pixels to the given value.
+     *
+     * pixels -- a pointer to the pixels that will have their alpha set to this value
+     * alpha --  a downscaled 8-bit value for opacity
+     * nPixels -- the number of pixels
+     *
+     */
+    virtual void setAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const = 0;
+
+    /**
+     * Multiply the alpha channel of the given run of pixels by the given value.
+     *
+     * pixels -- a pointer to the pixels that will have their alpha set to this value
+     * alpha --  a downscaled 8-bit value for opacity
+     * nPixels -- the number of pixels
+     *
+     */
+    virtual void multiplyAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) = 0;
+
+    /**
+     * Applies the specified 8-bit alpha tqmask to the pixels. We assume that there are just
+     * as many alpha values as pixels but we do not check this; the alpha values
+     * are assumed to be 8-bits.
+     */
+    virtual void applyAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels) = 0;
+
+    /**
+     * Applies the inverted 8-bit alpha tqmask to the pixels. We assume that there are just
+     * as many alpha values as pixels but we do not check this; the alpha values
+     * are assumed to be 8-bits.
+     */
+    virtual void applyInverseAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels) = 0;
+
+    /**
+     * Create an adjustment object for adjusting the brightness and contrast
+     * transferValues is a 256 bins array with values from 0 to 0xFFFF
+     */
+    virtual KisColorAdjustment *createBrightnessContrastAdjustment(TQ_UINT16 *transferValues) = 0;
+
+    /**
+     * Create an adjustment object for desaturating
+     */
+    virtual KisColorAdjustment *createDesaturateAdjustment() = 0;
+
+    /**
+     * Create an adjustment object for adjusting individual channels
+     * transferValues is an array of nColorChannels number of 256 bins array with values from 0 to 0xFFFF
+     */
+    virtual KisColorAdjustment *createPerChannelAdjustment(TQ_UINT16 **transferValues) = 0;
+
+    /**
+     * Apply the adjustment created with onr of the other functions
+     */
+    virtual void applyAdjustment(const TQ_UINT8 *src, TQ_UINT8 *dst, KisColorAdjustment *, TQ_INT32 nPixels) = 0;
+
+    /**
+     * Invert color channels of the given pixels
+     */
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels) = 0;
+
+    // XXX: What with alpha channels? YYY: Add an overloaded function that takes alpha into account?
+    /**
+     * Get the difference between 2 colors, normalized in the range (0,255)
+     */
+    virtual TQ_UINT8 difference(const TQ_UINT8* src1, const TQ_UINT8* src2) = 0;
+
+
+    /**
+     * Mix the colors given their weights and return in dst
+     * The sum of weights is assumed 255 */
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const = 0;
+
+    /**
+     * Convolve the given array of pointers to pixels and return the result
+     * in dst. The kernel values are clamped between -128 and 128
+     */
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nPixels) const = 0;
+
+    /**
+     * Darken all color channels with the given amount. If compensate is true,
+     * the compensation factor will be used to limit the darkening.
+     *
+     * (See the bumpmap filter)
+     */
+    virtual void darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const = 0;
+
+    /**
+     * Calculate the intensity of the given pixel, scaled down to the range 0-255. XXX: Maybe this should be more flexible
+    */
+    virtual TQ_UINT8 intensity8(const TQ_UINT8 * src) const = 0;
+    
+    /**
+     * Create a mathematical toolbox compatible with this colorspace
+     */
+    virtual KisID mathToolboxID() const =0;
+    
+    /**
+     * Compose two arrays of pixels together. If source and target
+     * are not the same colour model, the source pixels will be
+     * converted to the target model.
+     */
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dststride,
+                KisColorSpace * srcSpace,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op) = 0;
+
+    /**
+     * The backgroundfilters will be run periodically on the newly
+     * created paint device. XXX: Currently this uses times and not
+     * threads.
+     */
+    virtual TQValueList<KisFilter*> createBackgroundFilters()
+        { return TQValueList<KisFilter*>(); };
+
+private:
+
+    DCOPObject * m_dcop;
+
+};
+
+class KisColorSpaceFactory {
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const = 0;
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() = 0;
+
+    virtual icColorSpaceSignature colorSpaceSignature() = 0;
+
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *) = 0;
+
+    /**
+     * Returns the default icc profile for use with this colorspace. This may be ""
+     *
+     & @return the default icc profile name
+     */
+    virtual TQString defaultProfile() = 0;
+
+};
+
+#endif // KIS_COLORSPACE_H_
diff --git a/chalk/chalkcolor/kis_colorspace_factory_registry.cc b/chalk/chalkcolor/kis_colorspace_factory_registry.cc
new file mode 100644
index 000000000..6758f7d56
--- /dev/null
+++ b/chalk/chalkcolor/kis_colorspace_factory_registry.cc
@@ -0,0 +1,222 @@
+/*
+ *  Copyright (c) 2003 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kdebug.h"
+#include <kparts/plugin.h>
+#include <kservice.h>
+#include <ktrader.h>
+#include <kparts/componentfactory.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+#include "kis_debug_areas.h"
+#include "kis_colorspace.h"
+#include "kis_profile.h"
+#include "kis_colorspace_factory_registry.h"
+#include "kis_alpha_colorspace.h"
+#include "kis_lab_colorspace.h"
+
+
+KisColorSpaceFactoryRegistry::KisColorSpaceFactoryRegistry(TQStringList profileFilenames)
+{
+    // Create the built-in colorspaces
+
+    m_alphaCs = new KisAlphaColorSpace(this, 0);
+
+    // Load the profiles
+    if (!profileFilenames.empty()) {
+        KisProfile * profile = 0;
+        for ( TQStringList::Iterator it = profileFilenames.begin(); it != profileFilenames.end(); ++it ) {
+            profile = new KisProfile(*it);
+            Q_CHECK_PTR(profile);
+
+            profile->load();
+            if (profile->valid()) {
+                m_profileMap[profile->productName()] = profile;
+            }
+        }
+    }
+
+    KisProfile *labProfile = new KisProfile(cmsCreateLabProfile(NULL));
+    addProfile(labProfile);
+    add(new KisLabColorSpaceFactory());
+/* XXX where to put this
+    KisHistogramProducerFactoryRegistry::instance()->add(
+                new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
+                (KisID("LABAHISTO", i18n("L*a*b* Histogram")), new KisLabColorSpace(this, 0);) );
+*/
+
+    // Load all colorspace modules
+    KTrader::OfferList offers = KTrader::self()->query(TQString::tqfromLatin1("Chalk/ColorSpace"),
+                                                         TQString::tqfromLatin1("(Type == 'Service') and "
+                                                                             "([X-Chalk-Version] == 2)"));
+
+    if (offers.empty()) {
+        KMessageBox::sorry(0, i18n("Cannot start Chalk: no colorspaces available."));
+        abort();
+    }
+
+    KTrader::OfferList::ConstIterator iter;
+    for(iter = offers.begin(); iter != offers.end(); ++iter)
+    {
+        KService::Ptr service = *iter;
+        int errCode = 0;
+        KParts::Plugin* plugin =
+             KParts::ComponentFactory::createInstanceFromService<KParts::Plugin> ( service, this, 0, TQStringList(), &errCode);
+        if ( plugin )
+            kdDebug(DBG_AREA_PLUGINS) << "found colorspace " << service->property("Name").toString() << "\n";
+        else {
+            kdDebug(41006) << "found plugin " << service->property("Name").toString() << ", " << errCode << "\n";
+            if( errCode == KParts::ComponentFactory::ErrNoLibrary)
+            {
+                kdWarning(41006) << " Error loading plugin was : ErrNoLibrary " << KLibLoader::self()->lastErrorMessage() << endl;
+            }
+        }
+    }
+}
+
+KisColorSpaceFactoryRegistry::KisColorSpaceFactoryRegistry()
+{
+}
+
+KisColorSpaceFactoryRegistry::~KisColorSpaceFactoryRegistry()
+{
+}
+
+KisProfile *  KisColorSpaceFactoryRegistry::getProfileByName(const TQString & name)
+{
+    if (m_profileMap.tqfind(name) == m_profileMap.end()) {
+        return 0;
+    }
+
+    return m_profileMap[name];
+}
+
+TQValueVector<KisProfile *>  KisColorSpaceFactoryRegistry::profilesFor(KisID id)
+{
+    return profilesFor(get(id));
+}
+
+TQValueVector<KisProfile *>  KisColorSpaceFactoryRegistry::profilesFor(KisColorSpaceFactory * csf)
+{
+
+    TQValueVector<KisProfile *>  profiles;
+
+    TQMap<TQString, KisProfile * >::Iterator it;
+    for (it = m_profileMap.begin(); it != m_profileMap.end(); ++it) {
+        KisProfile *  profile = it.data();
+        if (profile->colorSpaceSignature() == csf->colorSpaceSignature()) {
+            profiles.push_back(profile);
+        }
+    }
+    return profiles;
+}
+
+void KisColorSpaceFactoryRegistry::addProfile(KisProfile *p)
+{
+      if (p->valid()) {
+          m_profileMap[p->productName()] = p;
+      }
+}
+
+void KisColorSpaceFactoryRegistry::addPaintDeviceAction(KisColorSpace* cs,
+        KisPaintDeviceAction* action) {
+    m_paintDevActionMap[cs->id()].append(action);
+}
+
+TQValueVector<KisPaintDeviceAction *>
+KisColorSpaceFactoryRegistry::paintDeviceActionsFor(KisColorSpace* cs) {
+    return m_paintDevActionMap[cs->id()];
+}
+
+KisColorSpace * KisColorSpaceFactoryRegistry::getColorSpace(const KisID & csID, const TQString & pName)
+{
+    TQString profileName = pName;
+
+    if(profileName.isEmpty())
+    {
+        KisColorSpaceFactory *csf = get(csID);
+
+        if(!csf)
+            return 0;
+
+        profileName = csf->defaultProfile();
+    }
+
+    TQString name = csID.id() + "<comb>" + profileName;
+
+    if (m_csMap.tqfind(name) == m_csMap.end()) {
+        KisColorSpaceFactory *csf = get(csID);
+        if(!csf)
+            return 0;
+
+        KisProfile *p = getProfileByName(profileName);
+        if(!p && profileName != "")
+            return 0;
+        KisColorSpace *cs = csf->createColorSpace(this, p);
+        if(!cs)
+            return 0;
+
+        m_csMap[name] = cs;
+    }
+
+    if(m_csMap.tqcontains(name))
+        return m_csMap[name];
+    else
+        return 0;
+}
+
+
+KisColorSpace * KisColorSpaceFactoryRegistry::getColorSpace(const KisID & csID, const KisProfile * profile)
+{
+    if( profile )
+    {
+        KisColorSpace *cs = getColorSpace( csID, profile->productName());
+
+        if(!cs)
+        {
+            // The profile was not stored and thus not the combination either
+            KisColorSpaceFactory *csf = get(csID);
+            if(!csf)
+                return 0;
+
+            cs = csf->createColorSpace(this, const_cast<KisProfile *>(profile));
+            if(!cs )
+                return 0;
+
+            TQString name = csID.id() + "<comb>" + profile->productName();
+            m_csMap[name] = cs;
+        }
+
+        return cs;
+    } else {
+        return getColorSpace( csID, "");
+    }
+}
+
+KisColorSpace * KisColorSpaceFactoryRegistry::getAlpha8()
+{
+   return m_alphaCs;
+}
+
+KisColorSpace * KisColorSpaceFactoryRegistry::getRGB8()
+{
+    return getColorSpace(KisID("RGBA", ""), "");
+}
+
+#include "kis_colorspace_factory_registry.moc"
diff --git a/chalk/chalkcolor/kis_colorspace_factory_registry.h b/chalk/chalkcolor/kis_colorspace_factory_registry.h
new file mode 100644
index 000000000..104c99aa9
--- /dev/null
+++ b/chalk/chalkcolor/kis_colorspace_factory_registry.h
@@ -0,0 +1,121 @@
+/*
+ *  Copyright (c) 2003 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_COLORSPACE_FACTORY_REGISTRY_H_
+#define KIS_COLORSPACE_FACTORY_REGISTRY_H_
+#include "tqobject.h"
+#include "kis_generic_registry.h"
+#include "kis_colorspace.h"
+
+class TQStringList;
+class KisPaintDeviceAction;
+
+/**
+ * This class tqcontains:
+ *      - a registry of colorspace instantiated with specific profiles.
+ *      - a registry of singleton colorspace factories.
+ *      - a registry of icc profiles
+ */
+class KisColorSpaceFactoryRegistry : public TQObject,  public KisGenericRegistry<KisColorSpaceFactory *> {
+
+
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+
+    /**
+     * Create a new colorspacefactory registry. The registry will
+     * load all colorspace modules that have the right version and
+     * all profiles given in the list. It is always possible
+     * to add more profiles with addProfile()
+     *
+     * @param profileFileNames a list of all filenames of all profiles that need to be loaded initially
+     */
+    KisColorSpaceFactoryRegistry(TQStringList profileFileNames);
+
+    virtual ~KisColorSpaceFactoryRegistry();
+
+    /**
+     * Add the profile to the list.
+     */
+    void addProfile(KisProfile * p);
+
+    /**
+     * Return the profile associated with the given product name,
+     * or 0.
+     */
+    KisProfile *  getProfileByName(const TQString & name);
+
+    /**
+     * Return the vector of profiles for this colorspacefactory
+     */
+    TQValueVector<KisProfile *>  profilesFor(KisColorSpaceFactory * cs);
+
+    TQValueVector<KisProfile *>  profilesFor(KisID id);
+
+    /**
+     * Return the colorspace + profile as named, or NULL if impossible combination.
+     */
+    KisColorSpace *  getColorSpace(const KisID & csID, const TQString & profileName);
+
+    /**
+     * Return the colorspace + profile -- where the profile is matched on the name of the specified profile
+     */
+    KisColorSpace * getColorSpace(const KisID & csID, const KisProfile * profile);
+
+    /**
+     * Convenience method to get the often used alpha colorspace
+     */
+    KisColorSpace * getAlpha8();
+
+    /**
+     * Convenience method to get an RGB colorspace with the default lcms profile
+     */
+    KisColorSpace * getRGB8();
+
+    /**
+     * add a KisConstructPaintDeviceAction to the registry for a colorspace
+     * 
+     * These actions are exectued when an image is created on the first layer
+     * in the image, on the image width and height rect.
+     */
+    void addPaintDeviceAction(KisColorSpace* cs, KisPaintDeviceAction* action);
+
+    /**
+     * Get a list of KisConstructPaintDeviceAction for a colorspace
+     */
+    TQValueVector<KisPaintDeviceAction *> paintDeviceActionsFor(KisColorSpace* cs);
+
+private:
+    KisColorSpaceFactoryRegistry();
+    KisColorSpaceFactoryRegistry(const KisColorSpaceFactoryRegistry&);
+    KisColorSpaceFactoryRegistry operator=(const KisColorSpaceFactoryRegistry&);
+
+private:
+
+    TQMap<TQString, KisProfile * > m_profileMap;
+    TQMap<TQString, KisColorSpace * > m_csMap;
+    typedef TQValueVector<KisPaintDeviceAction *> PaintActionVector;
+    TQMap<KisID, PaintActionVector> m_paintDevActionMap;
+    KisColorSpace *m_alphaCs;
+};
+
+#endif // KIS_COLORSPACE_FACTORY_REGISTRY_H_
+
diff --git a/chalk/chalkcolor/kis_colorspace_iface.cc b/chalk/chalkcolor/kis_colorspace_iface.cc
new file mode 100644
index 000000000..6e6b3cb86
--- /dev/null
+++ b/chalk/chalkcolor/kis_colorspace_iface.cc
@@ -0,0 +1,39 @@
+/*
+ *  This file is part of the KDE project
+ *
+ *  Copyright (C) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#include <kapplication.h>
+
+#include "kis_colorspace_iface.h"
+#include "kis_colorspace.h"
+
+#include <dcopclient.h>
+
+KisColorSpaceIface::KisColorSpaceIface( KisColorSpace * tqparent )
+	: DCOPObject(tqparent->id().id().latin1())
+{
+	m_parent = tqparent;
+}
+
+TQByteArray KisColorSpaceIface::invertColor(TQByteArray src, TQ_INT32 nPixels)
+{
+    m_parent->invertColor((TQ_UINT8*)src.data(), nPixels);
+    return src;
+
+}
+
diff --git a/chalk/chalkcolor/kis_colorspace_iface.h b/chalk/chalkcolor/kis_colorspace_iface.h
new file mode 100644
index 000000000..ce52e8469
--- /dev/null
+++ b/chalk/chalkcolor/kis_colorspace_iface.h
@@ -0,0 +1,43 @@
+/* This file is part of the KDE project
+ *  Copyright (C) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _KIS_COLORSPACE_IFACE_H
+#define _KIS_COLORSPACE_IFACE_H
+
+#include <dcopref.h>
+#include <dcopobject.h>
+
+#include <tqstring.h>
+
+class KisColorSpace;
+
+class KisColorSpaceIface : public DCOPObject
+{
+	K_DCOP
+public:
+	KisColorSpaceIface( KisColorSpace * tqparent );
+k_dcop:
+
+    TQByteArray invertColor(TQByteArray src, TQ_INT32 nPixels);
+
+private:
+
+	KisColorSpace *m_parent;
+};
+
+#endif
diff --git a/chalk/chalkcolor/kis_composite_op.cc b/chalk/chalkcolor/kis_composite_op.cc
new file mode 100644
index 000000000..ddce271b7
--- /dev/null
+++ b/chalk/chalkcolor/kis_composite_op.cc
@@ -0,0 +1,138 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <klocale.h>
+
+#include "kis_composite_op.h"
+
+//KisIDCompositeOpMap
+std::map<KisID, CompositeOp> KisCompositeOp::s_idOpMap;
+
+KisCompositeOp::KisCompositeOp()
+{
+    m_valid = false;
+}
+
+KisCompositeOp::KisCompositeOp(const TQString& id)
+{
+    if (s_idOpMap.empty()) {
+        fillMap();
+    }
+
+    KisIDCompositeOpMap::const_iterator it;
+    m_valid = false;
+
+    for (it = s_idOpMap.begin(); it != s_idOpMap.end(); ++it) {
+
+        const KisID& kisId = (*it).first;
+
+        if (kisId.id() == id) {
+
+            m_id = (*it).first;
+            m_op = (*it).second;
+            m_valid = true;
+            break;
+        }
+    }
+}
+
+KisCompositeOp::KisCompositeOp(CompositeOp compositeOp)
+{
+    if (s_idOpMap.empty()) {
+        fillMap();
+    }
+
+    KisIDCompositeOpMap::const_iterator it;
+    m_valid = false;
+
+    for (it = s_idOpMap.begin(); it != s_idOpMap.end(); ++it) {
+
+        CompositeOp compOp = (*it).second;
+
+        if (compOp == compositeOp) {
+
+            m_id = (*it).first;
+            m_op = compositeOp;
+            m_valid = true;
+            break;
+        }
+    }
+}
+
+bool KisCompositeOp::operator==(const KisCompositeOp& other) const
+{
+    if (isValid() && other.isValid()) {
+        return op() == other.op();
+    }
+    return false;
+}
+
+bool KisCompositeOp::operator!=(const KisCompositeOp& other) const
+{
+    return !(*this == other);
+}
+
+void KisCompositeOp::fillMap()
+{
+    s_idOpMap[KisID("normal",     i18n("Normal"))] =        COMPOSITE_OVER;
+    s_idOpMap[KisID("alphadarken",     i18n("Alpha Darken"))] =        COMPOSITE_ALPHA_DARKEN;
+    s_idOpMap[KisID("in",         i18n("In"))] =                   COMPOSITE_IN;
+    s_idOpMap[KisID("out",         i18n("Out"))] =            COMPOSITE_OUT;
+    s_idOpMap[KisID("atop",     i18n("Atop"))] =        COMPOSITE_ATOP;
+    s_idOpMap[KisID("xor",         i18n("Xor"))] =            COMPOSITE_XOR;
+    s_idOpMap[KisID("plus",        i18n("Plus"))] =        COMPOSITE_PLUS;
+    s_idOpMap[KisID("minus",    i18n("Minus"))] =        COMPOSITE_MINUS;
+    s_idOpMap[KisID("add",         i18n("Add"))] =            COMPOSITE_ADD;
+    s_idOpMap[KisID("subtract",    i18n("Subtract"))] =        COMPOSITE_SUBTRACT;
+    s_idOpMap[KisID("diff",     i18n("Diff"))] =        COMPOSITE_DIFF;
+    s_idOpMap[KisID("multiply",    i18n("Multiply"))] =        COMPOSITE_MULT;
+    s_idOpMap[KisID("divide",    i18n("Divide"))] =        COMPOSITE_DIVIDE;
+    s_idOpMap[KisID("dodge",     i18n("Dodge"))] =        COMPOSITE_DODGE;
+    s_idOpMap[KisID("burn",     i18n("Burn"))] =        COMPOSITE_BURN;
+    s_idOpMap[KisID("bumpmap",     i18n("Bumpmap"))] =        COMPOSITE_BUMPMAP;
+    s_idOpMap[KisID("copy",     i18n("Copy"))] =        COMPOSITE_COPY;
+    s_idOpMap[KisID("copyred",     i18n("Copy Red"))] =        COMPOSITE_COPY_RED;
+    s_idOpMap[KisID("copygreen",     i18n("Copy Green"))] =        COMPOSITE_COPY_GREEN;
+    s_idOpMap[KisID("copyblue",     i18n("Copy Blue"))] =        COMPOSITE_COPY_BLUE;
+    s_idOpMap[KisID("copyopacity",     i18n("Copy Opacity"))] =    COMPOSITE_COPY_OPACITY;
+    s_idOpMap[KisID("clear",     i18n("Clear"))] =        COMPOSITE_CLEAR;
+    s_idOpMap[KisID("dissolve",     i18n("Dissolve"))] =        COMPOSITE_DISSOLVE;
+    s_idOpMap[KisID("displace",     i18n("Displace"))] =        COMPOSITE_DISPLACE;
+#if 0
+    s_idOpMap[KisID("modulate",     i18n("Modulate"))] =        COMPOSITE_MODULATE;
+    s_idOpMap[KisID("threshold",     i18n("Threshold"))] =        COMPOSITE_THRESHOLD;
+#endif
+    s_idOpMap[KisID("nocomposition",i18n("No Composition"))] =    COMPOSITE_NO;
+    s_idOpMap[KisID("darken",     i18n("Darken"))] =        COMPOSITE_DARKEN;
+    s_idOpMap[KisID("lighten",     i18n("Lighten"))] =        COMPOSITE_LIGHTEN;
+    s_idOpMap[KisID("hue",         i18n("Hue"))] =            COMPOSITE_HUE;
+    s_idOpMap[KisID("saturation",     i18n("Saturation"))] =        COMPOSITE_SATURATION;
+    s_idOpMap[KisID("value",     i18n("Value"))] =        COMPOSITE_VALUE;
+    s_idOpMap[KisID("color",     i18n("Color"))] =        COMPOSITE_COLOR;
+    s_idOpMap[KisID("colorize",     i18n("Colorize"))] =        COMPOSITE_COLORIZE;
+    s_idOpMap[KisID("luminize",     i18n("Luminize"))] =        COMPOSITE_LUMINIZE;
+    s_idOpMap[KisID("screen",     i18n("Screen"))] =        COMPOSITE_SCREEN;
+    s_idOpMap[KisID("overlay",     i18n("Overlay"))] =        COMPOSITE_OVERLAY;
+    s_idOpMap[KisID("copycyan",     i18n("Copy Cyan"))] =        COMPOSITE_COPY_CYAN;
+    s_idOpMap[KisID("copymagenta",     i18n("Copy Magenta"))] =    COMPOSITE_COPY_MAGENTA;
+    s_idOpMap[KisID("copyyellow",     i18n("Copy Yellow"))] =        COMPOSITE_COPY_YELLOW;
+    s_idOpMap[KisID("copyblack",     i18n("Copy Black"))] =        COMPOSITE_COPY_BLACK;
+    s_idOpMap[KisID("erase",     i18n("Erase"))] =        COMPOSITE_ERASE;
+    s_idOpMap[KisID("undefined",     i18n("Undefined"))] =            COMPOSITE_UNDEF;
+}
+
diff --git a/chalk/chalkcolor/kis_composite_op.h b/chalk/chalkcolor/kis_composite_op.h
new file mode 100644
index 000000000..bd4f10a2a
--- /dev/null
+++ b/chalk/chalkcolor/kis_composite_op.h
@@ -0,0 +1,103 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_COMPOSITE_OP_H_
+#define KIS_COMPOSITE_OP_H_
+
+#include <map>
+#include <tqvaluelist.h>
+
+//#include "kis_global.h"
+#include "kis_id.h"
+
+enum CompositeOp {
+    COMPOSITE_OVER,
+    COMPOSITE_IN,
+    COMPOSITE_OUT,
+    COMPOSITE_ATOP,
+    COMPOSITE_XOR,
+    COMPOSITE_PLUS,
+    COMPOSITE_MINUS,
+    COMPOSITE_ADD,
+    COMPOSITE_SUBTRACT,
+    COMPOSITE_DIFF,
+    COMPOSITE_MULT,
+    COMPOSITE_DIVIDE,
+    COMPOSITE_DODGE,
+    COMPOSITE_BURN,
+    COMPOSITE_BUMPMAP,
+    COMPOSITE_COPY,
+    COMPOSITE_COPY_RED,
+    COMPOSITE_COPY_GREEN,
+    COMPOSITE_COPY_BLUE,
+    COMPOSITE_COPY_OPACITY,
+    COMPOSITE_CLEAR,
+    COMPOSITE_DISSOLVE,
+    COMPOSITE_DISPLACE,
+#if 0
+    COMPOSITE_MODULATE,
+    COMPOSITE_THRESHOLD,
+#endif
+    COMPOSITE_NO,
+    COMPOSITE_DARKEN,
+    COMPOSITE_LIGHTEN,
+    COMPOSITE_HUE,
+    COMPOSITE_SATURATION,
+    COMPOSITE_VALUE,
+    COMPOSITE_COLOR,
+    COMPOSITE_COLORIZE,
+    COMPOSITE_LUMINIZE,
+    COMPOSITE_SCREEN,
+    COMPOSITE_OVERLAY,
+    COMPOSITE_COPY_CYAN,
+    COMPOSITE_COPY_MAGENTA,
+    COMPOSITE_COPY_YELLOW,
+    COMPOSITE_COPY_BLACK,
+    COMPOSITE_ERASE,
+    COMPOSITE_ALPHA_DARKEN,
+    COMPOSITE_UNDEF
+};
+
+class KisCompositeOp {
+public:
+    KisCompositeOp();
+    KisCompositeOp(const TQString& id);
+    KisCompositeOp(CompositeOp compositeOp);
+
+    KisID id() const { return m_id; }
+    CompositeOp op() const { return m_op; }
+
+    bool isValid() const { return m_valid; }
+
+    bool operator==(const KisCompositeOp& other) const;
+    bool operator!=(const KisCompositeOp& other) const;
+
+private:
+    void fillMap();
+
+private:
+    CompositeOp m_op;
+    KisID m_id;
+    bool m_valid;
+
+    typedef std::map<KisID, CompositeOp> KisIDCompositeOpMap;
+    static KisIDCompositeOpMap s_idOpMap;
+};
+
+typedef TQValueList<KisCompositeOp> KisCompositeOpList;
+
+#endif // KIS_COMPOSITE_OP_H
diff --git a/chalk/chalkcolor/kis_f16half_base_colorspace.cc b/chalk/chalkcolor/kis_f16half_base_colorspace.cc
new file mode 100644
index 000000000..d4886c5f5
--- /dev/null
+++ b/chalk/chalkcolor/kis_f16half_base_colorspace.cc
@@ -0,0 +1,125 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kdebug.h"
+
+#include "kis_global.h"
+#include "kis_f16half_base_colorspace.h"
+
+TQ_UINT8 KisF16HalfBaseColorSpace::getAlpha(const TQ_UINT8 * U8_pixel) const
+{
+    if (m_alphaPos < 0) return OPACITY_OPAQUE;
+
+    U8_pixel += m_alphaPos;
+
+    const half *pixel = reinterpret_cast<const half *>(U8_pixel);
+    return HALF_TO_UINT8(*pixel);
+}
+
+void KisF16HalfBaseColorSpace::setAlpha(TQ_UINT8 *U8_pixel, TQ_UINT8 alpha, TQ_INT32 nPixels) const
+{
+    if (m_alphaPos < 0) return;
+    TQ_INT32 psize = pixelSize();
+
+    while (nPixels > 0) {
+
+        half *pixel = reinterpret_cast<half *>(U8_pixel + m_alphaPos);
+        *pixel = UINT8_TO_HALF(alpha);
+
+        --nPixels;
+        U8_pixel += psize;
+    }
+}
+
+void KisF16HalfBaseColorSpace::multiplyAlpha(TQ_UINT8 *U8_pixel, TQ_UINT8 U8_alpha, TQ_INT32 nPixels)
+{
+    if (m_alphaPos < 0) return;
+    TQ_INT32 psize = pixelSize();
+    half alpha = UINT8_TO_HALF(U8_alpha);
+
+    while (nPixels > 0) {
+
+        half *pixelAlpha = reinterpret_cast<half *>(U8_pixel + m_alphaPos);
+        *pixelAlpha *= alpha;
+
+        --nPixels;
+        U8_pixel += psize;
+    }
+}
+
+void KisF16HalfBaseColorSpace::applyAlphaU8Mask(TQ_UINT8 * U8_pixel, TQ_UINT8 * alpha8, TQ_INT32 nPixels)
+{
+    if (m_alphaPos < 0) return;
+
+    TQ_INT32 psize = pixelSize();
+
+    while (nPixels--) {
+
+        half *pixelAlpha = reinterpret_cast<half *>(U8_pixel + m_alphaPos);
+        *pixelAlpha *= UINT8_TO_HALF(*alpha8);
+
+        ++alpha8;
+        U8_pixel += psize;
+    }
+}
+
+void KisF16HalfBaseColorSpace::applyInverseAlphaU8Mask(TQ_UINT8 * U8_pixels, TQ_UINT8 * alpha8, TQ_INT32 nPixels)
+{
+    if (m_alphaPos < 0) return;
+
+    TQ_INT32 psize = pixelSize();
+
+    while (nPixels--) {
+
+            half *pixelAlpha = reinterpret_cast<half *>(U8_pixels + m_alphaPos);
+            *pixelAlpha *= UINT8_TO_HALF(MAX_SELECTED - *alpha8);
+
+            U8_pixels += psize;
+            ++alpha8;
+    }
+}
+
+TQString KisF16HalfBaseColorSpace::channelValueText(const TQ_UINT8 *U8_pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < (TQ_UINT32)nChannels());
+    const half *pixel = reinterpret_cast<const half *>(U8_pixel);
+    TQ_UINT32 channelPosition = channels()[channelIndex] -> pos() / sizeof(half);
+
+    return TQString().setNum(pixel[channelPosition]);
+}
+
+TQString KisF16HalfBaseColorSpace::normalisedChannelValueText(const TQ_UINT8 *U8_pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < (TQ_UINT32)nChannels());
+    const half *pixel = reinterpret_cast<const half *>(U8_pixel);
+    TQ_UINT32 channelPosition = channels()[channelIndex] -> pos() / sizeof(half);
+
+    return TQString().setNum(100.0 * pixel[channelPosition]);
+}
+
+TQ_UINT8 KisF16HalfBaseColorSpace::scaleToU8(const TQ_UINT8 * U8_pixel, TQ_INT32 channelPos)
+{
+    const half *pixelChannel = reinterpret_cast<const half *>(U8_pixel + channelPos);
+    return HALF_TO_UINT8(*pixelChannel);
+}
+
+TQ_UINT16 KisF16HalfBaseColorSpace::scaleToU16(const TQ_UINT8 * U8_pixel, TQ_INT32 channelPos)
+{
+    const half *pixelChannel = reinterpret_cast<const half *>(U8_pixel + channelPos);
+    return HALF_TO_UINT16(*pixelChannel);
+}
+
diff --git a/chalk/chalkcolor/kis_f16half_base_colorspace.h b/chalk/chalkcolor/kis_f16half_base_colorspace.h
new file mode 100644
index 000000000..ff1dbf8c5
--- /dev/null
+++ b/chalk/chalkcolor/kis_f16half_base_colorspace.h
@@ -0,0 +1,107 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_F16HALF_BASE_COLORSPACE_H_
+#define KIS_F16HALF_BASE_COLORSPACE_H_
+
+#include <tqcolor.h>
+
+#include <half.h>
+
+#include "kis_global.h"
+#include "kis_abstract_colorspace.h"
+#include "kis_integer_maths.h"
+
+/**
+ * This class is the base for all 16-bit float colorspaces using the
+ * OpenEXR half format. This format can be used with the OpenGL
+ * extensions GL_NV_half_float and GL_ARB_half_float_pixel.
+ */
+
+inline half UINT8_TO_HALF(uint c)
+{
+    return static_cast<half>(c) / UINT8_MAX;
+}
+
+inline uint HALF_TO_UINT8(half c)
+{
+    return static_cast<uint>(CLAMP(static_cast<int>(c * static_cast<int>(UINT8_MAX) + 0.5),
+                                   static_cast<int>(UINT8_MIN), static_cast<int>(UINT8_MAX)));
+}
+
+
+inline uint HALF_TO_UINT16(half c)
+{
+    return static_cast<uint>(CLAMP(static_cast<int>(c * static_cast<int>(UINT16_MAX) + 0.5),
+                                   static_cast<int>(UINT16_MIN), static_cast<int>(UINT16_MAX)));
+}
+
+inline half HALF_BLEND(half a, half b, half alpha)
+{
+    return (a - b) * alpha + b;
+}
+
+#define F16HALF_OPACITY_OPAQUE ((half)1.0f)
+#define F16HALF_OPACITY_TRANSPARENT ((half)0.0f)
+
+class KisF16HalfBaseColorSpace : public KisAbstractColorSpace {
+
+public:
+
+    KisF16HalfBaseColorSpace(const KisID & id, DWORD cmType, icColorSpaceSignature colorSpaceSignature,
+                             KisColorSpaceFactoryRegistry * tqparent,
+                             KisProfile *p)
+	: KisAbstractColorSpace(id, cmType, colorSpaceSignature, tqparent, p)
+    {
+        m_alphaSize = sizeof(half);
+    };
+
+    virtual TQ_UINT8 getAlpha(const TQ_UINT8 * pixel) const;
+    virtual void setAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const;
+    virtual void multiplyAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels);
+
+    virtual void applyAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+    virtual void applyInverseAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+
+    virtual TQString channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+    virtual TQString normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+
+    virtual TQ_UINT8 scaleToU8(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+    virtual TQ_UINT16 scaleToU16(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+
+    virtual bool hasHighDynamicRange() const { return true; }
+
+protected:
+    // For Alpha Composite
+    struct F16HalfMult {
+        inline half operator()(const half& a, const half& b) const {
+            return a * b;
+        }
+    };
+    struct Uint8ToF16Half {
+        inline half operator()(const TQ_UINT8 src) const {
+            return UINT8_TO_HALF(src);
+        }
+    };
+    struct F16HalfOpacityTest {
+        inline bool operator()(const half& opacity) const {
+            return opacity > F16HALF_OPACITY_TRANSPARENT + HALF_EPSILON;
+        }
+    };
+};
+
+#endif // KIS_F16HALF_BASE_COLORSPACE_H_
diff --git a/chalk/chalkcolor/kis_f32_base_colorspace.cc b/chalk/chalkcolor/kis_f32_base_colorspace.cc
new file mode 100644
index 000000000..27a6a312e
--- /dev/null
+++ b/chalk/chalkcolor/kis_f32_base_colorspace.cc
@@ -0,0 +1,125 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kdebug.h"
+
+#include "kis_global.h"
+#include "kis_f32_base_colorspace.h"
+
+TQ_UINT8 KisF32BaseColorSpace::getAlpha(const TQ_UINT8 * U8_pixel) const
+{
+    if (m_alphaPos < 0) return OPACITY_OPAQUE;
+
+    U8_pixel += m_alphaPos;
+
+    const float *pixel = reinterpret_cast<const float *>(U8_pixel);
+    return FLOAT_TO_UINT8(*pixel);
+}
+
+void KisF32BaseColorSpace::setAlpha(TQ_UINT8 *U8_pixel, TQ_UINT8 alpha, TQ_INT32 nPixels) const
+{
+    if (m_alphaPos < 0) return;
+    TQ_INT32 psize = pixelSize();
+
+    while (nPixels > 0) {
+
+        float *pixel = reinterpret_cast<float *>(U8_pixel + m_alphaPos);
+        *pixel = UINT8_TO_FLOAT(alpha);
+
+        --nPixels;
+        U8_pixel += psize;
+    }
+}
+
+void KisF32BaseColorSpace::multiplyAlpha(TQ_UINT8 *U8_pixel, TQ_UINT8 U8_alpha, TQ_INT32 nPixels)
+{
+    if (m_alphaPos < 0) return;
+    TQ_INT32 psize = pixelSize();
+    float alpha = UINT8_TO_FLOAT(U8_alpha);
+
+    while (nPixels > 0) {
+
+        float *pixelAlpha = reinterpret_cast<float *>(U8_pixel + m_alphaPos);
+        *pixelAlpha *= alpha;
+
+        --nPixels;
+        U8_pixel += psize;
+    }
+}
+
+void KisF32BaseColorSpace::applyAlphaU8Mask(TQ_UINT8 * U8_pixel, TQ_UINT8 * alpha8, TQ_INT32 nPixels)
+{
+    if (m_alphaPos < 0) return;
+
+    TQ_INT32 psize = pixelSize();
+
+    while (nPixels--) {
+
+        float *pixelAlpha = reinterpret_cast<float *>(U8_pixel + m_alphaPos);
+        *pixelAlpha *= UINT8_TO_FLOAT(*alpha8);
+
+        ++alpha8;
+        U8_pixel += psize;
+    }
+}
+
+void KisF32BaseColorSpace::applyInverseAlphaU8Mask(TQ_UINT8 * U8_pixels, TQ_UINT8 * alpha8, TQ_INT32 nPixels)
+{
+    if (m_alphaPos < 0) return;
+
+    TQ_INT32 psize = pixelSize();
+
+    while (nPixels--) {
+
+            float *pixelAlpha = reinterpret_cast<float *>(U8_pixels + m_alphaPos);
+            *pixelAlpha *= UINT8_TO_FLOAT(MAX_SELECTED - *alpha8);
+
+            U8_pixels += psize;
+            ++alpha8;
+    }
+}
+
+TQString KisF32BaseColorSpace::channelValueText(const TQ_UINT8 *U8_pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < (TQ_UINT32)nChannels());
+    const float *pixel = reinterpret_cast<const float *>(U8_pixel);
+    TQ_UINT32 channelPosition = channels()[channelIndex]->pos() / sizeof(float);
+
+    return TQString().setNum(pixel[channelPosition]);
+}
+
+TQString KisF32BaseColorSpace::normalisedChannelValueText(const TQ_UINT8 *U8_pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < (TQ_UINT32)nChannels());
+    const float *pixel = reinterpret_cast<const float *>(U8_pixel);
+    TQ_UINT32 channelPosition = channels()[channelIndex]->pos() / sizeof(float);
+
+    return TQString().setNum(100.0 * pixel[channelPosition]);
+}
+
+TQ_UINT8 KisF32BaseColorSpace::scaleToU8(const TQ_UINT8 * U8_pixel, TQ_INT32 channelPos)
+{
+    const float *pixelChannel = reinterpret_cast<const float *>(U8_pixel + channelPos);
+    return FLOAT_TO_UINT8(*pixelChannel);
+}
+
+TQ_UINT16 KisF32BaseColorSpace::scaleToU16(const TQ_UINT8 * U8_pixel, TQ_INT32 channelPos)
+{
+    const float *pixelChannel = reinterpret_cast<const float *>(U8_pixel + channelPos);
+    return FLOAT_TO_UINT16(*pixelChannel);
+}
+
diff --git a/chalk/chalkcolor/kis_f32_base_colorspace.h b/chalk/chalkcolor/kis_f32_base_colorspace.h
new file mode 100644
index 000000000..60ecb9aa6
--- /dev/null
+++ b/chalk/chalkcolor/kis_f32_base_colorspace.h
@@ -0,0 +1,83 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_F32_BASE_COLORSPACE_H_
+#define KIS_F32_BASE_COLORSPACE_H_
+
+#include <tqcolor.h>
+
+#include "kis_global.h"
+#include "kis_abstract_colorspace.h"
+#include "kis_integer_maths.h"
+
+/**
+ * This class is the base for all 32-bit float colorspaces.
+ */
+
+inline float UINT8_TO_FLOAT(uint c)
+{
+    return static_cast<float>(c) / UINT8_MAX;
+}
+
+inline uint FLOAT_TO_UINT8(float c)
+{
+    return static_cast<uint>(CLAMP(static_cast<int>(c * static_cast<int>(UINT8_MAX) + 0.5),
+                                   static_cast<int>(UINT8_MIN), static_cast<int>(UINT8_MAX)));
+}
+
+
+inline uint FLOAT_TO_UINT16(float c)
+{
+    return static_cast<uint>(CLAMP(static_cast<int>(c * static_cast<int>(UINT16_MAX) + 0.5),
+                                   static_cast<int>(UINT16_MIN), static_cast<int>(UINT16_MAX)));
+}
+
+inline float FLOAT_BLEND(float a, float b, float alpha)
+{
+    return (a - b) * alpha + b;
+}
+
+#define F32_OPACITY_OPAQUE 1.0f
+#define F32_OPACITY_TRANSPARENT 0.0f
+
+class KisF32BaseColorSpace : public KisAbstractColorSpace {
+
+public:
+
+    KisF32BaseColorSpace(const KisID & id, DWORD cmType, icColorSpaceSignature colorSpaceSignature, KisColorSpaceFactoryRegistry * tqparent, KisProfile *p)
+	: KisAbstractColorSpace(id, cmType, colorSpaceSignature, tqparent, p)
+    {
+	m_alphaSize = sizeof(float);
+    };
+
+    virtual TQ_UINT8 getAlpha(const TQ_UINT8 * pixel) const;
+    virtual void setAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const;
+    virtual void multiplyAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels);
+
+    virtual void applyAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+    virtual void applyInverseAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+
+    virtual TQString channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+    virtual TQString normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+
+    virtual TQ_UINT8 scaleToU8(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+    virtual TQ_UINT16 scaleToU16(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+
+    virtual bool hasHighDynamicRange() const { return true; }
+};
+
+#endif // KIS_F32_BASE_COLORSPACE_H_
diff --git a/chalk/chalkcolor/kis_histogram_producer.cc b/chalk/chalkcolor/kis_histogram_producer.cc
new file mode 100644
index 000000000..bbea95bac
--- /dev/null
+++ b/chalk/chalkcolor/kis_histogram_producer.cc
@@ -0,0 +1,67 @@
+/*
+ *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_histogram_producer.h"
+#include "kis_basic_histogram_producers.h"
+
+KisHistogramProducerFactoryRegistry* KisHistogramProducerFactoryRegistry::m_singleton = 0;
+
+KisHistogramProducerFactoryRegistry::KisHistogramProducerFactoryRegistry() {
+    Q_ASSERT(KisHistogramProducerFactoryRegistry::m_singleton == 0);
+}
+
+KisHistogramProducerFactoryRegistry::~KisHistogramProducerFactoryRegistry() {
+}
+
+KisHistogramProducerFactoryRegistry* KisHistogramProducerFactoryRegistry::instance() {
+    if(KisHistogramProducerFactoryRegistry::m_singleton == 0) {
+        KisHistogramProducerFactoryRegistry::m_singleton
+                = new KisHistogramProducerFactoryRegistry();
+        m_singleton->add( new KisGenericLabHistogramProducerFactory() );
+    }
+    return KisHistogramProducerFactoryRegistry::m_singleton;
+}
+
+KisIDList KisHistogramProducerFactoryRegistry::listKeysCompatibleWith(
+        KisColorSpace* colorSpace) const
+{
+    KisIDList list;
+    TQValueList<float> preferredList;
+    storageMap::const_iterator it = m_storage.begin();
+    storageMap::const_iterator endit = m_storage.end();
+    // O(n^2), can't this be done better? (But preferrably not by looking up the preferredness
+    // during the sorting...
+    while( it != endit ) {
+        if (it->second->isCompatibleWith(colorSpace)) {
+            float preferred = it->second->preferrednessLevelWith(colorSpace);
+            TQValueList<float>::iterator pit = preferredList.begin();
+            TQValueList<float>::iterator pend = preferredList.end();
+            KisIDList::iterator lit = list.begin();
+
+            while (pit != pend && preferred <= *pit) {
+                ++pit;
+                ++lit;
+            }
+
+            list.insert(lit, it->first);
+            preferredList.insert(pit, preferred);
+        }
+        ++it;
+    }
+    return list;
+}
diff --git a/chalk/chalkcolor/kis_histogram_producer.h b/chalk/chalkcolor/kis_histogram_producer.h
new file mode 100644
index 000000000..2d25b354c
--- /dev/null
+++ b/chalk/chalkcolor/kis_histogram_producer.h
@@ -0,0 +1,129 @@
+/*
+ *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _KIS_HISTOGRAM_PRODUCER_
+#define _KIS_HISTOGRAM_PRODUCER_
+
+#include <tqglobal.h>
+#include <ksharedptr.h>
+
+#include <kis_colorspace.h>
+
+#include "kis_generic_registry.h"
+
+class KisRectIteratorPixel;
+class TQString;
+class KisChannelInfo;
+
+/**
+ * This class is an interface used in the generation of a histogram. It is a container of
+ * data, all mathematically interesting things will calculated by a KisHistogram.
+ *
+ * The default view will be the entire range each color can be in. And don't let the
+ * numberOfBins return anything else then 256 unless you have a very good reason for it.
+ *
+ * About the views: a view is a zoom combined with a start level: the entire
+ * range of a channel is 0.0 - 1.0: this is the position. Combined with a zoom, we can
+ * calculate what part of a channel will fall in a bin. This gives us an interface to
+ * that the views that is not dependent of the actual colorspace of the histogram.
+ * The 'size' value is the size, again from 0.0 to 1.0 of the displayed range.
+ *
+ * For comfort of the GUI, and because it is logical, channels are accessed in the order
+ * in which they are found in the channels() method. This is potentially different from
+ * the order in which they are internally ordered!
+ **/
+class KisHistogramProducer : public KShared {
+public:
+    KisHistogramProducer() : m_skipTransparent(true), m_skipUnselected(true) {}
+    virtual ~KisHistogramProducer() {}
+
+    // Methods to change the bins
+
+    /** Clears the data in this producer, but keeps its other settings */
+    virtual void clear() = 0;
+
+    /**
+     * Adds the values from the specified array of pixels to the bins -- does not
+     * reset anything.
+     *
+     * @param pixels A pointer an array of pixeldata in the given colorspace
+     * @param selectionMask a pointer to an array of bytes, where 0 is unselected and 1-255 is degree of selectedness. The array
+     *                      must be just as long as the array of pixels.
+     * @param nPixels The number of pixels
+     * @param colorSpace the colorspace that can decode the pixel data.
+     */
+    virtual void addRegionToBin(TQ_UINT8 * pixels, TQ_UINT8 * selectionMask, TQ_UINT32 nPixels, KisColorSpace* colorSpace) = 0;
+
+    // Methods to set what exactly is being added to the bins
+    virtual void setView(double from, double width) = 0;
+    virtual void setSkipTransparent(bool set) { m_skipTransparent = set; }
+    virtual void setSkipUnselected(bool set) { m_skipUnselected = set; }
+
+    // Methods with general information about this specific producer
+    virtual const KisID& id() const = 0;
+    virtual TQValueVector<KisChannelInfo *> channels() = 0;
+    virtual TQ_INT32 numberOfBins() = 0;
+    virtual TQString positionToString(double pos) const = 0;
+    virtual double viewFrom() const = 0;
+    virtual double viewWidth() const = 0;
+    virtual double maximalZoom() const = 0;
+
+    // Methods to get information on the data we have seen
+    virtual TQ_INT32 count() = 0;
+    virtual TQ_INT32 getBinAt(TQ_INT32 channel, TQ_INT32 position) = 0;
+    virtual TQ_INT32 outOfViewLeft(TQ_INT32 channel) = 0;
+    virtual TQ_INT32 outOfViewRight(TQ_INT32 channel) = 0;
+protected:
+    bool m_skipTransparent;
+    bool m_skipUnselected;
+};
+
+typedef KSharedPtr<KisHistogramProducer> KisHistogramProducerSP;
+
+class KisHistogramProducerFactory {
+public:
+    KisHistogramProducerFactory(const KisID& id) : m_id(id) {}
+    virtual ~KisHistogramProducerFactory() {}
+    /// Factory method, generates a new KisHistogramProducer
+    virtual KisHistogramProducerSP generate() = 0;
+    /// Returns if a colorspace can be used with this producer
+    virtual bool isCompatibleWith(KisColorSpace* colorSpace) const = 0;
+    /// Returns a float in the [0.0, 1.0] range, 0.0 means this is a very generic method
+    virtual float preferrednessLevelWith(KisColorSpace* colorSpace) const = 0;
+    virtual const KisID& id() const { return m_id; }
+protected:
+    KisID m_id;
+};
+
+class KisHistogramProducerFactoryRegistry
+    : public KisGenericRegistry<KisHistogramProducerFactory*> {
+public:
+    virtual ~KisHistogramProducerFactoryRegistry();
+    static KisHistogramProducerFactoryRegistry* instance();
+    /// returns a list, sorted by preferrence: higher preferance comes first
+    KisIDList listKeysCompatibleWith(KisColorSpace* colorSpace) const;
+
+private:
+   KisHistogramProducerFactoryRegistry();
+   KisHistogramProducerFactoryRegistry(const KisHistogramProducerFactoryRegistry&);
+   KisHistogramProducerFactoryRegistry operator=(const KisHistogramProducerFactoryRegistry&);
+
+   static KisHistogramProducerFactoryRegistry* m_singleton;
+};
+
+#endif // _KIS_HISTOGRAM_PRODUCER
diff --git a/chalk/chalkcolor/kis_profile.cc b/chalk/chalkcolor/kis_profile.cc
new file mode 100644
index 000000000..2d0ad98f4
--- /dev/null
+++ b/chalk/chalkcolor/kis_profile.cc
@@ -0,0 +1,208 @@
+/*
+ *  kis_profile.cc - part of Krayon
+ *
+ *  Copyright (c) 2000 Matthias Elter <elter@kde.org>
+ *                2001 John Califf
+ *                2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <cfloat>
+#include <cmath>
+#include <config.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+#include <tqtextstream.h>
+#include <tqfile.h>
+
+#include <kdebug.h>
+
+#include "kis_profile.h"
+#include "kis_global.h"
+
+#include "ksharedptr.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <fixx11h.h>
+
+KisProfile::KisProfile(TQByteArray rawData)
+    : m_rawData(rawData),
+      m_filename( TQString() ),
+      m_valid( false ),
+      m_suitableForOutput(false)
+{
+    m_profile = cmsOpenProfileFromMem(rawData.data(), (DWORD)rawData.size());
+    init();
+}
+
+KisProfile::KisProfile(const TQString& file)
+    : m_filename(file),
+      m_valid( false ),
+      m_suitableForOutput( false )
+{
+}
+
+KisProfile::KisProfile(const cmsHPROFILE profile)
+    : m_profile(profile),
+      m_filename( TQString() ),
+      m_valid( true )
+{
+    size_t  bytesNeeded=0;
+
+    // Make a raw data image ready for saving
+    _cmsSaveProfileToMem(m_profile, 0, &bytesNeeded); // calc size
+    if(m_rawData.tqresize(bytesNeeded))
+    {
+        _cmsSaveProfileToMem(m_profile, m_rawData.data(), &bytesNeeded); // fill buffer
+        cmsHPROFILE newprofile = cmsOpenProfileFromMem(m_rawData.data(), (DWORD) bytesNeeded);
+        cmsCloseProfile(m_profile);
+        m_profile = newprofile;
+    }
+    else
+        m_rawData.resize(0);
+
+    init();
+}
+
+KisProfile::~KisProfile()
+{
+    cmsCloseProfile(m_profile);
+}
+
+
+bool KisProfile::load()
+{
+    TQFile file(m_filename);
+    file.open(IO_ReadOnly);
+    m_rawData = file.readAll();
+    m_profile = cmsOpenProfileFromMem(m_rawData.data(), (DWORD)m_rawData.size());
+    file.close();
+
+    if (m_profile == 0) {
+        kdWarning() << "Failed to load profile from " << m_filename << endl;
+    }
+
+    return init();
+
+}
+
+bool KisProfile::init()
+{
+    if (m_profile) {
+        m_colorSpaceSignature = cmsGetColorSpace(m_profile);
+        m_deviceClass = cmsGetDeviceClass(m_profile);
+        m_productName = cmsTakeProductName(m_profile);
+        m_productDescription = cmsTakeProductDesc(m_profile);
+        m_productInfo = cmsTakeProductInfo(m_profile);
+        m_valid = true;
+
+        // Check if the profile can convert (something->this)
+//         LPMATSHAPER OutMatShaper = cmsBuildOutputMatrixShaper(m_profile);
+//         if( OutMatShaper )
+//         {
+//             m_suitableForOutput = true;
+//         }
+        cmsCIEXYZTRIPLE Primaries;
+
+        if (cmsTakeColorants(&Primaries, m_profile))
+        {
+            m_suitableForOutput = true;
+        }
+
+#if 0
+    // XXX: It wasn't that easy to save a little memory: thsi gives an lcms error
+        // Okay, we know enough. Free the memory; we'll load it again if needed.
+
+        cmsCloseProfile(m_profile);
+        m_profile = 0;
+
+#endif
+        return true;
+    }
+    return false;
+}
+
+cmsHPROFILE KisProfile::profile()
+{
+#if 0
+	if (m_profile = 0) {
+	    TQFile file(m_filename);
+	    file.open(IO_ReadOnly);
+	    m_rawData = file.readAll();
+	    m_profile = cmsOpenProfileFromMem(m_rawData.data(), (DWORD)m_rawData.size());
+        file.close();
+	}
+#endif
+	return m_profile;
+}
+
+bool KisProfile::save()
+{
+    return false;
+}
+
+KisAnnotationSP KisProfile::annotation() const
+{
+    // XXX we hardcode icc, this is correct for lcms?
+    // XXX productName(), or just "ICC Profile"?
+    if (!m_rawData.isEmpty())
+        return new KisAnnotation("icc", productName(), m_rawData);
+    else
+        return 0;
+}
+
+KisProfile *  KisProfile::getScreenProfile (int screen)
+{
+
+#ifdef Q_WS_X11
+
+    Atom type;
+    int format;
+    unsigned long nitems;
+    unsigned long bytes_after;
+    TQ_UINT8 * str;
+
+    static Atom icc_atom = XInternAtom( qt_xdisplay(), "_ICC_PROFILE", False );
+
+    if  ( XGetWindowProperty ( qt_xdisplay(),
+                    qt_xrootwin( screen ),
+                    icc_atom,
+                    0,
+                    INT_MAX,
+                    False,
+                    XA_CARDINAL,
+                    &type,
+                    &format,
+                    &nitems,
+                    &bytes_after,
+                    (unsigned char **) &str)
+                ) {
+
+        TQByteArray bytes (nitems);
+        bytes.assign((char*)str, (TQ_UINT32)nitems);
+
+        return new KisProfile(bytes);
+    } else {
+        return NULL;
+    }
+#else
+    return NULL;
+
+#endif
+}
+
+
diff --git a/chalk/chalkcolor/kis_profile.h b/chalk/chalkcolor/kis_profile.h
new file mode 100644
index 000000000..5f732188d
--- /dev/null
+++ b/chalk/chalkcolor/kis_profile.h
@@ -0,0 +1,98 @@
+/*
+ *  kis_profile.h - part of Krayon
+ *
+ *  Copyright (c) 2000 Matthias Elter  <elter@kde.org>
+ *                2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_PROFILE_H
+#define KIS_PROFILE_H
+
+#include <config.h>
+
+#include LCMS_HEADER
+
+#include <tqvaluevector.h>
+#include <tqcstring.h>
+
+#include <kio/job.h>
+
+#include <kis_annotation.h>
+
+//XXX: Profiles should be loaded by the color strategies
+//     and be available only through the color strategy
+//     that matches the profile's color model
+class KisProfile {
+
+public:
+    KisProfile(TQByteArray rawData);
+    KisProfile(const TQString& file);
+    KisProfile(const cmsHPROFILE profile);
+
+    virtual ~KisProfile();
+
+    virtual bool load();
+    virtual bool save();
+
+    inline icColorSpaceSignature colorSpaceSignature() const { return m_colorSpaceSignature; }
+    inline icProfileClassSignature deviceClass() const { return m_deviceClass; }
+    inline TQString productName() const { return m_productName; }
+    inline TQString productDescription() const { return m_productDescription; }
+    inline TQString productInfo() const { return m_productInfo; }
+    inline TQString manufacturer() const { return m_manufacturer; }
+    cmsHPROFILE profile();
+
+    KisAnnotationSP annotation() const;
+
+    friend inline bool operator==( const KisProfile &,  const KisProfile & );
+
+    inline bool valid() const { return m_valid; };
+    
+    inline bool isSuitableForOutput() { return m_suitableForOutput; };
+
+    inline TQString filename() const { return m_filename; }
+
+public:
+
+    static KisProfile *  getScreenProfile(int screen = -1);
+
+private:
+    bool init();
+
+    cmsHPROFILE m_profile;
+    icColorSpaceSignature m_colorSpaceSignature;
+    icProfileClassSignature m_deviceClass;
+    TQString m_productName;
+    TQString m_productDescription;
+    TQString m_productInfo;
+    TQString m_manufacturer;
+
+    TQByteArray m_rawData;
+
+    TQString m_filename;
+    bool m_valid;
+    bool m_suitableForOutput;
+
+};
+
+inline bool operator==( const KisProfile & p1,  const KisProfile & p2 )
+{
+    return p1.m_profile == p2.m_profile;
+}
+
+#endif // KIS_PROFILE_H
+
diff --git a/chalk/chalkcolor/kis_u16_base_colorspace.cc b/chalk/chalkcolor/kis_u16_base_colorspace.cc
new file mode 100644
index 000000000..a735e35ce
--- /dev/null
+++ b/chalk/chalkcolor/kis_u16_base_colorspace.cc
@@ -0,0 +1,148 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kdebug.h"
+
+#include "kis_global.h"
+#include "kis_abstract_colorspace.h"
+#include "kis_integer_maths.h"
+#include "kis_u16_base_colorspace.h"
+
+
+TQ_UINT8 KisU16BaseColorSpace::getAlpha(const TQ_UINT8 * U8_pixel) const
+{
+    if (m_alphaPos < 0) return OPACITY_OPAQUE;
+
+    U8_pixel+= m_alphaPos;
+
+    const TQ_UINT16 *pixel = reinterpret_cast<const TQ_UINT16 *>(U8_pixel);
+    return UINT16_TO_UINT8(*pixel);
+}
+
+
+void KisU16BaseColorSpace::setAlpha(TQ_UINT8 *U8_pixel, TQ_UINT8 alpha, TQ_INT32 nPixels) const
+{
+    if (m_alphaPos < 0) return;
+    TQ_INT32 psize = pixelSize();
+
+
+    while (nPixels > 0) {
+
+        TQ_UINT16 *pixel = reinterpret_cast<TQ_UINT16 *>(U8_pixel + m_alphaPos);
+        pixel[0] = UINT8_TO_UINT16(alpha);
+
+        --nPixels;
+        U8_pixel += psize;
+    }
+}
+
+void KisU16BaseColorSpace::multiplyAlpha(TQ_UINT8 *U8_pixel, TQ_UINT8 U8_alpha, TQ_INT32 nPixels)
+{
+    if (m_alphaPos < 0) return;
+
+    TQ_INT32 psize = pixelSize();
+    TQ_UINT16 alpha = UINT8_TO_UINT16(U8_alpha);
+
+    while (nPixels > 0) {
+
+        TQ_UINT16 *pixelAlpha = reinterpret_cast<TQ_UINT16 *>(U8_pixel + m_alphaPos);
+        *pixelAlpha = UINT16_MULT(*pixelAlpha, alpha);
+
+        --nPixels;
+        U8_pixel += psize;
+    }
+}
+
+void KisU16BaseColorSpace::applyAlphaU8Mask(TQ_UINT8 * U8_pixel, TQ_UINT8 * alpha8, TQ_INT32 nPixels)
+{
+    if (m_alphaPos < 0) return;
+
+    TQ_INT32 psize = pixelSize();
+
+    while (nPixels--) {
+
+        // Go to the alpha position (which is given in bytes from the start of the pixel,
+        // and cast to short.
+
+        TQ_UINT16 *pixelAlpha = reinterpret_cast<TQ_UINT16 *>(U8_pixel + m_alphaPos);
+        *pixelAlpha = UINT8_MULT(*pixelAlpha, *alpha8);
+
+        ++alpha8;
+        U8_pixel += psize;
+
+    }
+}
+
+void KisU16BaseColorSpace::applyInverseAlphaU8Mask(TQ_UINT8 * U8_pixels, TQ_UINT8 * alpha8, TQ_INT32 nPixels)
+{
+
+    if (m_alphaPos < 0) return;
+
+    TQ_INT32 psize = pixelSize();
+
+
+    while(nPixels--) {
+
+            TQ_UINT16 s_alpha8;
+            TQ_UINT32 p_alpha, s_alpha16;
+
+            TQ_UINT16 *alpha = reinterpret_cast<TQ_UINT16 *>(U8_pixels + m_alphaPos);
+
+            p_alpha = *(alpha);
+            s_alpha8 = MAX_SELECTED - *alpha8;
+            s_alpha16 = UINT8_TO_UINT16(s_alpha8);
+
+            // Go to the alpha position (which is given in bytes from the start of the pixel,
+            // and cast to short.
+
+            alpha[0] = UINT16_MULT(p_alpha, s_alpha16);
+
+            U8_pixels += psize;
+            ++alpha8;
+    }
+}
+
+TQString KisU16BaseColorSpace::channelValueText(const TQ_UINT8 *U8_pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < (TQ_UINT32)nChannels());
+    const TQ_UINT16 *pixel = reinterpret_cast<const TQ_UINT16 *>(U8_pixel);
+    TQ_UINT32 channelPosition = channels()[channelIndex]->pos() / sizeof(TQ_UINT16);
+
+    return TQString().setNum(pixel[channelPosition]);
+}
+
+TQString KisU16BaseColorSpace::normalisedChannelValueText(const TQ_UINT8 *U8_pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < (TQ_UINT32)nChannels());
+    const TQ_UINT16 *pixel = reinterpret_cast<const TQ_UINT16 *>(U8_pixel);
+    TQ_UINT32 channelPosition = m_channels[channelIndex]->pos() / sizeof(TQ_UINT16);
+
+    return TQString().setNum(100.0 * static_cast<float>(pixel[channelPosition]) / UINT16_MAX);
+}
+
+TQ_UINT8 KisU16BaseColorSpace::scaleToU8(const TQ_UINT8 * U8_pixel, TQ_INT32 channelPos)
+{
+    const TQ_UINT16 *pixel = reinterpret_cast<const TQ_UINT16 *>(U8_pixel);
+    return UINT16_TO_UINT8(pixel[channelPos]);
+}
+
+TQ_UINT16 KisU16BaseColorSpace::scaleToU16(const TQ_UINT8 * U8_pixel, TQ_INT32 channelPos)
+{
+    const TQ_UINT16 *pixel = reinterpret_cast<const TQ_UINT16 *>(U8_pixel);
+    return pixel[channelPos];
+}
+
diff --git a/chalk/chalkcolor/kis_u16_base_colorspace.h b/chalk/chalkcolor/kis_u16_base_colorspace.h
new file mode 100644
index 000000000..756ab9b53
--- /dev/null
+++ b/chalk/chalkcolor/kis_u16_base_colorspace.h
@@ -0,0 +1,80 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_U16_BASE_COLORSPACE_H_
+#define KIS_U16_BASE_COLORSPACE_H_
+
+#include "kis_global.h"
+#include "kis_abstract_colorspace.h"
+#include "kis_integer_maths.h"
+
+/**
+ * This is the base class for 16-bit/channel colorspaces with 16-bit alpha
+ * channels. It defines a number of common methods, like handling 16-bit alpha
+ * and up- and down-scaling of channels.
+ */
+class KisU16BaseColorSpace : public KisAbstractColorSpace {
+
+public:
+
+    static const TQ_UINT16 U16_OPACITY_OPAQUE = UINT16_MAX;
+    static const TQ_UINT16 U16_OPACITY_TRANSPARENT = UINT16_MIN;
+
+public:
+
+    KisU16BaseColorSpace(const KisID & id, DWORD cmType, icColorSpaceSignature colorSpaceSignature,
+                         KisColorSpaceFactoryRegistry * tqparent,
+                         KisProfile *p)
+	: KisAbstractColorSpace(id, cmType, colorSpaceSignature,
+                                tqparent,
+                                p)
+    {
+	    m_alphaSize = sizeof(TQ_UINT16);
+    };
+
+    virtual TQ_UINT8 getAlpha(const TQ_UINT8 * pixel) const;
+    virtual void setAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const;
+    virtual void multiplyAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels);
+
+    virtual void applyAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+    virtual void applyInverseAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+
+    virtual TQString channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+    virtual TQString normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+
+    virtual TQ_UINT8 scaleToU8(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+    virtual TQ_UINT16 scaleToU16(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+
+protected:
+    // For Alpha Composite
+    struct U16Mult {
+        inline TQ_UINT16 operator()(const TQ_UINT16& a, const TQ_UINT16& b) const {
+            return UINT16_MULT(a, b);
+        }
+    };
+    struct Uint8ToU16 {
+        inline TQ_UINT16 operator()(const TQ_UINT8 src) const {
+            return UINT8_TO_UINT16(src);
+        }
+    };
+    struct U16OpacityTest {
+        inline bool operator()(const TQ_UINT16& opacity) const {
+            return opacity != U16_OPACITY_TRANSPARENT;
+        }
+    };
+};
+#endif // KIS_U16_BASE_COLORSPACE_H_
diff --git a/chalk/chalkcolor/kis_u8_base_colorspace.cc b/chalk/chalkcolor/kis_u8_base_colorspace.cc
new file mode 100644
index 000000000..338d95d6b
--- /dev/null
+++ b/chalk/chalkcolor/kis_u8_base_colorspace.cc
@@ -0,0 +1,118 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <tqcolor.h>
+
+#include <kdebug.h>
+
+#include "kis_abstract_colorspace.h"
+#include "kis_u8_base_colorspace.h"
+#include "kis_integer_maths.h"
+
+TQ_UINT8 KisU8BaseColorSpace::getAlpha(const TQ_UINT8 * pixel) const
+{
+    return pixel[m_alphaPos];
+}
+
+
+
+void KisU8BaseColorSpace::setAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const
+{
+    if (m_alphaPos < 0) return;
+    TQ_INT32 psize = pixelSize();
+
+    pixels += m_alphaPos;
+    while (nPixels > 0) {
+        *pixels = alpha;
+        --nPixels;
+        pixels += psize;
+    }
+
+}
+
+void KisU8BaseColorSpace::multiplyAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels)
+{
+    if (m_alphaPos < 0) return;
+    TQ_INT32 psize = pixelSize();
+
+    while (nPixels > 0) {
+        pixels[m_alphaPos] = UINT8_MULT(pixels[m_alphaPos], alpha);
+        --nPixels;
+        pixels += psize;
+    }
+}
+
+void KisU8BaseColorSpace::applyAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels)
+{
+    TQ_INT32 psize = pixelSize();
+
+    while (nPixels--) {
+
+        pixels[m_alphaPos] = UINT8_MULT(*(pixels + m_alphaPos) , *alpha);
+
+        alpha++;
+        pixels += psize;
+
+    }
+}
+
+void KisU8BaseColorSpace::applyInverseAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels)
+{
+    TQ_INT32 psize = pixelSize();
+
+    while(nPixels--) {
+
+            TQ_UINT16 p_alpha, s_alpha;
+
+            p_alpha = getAlpha(pixels);
+            s_alpha = MAX_SELECTED - *alpha;
+
+            setAlpha(pixels, UINT8_MULT(p_alpha, s_alpha), 1);
+
+            pixels += psize;
+            ++alpha;
+    }
+}
+
+TQString KisU8BaseColorSpace::channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < (TQ_UINT32)nChannels());
+    TQ_UINT32 channelPosition = m_channels[channelIndex]->pos();
+
+    return TQString().setNum(pixel[channelPosition]);
+}
+
+TQString KisU8BaseColorSpace::normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < (TQ_UINT32)nChannels());
+    TQ_UINT32 channelPosition = m_channels[channelIndex]->pos();
+
+    return TQString().setNum(100.0 * static_cast<float>(pixel[channelPosition]) / UINT8_MAX);
+}
+
+
+TQ_UINT8 KisU8BaseColorSpace::scaleToU8(const TQ_UINT8 * pixel, TQ_INT32 channelPos)
+{
+    return pixel[channelPos];
+}
+
+TQ_UINT16 KisU8BaseColorSpace::scaleToU16(const TQ_UINT8 * pixel, TQ_INT32 channelPos)
+{
+    return UINT8_TO_UINT16(pixel[channelPos]);
+}
+
diff --git a/chalk/chalkcolor/kis_u8_base_colorspace.h b/chalk/chalkcolor/kis_u8_base_colorspace.h
new file mode 100644
index 000000000..098a1f59c
--- /dev/null
+++ b/chalk/chalkcolor/kis_u8_base_colorspace.h
@@ -0,0 +1,77 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_U8_BASE_COLORSPACE_H_
+#define KIS_U8_BASE_COLORSPACE_H_
+
+#include <tqcolor.h>
+
+#include <tqcolor.h>
+
+#include "kis_global.h"
+#include "kis_abstract_colorspace.h"
+#include "kis_integer_maths.h"
+
+/**
+ * This class is the base for all homogenous 8-bit/channel colorspaces with 8-bit alpha channels
+ */
+class KisU8BaseColorSpace : public KisAbstractColorSpace {
+
+public:
+
+    KisU8BaseColorSpace(const KisID & id, DWORD cmType, icColorSpaceSignature colorSpaceSignature,
+                        KisColorSpaceFactoryRegistry * tqparent,
+                        KisProfile *p)
+	: KisAbstractColorSpace(id, cmType, colorSpaceSignature, tqparent, p)
+    {
+	m_alphaSize = sizeof(TQ_UINT8);
+    };
+
+    virtual TQ_UINT8 getAlpha(const TQ_UINT8 * pixel) const;
+    virtual void setAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const;
+    virtual void multiplyAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels);
+
+    virtual void applyAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+    virtual void applyInverseAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+
+    virtual TQString channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+    virtual TQString normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+
+    virtual TQ_UINT8 scaleToU8(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+    virtual TQ_UINT16 scaleToU16(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+
+protected:
+    // For Alpha Composite
+    struct U8Mult {
+        inline TQ_UINT8 operator()(const TQ_UINT8& a, const TQ_UINT8& b) const {
+            return UINT8_MULT(a, b);
+        }
+    };
+    struct Uint8ToU8 {
+        inline TQ_UINT8 operator()(const TQ_UINT8 src) const {
+            return src;
+        }
+    };
+    struct U8OpacityTest {
+        inline bool operator()(const TQ_UINT8& opacity) const {
+            return opacity != OPACITY_TRANSPARENT;
+        }
+    };
+};
+
+
+#endif // KIS_U8_BASE_COLORSPACE_H_
diff --git a/chalk/chalkcolor/tests/Makefile.am b/chalk/chalkcolor/tests/Makefile.am
new file mode 100644
index 000000000..e78141e78
--- /dev/null
+++ b/chalk/chalkcolor/tests/Makefile.am
@@ -0,0 +1,16 @@
+AM_CPPFLAGS = \
+	-I$(srcdir)/../../sdk \
+	-I$(srcdir)/../ \
+	$(all_includes)
+
+# The check_ target makes sure we don't install the modules,
+# $(KDE_CHECK_PLUGIN) assures a shared library is created.
+check_LTLIBRARIES = kunittest_kis_color_conversions_tester.la
+
+kunittest_kis_color_conversions_tester_la_SOURCES = kis_color_conversions_tester.cpp
+kunittest_kis_color_conversions_tester_la_LIBADD = -lkunittest ../libchalkcolor.la ../../libchalkcommon.la
+kunittest_kis_color_conversions_tester_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+check-local: kunittest_kis_color_conversions_tester.la
+	kunittestmodrunner
+
diff --git a/chalk/chalkcolor/tests/kis_color_conversions_tester.cpp b/chalk/chalkcolor/tests/kis_color_conversions_tester.cpp
new file mode 100644
index 000000000..d244b5dd5
--- /dev/null
+++ b/chalk/chalkcolor/tests/kis_color_conversions_tester.cpp
@@ -0,0 +1,227 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "kis_color_conversions_tester.h"
+#include "kis_color_conversions.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE(kunittest_kis_color_conversions_tester, "Color Conversions Tester");
+KUNITTEST_MODULE_REGISTER_TESTER(KisColorConversionsTester);
+
+void KisColorConversionsTester::allTests()
+{
+    testRGBHSV();
+    testRGBHSL();
+}
+
+#define EPSILON 1e-6
+
+void KisColorConversionsTester::testRGBHSV()
+{
+    float r, g, b, h, s, v;
+
+    RGBToHSV(1, 0, 0, &h, &s, &v);
+    CHECK(h, 0.0f);
+    CHECK(s, 1.0f);
+    CHECK(v, 1.0f);
+
+    RGBToHSV(1, 1, 0, &h, &s, &v);
+    CHECK(h, 60.0f);
+    CHECK(s, 1.0f);
+    CHECK(v, 1.0f);
+
+    RGBToHSV(0, 1, 0, &h, &s, &v);
+    CHECK(h, 120.0f);
+    CHECK(s, 1.0f);
+    CHECK(v, 1.0f);
+
+    RGBToHSV(0, 1, 1, &h, &s, &v);
+    CHECK(h, 180.0f);
+    CHECK(s, 1.0f);
+    CHECK(v, 1.0f);
+
+    RGBToHSV(0, 0, 1, &h, &s, &v);
+    CHECK(h, 240.0f);
+    CHECK(s, 1.0f);
+    CHECK(v, 1.0f);
+
+    RGBToHSV(1, 0, 1, &h, &s, &v);
+    CHECK(h, 300.0f);
+    CHECK(s, 1.0f);
+    CHECK(v, 1.0f);
+
+    RGBToHSV(0, 0, 0, &h, &s, &v);
+    CHECK(h, -1.0f);
+    CHECK(s, 0.0f);
+    CHECK(v, 0.0f);
+
+    RGBToHSV(1, 1, 1, &h, &s, &v);
+    CHECK(h, -1.0f);
+    CHECK(s, 0.0f);
+    CHECK(v, 1.0f);
+
+    RGBToHSV(0.5, 0.25, 0.75, &h, &s, &v);
+    CHECK_TOLERANCE(h, 270.0f, EPSILON);
+    CHECK_TOLERANCE(s, 0.666667f, EPSILON);
+    CHECK_TOLERANCE(v, 0.75f, EPSILON);
+
+    HSVToRGB(0, 1, 1, &r, &g, &b);
+    CHECK(r, 1.0f);
+    CHECK(g, 0.0f);
+    CHECK(b, 0.0f);
+
+    HSVToRGB(60, 1, 1, &r, &g, &b);
+    CHECK(r, 1.0f);
+    CHECK(g, 1.0f);
+    CHECK(b, 0.0f);
+
+    HSVToRGB(120, 1, 1, &r, &g, &b);
+    CHECK(r, 0.0f);
+    CHECK(g, 1.0f);
+    CHECK(b, 0.0f);
+
+    HSVToRGB(180, 1, 1, &r, &g, &b);
+    CHECK(r, 0.0f);
+    CHECK(g, 1.0f);
+    CHECK(b, 1.0f);
+
+    HSVToRGB(240, 1, 1, &r, &g, &b);
+    CHECK(r, 0.0f);
+    CHECK(g, 0.0f);
+    CHECK(b, 1.0f);
+
+    HSVToRGB(300, 1, 1, &r, &g, &b);
+    CHECK(r, 1.0f);
+    CHECK(g, 0.0f);
+    CHECK(b, 1.0f);
+
+    HSVToRGB(-1, 0, 0, &r, &g, &b);
+    CHECK(r, 0.0f);
+    CHECK(g, 0.0f);
+    CHECK(b, 0.0f);
+
+    HSVToRGB(-1, 0, 1, &r, &g, &b);
+    CHECK(r, 1.0f);
+    CHECK(g, 1.0f);
+    CHECK(b, 1.0f);
+
+    HSVToRGB(270, 0.666667, 0.75, &r, &g, &b);
+    CHECK_TOLERANCE(r, 0.5f, EPSILON);
+    CHECK_TOLERANCE(g, 0.25f, EPSILON);
+    CHECK_TOLERANCE(b, 0.75f, EPSILON);
+}
+
+void KisColorConversionsTester::testRGBHSL()
+{
+    float r, g, b, h, s, l;
+
+    RGBToHSL(1, 0, 0, &h, &s, &l);
+    CHECK(h, 360.0f);
+    CHECK(s, 1.0f);
+    CHECK(l, 0.5f);
+
+    RGBToHSL(1, 1, 0, &h, &s, &l);
+    CHECK(h, 60.0f);
+    CHECK(s, 1.0f);
+    CHECK(l, 0.5f);
+
+    RGBToHSL(0, 1, 0, &h, &s, &l);
+    CHECK(h, 120.0f);
+    CHECK(s, 1.0f);
+    CHECK(l, 0.5f);
+
+    RGBToHSL(0, 1, 1, &h, &s, &l);
+    CHECK(h, 180.0f);
+    CHECK(s, 1.0f);
+    CHECK(l, 0.5f);
+
+    RGBToHSL(0, 0, 1, &h, &s, &l);
+    CHECK(h, 240.0f);
+    CHECK(s, 1.0f);
+    CHECK(l, 0.5f);
+
+    RGBToHSL(1, 0, 1, &h, &s, &l);
+    CHECK(h, 300.0f);
+    CHECK(s, 1.0f);
+    CHECK(l, 0.5f);
+
+    RGBToHSL(0, 0, 0, &h, &s, &l);
+    CHECK(h, -1.0f);
+    CHECK(s, 0.0f);
+    CHECK(l, 0.0f);
+
+    RGBToHSL(1, 1, 1, &h, &s, &l);
+    CHECK(h, -1.0f);
+    CHECK(s, 0.0f);
+    CHECK(l, 1.0f);
+
+    RGBToHSL(0.5, 0.25, 0.75, &h, &s, &l);
+    CHECK_TOLERANCE(h, 270.0f, EPSILON);
+    CHECK_TOLERANCE(s, 0.5f, EPSILON);
+    CHECK_TOLERANCE(l, 0.5f, EPSILON);
+
+    HSLToRGB(0, 1, 0.5, &r, &g, &b);
+    CHECK(r, 1.0f);
+    CHECK(g, 0.0f);
+    CHECK(b, 0.0f);
+
+    HSLToRGB(60, 1, 0.5, &r, &g, &b);
+    CHECK(r, 1.0f);
+    CHECK(g, 1.0f);
+    CHECK(b, 0.0f);
+
+    HSLToRGB(120, 1, 0.5, &r, &g, &b);
+    CHECK(r, 0.0f);
+    CHECK(g, 1.0f);
+    CHECK(b, 0.0f);
+
+    HSLToRGB(180, 1, 0.5, &r, &g, &b);
+    CHECK(r, 0.0f);
+    CHECK(g, 1.0f);
+    CHECK(b, 1.0f);
+
+    HSLToRGB(240, 1, 0.5, &r, &g, &b);
+    CHECK(r, 0.0f);
+    CHECK(g, 0.0f);
+    CHECK(b, 1.0f);
+
+    HSLToRGB(300, 1, 0.5, &r, &g, &b);
+    CHECK(r, 1.0f);
+    CHECK(g, 0.0f);
+    CHECK(b, 1.0f);
+
+    HSLToRGB(-1, 0, 0, &r, &g, &b);
+    CHECK(r, 0.0f);
+    CHECK(g, 0.0f);
+    CHECK(b, 0.0f);
+
+    HSLToRGB(-1, 0, 1, &r, &g, &b);
+    CHECK(r, 1.0f);
+    CHECK(g, 1.0f);
+    CHECK(b, 1.0f);
+
+    HSLToRGB(270, 0.5, 0.5, &r, &g, &b);
+    CHECK_TOLERANCE(r, 0.5f, EPSILON);
+    CHECK_TOLERANCE(g, 0.25f, EPSILON);
+    CHECK_TOLERANCE(b, 0.75f, EPSILON);
+}
+
diff --git a/chalk/chalkcolor/tests/kis_color_conversions_tester.h b/chalk/chalkcolor/tests/kis_color_conversions_tester.h
new file mode 100644
index 000000000..1223abbb7
--- /dev/null
+++ b/chalk/chalkcolor/tests/kis_color_conversions_tester.h
@@ -0,0 +1,44 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_COLOR_CONVERSIONS_TESTER_H
+#define KIS_COLOR_CONVERSIONS_TESTER_H
+
+#include <kunittest/tester.h>
+
+#define CHECK_TOLERANCE( x, y, tolerance ) \
+if ((x) <= (y) + (tolerance) && (x) >= (y) - (tolerance)) \
+{ \
+    success(TQString(__FILE__) + "[" + TQString::number(__LINE__) + "]: passed " + #x); \
+} \
+else \
+{ \
+    failure(TQString(__FILE__) + "[" + TQString::number(__LINE__) + TQString("]: failed ") + #x + "\n Expected " + #y + ", Actual result " + TQString::number(x)); \
+} \
+
+
+class KisColorConversionsTester : public KUnitTest::Tester
+{
+public:
+        void allTests();
+    void testRGBHSV();
+    void testRGBHSL();
+};
+
+#endif
+
diff --git a/chalk/chalkpart.desktop b/chalk/chalkpart.desktop
new file mode 100644
index 000000000..92aa23044
--- /dev/null
+++ b/chalk/chalkpart.desktop
@@ -0,0 +1,91 @@
+[Desktop Entry]
+Name=KOffice Painting and Image Editor Component
+Name[bg]=Компонент за рисуване и редактиране на изображения в KOffice
+Name[ca]=Component de manipulació d'imatges de KOffice
+Name[cy]=Cydran Peintio a Golygu Delweddau KOffice
+Name[da]=Koffice male- og billedredigeringskomponent
+Name[de]=KOffice-Komponente für Malen und Bildbearbeitung
+Name[el]=Συστατικό επεξεργασίας και ζωγραφικής εικόνων του KOffice
+Name[eo]=KOffice Pentrad- kaj Bildredaktad-komponanto
+Name[es]=Componente de pintura y de edición de imágenes de KOffice
+Name[et]=KOffice'i joonistamise ja pilditöötluse komponent
+Name[fa]=مؤلفۀ ویرایشگر تصویر و رنگ‌آمیزی KOffice
+Name[fi]=KOfficen maalaus- ja kuvankäsittelykomponentti
+Name[fr]=Composant manipulation d'images et dessin de KOffice
+Name[fy]=KOffice-komponint foar ôfbyldingsmanupilaasje
+Name[gl]=Componente de Debuxo e Edición de Imaxes de KOffice
+Name[he]=רכיב של KOffice לצביעה ועריכת תמונות
+Name[hu]=KOffice rajzoló és képszerkesztő komponens
+Name[is]=KOffice málunar og myndritils eining
+Name[it]=Componente per il disegno e la manipolazione di immagini di KOffice
+Name[ja]=KOffice 描画と画像編集コンポーネント
+Name[km]=សមាសភាគ​កម្មវិធី​កែ​សម្រួល​រូបភាព និង​គំនូរ​KOffice
+Name[lv]=KOffice zīmēšanas un attelu apstrādes komponente
+Name[nb]=KOffice-komponent for maling og bildemanipulasjon
+Name[nds]=KOffice-Komponent för't Malen un Bildbewerken
+Name[ne]=केडीई कार्यालय पेन्टिङ्ग र छवि सम्पादक अवयव
+Name[nl]=KOffice-component voor afbeeldingsmanipulatie
+Name[pl]=Komponent edycji zdjęć oraz rysunków dla KOffice
+Name[pt]=Componente de Edição e Pintura de Imagens do KOffice
+Name[pt_BR]=Componente de Edição e Pintura de Imagens do KOffice
+Name[ru]=Компонент рисования и редактирования изображений KOffice
+Name[sk]=KOffice modul na úpravu a maľovanie obrázkov
+Name[sl]=Komponenta za slikanje in urejanje slik za KOffice
+Name[sr]=KOffice-ова компонента за цртање и уређивање слика
+Name[sr@Latn]=KOffice-ova komponenta za crtanje i uređivanje slika
+Name[sv]=Koffice målnings- och bildredigeringskomponent
+Name[uk]=Компонент KOffice для малювання і редагування зображень
+Name[uz]=KOffice rasm bilan ishlash komponenti
+Name[uz@cyrillic]=KOffice расм билан ишлаш компоненти
+Name[zh_CN]=KOffice 绘图和图像编辑器组件
+Name[zh_TW]=KOffice 繪圖與影像編輯元件
+X-KDE-Library=libchalkpart
+MimeType=application/x-chalk
+Type=Service
+ServiceTypes=KOfficePart,KParts/ReadOnlyPart,KParts/ReadWritePart
+X-KDE-NativeMimeType=application/x-chalk
+GenericName=Image Object
+GenericName[bg]=Графично изображение
+GenericName[br]=Tra skeudenn
+GenericName[ca]=Objecte d'imatge
+GenericName[cy]=Gwrthrych Delwedd
+GenericName[da]=Billedobjekt
+GenericName[de]=Bildobjekt
+GenericName[el]=Αντικείμενο εικόνας
+GenericName[eo]=Bildobjekto
+GenericName[es]=Objeto de imagen
+GenericName[et]=Pildiobjekt
+GenericName[fa]=شیء تصویر
+GenericName[fi]=Kuvaobjekti
+GenericName[fr]=Objet image
+GenericName[fy]=Ofbylding
+GenericName[ga]=Réad Íomhá
+GenericName[gl]=Imaxe
+GenericName[he]=אובייקט תמונה
+GenericName[hu]=Képobjektum
+GenericName[is]=Myndhluti
+GenericName[it]=Oggetto immagine
+GenericName[ja]=画像オブジェクト
+GenericName[km]=វត្ថុ​រូបភាព
+GenericName[lv]=Attēla objekts
+GenericName[nb]=Bildeobjekt
+GenericName[nds]=Bildobjekt
+GenericName[ne]=छवि वस्तु
+GenericName[nl]=Afbeelding
+GenericName[pl]=Obrazek
+GenericName[pt]=Objecto de Imagem
+GenericName[pt_BR]=Imagem
+GenericName[ru]=Рисунок
+GenericName[se]=Govvaobjeakta
+GenericName[sk]=Objekt obrázok
+GenericName[sl]=Slika
+GenericName[sr]=Објект слике
+GenericName[sr@Latn]=Objekt slike
+GenericName[sv]=Bildobjekt
+GenericName[uk]=Об'єкт зображення
+GenericName[uz]=Rasm obʼekti
+GenericName[uz@cyrillic]=Расм объекти
+GenericName[zh_CN]=图像对象
+GenericName[zh_TW]=圖片物件
+Icon=chalk
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/Makefile.am b/chalk/colorspaces/Makefile.am
new file mode 100644
index 000000000..8f975e966
--- /dev/null
+++ b/chalk/colorspaces/Makefile.am
@@ -0,0 +1,15 @@
+# Definition of the service type
+
+if have_openexr
+HALF_SUBDIRS=rgb_f16half
+endif
+
+SUBDIRS = rgb_u8 rgb_u16 rgb_f32 \
+	gray_u8 gray_u16 \
+	cmyk_u8 cmyk_u16 \
+	lms_f32 \
+	ycbcr_u8 ycbcr_u16 \
+	$(HALF_SUBDIRS) \
+	wet
+#wet wetsticky
+
diff --git a/chalk/colorspaces/README b/chalk/colorspaces/README
new file mode 100644
index 000000000..dfb25f70a
--- /dev/null
+++ b/chalk/colorspaces/README
@@ -0,0 +1,11 @@
+About Modules
+
+Modules are plug-ins that implement exchangable core functionality
+for Chalk, such as colour strategies. Modules are loaded at startup
+and shared among all Chalk documents and views. That means that making
+modules stateful is iffy, and that you need to be careful about 
+re-entrancy.
+
+Modules are named modules because the plugins, which are kpartgui's
+are already called plugins. Capito? Good.
+
diff --git a/chalk/colorspaces/cmyk_u16/Makefile.am b/chalk/colorspaces/cmyk_u16/Makefile.am
new file mode 100644
index 000000000..a43d685f1
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u16/Makefile.am
@@ -0,0 +1,30 @@
+kde_services_DATA = chalk_cmyk_u16_plugin.desktop
+
+INCLUDES  =  -I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../chalkcolor/ \
+	$(KOFFICE_INCLUDES) \
+	$(all_includes)
+
+lib_LTLIBRARIES = libchalk_cmyk_u16.la
+libchalk_cmyk_u16_la_SOURCES = kis_cmyk_u16_colorspace.cc
+libchalk_cmyk_u16_la_LDFLAGS = $(all_libraries)
+libchalk_cmyk_u16_la_LIBADD =  ../../chalkcolor/libchalkcolor.la
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = chalk_cmyk_u16_plugin.la
+
+# Srcs for the plugin
+chalk_cmyk_u16_plugin_la_SOURCES = cmyk_u16_plugin.cc
+noinst_HEADERS = cmyk_u16_plugin.h kis_cmyk_u16_colorspace.h
+
+chalk_cmyk_u16_plugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms
+chalk_cmyk_u16_plugin_la_LIBADD = libchalk_cmyk_u16.la ../../chalkcolor/libchalkcolor.la
+
+chalk_cmyk_u16_plugin_la_METASOURCES = AUTO
+#METASOURCES = AUTO # XXX: which of the two?
+
+
+SUBDIRS = .
+#$(TESTSDIR)
+
diff --git a/chalk/colorspaces/cmyk_u16/chalk_cmyk_u16_plugin.desktop b/chalk/colorspaces/cmyk_u16/chalk_cmyk_u16_plugin.desktop
new file mode 100644
index 000000000..661662b03
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u16/chalk_cmyk_u16_plugin.desktop
@@ -0,0 +1,85 @@
+[Desktop Entry]
+Name=CMYK Color Model (16-bit integer)
+Name[bg]=Цветови модел CMYK (16 бита)
+Name[ca]=Model de color CMYK (enters de 16 bits)
+Name[cy]=Model Lliw CMYK (cyfanrif 16-did)
+Name[da]=CMYK-farvemodel (16-bit heltal)
+Name[de]=CMYK-Farbmodell (16-bit Ganzzahl)
+Name[el]=Χρωματικό μοντέλο CMYK (16-bit ακέραιοι)
+Name[en_GB]=CMYK Colour Model (16-bit integer)
+Name[eo]=CMYK-kolormodelo (16-bita entjero)
+Name[es]=Modelo de color CMYK (entero de 16 bits)
+Name[et]=CMYK värvimudel (16-bitine täisarv)
+Name[fa]=مدل رنگ CMYK )عدد صحیح ۱۶ بیتی(
+Name[fi]=CMYK-värimalli 
+Name[fr]=Modèle de couleurs CMYK (entiers 16 bits)
+Name[fy]=CMYK-kleurmodel (16-bit ynteger)
+Name[gl]=Modelo de Cores CMYK (inteiro de 16-bit)
+Name[he]=מודל צבעים CMYK (16 סיביות)
+Name[hu]=CMYK színmodell (16 bites egész)
+Name[is]=CMYK litategund (16-bita)
+Name[it]=Modello di colore CMYK (intero a 16 bit)
+Name[ja]=CMYK カラーモデル (16 ビット整数)
+Name[km]=គំរូ​ពណ៌ CMYK (ចំនួនគត់ ១៦ ប៊ីត)
+Name[lt]=CMYK spalvų modelis (16-bitų sveikasis)
+Name[nb]=CMYK-fargemodell (16-bit heltall)
+Name[nds]=CMYK-Klöörmodell (16-Bit Heeltall)
+Name[ne]=CMYK रङ मोडेल (१६-बिट इन्टिजर)
+Name[nl]=CMYK-kleurmodel (16-bit integer)
+Name[pl]=Przestrzeń barw CMYK (16-bitowa liczbowa całkowita)
+Name[pt]=Modelo de Cor CMYK (inteiros de 16 bits)
+Name[pt_BR]=Modelo de Cor CMYK (inteiros de 16 bits)
+Name[ru]=CMYK (целое 16-бит)
+Name[se]=CMYK-ivdnemálle (16-bihttá lohku)
+Name[sk]=CMYK model farieb (16-bitové čísla)
+Name[sl]=Barvni model CMYK (16-bitno celo število)
+Name[sr]=CMYK модел боја (16-битно целобројно)
+Name[sr@Latn]=CMYK model boja (16-bitno celobrojno)
+Name[sv]=CMYK-färgmodell (16-bitars heltal)
+Name[uk]=Модель кольору CMYK (16-бітне ціле число)
+Name[uz]=CMYK rang usuli (16-bit butun)
+Name[uz@cyrillic]=CMYK ранг усули (16-бит бутун)
+Name[zh_CN]=CMYK 色彩模型(16 位整数)
+Name[zh_TW]=CMYK 色彩模型 (16-bit 整數)
+Comment=Color model for 16-bit integer per channel CMYK images
+Comment[bg]=Цветови модел за 16 битови изображения CMYK
+Comment[ca]=Model de color d'enters de 16 bits per a canal d'imatges CMYK
+Comment[cy]=Model lliw ar gyfer delweddau CMYK â chyfanrif 16-did/sianel
+Comment[da]=Farvemodel for 16-bit heltal pr kanal CMYK-billeder
+Comment[de]=Farbmodell für 16-bit pro Kanal CMYK-Bilder
+Comment[el]=Χρωματικό μοντέλο για 16-bit ακεραίους ανά κανάλι CMYK εικόνες
+Comment[en_GB]=Colour model for 16-bit integer per channel CMYK images
+Comment[es]=Modelo de color de entero de 16 bits por canal para imágenes CMYK
+Comment[et]=16-bitiste täisarvuliste kanalitega CMYK-piltide värvimudel
+Comment[fa]=مدل رنگ برای عدد صحیح ۱۶ بیتی در هر مجرای تصاویر CMYK
+Comment[fi]=Värimalli 8-bittisille/kanavaisille CMYK-kuville 
+Comment[fr]=Modèle de couleurs pour des images CMYK à 16 bits/plage
+Comment[fy]=Kleurmodel foar 16-bit/kanaal fan CMYK-ôfbeeldings
+Comment[gl]=Modelo de Cores para imaxes CMYK de 16-bit por canal
+Comment[he]=מודל צבעים עבור תמונות CMYK של 16 סיביות/ערוצים
+Comment[hu]=Színmodell 16 bit/csatorna CMYK képekhez
+Comment[is]=Litategund fyrir 16-bita/rásir CMYK myndir
+Comment[it]=Modello di colore per immagini CMYK a canale di 16 bit
+Comment[ja]=16 ビット整数/チャンネル CMYK 画像のためのカラーモデル
+Comment[km]=គំរូ​ពណ៌​សម្រាប់​រូបភាព CMYK ចំនួនគត់ ១៦ ប៊ីត​ក្នុង​មួយ​ឆានែល
+Comment[nb]=Fargemodell for CMYK-bilder med 16 bit per kanal
+Comment[nds]=Klöörmodell för CMYK-Biller mit 16-Bit Heeltall per Kanaal
+Comment[ne]=प्रति च्यानल CMYK छविहरूको १६ बिट इन्टिजरका लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor 16-bit/kanaal van CMYK-afbeeldingen
+Comment[pl]=Przestrzeń barw dla obrazków CMYK z 16-bitowymi liczbami całkowitymi na kanał
+Comment[pt]=Modelo de cor para imagens CMYK com 16 bits por canal
+Comment[pt_BR]=Modelo de cor para imagens CMYK com 16 bits por canal
+Comment[ru]=Цветовое пространство CMYK (целое 16-бит/канал)
+Comment[se]=CMYK-ivdnemálle mas lea 16 bihttá kanálas
+Comment[sk]=Model farieb pre CMYK obrázky so 16 bitmi na kanál
+Comment[sl]=Barvni model za slike CMYK z 16 biti/kanal
+Comment[sr]=Модел боја за CMYK слике, 16-битно целобројно по каналу
+Comment[sr@Latn]=Model boja za CMYK slike, 16-bitno celobrojno po kanalu
+Comment[sv]=Färgmodell för 16-bitars heltal per kanal CMYK-bilder
+Comment[uk]=Модель кольору з 16-бітним цілим числом для кожного каналу зображень CMYK
+Comment[zh_CN]=16 位整数每通道 CYMK 图像的色彩模型
+Comment[zh_TW]=每色頻為 16-bit 的 CMYK 圖片色彩模型
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-KDE-Library=chalk_cmyk_u16_plugin
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/cmyk_u16/cmyk_u16_plugin.cc b/chalk/colorspaces/cmyk_u16/cmyk_u16_plugin.cc
new file mode 100644
index 000000000..d694133e5
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u16/cmyk_u16_plugin.cc
@@ -0,0 +1,61 @@
+/*
+* cmyk_u16_plugin.cc -- Part of Chalk
+*
+* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+*
+*  This program is free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  This program is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  You should have received a copy of the GNU General Public License
+*  along with this program; if not, write to the Free Software
+*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include <kinstance.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+
+#include <kis_debug_areas.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_basic_histogram_producers.h>
+#include <kis_debug_areas.h>
+#include "cmyk_u16_plugin.h"
+#include "kis_cmyk_u16_colorspace.h"
+
+typedef KGenericFactory<CMYKU16Plugin> CMYKU16PluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalk_cmyk_u16_plugin, CMYKU16PluginFactory( "chalk" ) )
+
+
+CMYKU16Plugin::CMYKU16Plugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(CMYKU16PluginFactory::instance());
+
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") )
+    {
+        KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( tqparent );
+
+        KisColorSpace * colorSpaceCMYKU16 = new KisCmykU16ColorSpace(f, 0);
+        KisColorSpaceFactory * csf = new KisCmykU16ColorSpaceFactory();
+        Q_CHECK_PTR(colorSpaceCMYKU16);
+        f->add(csf);
+        KisHistogramProducerFactoryRegistry::instance()->add(
+                new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
+                (KisID("CMYK16HISTO", i18n("CMYK16")), colorSpaceCMYKU16) );
+    }
+
+}
+
+CMYKU16Plugin::~CMYKU16Plugin()
+{
+}
+
+#include "cmyk_u16_plugin.moc"
diff --git a/chalk/colorspaces/cmyk_u16/cmyk_u16_plugin.h b/chalk/colorspaces/cmyk_u16/cmyk_u16_plugin.h
new file mode 100644
index 000000000..07224a141
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u16/cmyk_u16_plugin.h
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CMYK_U16_PLUGIN_H_
+#define CMYK_U16_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the CMYK U16 colour space strategy.
+ */
+class CMYKU16Plugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    CMYKU16Plugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~CMYKU16Plugin();
+
+};
+
+
+#endif // CMYK_U16_PLUGIN_H_
diff --git a/chalk/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.cc b/chalk/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.cc
new file mode 100644
index 000000000..3f2ccc809
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.cc
@@ -0,0 +1,714 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include LCMS_HEADER
+
+#include <tqimage.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include <kis_debug_areas.h>
+#include "kis_cmyk_u16_colorspace.h"
+#include "kis_u16_base_colorspace.h"
+#include "kis_color_conversions.h"
+#include "kis_integer_maths.h"
+#include "kis_colorspace_factory_registry.h"
+
+namespace {
+    const TQ_INT32 MAX_CHANNEL_CMYK = 4;
+    const TQ_INT32 MAX_CHANNEL_CMYKA = 5;
+}
+
+KisCmykU16ColorSpace::KisCmykU16ColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) :
+    KisU16BaseColorSpace(KisID("CMYKA16", i18n("CMYK (16-bit integer/channel)")), TYPE_CMYK5_16, icSigCmykData, tqparent, p)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Cyan"), i18n("C"), 0 * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16), TQt::cyan));
+    m_channels.push_back(new KisChannelInfo(i18n("Magenta"), i18n("M"), 1 * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16), TQt::magenta));
+    m_channels.push_back(new KisChannelInfo(i18n("Yellow"), i18n("Y"), 2 * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16), TQt::yellow));
+    m_channels.push_back(new KisChannelInfo(i18n("Black"), i18n("K"), 3 * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16), TQt::black));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), 4 * sizeof(TQ_UINT16), KisChannelInfo::ALPHA, KisChannelInfo::UINT16, sizeof(TQ_UINT16)));
+
+    m_alphaPos = PIXEL_ALPHA * sizeof(TQ_UINT16);
+
+    init();
+}
+
+KisCmykU16ColorSpace::~KisCmykU16ColorSpace()
+{
+}
+
+void KisCmykU16ColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    TQ_UINT32 totalCyan = 0, totalMagenta = 0, totalYellow = 0, totalBlack = 0, newAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel *pixel = reinterpret_cast<const Pixel *>(*colors);
+
+        TQ_UINT32 alpha = pixel->alpha;
+        TQ_UINT32 alphaTimesWeight = UINT16_MULT(alpha, UINT8_TO_UINT16(*weights));
+
+        totalCyan += UINT16_MULT(pixel->cyan, alphaTimesWeight);
+        totalMagenta += UINT16_MULT(pixel->magenta, alphaTimesWeight);
+        totalYellow += UINT16_MULT(pixel->yellow, alphaTimesWeight);
+        totalBlack += UINT16_MULT(pixel->black, alphaTimesWeight);
+        newAlpha += alphaTimesWeight;
+
+        weights++;
+        colors++;
+    }
+
+    Q_ASSERT(newAlpha <= U16_OPACITY_OPAQUE);
+
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->alpha = newAlpha;
+
+    if (newAlpha > 0) {
+        totalCyan = UINT16_DIVIDE(totalCyan, newAlpha);
+        totalMagenta = UINT16_DIVIDE(totalMagenta, newAlpha);
+        totalYellow = UINT16_DIVIDE(totalYellow, newAlpha);
+        totalBlack = UINT16_DIVIDE(totalBlack, newAlpha);
+    }
+
+    dstPixel->cyan = totalCyan;
+    dstPixel->magenta = totalMagenta;
+    dstPixel->yellow = totalYellow;
+    dstPixel->black = totalBlack;
+}
+
+void KisCmykU16ColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const
+{
+    TQ_INT32 totalCyan = 0, totalMagenta = 0, totalYellow = 0, totalK = 0, totalAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel * pixel = reinterpret_cast<const Pixel *>( *colors );
+
+        TQ_INT32 weight = *kernelValues;
+
+        if (weight != 0) {
+            totalCyan += pixel->cyan * weight;
+            totalMagenta += pixel->magenta * weight;
+            totalYellow += pixel->yellow * weight;
+            totalK += pixel->black * weight;
+            totalAlpha += pixel->alpha * weight;
+        }
+        colors++;
+        kernelValues++;
+    }
+
+    Pixel * p = reinterpret_cast< Pixel *>( dst );
+
+    if (channelFlags & KisChannelInfo::FLAG_COLOR) {
+        p->cyan = CLAMP( ( totalCyan / factor) + offset, 0, TQ_UINT16_MAX);
+        p->magenta = CLAMP( ( totalMagenta / factor) + offset, 0, TQ_UINT16_MAX);
+        p->yellow = CLAMP( ( totalYellow / factor) + offset, 0, TQ_UINT16_MAX);
+        p->black = CLAMP( ( totalK / factor) + offset, 0, TQ_UINT16_MAX);
+    }
+    if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+        p->alpha = CLAMP((totalAlpha/ factor) + offset, 0, TQ_UINT16_MAX);
+    }
+}
+
+
+void KisCmykU16ColorSpace::invertColor(TQ_UINT8 * src, TQ_INT32 nPixels)
+{
+    TQ_UINT32 psize = pixelSize();
+
+    while (nPixels--)
+    {
+        Pixel * p = reinterpret_cast< Pixel *>( src );
+        p->cyan = TQ_UINT16_MAX - p->cyan;
+        p->magenta = TQ_UINT16_MAX - p->magenta;
+        p->yellow = TQ_UINT16_MAX - p->yellow;
+        p->black = TQ_UINT16_MAX - p->black;
+        src += psize;
+    }
+}
+
+
+
+void KisCmykU16ColorSpace::applyAdjustment(const TQ_UINT8 *src, TQ_UINT8 *dst, KisColorAdjustment *adj, TQ_INT32 nPixels)
+{
+    TQ_UINT32 psize = pixelSize();
+    
+    TQ_UINT8 * tmp = new TQ_UINT8[nPixels * psize];
+    TQ_UINT8 * tmpPtr = tmp;
+    memcpy(tmp, dst, nPixels * psize);
+    
+    KisAbstractColorSpace::applyAdjustment(src, dst, adj, nPixels);
+
+    // Copy the alpha, which lcms doesn't do for us, grumble.
+
+    while (nPixels--)
+    {
+        TQ_UINT16 *pixelAlphaSrc = reinterpret_cast<TQ_UINT16 *>(tmpPtr + m_alphaPos);
+        TQ_UINT16 *pixelAlphaDst = reinterpret_cast<TQ_UINT16 *>(dst + m_alphaPos);
+        
+        *pixelAlphaDst= *pixelAlphaSrc;
+        
+        tmpPtr += psize;
+        dst += psize;
+    }
+
+    delete [] tmp;
+}
+
+TQValueVector<KisChannelInfo *> KisCmykU16ColorSpace::channels() const
+{
+    return m_channels;
+}
+
+TQ_UINT32 KisCmykU16ColorSpace::nChannels() const
+{
+    return MAX_CHANNEL_CMYKA;
+}
+
+TQ_UINT32 KisCmykU16ColorSpace::nColorChannels() const
+{
+    return MAX_CHANNEL_CMYK;
+}
+
+TQ_UINT32 KisCmykU16ColorSpace::pixelSize() const
+{
+    return MAX_CHANNEL_CMYKA * sizeof(TQ_UINT16);
+}
+
+void KisCmykU16ColorSpace::getSingleChannelPixel(TQ_UINT8 *dstPixel, const TQ_UINT8 *srcPixel, TQ_UINT32 channelIndex)
+{
+    if (channelIndex < (TQ_UINT32)MAX_CHANNEL_CMYKA) {
+
+        memset(dstPixel, 0, MAX_CHANNEL_CMYKA * sizeof(TQ_UINT16));
+
+        if (U16_OPACITY_TRANSPARENT != 0) {
+            dstPixel[PIXEL_ALPHA] = U16_OPACITY_TRANSPARENT;
+        }
+
+        memcpy(dstPixel + (channelIndex * sizeof(TQ_UINT16)), srcPixel + (channelIndex * sizeof(TQ_UINT16)), sizeof(TQ_UINT16));
+    }
+}
+
+void KisCmykU16ColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT16 *src = reinterpret_cast<const TQ_UINT16 *>(srcRowStart);
+        TQ_UINT16 *dst = reinterpret_cast<TQ_UINT16 *>(dstRowStart);
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            TQ_UINT16 srcAlpha = src[PIXEL_ALPHA];
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, UINT8_TO_UINT16(U8_tqmask));
+                }
+                tqmask++;
+            }
+
+            if (srcAlpha != U16_OPACITY_TRANSPARENT) {
+
+                if (opacity != U16_OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, opacity);
+                }
+
+                if (srcAlpha == U16_OPACITY_OPAQUE) {
+                    memcpy(dst, src, MAX_CHANNEL_CMYKA * sizeof(TQ_UINT16));
+                } else {
+                    TQ_UINT16 dstAlpha = dst[PIXEL_ALPHA];
+
+                    TQ_UINT16 srcBlend;
+
+                    if (dstAlpha == U16_OPACITY_OPAQUE) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        TQ_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                        dst[PIXEL_ALPHA] = newAlpha;
+
+                        if (newAlpha != 0) {
+                            srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha);
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend == U16_OPACITY_OPAQUE) {
+                        memcpy(dst, src, MAX_CHANNEL_CMYK * sizeof(TQ_UINT16));
+                    } else {
+                        dst[PIXEL_CYAN] = UINT16_BLEND(src[PIXEL_CYAN], dst[PIXEL_CYAN], srcBlend);
+                        dst[PIXEL_MAGENTA] = UINT16_BLEND(src[PIXEL_MAGENTA], dst[PIXEL_MAGENTA], srcBlend);
+                        dst[PIXEL_YELLOW] = UINT16_BLEND(src[PIXEL_YELLOW], dst[PIXEL_YELLOW], srcBlend);
+                        dst[PIXEL_BLACK] = UINT16_BLEND(src[PIXEL_BLACK], dst[PIXEL_BLACK], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_CMYKA;
+            dst += MAX_CHANNEL_CMYKA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart) {
+            tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+}
+
+#define COMMON_COMPOSITE_OP_PROLOG() \
+    while (rows > 0) { \
+    \
+        const TQ_UINT16 *src = reinterpret_cast<const TQ_UINT16 *>(srcRowStart); \
+        TQ_UINT16 *dst = reinterpret_cast<TQ_UINT16 *>(dstRowStart); \
+        TQ_INT32 columns = numColumns; \
+        const TQ_UINT8 *tqmask = tqmaskRowStart; \
+    \
+        while (columns > 0) { \
+    \
+            TQ_UINT16 srcAlpha = src[PIXEL_ALPHA]; \
+            TQ_UINT16 dstAlpha = dst[PIXEL_ALPHA]; \
+    \
+            srcAlpha = TQMIN(srcAlpha, dstAlpha); \
+    \
+            if (tqmask != 0) { \
+                TQ_UINT8 U8_tqmask = *tqmask; \
+    \
+                if (U8_tqmask != OPACITY_OPAQUE) { \
+                    srcAlpha = UINT16_MULT(srcAlpha, UINT8_TO_UINT16(U8_tqmask)); \
+                } \
+                tqmask++; \
+            } \
+    \
+            if (srcAlpha != U16_OPACITY_TRANSPARENT) { \
+    \
+                if (opacity != U16_OPACITY_OPAQUE) { \
+                    srcAlpha = UINT16_MULT(srcAlpha, opacity); \
+                } \
+    \
+                TQ_UINT16 srcBlend; \
+    \
+                if (dstAlpha == U16_OPACITY_OPAQUE) { \
+                    srcBlend = srcAlpha; \
+                } else { \
+                    TQ_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha); \
+                    dst[PIXEL_ALPHA] = newAlpha; \
+    \
+                    if (newAlpha != 0) { \
+                        srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha); \
+                    } else { \
+                        srcBlend = srcAlpha; \
+                    } \
+                }
+
+#define COMMON_COMPOSITE_OP_EPILOG() \
+            } \
+    \
+            columns--; \
+            src += MAX_CHANNEL_CMYKA; \
+            dst += MAX_CHANNEL_CMYKA; \
+        } \
+    \
+        rows--; \
+        srcRowStart += srcRowStride; \
+        dstRowStart += dstRowStride; \
+        if(tqmaskRowStart) { \
+            tqmaskRowStart += tqmaskRowStride; \
+        } \
+    }
+
+void KisCmykU16ColorSpace::compositeMultiply(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+
+        for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = UINT16_MULT(srcColor, dstColor);
+
+            dst[channel] = UINT16_BLEND(srcColor, dstColor, srcBlend);
+        }
+
+
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeDivide(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN((dstColor * (UINT16_MAX + 1u) + (srcColor / 2u)) / (1u + srcColor), UINT16_MAX);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeScreen(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = UINT16_MAX - UINT16_MULT(UINT16_MAX - dstColor, UINT16_MAX - srcColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeOverlay(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = UINT16_MULT(dstColor, dstColor + 2u * UINT16_MULT(srcColor, UINT16_MAX - dstColor));
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeDodge(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN((dstColor * (UINT16_MAX + 1u)) / (UINT16_MAX + 1u - srcColor), UINT16_MAX);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN(((UINT16_MAX - dstColor) * (UINT16_MAX + 1u)) / (srcColor + 1u), UINT16_MAX);
+            if (srcColor > UINT16_MAX - srcColor) srcColor = UINT16_MAX;
+            
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN(srcColor, dstColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeLighten(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMAX(srcColor, dstColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykU16ColorSpace::compositeErase(TQ_UINT8 *dst,
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src,
+            TQ_INT32 srcRowSize,
+            const TQ_UINT8 *srcAlphaMask,
+            TQ_INT32 tqmaskRowStride,
+            TQ_INT32 rows,
+            TQ_INT32 cols,
+            TQ_UINT16 /*opacity*/)
+{
+    while (rows-- > 0)
+    {
+        const Pixel *s = reinterpret_cast<const Pixel *>(src);
+        Pixel *d = reinterpret_cast<Pixel *>(dst);
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (TQ_INT32 i = cols; i > 0; i--, s++, d++)
+        {
+            TQ_UINT16 srcAlpha = s->alpha;
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_BLEND(srcAlpha, U16_OPACITY_OPAQUE, UINT8_TO_UINT16(U8_tqmask));
+                }
+                tqmask++;
+            }
+            d->alpha = UINT16_MULT(srcAlpha, d->alpha);
+        }
+
+        dst += dstRowSize;
+        src += srcRowSize;
+        if(srcAlphaMask) {
+            srcAlphaMask += tqmaskRowStride;
+        }
+    }
+}
+
+
+void KisCmykU16ColorSpace::bitBlt(TQ_UINT8 *dst,
+                      TQ_INT32 dstRowStride,
+                      const TQ_UINT8 *src,
+                      TQ_INT32 srcRowStride,
+                      const TQ_UINT8 *tqmask,
+                      TQ_INT32 tqmaskRowStride,
+                      TQ_UINT8 U8_opacity,
+                      TQ_INT32 rows,
+                      TQ_INT32 cols,
+                      const KisCompositeOp& op)
+{
+    TQ_UINT16 opacity = UINT8_TO_UINT16(U8_opacity);
+
+    switch (op.op()) {
+    case COMPOSITE_UNDEF:
+        // Undefined == no composition
+        break;
+    case COMPOSITE_OVER:
+        compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_IN:
+        //compositeIn(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+    case COMPOSITE_OUT:
+        //compositeOut(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ATOP:
+        //compositeAtop(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_XOR:
+        //compositeXor(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_PLUS:
+        //compositePlus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MINUS:
+        //compositeMinus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ADD:
+        //compositeAdd(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SUBTRACT:
+        //compositeSubtract(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIFF:
+        //compositeDiff(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MULT:
+        compositeMultiply(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIVIDE:
+        compositeDivide(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BUMPMAP:
+        //compositeBumpmap(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY:
+        compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, U8_opacity);
+        break;
+    case COMPOSITE_COPY_CYAN:
+        //compositeCopyCyan(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_MAGENTA:
+        //compositeCopyMagenta(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_YELLOW:
+        //compositeCopyYellow(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_OPACITY:
+        //compositeCopyOpacity(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_CLEAR:
+        //compositeClear(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISSOLVE:
+        //compositeDissolve(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISPLACE:
+        //compositeDisplace(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#if 0
+    case COMPOSITE_MODULATE:
+        compositeModulate(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_THRESHOLD:
+        compositeThreshold(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#endif
+    case COMPOSITE_NO:
+        // No composition.
+        break;
+    case COMPOSITE_DARKEN:
+        compositeDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LIGHTEN:
+        compositeLighten(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_HUE:
+        //compositeHue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SATURATION:
+        //compositeSaturation(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_VALUE:
+        //compositeValue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLOR:
+        //compositeColor(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLORIZE:
+        //compositeColorize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LUMINIZE:
+        //compositeLuminize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SCREEN:
+        compositeScreen(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_OVERLAY:
+        compositeOverlay(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ERASE:
+        compositeErase(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DODGE:
+        compositeDodge(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BURN:
+        compositeBurn(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ALPHA_DARKEN:
+        abstractCompositeAlphaDarken<TQ_UINT16, U16Mult, Uint8ToU16, U16OpacityTest,
+                                     PIXEL_ALPHA, MAX_CHANNEL_CMYK, MAX_CHANNEL_CMYKA>(
+                dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride,
+                rows, cols, opacity, U16Mult(), Uint8ToU16(), U16OpacityTest());
+            break;
+    default:
+        break;
+    }
+}
+
+KisCompositeOpList KisCmykU16ColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    list.append(KisCompositeOp(COMPOSITE_ALPHA_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_MULT));
+    list.append(KisCompositeOp(COMPOSITE_BURN));
+    list.append(KisCompositeOp(COMPOSITE_DODGE));
+    list.append(KisCompositeOp(COMPOSITE_DIVIDE));
+    list.append(KisCompositeOp(COMPOSITE_SCREEN));
+    list.append(KisCompositeOp(COMPOSITE_OVERLAY));
+    list.append(KisCompositeOp(COMPOSITE_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_LIGHTEN));
+
+    return list;
+}
diff --git a/chalk/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.h b/chalk/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.h
new file mode 100644
index 000000000..8e43cd1cd
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u16/kis_cmyk_u16_colorspace.h
@@ -0,0 +1,123 @@
+/*
+ *  Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_STRATEGY_COLORSPACE_CMYK_U16_H_
+#define KIS_STRATEGY_COLORSPACE_CMYK_U16_H_
+
+#include <tqcolor.h>
+
+#include <koffice_export.h>
+
+#include "kis_global.h"
+#include "kis_u16_base_colorspace.h"
+#include "kis_integer_maths.h"
+
+
+class KRITATOOL_EXPORT KisCmykU16ColorSpace : public KisU16BaseColorSpace {
+public:
+
+    struct Pixel {
+        TQ_UINT16 cyan;
+        TQ_UINT16 magenta;
+        TQ_UINT16 yellow;
+        TQ_UINT16 black;
+        TQ_UINT16 alpha;
+    };
+
+public:
+    KisCmykU16ColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p);
+    virtual ~KisCmykU16ColorSpace();
+
+    virtual bool willDegrade(ColorSpaceIndependence independence)
+        {
+            if (independence == TO_RGBA8)
+                return true;
+            else
+                return false;
+        };
+
+public:
+
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const;
+    virtual TQ_UINT32 nColorChannels() const;
+    virtual TQ_UINT32 pixelSize() const;
+    
+    virtual void applyAdjustment(const TQ_UINT8 *src, TQ_UINT8 *dst, KisColorAdjustment *adj, TQ_INT32 nPixels);
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
+    virtual void getSingleChannelPixel(TQ_UINT8 *dstPixel, const TQ_UINT8 *srcPixel, TQ_UINT32 channelIndex);
+
+    virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+protected:
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dstRowStride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeMultiply(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDivide(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeScreen(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeOverlay(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDodge(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeBurn(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeLighten(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+
+private:
+    friend class KisCmykU16ColorSpaceTester;
+
+    static const TQ_UINT8 PIXEL_CYAN = 0;
+    static const TQ_UINT8 PIXEL_MAGENTA = 1;
+    static const TQ_UINT8 PIXEL_YELLOW = 2;
+    static const TQ_UINT8 PIXEL_BLACK = 3;
+    static const TQ_UINT8 PIXEL_ALPHA = 4;
+};
+
+class KisCmykU16ColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const { return KisID("CMYKA16", i18n("CMYK (16-bit integer/channel)")); };
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() { return TYPE_CMYK5_16; };
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return icSigCmykData; };
+
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisCmykU16ColorSpace(tqparent, p); };
+
+    virtual TQString defaultProfile() { return "Offset printing, according to ISO/DIS 12647-2:2004, OFCOM, paper type 1 or 2 = coated art, 115 g/m2, screen ruling 60 cm-1, positive-acting plates"; };
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_CMYK_U16_H_
diff --git a/chalk/colorspaces/cmyk_u8/Makefile.am b/chalk/colorspaces/cmyk_u8/Makefile.am
new file mode 100644
index 000000000..623add37d
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u8/Makefile.am
@@ -0,0 +1,20 @@
+kde_services_DATA = chalkcmykplugin.desktop
+
+INCLUDES  = -I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor/color_strategy \
+	-I$(srcdir)/../../chalkcolor \
+	$(KOFFICE_INCLUDES) \
+	$(all_includes)
+
+kde_module_LTLIBRARIES = chalkcmykplugin.la
+
+chalkcmykplugin_la_SOURCES = cmyk_plugin.cc kis_cmyk_colorspace.cc
+noinst_HEADERS = cmyk_plugin.h kis_cmyk_colorspace.h 
+
+chalkcmykplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms
+chalkcmykplugin_la_LIBADD =  ../../chalkcolor/libchalkcolor.la
+
+chalkcmykplugin_la_METASOURCES = AUTO
+
+
+SUBDIRS=templates
diff --git a/chalk/colorspaces/cmyk_u8/chalkcmykplugin.desktop b/chalk/colorspaces/cmyk_u8/chalkcmykplugin.desktop
new file mode 100644
index 000000000..d01baeb3c
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u8/chalkcmykplugin.desktop
@@ -0,0 +1,99 @@
+[Desktop Entry]
+Name=CMYK Color Model
+Name[bg]=Цветови модел CMYK
+Name[br]=Gobari al livioù CMYK
+Name[ca]=Model de color CMYK
+Name[cy]=Model Lliw CMYK
+Name[da]=CMYK-farvemodel
+Name[de]=CMYK-Farbmodell
+Name[el]=Χρωματικό μοντέλο CMYK
+Name[en_GB]=CMYK Colour Model
+Name[eo]=CMYK-kolormodelo
+Name[es]=Modelo de color CMYK
+Name[et]=CMYK värvimudel
+Name[eu]=CMYK kolore-eredua
+Name[fa]=مدل رنگ CMYK
+Name[fi]=CMYK-värimalli
+Name[fr]=Modèle de couleurs CMYK
+Name[fy]=CMYK kleur-model
+Name[gl]=Modelo de Cores CMYK
+Name[he]=מודל צבעים CMYK
+Name[hi]=सीएमवायके रंग नमूना
+Name[hu]=CMYK színmodell
+Name[is]=CMYK litategund
+Name[it]=Modello di colore CMYK
+Name[ja]=CMYK カラーモデル
+Name[km]=គំរូពណ៌ CMYK
+Name[lt]=CMYK spalvų modelis
+Name[ms]=Model Warna CMYK
+Name[nb]=CMYK-fargemodell
+Name[nds]=CMYK-Klöörmodell
+Name[ne]=CMYK रङ मोडेलल
+Name[nl]=CMYK-kleurmodel
+Name[nn]=CMYK-fargemodell
+Name[pl]=Przestrzeń barw CMYK
+Name[pt]=Modelo de Cor CMYK
+Name[pt_BR]=Modelo de Cor CMYK
+Name[ru]=CMYK
+Name[se]=CMYK-ivdnemálle
+Name[sk]=Model farieb CMYK
+Name[sl]=Barvni model CMYK
+Name[sr]=CMYK модел боја
+Name[sr@Latn]=CMYK model boja
+Name[sv]=CMYK-färgmodell
+Name[ta]=CMYK வண்ண முறை
+Name[tr]=CMYK Renk Modeli
+Name[uk]=Модель кольору CMYK
+Name[uz]=CMYK rang usuli
+Name[uz@cyrillic]=CMYK ранг усули
+Name[zh_CN]=CMYK 色彩模型
+Name[zh_TW]=CMYK 色彩模型
+Comment=Color model for 8-bit/channel CMYK images
+Comment[bg]=Цветови модел за 8 битови изображения CMYK
+Comment[ca]=Model de color d'enters de 8 bits per a canal d'imatges CMYK
+Comment[cy]=Model lliw ar gyfer delweddau CMYK 8-did/sianel
+Comment[da]=Farvemodel for 8-bit/kanal CMYK-billeder
+Comment[de]=Farbmodell für 8-bit pro Kanal CMYK-Bilder
+Comment[el]=Χρωματικό μοντέλο για 8-bit/κανάλι CMYK εικόνες
+Comment[en_GB]=Colour model for 8-bit/channel CMYK images
+Comment[es]=Modelo de color para imágenes de 8 bits/canal CMYK
+Comment[et]=8-bitiste kanalitega CMYK-piltide värvimudel
+Comment[eu]=8 bit/kanaleko CMYK irudien kolore-eredua
+Comment[fa]=مدل رنگ برای تصاویر CMYK مجرا/۸ بیتی
+Comment[fi]=Värimalli 8-bittisille/kanavaisille CMYK-kuville
+Comment[fr]=Modèle de couleurs pour des images CMYK à 8 bits/plage
+Comment[fy]=Kleurmodel foar 8-bit/kanaal CMYK-ôfbeeldings
+Comment[gl]=Modelo de Cores para imaxer CMYK de 8-bit/canal
+Comment[he]=מודל צבעים עבור תמונות CMYK של 8 סיביות/ערוצים
+Comment[hi]=8-बिट/चैनल सीएमवायके छवियों के लिए रंग नमूना
+Comment[hu]=Színmodell 8 bit/csatorna CMYK képekhez
+Comment[is]=Litategund fyrir 8-bita/rásir CMYK myndir
+Comment[it]=Modello di colore per immagini CMYK a canale di 8 bit
+Comment[ja]=8 ビット/チャンネル CMYK 画像のためのカラーモデル
+Comment[km]=គំរូពណ៌សម្រាប់​រូបភាព CMYK ៨ ប៊ីត​ក្នុង​មួយ​ឆានែល
+Comment[ms]=Model warna bagi imej CMYK 8-bit/saluran
+Comment[nb]=Fargemodell for CMYK-bilder med 8 bit per kanal
+Comment[nds]=Klöörmodell för CMYK-Biller mit 8-Bit Heeltall per Kanaal
+Comment[ne]=८-बिट/च्यानल CMYK छविहरूका लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor 8-bit/kanaal CMYK-afbeeldingen
+Comment[nn]=Fargemodell for CMYK-bilete med 8 bit per kanal
+Comment[pl]=Przestrzeń barw dla obrazków CMYK 8 bitów/kanał
+Comment[pt]=Modelo de cor para imagens CMYK com 8 bits por canal
+Comment[pt_BR]=Modelo de cor para imagens com 8-bits de canal CMYK
+Comment[ru]=Цветовое пространство CMYK (8-бит/канал)
+Comment[se]=CMYK-ivdnemálle mas lea 8 bihttá kanálas
+Comment[sk]=Model farieb pre CMYK obrázky s 8 bitmi na kanál
+Comment[sl]=Barvni model za slike CMYK z 8 biti/kanal
+Comment[sr]=Модел боја за CMYK слике са 8 битова по каналу
+Comment[sr@Latn]=Model boja za CMYK slike sa 8 bitova po kanalu
+Comment[sv]=Färgmodell för 8 bitar/kanal CMYK-bilder
+Comment[ta]=8/பிட்/வழி CMYK பிம்பங்களுக்கான வண்ண முறை
+Comment[tr]=8-bit/kanal CMYK görüntüler için renk modeli
+Comment[uk]=Модель кольору CMYK для зображень 8-біт/каналів
+Comment[zh_CN]=八位/通道 CMYK 图像的色彩模型
+Comment[zh_TW]=8-bit/色頻的 CMYK 圖片色彩模型
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-KDE-Library=chalkcmykplugin
+X-Chalk-Version=2
+
diff --git a/chalk/colorspaces/cmyk_u8/cmyk_plugin.cc b/chalk/colorspaces/cmyk_u8/cmyk_plugin.cc
new file mode 100644
index 000000000..686a22bfa
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u8/cmyk_plugin.cc
@@ -0,0 +1,66 @@
+/*
+ * cmyk_plugin.cc -- Part of Chalk
+ *
+ * Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kinstance.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <ktempfile.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+
+#include <kis_debug_areas.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_basic_histogram_producers.h>
+
+#include "cmyk_plugin.h"
+
+#include "kis_cmyk_colorspace.h"
+
+typedef KGenericFactory<CMYKPlugin> CMYKPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalkcmykplugin, CMYKPluginFactory( "chalk" ) )
+
+
+CMYKPlugin::CMYKPlugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(CMYKPluginFactory::instance());
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") )
+    {
+        KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( tqparent );
+
+        KisColorSpace * colorSpaceCMYK = new KisCmykColorSpace(f, 0);
+        KisColorSpaceFactory * csf = new KisCmykColorSpaceFactory();
+        Q_CHECK_PTR(colorSpaceCMYK);
+        f->add(csf);
+
+        KisHistogramProducerFactoryRegistry::instance()->add(
+                new KisBasicHistogramProducerFactory<KisBasicU8HistogramProducer>
+                (KisID("CMYKHISTO", i18n("CMYK")), colorSpaceCMYK) );
+    }
+
+}
+
+CMYKPlugin::~CMYKPlugin()
+{
+}
+
+#include "cmyk_plugin.moc"
diff --git a/chalk/colorspaces/cmyk_u8/cmyk_plugin.h b/chalk/colorspaces/cmyk_u8/cmyk_plugin.h
new file mode 100644
index 000000000..073a5e613
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u8/cmyk_plugin.h
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CMYK_PLUGIN_H_
+#define CMYK_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the CMYK colour space strategy.
+ */
+class CMYKPlugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    CMYKPlugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~CMYKPlugin();
+
+
+};
+
+#endif // CMYK_PLUGIN_H_
diff --git a/chalk/colorspaces/cmyk_u8/cmykplugin.rc b/chalk/colorspaces/cmyk_u8/cmykplugin.rc
new file mode 100644
index 000000000..bb7f63168
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u8/cmykplugin.rc
@@ -0,0 +1,7 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui library="chalkcmykplugin" version="1">
+<Menu name="Image"><text>&amp;Image</text>
+    <Menu name="Mode"><text>&amp;Mode</text>
+            <Action name="convert to RGB(A)"/>
+    </Menu>
+</Menu></kpartgui>
diff --git a/chalk/colorspaces/cmyk_u8/composite.h b/chalk/colorspaces/cmyk_u8/composite.h
new file mode 100644
index 000000000..4914a7dfa
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u8/composite.h
@@ -0,0 +1,76 @@
+/*
+ *  Copyright (c) 2006 Boudewijn Rempt
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+ 
+#ifndef COMPOSITE_CMYK
+#define COMPOSITE_CMYK
+
+void compositeCopyCyan(TQ_INT32 stride,
+               TQ_UINT8 *dst, 
+               TQ_INT32 dststride,
+               TQ_UINT8 *src, 
+               TQ_INT32 srcstride,
+               TQ_INT32 rows, 
+               TQ_INT32 cols, 
+               TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    compositeCopyChannel(PIXEL_CYAN, stride, dst, dststride, src, srcstride, rows, cols, opacity);
+}
+
+
+void compositeCopyMagenta(TQ_INT32 stride,
+              TQ_UINT8 *dst, 
+              TQ_INT32 dststride,
+              TQ_UINT8 *src, 
+              TQ_INT32 srcstride,
+              TQ_INT32 rows, 
+              TQ_INT32 cols, 
+              TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    compositeCopyChannel(PIXEL_MAGENTA, stride, dst, dststride, src, srcstride, rows, cols, opacity);
+
+}
+
+
+void compositeCopyYellow(TQ_INT32 stride,
+             TQ_UINT8 *dst, 
+             TQ_INT32 dststride,
+             TQ_UINT8 *src, 
+             TQ_INT32 srcstride,
+             TQ_INT32 rows, 
+             TQ_INT32 cols, 
+             TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    compositeCopyChannel(PIXEL_YELLOW, stride, dst, dststride, src, srcstride, rows, cols, opacity);
+
+}
+
+
+void compositeCopyBlack(TQ_INT32 stride,
+            TQ_UINT8 *dst, 
+            TQ_INT32 dststride,
+            TQ_UINT8 *src, 
+            TQ_INT32 srcstride,
+            TQ_INT32 rows, 
+            TQ_INT32 cols, 
+            TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    compositeCopyChannel(PIXEL_BLACK, stride, dst, dststride, src, srcstride, rows, cols, opacity);
+}
+
+
+#endif
\ No newline at end of file
diff --git a/chalk/colorspaces/cmyk_u8/kis_cmyk_colorspace.cc b/chalk/colorspaces/cmyk_u8/kis_cmyk_colorspace.cc
new file mode 100644
index 000000000..49256c261
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u8/kis_cmyk_colorspace.cc
@@ -0,0 +1,710 @@
+/*
+ *  Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can CYANistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <limits.h>
+#include <stdlib.h>
+#include <config.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_cmyk_colorspace.h"
+#include "kis_u8_base_colorspace.h"
+#include "kis_colorspace_factory_registry.h"
+
+#include "kis_profile.h"
+#include "kis_integer_maths.h"
+
+namespace cmyk {
+    const TQ_INT32 MAX_CHANNEL_CMYK = 4;
+    const TQ_INT32 MAX_CHANNEL_CMYKA = 5;
+}
+
+KisCmykColorSpace::KisCmykColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) :
+    KisU8BaseColorSpace(KisID("CMYK", i18n("CMYK")), TYPE_CMYK5_8, icSigCmykData, tqparent, p)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Cyan"), i18n("C"), 0, KisChannelInfo::COLOR, KisChannelInfo::UINT8, 1, TQt::cyan));
+    m_channels.push_back(new KisChannelInfo(i18n("Magenta"), i18n("M"), 1, KisChannelInfo::COLOR, KisChannelInfo::UINT8, 1, TQt::magenta));
+    m_channels.push_back(new KisChannelInfo(i18n("Yellow"), i18n("Y"), 2, KisChannelInfo::COLOR, KisChannelInfo::UINT8, 1, TQt::yellow));
+    m_channels.push_back(new KisChannelInfo(i18n("Black"), i18n("K"), 3, KisChannelInfo::COLOR, KisChannelInfo::UINT8, 1, TQt::black));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), 4, KisChannelInfo::ALPHA, KisChannelInfo::UINT8, 1, TQt::white));
+
+    m_alphaPos = PIXEL_CMYK_ALPHA;
+
+    init();
+}
+
+KisCmykColorSpace::~KisCmykColorSpace()
+{
+}
+
+void KisCmykColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    TQ_UINT32 totalCyan = 0, totalMagenta = 0, totalYellow = 0, totalK = 0, totalAlpha = 0;
+
+    while (nColors--)
+    {
+        TQ_UINT32 alpha = (*colors)[4];
+        TQ_UINT32 alphaTimesWeight = alpha * *weights;
+
+        totalCyan += (*colors)[0] * alphaTimesWeight;
+        totalMagenta += (*colors)[1] * alphaTimesWeight;
+        totalYellow += (*colors)[2] * alphaTimesWeight;
+        totalK += (*colors)[3] * alphaTimesWeight;
+        totalAlpha += alphaTimesWeight;
+
+        weights++;
+        colors++;
+    }
+
+    //Q_ASSERT(newAlpha <= 255*255);
+    if (totalAlpha > 255*255) totalAlpha = 255*255;
+
+    // Divide by 255.
+    dst[4] =(((totalAlpha + 0x80)>>8)+totalAlpha) >>8;
+
+    if (totalAlpha > 0) {
+        totalCyan = totalCyan / totalAlpha;
+        totalMagenta = totalMagenta / totalAlpha;
+        totalYellow = totalYellow / totalAlpha;
+        totalK = totalK / totalAlpha;
+    } // else the values are already 0 too
+
+    TQ_UINT32 dstCyan = totalCyan;
+    if (dstCyan > 255) dstCyan = 255;
+    dst[0] = dstCyan;
+
+    TQ_UINT32 dstMagenta = totalMagenta;
+    if (dstMagenta > 255) dstMagenta = 255;
+    dst[1] = dstMagenta;
+
+    TQ_UINT32 dstYellow = totalYellow;
+    if (dstYellow > 255) dstYellow = 255;
+    dst[2] = dstYellow;
+
+    TQ_UINT32 dstK = totalK;
+    if (dstK > 255) dstK = 255;
+    dst[3] = dstK;
+}
+
+
+void KisCmykColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const
+{
+    TQ_INT32 totalCyan = 0, totalMagenta = 0, totalYellow = 0, totalK = 0, totalAlpha = 0;
+
+    while (nColors--)
+    {
+        TQ_INT32 weight = *kernelValues;
+
+        if (weight != 0) {
+            totalCyan += (*colors)[PIXEL_CYAN] * weight;
+            totalMagenta += (*colors)[PIXEL_MAGENTA] * weight;
+            totalYellow += (*colors)[PIXEL_YELLOW] * weight;
+            totalK += (*colors)[PIXEL_BLACK] * weight;
+            totalAlpha += (*colors)[PIXEL_CMYK_ALPHA] * weight;
+        }
+        colors++;
+        kernelValues++;
+    }
+
+
+    if (channelFlags & KisChannelInfo::FLAG_COLOR) {
+        dst[PIXEL_CYAN] = CLAMP((totalCyan / factor) + offset, 0, TQ_UINT8_MAX);
+        dst[PIXEL_MAGENTA] = CLAMP((totalMagenta / factor) + offset, 0, TQ_UINT8_MAX);
+        dst[PIXEL_YELLOW] =  CLAMP((totalYellow / factor) + offset, 0, TQ_UINT8_MAX);
+        dst[PIXEL_BLACK] =  CLAMP((totalK / factor) + offset, 0, TQ_UINT8_MAX);
+    }
+    if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+        dst[PIXEL_CMYK_ALPHA] = CLAMP((totalAlpha/ factor) + offset, 0, TQ_UINT8_MAX);
+    }
+}
+
+
+void KisCmykColorSpace::invertColor(TQ_UINT8 * src, TQ_INT32 nPixels)
+{
+    TQ_UINT32 psize = pixelSize();
+
+    while (nPixels--)
+    {
+        src[PIXEL_CYAN] = TQ_UINT8_MAX - src[PIXEL_CYAN];
+        src[PIXEL_MAGENTA] = TQ_UINT8_MAX - src[PIXEL_MAGENTA];
+        src[PIXEL_YELLOW] = TQ_UINT8_MAX - src[PIXEL_YELLOW];
+        src[PIXEL_BLACK] = TQ_UINT8_MAX - src[PIXEL_BLACK];
+        src += psize;
+    }
+}
+
+void KisCmykColorSpace::applyAdjustment(const TQ_UINT8 *src, TQ_UINT8 *dst, KisColorAdjustment *adj, TQ_INT32 nPixels)
+{
+    TQ_UINT32 psize = pixelSize();
+
+    TQ_UINT8 * tmp = new TQ_UINT8[nPixels * psize];
+    TQ_UINT8 * tmpPtr = tmp;
+    memcpy(tmp, dst, nPixels * psize);
+
+    KisAbstractColorSpace::applyAdjustment(src, dst, adj, nPixels);
+
+    // Copy the alpha, which lcms doesn't do for us, grumble.
+
+    while (nPixels--)
+    {
+        dst[4] = tmpPtr[4];
+
+        tmpPtr += psize;
+        dst += psize;
+    }
+
+    delete [] tmp;
+}
+
+TQValueVector<KisChannelInfo *> KisCmykColorSpace::channels() const
+{
+    return m_channels;
+}
+
+TQ_UINT32 KisCmykColorSpace::nChannels() const
+{
+    return cmyk::MAX_CHANNEL_CMYKA;
+}
+
+TQ_UINT32 KisCmykColorSpace::nColorChannels() const
+{
+    return cmyk::MAX_CHANNEL_CMYK;
+}
+
+TQ_UINT32 KisCmykColorSpace::pixelSize() const
+{
+    return cmyk::MAX_CHANNEL_CMYKA;
+}
+
+void KisCmykColorSpace::getSingleChannelPixel(TQ_UINT8 *dstPixel, const TQ_UINT8 *srcPixel, TQ_UINT32 channelIndex)
+{
+    if (channelIndex < (TQ_UINT32)cmyk::MAX_CHANNEL_CMYKA) {
+
+        memset(dstPixel, 0, cmyk::MAX_CHANNEL_CMYKA * sizeof(TQ_UINT8));
+
+        if (OPACITY_TRANSPARENT != 0) {
+            dstPixel[PIXEL_CMYK_ALPHA] = OPACITY_TRANSPARENT;
+        }
+
+        memcpy(dstPixel + (channelIndex * sizeof(TQ_UINT8)), srcPixel + (channelIndex * sizeof(TQ_UINT8)), sizeof(TQ_UINT8));
+    }
+}
+
+void KisCmykColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_CMYK_ALPHA];
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(srcAlpha, U8_tqmask);
+                }
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(srcAlpha, opacity);
+                }
+
+                if (srcAlpha == OPACITY_OPAQUE) {
+                    memcpy(dst, src, cmyk::MAX_CHANNEL_CMYKA * sizeof(TQ_UINT8));
+                } else {
+                    TQ_UINT8 dstAlpha = dst[PIXEL_CMYK_ALPHA];
+
+                    TQ_UINT8 srcBlend;
+
+                    if (dstAlpha == OPACITY_OPAQUE) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                        dst[PIXEL_CMYK_ALPHA] = newAlpha;
+
+                        if (newAlpha != 0) {
+                            srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend == OPACITY_OPAQUE) {
+                        memcpy(dst, src, cmyk::MAX_CHANNEL_CMYK * sizeof(TQ_UINT8));
+                    } else {
+                        dst[PIXEL_CYAN] = UINT8_BLEND(src[PIXEL_CYAN], dst[PIXEL_CYAN], srcBlend);
+                        dst[PIXEL_MAGENTA] = UINT8_BLEND(src[PIXEL_MAGENTA], dst[PIXEL_MAGENTA], srcBlend);
+                        dst[PIXEL_YELLOW] = UINT8_BLEND(src[PIXEL_YELLOW], dst[PIXEL_YELLOW], srcBlend);
+                        dst[PIXEL_BLACK] = UINT8_BLEND(src[PIXEL_BLACK], dst[PIXEL_BLACK], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += cmyk::MAX_CHANNEL_CMYKA;
+            dst += cmyk::MAX_CHANNEL_CMYKA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart) {
+            tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+}
+
+#define COMMON_COMPOSITE_OP_PROLOG() \
+    while (rows > 0) { \
+    \
+        const TQ_UINT8 *src = srcRowStart; \
+        TQ_UINT8 *dst = dstRowStart; \
+        TQ_INT32 columns = numColumns; \
+        const TQ_UINT8 *tqmask = tqmaskRowStart; \
+    \
+        while (columns > 0) { \
+    \
+            TQ_UINT8 srcAlpha = src[PIXEL_CMYK_ALPHA]; \
+            TQ_UINT8 dstAlpha = dst[PIXEL_CMYK_ALPHA]; \
+    \
+            srcAlpha = TQMIN(srcAlpha, dstAlpha); \
+    \
+            if (tqmask != 0) { \
+                TQ_UINT8 U8_tqmask = *tqmask; \
+    \
+                if (U8_tqmask != OPACITY_OPAQUE) { \
+                    srcAlpha = UINT8_MULT(srcAlpha, U8_tqmask); \
+} \
+                tqmask++; \
+} \
+    \
+            if (srcAlpha != OPACITY_TRANSPARENT) { \
+    \
+                if (opacity != OPACITY_OPAQUE) { \
+                    srcAlpha = UINT8_MULT(srcAlpha, opacity); \
+} \
+    \
+                TQ_UINT8 srcBlend; \
+    \
+                if (dstAlpha == OPACITY_OPAQUE) { \
+                    srcBlend = srcAlpha; \
+} else { \
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha); \
+                    dst[PIXEL_CMYK_ALPHA] = newAlpha; \
+    \
+                    if (newAlpha != 0) { \
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha); \
+} else { \
+                        srcBlend = srcAlpha; \
+} \
+}
+
+#define COMMON_COMPOSITE_OP_EPILOG() \
+} \
+    \
+            columns--; \
+            src += cmyk::MAX_CHANNEL_CMYKA; \
+            dst += cmyk::MAX_CHANNEL_CMYKA; \
+} \
+    \
+        rows--; \
+        srcRowStart += srcRowStride; \
+        dstRowStart += dstRowStride; \
+        if(tqmaskRowStart) { \
+            tqmaskRowStart += tqmaskRowStride; \
+} \
+}
+
+void KisCmykColorSpace::compositeMultiply(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+
+        for (int channel = 0; channel < cmyk::MAX_CHANNEL_CMYK; channel++) {
+            TQ_UINT8 srcColor = src[channel];
+            TQ_UINT8 dstColor = dst[channel];
+
+            srcColor = UINT8_MULT(srcColor, dstColor);
+
+            dst[channel] = UINT8_BLEND(srcColor, dstColor, srcBlend);
+        }
+
+
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykColorSpace::compositeDivide(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < cmyk::MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT8 srcColor = src[channel];
+            TQ_UINT8 dstColor = dst[channel];
+
+            srcColor = TQMIN((dstColor * (UINT8_MAX + 1u) + (srcColor / 2u)) / (1u + srcColor), UINT8_MAX);
+
+            TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykColorSpace::compositeScreen(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < cmyk::MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT8 srcColor = src[channel];
+            TQ_UINT8 dstColor = dst[channel];
+
+            srcColor = UINT8_MAX - UINT8_MULT(UINT8_MAX - dstColor, UINT8_MAX - srcColor);
+
+            TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykColorSpace::compositeOverlay(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < cmyk::MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT8 srcColor = src[channel];
+            TQ_UINT8 dstColor = dst[channel];
+
+            srcColor = UINT8_MULT(dstColor, dstColor + 2u * UINT8_MULT(srcColor, UINT8_MAX - dstColor));
+
+            TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykColorSpace::compositeDodge(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < cmyk::MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT8 srcColor = src[channel];
+            TQ_UINT8 dstColor = dst[channel];
+
+            srcColor = TQMIN((dstColor * (UINT8_MAX + 1u)) / (UINT8_MAX + 1u - srcColor), UINT8_MAX);
+
+            TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < cmyk::MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT8 srcColor = src[channel];
+            TQ_UINT8 dstColor = dst[channel];
+
+            srcColor = TQMIN(((UINT8_MAX - dstColor) * (UINT8_MAX + 1u)) / (srcColor + 1u), UINT8_MAX);
+            if (srcColor > UINT8_MAX - srcColor) srcColor = UINT8_MAX;
+            
+            TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykColorSpace::compositeDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < cmyk::MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT8 srcColor = src[channel];
+            TQ_UINT8 dstColor = dst[channel];
+
+            srcColor = TQMIN(srcColor, dstColor);
+
+            TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykColorSpace::compositeLighten(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < cmyk::MAX_CHANNEL_CMYK; channel++) {
+
+            TQ_UINT8 srcColor = src[channel];
+            TQ_UINT8 dstColor = dst[channel];
+
+            srcColor = TQMAX(srcColor, dstColor);
+
+            TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisCmykColorSpace::compositeErase(TQ_UINT8 *dst,
+                                          TQ_INT32 dstRowSize,
+                                          const TQ_UINT8 *src,
+                                          TQ_INT32 srcRowSize,
+                                          const TQ_UINT8 *srcAlphaMask,
+                                          TQ_INT32 tqmaskRowStride,
+                                          TQ_INT32 rows,
+                                          TQ_INT32 cols,
+                                          TQ_UINT8 /*opacity*/)
+{
+    while (rows-- > 0)
+    {
+        const Pixel *s = reinterpret_cast<const Pixel *>(src);
+        Pixel *d = reinterpret_cast<Pixel *>(dst);
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (TQ_INT32 i = cols; i > 0; i--, s++, d++)
+        {
+            TQ_UINT8 srcAlpha = s->alpha;
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_BLEND(srcAlpha, OPACITY_OPAQUE, U8_tqmask);
+                }
+                tqmask++;
+            }
+            d->alpha = UINT8_MULT(srcAlpha, d->alpha);
+        }
+
+        dst += dstRowSize;
+        src += srcRowSize;
+        if(srcAlphaMask) {
+            srcAlphaMask += tqmaskRowStride;
+        }
+    }
+}
+
+void KisCmykColorSpace::bitBlt(TQ_UINT8 *dst,
+                                  TQ_INT32 dstRowStride,
+                                  const TQ_UINT8 *src,
+                                  TQ_INT32 srcRowStride,
+                                  const TQ_UINT8 *tqmask,
+                                  TQ_INT32 tqmaskRowStride,
+                                  TQ_UINT8 opacity,
+                                  TQ_INT32 rows,
+                                  TQ_INT32 cols,
+                                  const KisCompositeOp& op)
+{
+
+    switch (op.op()) {
+        case COMPOSITE_UNDEF:
+        // Undefined == no composition
+            break;
+        case COMPOSITE_OVER:
+            compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_IN:
+        //compositeIn(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        case COMPOSITE_OUT:
+        //compositeOut(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_ATOP:
+        //compositeAtop(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_XOR:
+        //compositeXor(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_PLUS:
+        //compositePlus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_MINUS:
+        //compositeMinus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_ADD:
+        //compositeAdd(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_SUBTRACT:
+        //compositeSubtract(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_DIFF:
+        //compositeDiff(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_MULT:
+            compositeMultiply(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_DIVIDE:
+            compositeDivide(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_BUMPMAP:
+        //compositeBumpmap(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_COPY:
+            compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_COPY_CYAN:
+        //compositeCopyCyan(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_COPY_MAGENTA:
+        //compositeCopyMagenta(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_COPY_YELLOW:
+        //compositeCopyYellow(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_COPY_OPACITY:
+        //compositeCopyOpacity(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_CLEAR:
+        //compositeClear(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_DISSOLVE:
+        //compositeDissolve(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_DISPLACE:
+        //compositeDisplace(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+#if 0
+        case COMPOSITE_MODULATE:
+        compositeModulate(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+        case COMPOSITE_THRESHOLD:
+        compositeThreshold(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#endif
+        case COMPOSITE_NO:
+        // No composition.
+            break;
+        case COMPOSITE_DARKEN:
+            compositeDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_LIGHTEN:
+            compositeLighten(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_HUE:
+        //compositeHue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_SATURATION:
+        //compositeSaturation(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_VALUE:
+        //compositeValue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_COLOR:
+        //compositeColor(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_COLORIZE:
+        //compositeColorize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_LUMINIZE:
+        //compositeLuminize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_SCREEN:
+            compositeScreen(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_OVERLAY:
+            compositeOverlay(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_ERASE:
+            compositeErase(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_DODGE:
+            compositeDodge(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_BURN:
+            compositeBurn(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_ALPHA_DARKEN:
+            abstractCompositeAlphaDarken<TQ_UINT8, U8Mult, Uint8ToU8, U8OpacityTest,
+                    PIXEL_CMYK_ALPHA, cmyk::MAX_CHANNEL_CMYK, cmyk::MAX_CHANNEL_CMYKA>(
+                    dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride,
+                    rows, cols, opacity, U8Mult(), Uint8ToU8(), U8OpacityTest());
+                    break;
+        default:
+            break;
+    }
+}
+
+KisCompositeOpList KisCmykColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    list.append(KisCompositeOp(COMPOSITE_ALPHA_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_MULT));
+    list.append(KisCompositeOp(COMPOSITE_BURN));
+    list.append(KisCompositeOp(COMPOSITE_DODGE));
+    list.append(KisCompositeOp(COMPOSITE_DIVIDE));
+    list.append(KisCompositeOp(COMPOSITE_SCREEN));
+    list.append(KisCompositeOp(COMPOSITE_OVERLAY));
+    list.append(KisCompositeOp(COMPOSITE_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_LIGHTEN));
+
+    return list;
+}
diff --git a/chalk/colorspaces/cmyk_u8/kis_cmyk_colorspace.h b/chalk/colorspaces/cmyk_u8/kis_cmyk_colorspace.h
new file mode 100644
index 000000000..69ef80e4c
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u8/kis_cmyk_colorspace.h
@@ -0,0 +1,126 @@
+/*
+ *  Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_STRATEGY_COLORSPACE_CMYK_H_
+#define KIS_STRATEGY_COLORSPACE_CMYK_H_
+
+#include <tqcolor.h>
+#include <tqmap.h>
+#include <koffice_export.h>
+#include "kis_global.h"
+#include "kis_u8_base_colorspace.h"
+
+class KRITACORE_EXPORT KisCmykColorSpace : public KisU8BaseColorSpace {
+
+public:
+
+        
+    struct Pixel {
+            TQ_UINT16 cyan;
+            TQ_UINT16 magenta;
+            TQ_UINT16 yellow;
+            TQ_UINT16 black;
+            TQ_UINT16 alpha;
+        };
+public:
+    KisCmykColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p);
+    virtual ~KisCmykColorSpace();
+
+
+    virtual bool willDegrade(ColorSpaceIndependence independence)
+        {
+            if (independence == TO_RGBA8)
+                return true;
+            else
+                return false;
+        };
+
+
+
+public:
+
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+    virtual void applyAdjustment(const TQ_UINT8 *src, TQ_UINT8 *dst, KisColorAdjustment *adj, TQ_INT32 nPixels);
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
+    // XXX: darken & intensity8?
+    
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const;
+    virtual TQ_UINT32 nColorChannels() const;
+    virtual TQ_UINT32 pixelSize() const;
+    virtual void getSingleChannelPixel(TQ_UINT8 *dstPixel, const TQ_UINT8 *srcPixel, TQ_UINT32 channelIndex);
+    
+    virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+protected:
+    
+    virtual void bitBlt(TQ_UINT8 *dst,
+                        TQ_INT32 dstRowStride,
+                        const TQ_UINT8 *src,
+                        TQ_INT32 srcRowStride,
+                        const TQ_UINT8 *srcAlphaMask,
+                        TQ_INT32 tqmaskRowStride,
+                        TQ_UINT8 opacity,
+                        TQ_INT32 rows,
+                        TQ_INT32 cols,
+                        const KisCompositeOp& op);
+
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeMultiply(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeDivide(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeScreen(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeOverlay(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeDodge(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeBurn(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeLighten(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+
+private:
+
+    TQ_UINT8 * m_qcolordata;
+
+    static const TQ_UINT8 PIXEL_CYAN = 0;
+    static const TQ_UINT8 PIXEL_MAGENTA = 1;
+    static const TQ_UINT8 PIXEL_YELLOW = 2;
+    static const TQ_UINT8 PIXEL_BLACK = 3;
+    static const TQ_UINT8 PIXEL_CMYK_ALPHA = 4;
+};
+
+class KisCmykColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const { return KisID("CMYK", i18n("CMYK (8-bit integer/channel)")); };
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() { return TYPE_CMYK5_8; };
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return icSigCmykData; };
+
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisCmykColorSpace(tqparent, p); };
+
+    virtual TQString defaultProfile() { return "Offset printing, according to ISO/DIS 12647-2:2004, OFCOM, paper type 1 or 2 = coated art, 115 g/m2, screen ruling 60 cm-1, positive-acting plates"; }; //  Do not i18n -- this is from a data file
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_CMYK_H_
diff --git a/chalk/colorspaces/cmyk_u8/templates/.directory b/chalk/colorspaces/cmyk_u8/templates/.directory
new file mode 100644
index 000000000..f69b12ea1
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u8/templates/.directory
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Name=CMYK
+Name[fr]=CMJN
+Name[hi]=सीएमवायके
+X-KDE-DefaultTab=true
diff --git a/chalk/colorspaces/cmyk_u8/templates/Makefile.am b/chalk/colorspaces/cmyk_u8/templates/Makefile.am
new file mode 100644
index 000000000..fdd99b604
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u8/templates/Makefile.am
@@ -0,0 +1,8 @@
+templates_DATA = .directory white_2000x800.desktop
+templatesdir = $(kde_datadir)/chalk/templates/cmyk
+
+templatesrc_DATA = white_2000x800.kra
+templatesrcdir = $(kde_datadir)/chalk/templates/cmyk/.source
+
+templatesicon_ICON = AUTO
+templatesicondir = $(kde_datadir)/chalk/icons
diff --git a/chalk/colorspaces/cmyk_u8/templates/cr48-action-template_cmyk_empty.png b/chalk/colorspaces/cmyk_u8/templates/cr48-action-template_cmyk_empty.png
new file mode 100644
index 000000000..4e2374728
Binary files /dev/null and b/chalk/colorspaces/cmyk_u8/templates/cr48-action-template_cmyk_empty.png differ
diff --git a/chalk/colorspaces/cmyk_u8/templates/crsc-action-template_cmyk_empty.svgz b/chalk/colorspaces/cmyk_u8/templates/crsc-action-template_cmyk_empty.svgz
new file mode 100644
index 000000000..a1ad0ae5f
Binary files /dev/null and b/chalk/colorspaces/cmyk_u8/templates/crsc-action-template_cmyk_empty.svgz differ
diff --git a/chalk/colorspaces/cmyk_u8/templates/white_2000x800.desktop b/chalk/colorspaces/cmyk_u8/templates/white_2000x800.desktop
new file mode 100644
index 000000000..81119e3ac
--- /dev/null
+++ b/chalk/colorspaces/cmyk_u8/templates/white_2000x800.desktop
@@ -0,0 +1,100 @@
+[Desktop Entry]
+Type=Link
+URL=.source/white_2000x800.kra
+Icon=template_cmyk_empty
+Name=White 2000 x 800
+Name[bg]=Бяло 2000x800
+Name[br]=Gwenn 2000 x 800
+Name[ca]=Blanc 2000 x 800
+Name[cy]=Gwyn 2000 x 800
+Name[da]=Hvidt 2000 x 800
+Name[de]=Weiß 2000 x 800
+Name[el]=Λευκό 2000 x 800
+Name[es]=2000 x 800 blanco
+Name[et]=Valge 2000 x 800
+Name[eu]=Zuria 2000 x 800
+Name[fa]=سفید ۸۰۰ × ۲۰۰۰
+Name[fi]=Valkoinen 2000 x 800
+Name[fr]=Image blanche 2000 x 800
+Name[fy]=Wyt 2000 x 800
+Name[ga]=Bán 2000×800
+Name[gl]=Branco 2000 x 800
+Name[he]=לבן ‎2000 x 800
+Name[hi]=सफेद 2000 x 800
+Name[hu]=fehér 2000 x 800
+Name[is]=Hvít 2000 x 800
+Name[it]=Bianco 2000 × 800
+Name[ja]=白 2000 x 800
+Name[km]=ពណ៌​ស 2000 x 800
+Name[lt]=Baltas 2000 x 800
+Name[lv]=Balts 2000 x 800
+Name[ms]=Putih 2000 x 800
+Name[nb]=Hvit 2000 x 800
+Name[nds]=Witt 2000 x 800
+Name[ne]=सेतो २००० x ८००
+Name[nl]=Wit 2000 x 800
+Name[nn]=Kvitt 2000 × 800
+Name[pl]=Biały 2000 x 800
+Name[pt]=Branca 2000 x 800
+Name[pt_BR]=2000 x 800 em Branco
+Name[ru]=Белый 2000x800
+Name[se]=Vilges 2000 × 800
+Name[sk]=Biely 2000 x 800
+Name[sl]=Bela 2000 x 800
+Name[sr]=Бела 2000 x 800
+Name[sr@Latn]=Bela 2000 x 800
+Name[sv]=Vit 2000 x 800
+Name[ta]=வெள்ளை 2000 x 800
+Name[tr]=Beyaz 2000 x 800
+Name[uk]=Біле 2000 x 800
+Name[uz]=Oq 2000 x 800
+Name[uz@cyrillic]=Оқ 2000 x 800
+Name[zh_CN]=白色 2000 x 800
+Name[zh_TW]=白色 2000 x 800
+Comment=Creates a white CMYK image of 2000 x 800 pixels.
+Comment[bg]=Създаване на бяло изображения CMYK с размери 2000x800 пиксела.
+Comment[ca]=Crea una imatge blanca CMYK de 2000 x 800 píxels.
+Comment[cy]=Creu delwedd CMYK wen o 2000 x 800 picsel.
+Comment[da]=Laver et hvidt CMYK-billede på 2000 x 800 biledpunkter.
+Comment[de]=Erstellt ein weißes CMYK-Bild mit 2000 x 800 Pixeln.
+Comment[el]=Δημιουργεί μία λευκή CMYK εικόνα μεγέθους 2000 x 800 εικονοστοιχείων.
+Comment[es]=Crea una imagen CMYK blanca de 2000 x 800 píxeles.
+Comment[et]=Loob valge CMYK-pildi mõõtmetega 2000 x 800 pikslit.
+Comment[eu]=2000 x 800 pixeleko CMYK irudi zuri bat sortzen du.
+Comment[fa]=یک تصویر سفید CMYK ۲۰۰۰ × ۸۰۰ تصویردانه‌ای ایجاد می‌کند.
+Comment[fi]=Luo valkoisen 2000 x 800 pikselin CMYK-kuvan.
+Comment[fr]=Crée une image CMYK blanche de 2000 x 800 pixels.
+Comment[fy]=Makket in wite CMYK-ôfbeelding oan fan 2000 x 2000 byldpunten.
+Comment[gl]=Cria unha imaxe CMYK branca de 2000 x 800 pixels.
+Comment[he]=יצירת תמונת CMYK לבנה בגודל ‎2000 x 800 פיקסלים
+Comment[hi]=2000 x 800 पिक्सेल की सफेद सीएमवायके छवि बनाता है.
+Comment[hu]=Létrehoz egy fehér, 2000 x 800 képpontos CMYK képet.
+Comment[is]=Býr til hvíta CMYK mynd með 2000 x 800 punktum.
+Comment[it]=Crea un'immagine CMYK bianca di 2000 × 800 pixel.
+Comment[ja]=2000 x 800 ピクセルの CMYK 画像を作成
+Comment[km]=បង្កើត​រូបភាព CMYK ពណ៌​ស​មួយ ដែល​មាន​ទំហំ ២០០០ x ៨០០ ភីកសែល ។
+Comment[ms]=Cipta  imej CMYK putih 2000 x 800 piksel.
+Comment[nb]=Lager et hvitt CMYK-bilde på 2000 x 800 piksler.
+Comment[nds]=Stellt en wittet CMYK-Bild mit 2000 x 800 Pixels op.
+Comment[ne]=२००० x ८०० पिक्सेलको सेतो CMYK छवि सिर्जना गर्दछ ।
+Comment[nl]=Maakt een witte CMYK-afbeelding aan van 2000 x 2000 pixels.
+Comment[nn]=Lagar eit kvitt CMYK-bilete på 2000 × 800 pikslar.
+Comment[pl]=Tworzy biały obrazek CMYK o rozmiarach 2000 na 800 pikseli.
+Comment[pt]=Cria uma imagem CMYK branca com 2000 x 800 pontos.
+Comment[pt_BR]=Cria uma imagem CMYK em branco de 2000 x 800 pixéis.
+Comment[ru]=Рисунок CMYK, 2000x800, белый фон
+Comment[se]=Ráhkada CMYK-gova mas leat 2000 × 800 govvačuoggá.
+Comment[sk]=Vytvorí biely obrázok CMYK s rozmermi 2000 x 800 pixelov.
+Comment[sl]=Ustvari belo sliko CMYK velikosti 2000 x 800 pik.
+Comment[sr]=Прави белу CMYK слику са 2000 x 800 пиксела.
+Comment[sr@Latn]=Pravi belu CMYK sliku sa 2000 x 800 piksela.
+Comment[sv]=Skapar en vit CMYK-bild med 2000 x 800 bildpunkter.
+Comment[ta]=2000 x 800 படத்துணுக்குகளில் ஒரு வெள்ளை CMYK  பிம்பத்தை உருவாக்குகிறது.
+Comment[tr]=2000 x 800 piksel ebadında beyaz bir CMYK görüntü oluşturur.
+Comment[uk]=Створює біле зображення CMYK 2000 x 800 пікселів.
+Comment[uz]=Oʻlchami 2000 x 800 nuqta boʻlgan oq CMYK rasmni yaratish.
+Comment[uz@cyrillic]=Ўлчами 2000 x 800 нуқта бўлган оқ CMYK расмни яратиш.
+Comment[zh_CN]=创建 2000 x 800 像素的白色 CMYK 图像。
+Comment[zh_TW]=建立一個白色，2000 x 800 像素的 CMYK 圖片。
+X-Chalk-Version=2
+
diff --git a/chalk/colorspaces/cmyk_u8/templates/white_2000x800.kra b/chalk/colorspaces/cmyk_u8/templates/white_2000x800.kra
new file mode 100644
index 000000000..b6833a24a
Binary files /dev/null and b/chalk/colorspaces/cmyk_u8/templates/white_2000x800.kra differ
diff --git a/chalk/colorspaces/gray_u16/Makefile.am b/chalk/colorspaces/gray_u16/Makefile.am
new file mode 100644
index 000000000..5b756bceb
--- /dev/null
+++ b/chalk/colorspaces/gray_u16/Makefile.am
@@ -0,0 +1,29 @@
+# location for the rc file
+kde_services_DATA = chalk_gray_u16_plugin.desktop
+
+INCLUDES  =  -I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor/color_strategy \
+	-I$(srcdir)/../../chalkcolor/ \
+	$(KOFFICE_INCLUDES) \
+	$(all_includes)
+
+lib_LTLIBRARIES = libchalk_gray_u16.la
+libchalk_gray_u16_la_SOURCES = kis_gray_u16_colorspace.cc
+libchalk_gray_u16_la_LDFLAGS = $(all_libraries)
+libchalk_gray_u16_la_LIBADD =  ../../chalkcolor/libchalkcolor.la
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = chalk_gray_u16_plugin.la
+
+# Srcs for the plugin
+chalk_gray_u16_plugin_la_SOURCES = gray_u16_plugin.cc
+noinst_HEADERS = gray_u16_plugin.h kis_gray_u16_colorspace.h
+
+chalk_gray_u16_plugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms
+chalk_gray_u16_plugin_la_LIBADD =  libchalk_gray_u16.la ../../chalkcolor/libchalkcolor.la
+
+chalk_gray_u16_plugin_la_METASOURCES = AUTO
+
+
+SUBDIRS = .
+
diff --git a/chalk/colorspaces/gray_u16/chalk_gray_u16_plugin.desktop b/chalk/colorspaces/gray_u16/chalk_gray_u16_plugin.desktop
new file mode 100644
index 000000000..893557c5a
--- /dev/null
+++ b/chalk/colorspaces/gray_u16/chalk_gray_u16_plugin.desktop
@@ -0,0 +1,83 @@
+[Desktop Entry]
+Name=Grayscale Color Model (16-bit integer)
+Name[bg]=Цветови модел сива гама (16 бита)
+Name[ca]=Model de color d'escala de grisos (enters de 16 bits)
+Name[cy]=Model Lliw Graddlwyd (cyfanrif 16-did)
+Name[da]=Farvemodel med gråskala (16-bit heltal)
+Name[de]=Graustufen-Farbmodell (16-bit Ganzzahl)
+Name[el]=Χρωματικό μοντέλο διαβαθμίσεων του γκρι (16 bit ακέραιοι)
+Name[en_GB]=Greyscale Colour Model (16-bit integer)
+Name[eo]=Grizoskala kolormodelo (16-bita entjero)
+Name[es]=Modelo de color de escala de grises (entero de 16 bits)
+Name[et]=Halltooni värvimudel (16-bitine)
+Name[fa]=مدل رنگ مقیاس خاکستری )عدد صحیح ۱۶ بیتی(
+Name[fi]=Harmaasävyvärimalli (16-bittinen)
+Name[fr]=Modèle de couleurs en nivaux de gris (entiers 16 bits)
+Name[fy]=Kleurmodel foar griiswearden (16-bit yntegers)
+Name[gl]=Modelo de Cores en Escala de Gris (inteiro de 16-bit)
+Name[he]=מודל צבעים של גווני אפור )16 סיביות(
+Name[hu]=Szürkeárnyalatos színmodell (16 bites egész)
+Name[is]=Gráskala litategund (16-bita heiltala)
+Name[it]=Modello di colore a scala di grigio (intero a 16 bit)
+Name[ja]=グレースケール カラーモデル (16 ビット整数)
+Name[km]=គំរូ​ពណ៌​មាត្រដ្ឋានប្រផេះ (ចំនួនគត់ ១៦ ប៊ីត)
+Name[nb]=Fargemodell med gråtoner (16-bit heltall)
+Name[nds]=Griestöön-Klöörmodell (16-Bit Heeltall)
+Name[ne]=ग्रेस्केल रङ मोडेल (१६-बिट इन्टिजर)
+Name[nl]=Kleurmodel voor grijswaarden (16-bit integers)
+Name[pl]=Skala szarości (16-bitowa liczba całkowita)
+Name[pt]=Modelo de Cor de Tons de Cinzento (inteiros de 16 bits)
+Name[pt_BR]=Modelo de Cor de Tons de Cinza (inteiros de 16 bits)
+Name[ru]=Градации серого (целое 16-бит)
+Name[se]=Ránesivdnemálle (16-bihttá lohku)
+Name[sk]=Čiernobiely/šedý model farieb (16-bitové čísla)
+Name[sl]=Sivinski barvni model (16-bitno celo število)
+Name[sr]=Модел боја у сивим нијансама (16-битно целобројно)
+Name[sr@Latn]=Model boja u sivim nijansama (16-bitno celobrojno)
+Name[sv]=Färgmodell med gråskala (16-bitars heltal)
+Name[uk]=Модель кольору відтінків сірого (16-бітне ціле число)
+Name[uz]=Kul rang usuli (16-bit butun)
+Name[uz@cyrillic]=Кул ранг усули (16-бит бутун)
+Name[zh_CN]=灰度色彩模型(16 位整数)
+Name[zh_TW]=灰階色彩模型 (16-bit 整數)
+Comment=Color model for 16-bit integer per channel Grayscale images
+Comment[bg]=Цветови модел за 16 битови изображения в сива гама
+Comment[ca]=Model de color d'enters de 16 bits per a canal d'imatges d'escala de grisos
+Comment[cy]=Model lliw ar gyfer delweddau Graddlwyd â chyfanrif 16-did/sianel
+Comment[da]=Farvemodel for 16-bit heltal pr kanal Gråskala-billeder
+Comment[de]=Farbmodell für 16-bit Ganzzahl pro Kanal Graustufen-Bilder
+Comment[el]=Χρωματικό μοντέλο για 16-bit ακεραίους ανά κανάλι με διαβαθμίσεις του γκρι εικόνες
+Comment[en_GB]=Colour model for 16-bit integer per channel Greyscale images
+Comment[es]=Modelo de color de entero de 16 bits por canal para imágenes de escala de grises
+Comment[et]=16-bitiste täisarvuliste kanalitega halltoonis piltide värvimudel
+Comment[fa]=مدل رنگ برای عدد صحیح ۱۶ بیتی در هر تصویر مقیاس خاکستری مجرا
+Comment[fi]=Värimalli 16-bittisille harmaasävykuville
+Comment[fr]=Modèle de couleurs pour des images en nivaux de gris à 16 bits/plage
+Comment[fy]=Kleurmodel foar16-bit/kanaal griiswearde-ôfbeeldings
+Comment[gl]=Modelo de cor para imaxes en escala de grises de  16-bit por canal
+Comment[he]=מודל צבעים עבור תמונות של 16 סיביות בגווני אפור
+Comment[hu]=Színmodell 16 bit/csatorna szürkeárnyalatos képekhez
+Comment[is]=Litategund fyrir 16-bita heiltölu á rás gráskala myndir
+Comment[it]=Modello di colore per immagini in scala di grigio a canale di 16 bit
+Comment[ja]=16 ビット整数/チャンネル グレースケール画像のためのカラーモデル
+Comment[km]=គំរូ​ពណ៌​សម្រាប់​រូបភាព​មាត្រដ្ឋាន​ប្រផេះ​ចំនួន​គត់ ១៦ ប៊ីត​ក្នុង​មួយ​ឆានែល
+Comment[nb]=Fargemodell for gråtonebilde med 16 bit per kanal
+Comment[nds]=Klöörmodell för Griestöön-Biller mit 16-Bit Heeltall per Kanaal
+Comment[ne]=प्रति च्यानल ग्रेस्केल छविहरूका १६-बिट च्यानलका लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor 16-bit/kanaal grijswaarde-afbeeldingen
+Comment[pl]=Przestrzeń barw dla obrazków w skali szarości z 16-bitową liczbą całkowitą na kanał
+Comment[pt]=Modelo de cor para imagens de tons de cinzento com 16 bits por canal
+Comment[pt_BR]=Modelo de cor para imagens de tons de cinza com 16 bits por canal
+Comment[ru]=Цветовое пространство градаций серого (целое 16-бит/канал)
+Comment[sk]=Model farieb pre ČB/šedé obrázky so 16 bitmi na kanál
+Comment[sl]=Barvni model za 16-bitna cela števila/kanal sivinske slike
+Comment[sr]=Модел боја за слике у сивим нијансама, 16-битно целобројно по каналу
+Comment[sr@Latn]=Model boja za slike u sivim nijansama, 16-bitno celobrojno po kanalu
+Comment[sv]=Färgmodell för 16-bitars heltal per kanal gråskalebilder
+Comment[uk]=Модель кольору для зображень відтінків сірого, 16-біт/канал
+Comment[zh_CN]=每通道 16 位整数的灰度图像色彩模型
+Comment[zh_TW]=每色頻為 16-bit 的灰階圖片色彩模型
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-Chalk-Version=2
+X-KDE-Library=chalk_gray_u16_plugin
diff --git a/chalk/colorspaces/gray_u16/gray_u16_plugin.cc b/chalk/colorspaces/gray_u16/gray_u16_plugin.cc
new file mode 100644
index 000000000..436caf5db
--- /dev/null
+++ b/chalk/colorspaces/gray_u16/gray_u16_plugin.cc
@@ -0,0 +1,63 @@
+/*
+* gray_u16_plugin.cc -- Part of Chalk
+*
+* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+*
+*  This program is free software; you can grayistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  This program is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  You should have received a copy of the GNU General Public License
+*  along with this program; if not, write to the Free Software
+*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include <kinstance.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+
+#include <kis_debug_areas.h>
+
+#include <kis_colorspace_factory_registry.h>
+#include <kis_basic_histogram_producers.h>
+
+#include "gray_u16_plugin.h"
+#include "kis_gray_u16_colorspace.h"
+
+typedef KGenericFactory<GRAYU16Plugin> GRAYU16PluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalk_gray_u16_plugin, GRAYU16PluginFactory( "chalk" ) )
+
+
+GRAYU16Plugin::GRAYU16Plugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(GRAYU16PluginFactory::instance());
+
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") )
+    {
+        KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( tqparent );
+
+        KisColorSpace * colorSpaceGRAYU16 = new KisGrayU16ColorSpace(f, 0);
+        KisColorSpaceFactory * csf = new KisGrayU16ColorSpaceFactory();
+        Q_CHECK_PTR(colorSpaceGRAYU16);
+        f->add(csf);
+
+        KisHistogramProducerFactoryRegistry::instance()->add(
+                new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
+                (KisID("GRAYA16HISTO", i18n("GRAY/Alpha16")), colorSpaceGRAYU16) );
+    }
+
+}
+
+GRAYU16Plugin::~GRAYU16Plugin()
+{
+}
+
+#include "gray_u16_plugin.moc"
diff --git a/chalk/colorspaces/gray_u16/gray_u16_plugin.h b/chalk/colorspaces/gray_u16/gray_u16_plugin.h
new file mode 100644
index 000000000..39ef6c2ac
--- /dev/null
+++ b/chalk/colorspaces/gray_u16/gray_u16_plugin.h
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can grayistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GRAY_U16_PLUGIN_H_
+#define GRAY_U16_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the GRAY U16 colour space strategy.
+ */
+class GRAYU16Plugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    GRAYU16Plugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~GRAYU16Plugin();
+
+};
+
+
+#endif // GRAY_U16_PLUGIN_H_
diff --git a/chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.cc b/chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.cc
new file mode 100644
index 000000000..00f3440c1
--- /dev/null
+++ b/chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.cc
@@ -0,0 +1,658 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <limits.h>
+#include <stdlib.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+#include <kglobal.h>
+
+#include "kis_gray_u16_colorspace.h"
+#include "kis_u16_base_colorspace.h"
+#include "kis_color_conversions.h"
+#include "kis_integer_maths.h"
+#include "kis_colorspace_factory_registry.h"
+
+namespace {
+    const TQ_INT32 MAX_CHANNEL_GRAY = 1;
+    const TQ_INT32 MAX_CHANNEL_GRAYA = 2;
+}
+
+KisGrayU16ColorSpace::KisGrayU16ColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) :
+    KisU16BaseColorSpace(KisID("GRAYA16", i18n("Grayscale (16-bit integer/channel)")), TYPE_GRAYA_16, icSigGrayData, tqparent, p)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Gray"), i18n("G"), PIXEL_GRAY * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16)));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), PIXEL_ALPHA * sizeof(TQ_UINT16), KisChannelInfo::ALPHA, KisChannelInfo::UINT16, sizeof(TQ_UINT16)));
+
+/*    LPGAMMATABLE Gamma = cmsBuildGamma(256, 2.2);
+    cmsHPROFILE hProfile = cmsCreateGrayProfile(cmsD50_xyY(), Gamma);
+    cmsFreeGamma(Gamma);
+*/
+
+    m_alphaPos = PIXEL_ALPHA * sizeof(TQ_UINT16);
+
+    init();
+}
+
+KisGrayU16ColorSpace::~KisGrayU16ColorSpace()
+{
+}
+
+void KisGrayU16ColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    TQ_UINT32 totalGray = 0, newAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel *pixel = reinterpret_cast<const Pixel *>(*colors);
+
+        TQ_UINT32 alpha = pixel->alpha;
+        TQ_UINT32 alphaTimesWeight = UINT16_MULT(alpha, UINT8_TO_UINT16(*weights));
+
+        totalGray += UINT16_MULT(pixel->gray, alphaTimesWeight);
+        newAlpha += alphaTimesWeight;
+
+        weights++;
+        colors++;
+    }
+
+    Q_ASSERT(newAlpha <= U16_OPACITY_OPAQUE);
+
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->alpha = newAlpha;
+
+    if (newAlpha > 0) {
+        totalGray = UINT16_DIVIDE(totalGray, newAlpha);
+    }
+
+    dstPixel->gray = totalGray;
+}
+
+void KisGrayU16ColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst,
+                                          TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const
+{
+    TQ_INT32 totalGray = 0, totalAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel * pixel = reinterpret_cast<const Pixel *>( *colors );
+
+        TQ_INT32 weight = *kernelValues;
+
+        if (weight != 0) {
+            totalGray += pixel->gray * weight;
+            totalAlpha += pixel->alpha * weight;
+        }
+        colors++;
+        kernelValues++;
+    }
+
+    Pixel * p = reinterpret_cast< Pixel *>( dst );
+
+    if (channelFlags & KisChannelInfo::FLAG_COLOR) {
+        p->gray = CLAMP( ( totalGray / factor) + offset, 0, TQ_UINT16_MAX);
+    }
+    if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+        p->alpha = CLAMP((totalAlpha/ factor) + offset, 0, TQ_UINT16_MAX);
+    }
+}
+
+
+void KisGrayU16ColorSpace::invertColor(TQ_UINT8 * src, TQ_INT32 nPixels)
+{
+    TQ_UINT32 psize = pixelSize();
+
+    while (nPixels--)
+    {
+        Pixel * p = reinterpret_cast< Pixel *>( src );
+        p->gray = TQ_UINT16_MAX - p->gray;
+        src += psize;
+    }
+}
+
+
+
+TQ_UINT8 KisGrayU16ColorSpace::intensity8(const TQ_UINT8 * src) const
+{
+    const Pixel * p = reinterpret_cast<const Pixel *>( src );
+    return UINT16_TO_UINT8(p->gray);
+}
+
+
+TQValueVector<KisChannelInfo *> KisGrayU16ColorSpace::channels() const
+{
+    return m_channels;
+}
+
+TQ_UINT32 KisGrayU16ColorSpace::nChannels() const
+{
+    return MAX_CHANNEL_GRAYA;
+}
+
+TQ_UINT32 KisGrayU16ColorSpace::nColorChannels() const
+{
+    return MAX_CHANNEL_GRAY;
+}
+
+TQ_UINT32 KisGrayU16ColorSpace::pixelSize() const
+{
+    return MAX_CHANNEL_GRAYA * sizeof(TQ_UINT16);
+}
+
+void KisGrayU16ColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT16 *src = reinterpret_cast<const TQ_UINT16 *>(srcRowStart);
+        TQ_UINT16 *dst = reinterpret_cast<TQ_UINT16 *>(dstRowStart);
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            TQ_UINT16 srcAlpha = src[PIXEL_ALPHA];
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, UINT8_TO_UINT16(U8_tqmask));
+                }
+                tqmask++;
+            }
+
+            if (srcAlpha != U16_OPACITY_TRANSPARENT) {
+
+                if (opacity != U16_OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, opacity);
+                }
+
+                if (srcAlpha == U16_OPACITY_OPAQUE) {
+                    memcpy(dst, src, MAX_CHANNEL_GRAYA * sizeof(TQ_UINT16));
+                } else {
+                    TQ_UINT16 dstAlpha = dst[PIXEL_ALPHA];
+
+                    TQ_UINT16 srcBlend;
+
+                    if (dstAlpha == U16_OPACITY_OPAQUE) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        TQ_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                        dst[PIXEL_ALPHA] = newAlpha;
+
+                        if (newAlpha != 0) {
+                            srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha);
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend == U16_OPACITY_OPAQUE) {
+                        memcpy(dst, src, MAX_CHANNEL_GRAY * sizeof(TQ_UINT16));
+                    } else {
+                        dst[PIXEL_GRAY] = UINT16_BLEND(src[PIXEL_GRAY], dst[PIXEL_GRAY], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_GRAYA;
+            dst += MAX_CHANNEL_GRAYA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart) {
+            tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+}
+
+#define COMMON_COMPOSITE_OP_PROLOG() \
+    while (rows > 0) { \
+    \
+        const TQ_UINT16 *src = reinterpret_cast<const TQ_UINT16 *>(srcRowStart); \
+        TQ_UINT16 *dst = reinterpret_cast<TQ_UINT16 *>(dstRowStart); \
+        TQ_INT32 columns = numColumns; \
+        const TQ_UINT8 *tqmask = tqmaskRowStart; \
+    \
+        while (columns > 0) { \
+    \
+            TQ_UINT16 srcAlpha = src[PIXEL_ALPHA]; \
+            TQ_UINT16 dstAlpha = dst[PIXEL_ALPHA]; \
+    \
+            srcAlpha = TQMIN(srcAlpha, dstAlpha); \
+    \
+            if (tqmask != 0) { \
+                TQ_UINT8 U8_tqmask = *tqmask; \
+    \
+                if (U8_tqmask != OPACITY_OPAQUE) { \
+                    srcAlpha = UINT16_MULT(srcAlpha, UINT8_TO_UINT16(U8_tqmask)); \
+                } \
+                tqmask++; \
+            } \
+    \
+            if (srcAlpha != U16_OPACITY_TRANSPARENT) { \
+    \
+                if (opacity != U16_OPACITY_OPAQUE) { \
+                    srcAlpha = UINT16_MULT(srcAlpha, opacity); \
+                } \
+    \
+                TQ_UINT16 srcBlend; \
+    \
+                if (dstAlpha == U16_OPACITY_OPAQUE) { \
+                    srcBlend = srcAlpha; \
+                } else { \
+                    TQ_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha); \
+                    dst[PIXEL_ALPHA] = newAlpha; \
+    \
+                    if (newAlpha != 0) { \
+                        srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha); \
+                    } else { \
+                        srcBlend = srcAlpha; \
+                    } \
+                }
+
+#define COMMON_COMPOSITE_OP_EPILOG() \
+            } \
+    \
+            columns--; \
+            src += MAX_CHANNEL_GRAYA; \
+            dst += MAX_CHANNEL_GRAYA; \
+        } \
+    \
+        rows--; \
+        srcRowStart += srcRowStride; \
+        dstRowStart += dstRowStride; \
+        if(tqmaskRowStart) { \
+            tqmaskRowStart += tqmaskRowStride; \
+        } \
+    }
+
+void KisGrayU16ColorSpace::compositeMultiply(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        TQ_UINT16 srcColor = src[PIXEL_GRAY];
+        TQ_UINT16 dstColor = dst[PIXEL_GRAY];
+
+        srcColor = UINT16_MULT(srcColor, dstColor);
+
+        dst[PIXEL_GRAY] = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisGrayU16ColorSpace::compositeDivide(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_GRAY; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN((dstColor * (UINT16_MAX + 1u) + (srcColor / 2u)) / (1u + srcColor), UINT16_MAX);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisGrayU16ColorSpace::compositeScreen(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_GRAY; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = UINT16_MAX - UINT16_MULT(UINT16_MAX - dstColor, UINT16_MAX - srcColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisGrayU16ColorSpace::compositeOverlay(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_GRAY; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = UINT16_MULT(dstColor, dstColor + 2u * UINT16_MULT(srcColor, UINT16_MAX - dstColor));
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisGrayU16ColorSpace::compositeDodge(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_GRAY; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN((dstColor * (UINT16_MAX + 1u)) / (UINT16_MAX + 1u - srcColor), UINT16_MAX);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisGrayU16ColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_GRAY; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = kMin(((UINT16_MAX - dstColor) * (UINT16_MAX + 1u)) / (srcColor + 1u), UINT16_MAX);
+            srcColor = kClamp(UINT16_MAX - srcColor, 0u, UINT16_MAX);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisGrayU16ColorSpace::compositeDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_GRAY; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN(srcColor, dstColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisGrayU16ColorSpace::compositeLighten(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_GRAY; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMAX(srcColor, dstColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+
+void KisGrayU16ColorSpace::compositeErase(TQ_UINT8 *dst,
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src,
+            TQ_INT32 srcRowSize,
+            const TQ_UINT8 *srcAlphaMask,
+            TQ_INT32 tqmaskRowStride,
+            TQ_INT32 rows,
+            TQ_INT32 cols,
+            TQ_UINT16 /*opacity*/)
+{
+    while (rows-- > 0)
+    {
+        const Pixel *s = reinterpret_cast<const Pixel *>(src);
+        Pixel *d = reinterpret_cast<Pixel *>(dst);
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (TQ_INT32 i = cols; i > 0; i--, s++, d++)
+        {
+            TQ_UINT16 srcAlpha = s->alpha;
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_BLEND(srcAlpha, U16_OPACITY_OPAQUE, UINT8_TO_UINT16(U8_tqmask));
+                }
+                tqmask++;
+            }
+            d->alpha = UINT16_MULT(srcAlpha, d->alpha);
+        }
+
+        dst += dstRowSize;
+        src += srcRowSize;
+        if(srcAlphaMask) {
+            srcAlphaMask += tqmaskRowStride;
+        }
+    }
+}
+
+void KisGrayU16ColorSpace::bitBlt(TQ_UINT8 *dst,
+                      TQ_INT32 dstRowStride,
+                      const TQ_UINT8 *src,
+                      TQ_INT32 srcRowStride,
+                      const TQ_UINT8 *tqmask,
+                      TQ_INT32 tqmaskRowStride,
+                      TQ_UINT8 U8_opacity,
+                      TQ_INT32 rows,
+                      TQ_INT32 cols,
+                      const KisCompositeOp& op)
+{
+    TQ_UINT16 opacity = UINT8_TO_UINT16(U8_opacity);
+
+    switch (op.op()) {
+    case COMPOSITE_UNDEF:
+        // Undefined == no composition
+        break;
+    case COMPOSITE_OVER:
+        compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_IN:
+        //compositeIn(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+    case COMPOSITE_OUT:
+        //compositeOut(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ATOP:
+        //compositeAtop(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_XOR:
+        //compositeXor(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_PLUS:
+        //compositePlus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MINUS:
+        //compositeMinus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ADD:
+        //compositeAdd(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SUBTRACT:
+        //compositeSubtract(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIFF:
+        //compositeDiff(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MULT:
+        compositeMultiply(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIVIDE:
+        compositeDivide(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BUMPMAP:
+        //compositeBumpmap(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY:
+        compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, U8_opacity);
+        break;
+    case COMPOSITE_COPY_RED:
+        //compositeCopyRed(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_GREEN:
+        //compositeCopyGreen(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_BLUE:
+        //compositeCopyBlue(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_OPACITY:
+        //compositeCopyOpacity(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_CLEAR:
+        //compositeClear(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISSOLVE:
+        //compositeDissolve(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISPLACE:
+        //compositeDisplace(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#if 0
+    case COMPOSITE_MODULATE:
+        compositeModulate(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_THRESHOLD:
+        compositeThreshold(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#endif
+    case COMPOSITE_NO:
+        // No composition.
+        break;
+    case COMPOSITE_DARKEN:
+        compositeDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LIGHTEN:
+        compositeLighten(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_HUE:
+        //compositeHue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SATURATION:
+        //compositeSaturation(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_VALUE:
+        //compositeValue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLOR:
+        //compositeColor(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLORIZE:
+        //compositeColorize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LUMINIZE:
+        //compositeLuminize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SCREEN:
+        compositeScreen(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_OVERLAY:
+        compositeOverlay(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ERASE:
+        compositeErase(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DODGE:
+        compositeDodge(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BURN:
+        compositeBurn(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ALPHA_DARKEN:
+        abstractCompositeAlphaDarken<TQ_UINT16, U16Mult, Uint8ToU16, U16OpacityTest,
+                    PIXEL_ALPHA, MAX_CHANNEL_GRAY, MAX_CHANNEL_GRAYA>(
+                    dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride,
+                    rows, cols, opacity, U16Mult(), Uint8ToU16(), U16OpacityTest());
+        break;
+    default:
+        break;
+    }
+}
+
+KisCompositeOpList KisGrayU16ColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    list.append(KisCompositeOp(COMPOSITE_ALPHA_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_MULT));
+    list.append(KisCompositeOp(COMPOSITE_BURN));
+    list.append(KisCompositeOp(COMPOSITE_DODGE));
+    list.append(KisCompositeOp(COMPOSITE_DIVIDE));
+    list.append(KisCompositeOp(COMPOSITE_SCREEN));
+    list.append(KisCompositeOp(COMPOSITE_OVERLAY));
+    list.append(KisCompositeOp(COMPOSITE_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_LIGHTEN));
+
+    return list;
+}
diff --git a/chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.h b/chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.h
new file mode 100644
index 000000000..5c2351da3
--- /dev/null
+++ b/chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.h
@@ -0,0 +1,118 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can grayistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_STRATEGY_COLORSPACE_GRAY_U16_H_
+#define KIS_STRATEGY_COLORSPACE_GRAY_U16_H_
+
+#include <tqcolor.h>
+
+#include <koffice_export.h>
+
+#include "kis_global.h"
+#include "kis_u16_base_colorspace.h"
+#include "kis_integer_maths.h"
+
+
+class KRITATOOL_EXPORT KisGrayU16ColorSpace : public KisU16BaseColorSpace {
+public:
+
+    struct Pixel {
+        TQ_UINT16 gray;
+        TQ_UINT16 alpha;
+    };
+
+    virtual bool willDegrade(ColorSpaceIndependence independence)
+        {
+            if (independence == TO_RGBA8)
+                return true;
+            else
+                return false;
+        };
+
+
+public:
+    KisGrayU16ColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p);
+    virtual ~KisGrayU16ColorSpace();
+
+public:
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
+    virtual TQ_UINT8 intensity8(const TQ_UINT8 * src) const;
+
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const;
+    virtual TQ_UINT32 nColorChannels() const;
+    virtual TQ_UINT32 pixelSize() const;
+
+    virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+
+protected:
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dstRowStride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeMultiply(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDivide(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeScreen(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeOverlay(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDodge(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeBurn(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeLighten(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+
+private:
+    friend class KisGrayU16ColorSpaceTester;
+
+    static const TQ_UINT8 PIXEL_GRAY = 0;
+    static const TQ_UINT8 PIXEL_ALPHA = 1;
+};
+
+class KisGrayU16ColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const { return KisID("GRAYA16", i18n("Grayscale (16-bit integer/channel)")); };
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() { return TYPE_GRAY_16; };
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return icSigGrayData; };
+
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisGrayU16ColorSpace(tqparent, p); };
+
+    virtual TQString defaultProfile() { return "gray built-in - (lcms internal)"; };
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_GRAY_U16_H_
diff --git a/chalk/colorspaces/gray_u8/Makefile.am b/chalk/colorspaces/gray_u8/Makefile.am
new file mode 100644
index 000000000..adce3031b
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/Makefile.am
@@ -0,0 +1,31 @@
+kde_services_DATA = chalkgrayplugin.desktop
+
+INCLUDES  =  -I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../chalkcolor/ \
+	-I$(interfacedir) \
+	$(KOFFICE_INCLUDES) \
+	$(all_includes)
+
+
+lib_LTLIBRARIES = libchalkgrayscale.la
+libchalkgrayscale_la_SOURCES = kis_gray_colorspace.cc
+libchalkgrayscale_la_LDFLAGS = $(all_libraries)
+libchalkgrayscale_la_LIBADD =  ../../chalkcolor/libchalkcolor.la
+
+kde_module_LTLIBRARIES = chalkgrayplugin.la
+
+chalkgrayplugin_la_SOURCES = gray_plugin.cc
+noinst_HEADERS = gray_plugin.h kis_gray_colorspace.h
+
+chalkgrayplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms
+chalkgrayplugin_la_LIBADD =  libchalkgrayscale.la ../../chalkcolor/libchalkcolor.la
+
+chalkgrayplugin_la_METASOURCES = AUTO
+
+if include_kunittest_tests
+TESTSDIR = tests
+endif
+
+SUBDIRS = . templates $(TESTSDIR)
+
diff --git a/chalk/colorspaces/gray_u8/chalkgrayplugin.desktop b/chalk/colorspaces/gray_u8/chalkgrayplugin.desktop
new file mode 100644
index 000000000..58a6d992f
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/chalkgrayplugin.desktop
@@ -0,0 +1,97 @@
+[Desktop Entry]
+Name=Grayscale Color Model
+Name[bg]=Цветови модел със степени на сивото
+Name[ca]=Model de color d'escala de grisos
+Name[cy]=Model Lliw Graddlwyd
+Name[da]=Farvemodel med gråskala
+Name[de]=Graustufen-Farbmodell
+Name[el]=Χρωματικό μοντέλο διαβαθμίσεων του γκρι
+Name[en_GB]=Greyscale Colour Model
+Name[eo]=Grizoskala kolormodelo
+Name[es]=Modelo de color de escala de grises
+Name[et]=Halltooni värvimudel
+Name[eu]=Gris-eskala kolore-eredua
+Name[fa]=مدل رنگ مقیاس خاکستری
+Name[fi]=Harmaasävyvärimalli
+Name[fr]=Modèle de couleurs en niveaux de gris
+Name[fy]=Griiswearden kleurmodel
+Name[gl]=Modelo de Cores en Escala de Gris
+Name[he]=מודל צבעים של גווני אפור
+Name[hi]=श्वेत-श्याम रंग नमूना
+Name[hu]=Szürkeárnyalatos színmodell
+Name[is]=Gráskala litategund
+Name[it]=Modello di colore in scala di grigio
+Name[ja]=グレースケール カラーモデル
+Name[km]=គំរូ​ពណ៌​មាត្រដ្ឋាន​ប្រផេះ
+Name[lv]=Pelēktoņu krāsu modelis
+Name[ms]=Model Warna Skala Kelabu
+Name[nb]=Fargemodell med gråtoner
+Name[nds]=Griestöön-Klöörmodell
+Name[ne]=ग्रेस्केल रङ मोडेल
+Name[nl]=Grijswaarden kleurmodel
+Name[nn]=Fargemodell med gråtonar
+Name[pl]=Skala szarości
+Name[pt]=Modelo de Cor de Tons de Cinzento
+Name[pt_BR]=Modelo de Cor em Tons de Cinza
+Name[ru]=Градации серого
+Name[se]=Ránesivnniid ivdnemálle
+Name[sk]=Model farieb ČB/šedý
+Name[sl]=Sivinski barvni model
+Name[sr]=Модел боја за сиве нијансе
+Name[sr@Latn]=Model boja za sive nijanse
+Name[sv]=Gråskalefärgmodell
+Name[ta]=பழுப்புநிற வண்ண மாதிரி
+Name[tr]=Griton Renk Modeli
+Name[uk]=Модель кольору "відтінки сірого"
+Name[uz]=Kul rang usuli
+Name[uz@cyrillic]=Кул ранг усули
+Name[zh_CN]=灰度色彩模型
+Name[zh_TW]=灰階色彩模型
+Comment=Color model for 8-bit grayscale images
+Comment[bg]=Цветови модел за 8 битови сиви изображения
+Comment[ca]=Model de color d'escala de grisos de 8 bits
+Comment[cy]=Model lliw ar gyfer delweddau graddlwyd 8-did
+Comment[da]=Farvemodel for 8-bit gråskala-billeder
+Comment[de]=Farbmodell für 8-bit Graustufenbilder
+Comment[el]=Χρωματικό μοντέλο για 8-bit με διαβαθμίσεις του γκρι εικόνες
+Comment[en_GB]=Colour model for 8-bit greyscale images
+Comment[eo]=Kolormodelo por 8-bitaj grizoskalaj bildoj
+Comment[es]=Modelo de color de imágenes de escala de grises para 8 bits
+Comment[et]=8-bitiste halltoonis piltide värvimudel
+Comment[eu]=8 bit/kanaleko gris-eskalako irudien kolore-eredua
+Comment[fa]=مدل رنگ برای تصاویر مقیاس خاکستری ۸ بیتی
+Comment[fi]=Värimalli 8-bittisille harmaasävykuville
+Comment[fr]=Modèle de couleurs pour des images en niveaux de gris 8 bits
+Comment[fy]=Kleurmodel foar ôfbeeldings yn 8-bit griiswearden
+Comment[gl]=Modelo de Cores de escala de gris de for 8-bit
+Comment[he]=מודל צבעים עבור תמונות של 8 סיביות בגווני אפור
+Comment[hi]=8-बिट श्वेत-श्याम छवियों के लिए रंग नमूना
+Comment[hu]=Színmodell 8 bites szürkeárnyalatos képekhez
+Comment[is]=Litategund fyrir 8-bita gráskala myndir
+Comment[it]=Modello di colore per immagini a 8 bit in scala di grigio
+Comment[ja]=8 ビット グレースケール画像のためのカラーモデル
+Comment[km]=គំរូ​ពណ៌​សម្រាប់​រូបភាព​មាត្រដ្ឋាន​ប្រផេះ ៨ ប៊ីត
+Comment[ms]=Model warna bagi imej skala kelabu 8-bit
+Comment[nb]=Fargemodell for 8-bits gråtonebilder
+Comment[nds]=Klöörmodell för Griestöön-Biller mit 8-Bit Heeltall
+Comment[ne]=८-बिट ग्रेस्केल छविहरूका लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor afbeeldingen in 8-bit grijswaarden
+Comment[nn]=Fargemodell for 8-bits gråtonebilete
+Comment[pl]=Przestrzeń braw dla 8-bitowych obrazków w skali szarości
+Comment[pt]=Modelo de cor para imagens de tons de cinzento com 8 bits
+Comment[pt_BR]=Modelo de cor para imagens com 8-bits de tons de cinza
+Comment[ru]=Цветовое пространство градаций серого (8-бит)
+Comment[sk]=Model farieb pre ČB/šedé obrázky s 8 bitmi na kanál
+Comment[sl]=Barvni model za 8 bitne sivinske slike
+Comment[sr]=Модел боја за слике у 8-битним сивим нијансама
+Comment[sr@Latn]=Model boja za slike u 8-bitnim sivim nijansama
+Comment[sv]=Färgmodell för 8-bitars gråskalebilder
+Comment[ta]=8-பிட் பழுப்புநிற பிம்பங்களுக்கு வண்ண மாதிரி
+Comment[tr]=8-bit griton görüntüler için renk modeli.
+Comment[uk]=Модель кольору зображень відтінків сірого (8-бітів)
+Comment[zh_CN]=8 位灰度图像的色彩模型
+Comment[zh_TW]=8-bit 灰階圖片的色彩模型
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-KDE-Library=chalkgrayplugin
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/gray_u8/gray_plugin.cc b/chalk/colorspaces/gray_u8/gray_plugin.cc
new file mode 100644
index 000000000..0028c5978
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/gray_plugin.cc
@@ -0,0 +1,77 @@
+/*
+ * gray_plugin.cc -- Part of Chalk
+ *
+ * Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kinstance.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <ktempfile.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+
+#include <kis_debug_areas.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_basic_histogram_producers.h>
+
+#include "gray_plugin.h"
+#include "kis_gray_colorspace.h"
+
+typedef KGenericFactory<GrayPlugin> GrayPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalkgrayplugin, GrayPluginFactory( "chalkcore" ) )
+
+
+GrayPlugin::GrayPlugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+           setInstance(GrayPluginFactory::instance());
+
+    // This is not a gui plugin; only load it when the doc is created.
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") )
+    {
+
+        KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( tqparent );
+
+        // .22 gamma grayscale or something like that. Taken from the lcms tutorial...
+        LPGAMMATABLE Gamma = cmsBuildGamma(256, 2.2);
+        cmsHPROFILE hProfile = cmsCreateGrayProfile(cmsD50_xyY(), Gamma);
+        cmsFreeGamma(Gamma);
+        KisProfile *defProfile = new KisProfile(hProfile);
+
+        f->addProfile(defProfile);
+
+        KisColorSpace * colorSpaceGrayA = new KisGrayColorSpace(f, 0);
+
+        KisColorSpaceFactory * csf = new KisGrayColorSpaceFactory();
+        Q_CHECK_PTR(colorSpaceGrayA);
+
+        f->add(csf);
+
+        KisHistogramProducerFactoryRegistry::instance()->add(
+            new KisBasicHistogramProducerFactory<KisBasicU8HistogramProducer>
+            (KisID("GRAYA8HISTO", i18n("GRAY/Alpha8")), colorSpaceGrayA) );
+    }
+
+}
+
+GrayPlugin::~GrayPlugin()
+{
+}
+
+#include "gray_plugin.moc"
diff --git a/chalk/colorspaces/gray_u8/gray_plugin.h b/chalk/colorspaces/gray_u8/gray_plugin.h
new file mode 100644
index 000000000..f18bf77c5
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/gray_plugin.h
@@ -0,0 +1,37 @@
+/*
+ *  Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GRAY_PLUGIN_H_
+#define GRAY_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the GRAY colour space strategy.
+ */
+class GrayPlugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    GrayPlugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~GrayPlugin();
+
+};
+
+#endif // GRAY_PLUGIN_H_
diff --git a/chalk/colorspaces/gray_u8/grayplugin.rc b/chalk/colorspaces/gray_u8/grayplugin.rc
new file mode 100644
index 000000000..8d4562cd4
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/grayplugin.rc
@@ -0,0 +1,7 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui library="chalkgrayplugin" version="1">
+<Menu name="Image"><text>&amp;Image</text>
+    <Menu name="Mode"><text>&amp;Mode</text>
+            <Action name="convert to Gray(A)"/>
+    </Menu>
+</Menu></kpartgui>
diff --git a/chalk/colorspaces/gray_u8/kis_gray_colorspace.cc b/chalk/colorspaces/gray_u8/kis_gray_colorspace.cc
new file mode 100644
index 000000000..dbd475df4
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/kis_gray_colorspace.cc
@@ -0,0 +1,997 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Cyrille Berger
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <limits.h>
+#include <stdlib.h>
+
+#include <config.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+
+#include <klocale.h>
+#include <kdebug.h>
+#include <kglobal.h>
+
+#include "kis_abstract_colorspace.h"
+#include "kis_u8_base_colorspace.h"
+#include "kis_gray_colorspace.h"
+#include "kis_integer_maths.h"
+
+#define downscale(quantum)  (quantum) //((unsigned char) ((quantum)/257UL))
+#define upscale(value)  (value) // ((TQ_UINT8) (257UL*(value)))
+
+namespace {
+    const TQ_INT32 MAX_CHANNEL_GRAYSCALE = 1;
+    const TQ_INT32 MAX_CHANNEL_GRAYSCALEA = 2;
+}
+
+KisGrayColorSpace::KisGrayColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) :
+    KisU8BaseColorSpace(KisID("GRAYA", i18n("Grayscale")), TYPE_GRAYA_8, icSigGrayData, tqparent, p)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Gray"), i18n("G"), 0, KisChannelInfo::COLOR, KisChannelInfo::UINT8));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), 1, KisChannelInfo::ALPHA, KisChannelInfo::UINT8));
+
+    m_alphaPos = PIXEL_GRAY_ALPHA;
+
+    init();
+}
+
+
+KisGrayColorSpace::~KisGrayColorSpace()
+{
+}
+
+void KisGrayColorSpace::setPixel(TQ_UINT8 *pixel, TQ_UINT8 gray, TQ_UINT8 alpha) const
+{
+    pixel[PIXEL_GRAY] = gray;
+    pixel[PIXEL_GRAY_ALPHA] = alpha;
+}
+
+void KisGrayColorSpace::getPixel(const TQ_UINT8 *pixel, TQ_UINT8 *gray, TQ_UINT8 *alpha) const
+{
+    *gray = pixel[PIXEL_GRAY];
+    *alpha = pixel[PIXEL_GRAY_ALPHA];
+}
+
+void KisGrayColorSpace::getAlpha(const TQ_UINT8 *pixel, TQ_UINT8 *alpha) const
+{
+    *alpha = pixel[PIXEL_GRAY_ALPHA];
+}
+
+void KisGrayColorSpace::setAlpha(TQ_UINT8 *pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const
+{
+    while (nPixels > 0) {
+        pixels[PIXEL_GRAY_ALPHA] = alpha;
+        --nPixels;
+        pixels += MAX_CHANNEL_GRAYSCALEA;
+    }
+}
+
+void KisGrayColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    TQ_UINT32 totalGray = 0, newAlpha = 0;
+
+    while (nColors--)
+    {
+        TQ_UINT32 alpha = (*colors)[PIXEL_GRAY_ALPHA];
+        TQ_UINT32 alphaTimesWeight = UINT8_MULT(alpha, *weights);
+
+        totalGray += (*colors)[PIXEL_GRAY] * alphaTimesWeight;
+        newAlpha += alphaTimesWeight;
+
+        weights++;
+        colors++;
+    }
+
+    Q_ASSERT(newAlpha <= 255);
+
+    dst[PIXEL_GRAY_ALPHA] = newAlpha;
+
+    if (newAlpha > 0) {
+        totalGray = UINT8_DIVIDE(totalGray, newAlpha);
+    }
+
+    // Divide by 255.
+    totalGray += 0x80;
+    TQ_UINT32 dstGray = ((totalGray >> 8) + totalGray) >> 8;
+    Q_ASSERT(dstGray <= 255);
+    dst[PIXEL_GRAY] = dstGray;
+}
+
+void KisGrayColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const
+{
+    TQ_INT32 totalGray = 0, totalAlpha = 0;
+
+    while (nColors--)
+    {
+        TQ_INT32 weight = *kernelValues;
+
+        if (weight != 0) {
+            totalGray += (*colors)[PIXEL_GRAY] * weight;
+            totalAlpha += (*colors)[PIXEL_GRAY_ALPHA] * weight;
+        }
+        colors++;
+        kernelValues++;
+    }
+
+
+    if (channelFlags & KisChannelInfo::FLAG_COLOR) {
+        dst[PIXEL_GRAY] = CLAMP((totalGray / factor) + offset, 0, TQ_UINT8_MAX);
+    }
+    if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+        dst[PIXEL_GRAY_ALPHA] = CLAMP((totalAlpha/ factor) + offset, 0, TQ_UINT8_MAX);
+    }
+
+}
+
+
+void KisGrayColorSpace::invertColor(TQ_UINT8 * src, TQ_INT32 nPixels)
+{
+    TQ_UINT32 psize = pixelSize();
+
+    while (nPixels--)
+    {
+        src[PIXEL_GRAY] = TQ_UINT8_MAX - src[PIXEL_GRAY];
+        src += psize;
+    }
+}
+
+void KisGrayColorSpace::darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const
+{
+    TQ_UINT32 pSize = pixelSize();
+
+    while (nPixels--) {
+        if (compensate) {
+            dst[PIXEL_GRAY]  = (TQ_INT8) TQMIN(255,((src[PIXEL_GRAY] * shade) / (compensation * 255)));
+        }
+        else {
+            dst[PIXEL_GRAY]  = (TQ_INT8) TQMIN(255, (src[PIXEL_GRAY] * shade / 255));
+        }
+        dst += pSize;
+        src += pSize;
+    }
+}
+
+TQ_UINT8 KisGrayColorSpace::intensity8(const TQ_UINT8 * src) const
+{
+    return src[PIXEL_GRAY];
+}
+
+TQValueVector<KisChannelInfo *> KisGrayColorSpace::channels() const
+{
+    return m_channels;
+}
+
+TQ_UINT32 KisGrayColorSpace::nChannels() const
+{
+    return MAX_CHANNEL_GRAYSCALEA;
+}
+
+TQ_UINT32 KisGrayColorSpace::nColorChannels() const
+{
+    return MAX_CHANNEL_GRAYSCALE;
+}
+
+TQ_UINT32 KisGrayColorSpace::pixelSize() const
+{
+    return MAX_CHANNEL_GRAYSCALEA;
+}
+
+void KisGrayColorSpace::bitBlt(TQ_UINT8 *dst,
+                      TQ_INT32 dstRowStride,
+                      const TQ_UINT8 *src,
+                      TQ_INT32 srcRowStride,
+                      const TQ_UINT8 *tqmask,
+                      TQ_INT32 tqmaskRowStride,
+                      TQ_UINT8 opacity,
+                      TQ_INT32 rows,
+                      TQ_INT32 cols,
+                      const KisCompositeOp& op)
+{
+    switch (op.op()) {
+    case COMPOSITE_OVER:
+        compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MULT:
+        compositeMultiply(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIVIDE:
+        compositeDivide(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DARKEN:
+        compositeDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LIGHTEN:
+        compositeLighten(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SCREEN:
+        compositeScreen(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_OVERLAY:
+        compositeOverlay(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DODGE:
+        compositeDodge(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BURN:
+        compositeBurn(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ERASE:
+        compositeErase(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY:
+        compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_CLEAR: {
+        TQ_UINT8 *d;
+        TQ_INT32 linesize;
+
+        linesize = MAX_CHANNEL_GRAYSCALEA*sizeof(TQ_UINT8) * cols;
+        d = dst;
+        while (rows-- > 0) {
+            memset(d, 0, linesize);
+            d += dstRowStride;
+        }
+    }
+        break;
+    case COMPOSITE_ALPHA_DARKEN:
+        compositeAlphaDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+
+    default:
+        break;
+    }
+}
+
+KisCompositeOpList KisGrayColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    list.append(KisCompositeOp(COMPOSITE_MULT));
+    list.append(KisCompositeOp(COMPOSITE_BURN));
+    list.append(KisCompositeOp(COMPOSITE_DODGE));
+    list.append(KisCompositeOp(COMPOSITE_DIVIDE));
+    list.append(KisCompositeOp(COMPOSITE_SCREEN));
+    list.append(KisCompositeOp(COMPOSITE_OVERLAY));
+    list.append(KisCompositeOp(COMPOSITE_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_LIGHTEN));
+
+    return list;
+}
+
+void KisGrayColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_GRAY_ALPHA];
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(srcAlpha, opacity);
+                }
+
+                if (srcAlpha == OPACITY_OPAQUE) {
+                    memcpy(dst, src, MAX_CHANNEL_GRAYSCALEA * sizeof(TQ_UINT8));
+                } else {
+                    TQ_UINT8 dstAlpha = dst[PIXEL_GRAY_ALPHA];
+
+                    TQ_UINT8 srcBlend;
+
+                    if (dstAlpha == OPACITY_OPAQUE) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                        dst[PIXEL_GRAY_ALPHA] = newAlpha;
+
+                        if (newAlpha != 0) {
+                            srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend == OPACITY_OPAQUE) {
+                        memcpy(dst, src, MAX_CHANNEL_GRAYSCALE * sizeof(TQ_UINT8));
+                    } else {
+                        dst[PIXEL_GRAY] = UINT8_BLEND(src[PIXEL_GRAY], dst[PIXEL_GRAY], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_GRAYSCALEA;
+            dst += MAX_CHANNEL_GRAYSCALEA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisGrayColorSpace::compositeMultiply(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_GRAY_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_GRAY_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_GRAY_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_GRAY_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                TQ_UINT8 srcColor = src[PIXEL_GRAY];
+                TQ_UINT8 dstColor = dst[PIXEL_GRAY];
+
+                srcColor = UINT8_MULT(srcColor, dstColor);
+
+                dst[PIXEL_GRAY] = UINT8_BLEND(srcColor, dstColor, srcBlend);
+            }
+
+            columns--;
+            src += MAX_CHANNEL_GRAYSCALEA;
+            dst += MAX_CHANNEL_GRAYSCALEA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisGrayColorSpace::compositeDivide(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_GRAY_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_GRAY_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_GRAY_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_GRAY_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_GRAYSCALE; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = TQMIN((dstColor * (UINT8_MAX + 1)) / (1 + srcColor), UINT8_MAX);
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_GRAYSCALEA;
+            dst += MAX_CHANNEL_GRAYSCALEA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisGrayColorSpace::compositeScreen(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_GRAY_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_GRAY_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_GRAY_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_GRAY_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_GRAYSCALE; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = UINT8_MAX - UINT8_MULT(UINT8_MAX - dstColor, UINT8_MAX - srcColor);
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_GRAYSCALEA;
+            dst += MAX_CHANNEL_GRAYSCALEA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisGrayColorSpace::compositeOverlay(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_GRAY_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_GRAY_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_GRAY_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_GRAY_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_GRAYSCALE; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = UINT8_MULT(dstColor, dstColor + UINT8_MULT(2 * srcColor, UINT8_MAX - dstColor));
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_GRAYSCALEA;
+            dst += MAX_CHANNEL_GRAYSCALEA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisGrayColorSpace::compositeDodge(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_GRAY_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_GRAY_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_GRAY_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_GRAY_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_GRAYSCALE; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = TQMIN((dstColor * (UINT8_MAX + 1)) / (UINT8_MAX + 1 - srcColor), UINT8_MAX);
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_GRAYSCALEA;
+            dst += MAX_CHANNEL_GRAYSCALEA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisGrayColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_GRAY_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_GRAY_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_GRAY_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_GRAY_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_GRAYSCALE; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = kMin(((UINT8_MAX - dstColor) * (UINT8_MAX + 1)) / (srcColor + 1), UINT8_MAX);
+                    srcColor = kClamp(UINT8_MAX - srcColor, 0u, UINT8_MAX);
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_GRAYSCALEA;
+            dst += MAX_CHANNEL_GRAYSCALEA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisGrayColorSpace::compositeDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_GRAY_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_GRAY_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_GRAY_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_GRAY_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_GRAYSCALE; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = TQMIN(srcColor, dstColor);
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_GRAYSCALEA;
+            dst += MAX_CHANNEL_GRAYSCALEA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisGrayColorSpace::compositeLighten(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_GRAY_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_GRAY_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_GRAY_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_GRAY_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_GRAYSCALE; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = TQMAX(srcColor, dstColor);
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_GRAYSCALEA;
+            dst += MAX_CHANNEL_GRAYSCALEA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisGrayColorSpace::compositeErase(TQ_UINT8 *dst,
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src,
+            TQ_INT32 srcRowSize,
+            const TQ_UINT8 *srcAlphaMask,
+            TQ_INT32 tqmaskRowStride,
+            TQ_INT32 rows,
+            TQ_INT32 cols,
+            TQ_UINT8 /*opacity*/)
+{
+    TQ_INT32 i;
+    TQ_UINT8 srcAlpha;
+
+    while (rows-- > 0)
+    {
+        const TQ_UINT8 *s = src;
+        TQ_UINT8 *d = dst;
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (i = cols; i > 0; i--, s+=MAX_CHANNEL_GRAYSCALEA, d+=MAX_CHANNEL_GRAYSCALEA)
+        {
+            srcAlpha = s[PIXEL_GRAY_ALPHA];
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_BLEND(srcAlpha, OPACITY_OPAQUE, *tqmask);
+                tqmask++;
+            }
+            d[PIXEL_GRAY_ALPHA] = UINT8_MULT(srcAlpha, d[PIXEL_GRAY_ALPHA]);
+        }
+
+        dst += dstRowSize;
+        if(srcAlphaMask)
+            srcAlphaMask += tqmaskRowStride;
+        src += srcRowSize;
+    }
+}
+
+void KisGrayColorSpace::compositeAlphaDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride,
+                                     const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride,
+                                     const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride,
+                                     TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_GRAY_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_GRAY_ALPHA];
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (opacity != OPACITY_OPAQUE) {
+                srcAlpha = UINT8_MULT(srcAlpha, opacity);
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT && srcAlpha >= dstAlpha) {
+                dst[PIXEL_GRAY_ALPHA] = srcAlpha;
+                memcpy(dst, src, MAX_CHANNEL_GRAYSCALE * sizeof(TQ_UINT8));
+            }
+
+            columns--;
+            src += MAX_CHANNEL_GRAYSCALEA;
+            dst += MAX_CHANNEL_GRAYSCALEA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
diff --git a/chalk/colorspaces/gray_u8/kis_gray_colorspace.h b/chalk/colorspaces/gray_u8/kis_gray_colorspace.h
new file mode 100644
index 000000000..8a3bc34ba
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/kis_gray_colorspace.h
@@ -0,0 +1,114 @@
+/*
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_
+#define KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_
+#include <tqcolor.h>
+
+#include <klocale.h>
+
+#include <koffice_export.h>
+
+#include "kis_global.h"
+#include "kis_abstract_colorspace.h"
+#include "kis_u8_base_colorspace.h"
+
+class KRITACORE_EXPORT KisGrayColorSpace : public KisU8BaseColorSpace {
+public:
+    KisGrayColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p);
+    virtual ~KisGrayColorSpace();
+
+    virtual bool willDegrade(ColorSpaceIndependence /*independence*/)
+        {
+            return false;
+        };
+
+public:
+
+    void setPixel(TQ_UINT8 *pixel, TQ_UINT8 gray, TQ_UINT8 alpha) const;
+    void getPixel(const TQ_UINT8 *pixel, TQ_UINT8 *gray, TQ_UINT8 *alpha) const;
+
+    virtual void getAlpha(const TQ_UINT8 *pixel, TQ_UINT8 *alpha) const;
+    virtual void setAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const;
+
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    virtual void darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const;
+    virtual TQ_UINT8 intensity8(const TQ_UINT8 * src) const;
+
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const;
+    virtual TQ_UINT32 nColorChannels() const;
+    virtual TQ_UINT32 pixelSize() const;
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dststride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+    KisCompositeOpList userVisiblecompositeOps() const;
+
+protected:
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeMultiply(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeDivide(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeScreen(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeOverlay(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeDodge(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeBurn(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeLighten(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeAlphaDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+
+
+private:
+    friend class KisGrayColorSpaceTester;
+
+    static const TQ_UINT8 PIXEL_GRAY = 0;
+    static const TQ_UINT8 PIXEL_GRAY_ALPHA = 1;
+};
+
+class KisGrayColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const { return KisID("GRAYA", i18n("Grayscale (8-bit integer/channel)")); };
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() { return TYPE_GRAYA_8; };
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return icSigGrayData; };
+
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisGrayColorSpace(tqparent, p); };
+
+    virtual TQString defaultProfile() { return "gray built-in - (lcms internal)"; };
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_
diff --git a/chalk/colorspaces/gray_u8/templates/.directory b/chalk/colorspaces/gray_u8/templates/.directory
new file mode 100644
index 000000000..e408f23fc
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/templates/.directory
@@ -0,0 +1,48 @@
+[Desktop Entry]
+Name=Grayscale
+Name[bg]=Гама на сивото
+Name[br]=SkeulLouet
+Name[ca]=Escala de grisos
+Name[cy]=Graddlwyd
+Name[da]=Gråskala
+Name[de]=Graustufen
+Name[el]=Διαβαθμίσεις του γκρι
+Name[eo]=Grizoskalo
+Name[es]=Escala de grises
+Name[et]=Halltoonid
+Name[fa]=مقیاس خاکستری
+Name[fi]=Harmaasävyinen
+Name[fr]=Niveaux de gris
+Name[fy]=Griiswearden
+Name[ga]=Liathscála
+Name[gl]=Escala de Gris
+Name[he]=גווני אפור
+Name[hi]=श्वेत-श्याम
+Name[hu]=Szürkeárnyalatok
+Name[is]=Gráskali
+Name[it]=Scala di grigio
+Name[ja]=グレースケール
+Name[km]=មាត្រដ្ឋាន​ប្រផេះ​
+Name[lv]=Pelēktoņu
+Name[nb]=Gråtoner
+Name[nds]=Griestöön
+Name[ne]=ग्रेस्केल
+Name[nl]=Grijswaarden
+Name[pl]=Skala szarości
+Name[pt]=Tons de Cinzento
+Name[pt_BR]=Tons de Cinza
+Name[ru]=Градации серого
+Name[se]=Ránesivnnit
+Name[sk]=Čiernobiely
+Name[sl]=Sivinska
+Name[sr]=Сиве нијансе
+Name[sr@Latn]=Sive nijanse
+Name[sv]=Gråskala
+Name[ta]=பழுப்புநிற வண்ணம்
+Name[tr]=Griton
+Name[uk]=Відтінки сірого
+Name[uz]=Oq-qora
+Name[uz@cyrillic]=Оқ-қора
+Name[zh_CN]=灰度
+Name[zh_TW]=灰階
+X-KDE-DefaultTab=true
diff --git a/chalk/colorspaces/gray_u8/templates/Makefile.am b/chalk/colorspaces/gray_u8/templates/Makefile.am
new file mode 100644
index 000000000..ab5be17b3
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/templates/Makefile.am
@@ -0,0 +1,8 @@
+templates_DATA = .directory white_640x480.desktop
+templatesdir = $(kde_datadir)/chalk/templates/gray
+
+templatesrc_DATA =white_640x480.kra 
+templatesrcdir = $(kde_datadir)/chalk/templates/gray/.source
+
+templatesicon_ICON = AUTO
+templatesicondir = $(kde_datadir)/chalk/icons
diff --git a/chalk/colorspaces/gray_u8/templates/cr48-action-template_gray_empty.png b/chalk/colorspaces/gray_u8/templates/cr48-action-template_gray_empty.png
new file mode 100644
index 000000000..73e064b69
Binary files /dev/null and b/chalk/colorspaces/gray_u8/templates/cr48-action-template_gray_empty.png differ
diff --git a/chalk/colorspaces/gray_u8/templates/crsc-action-template_gray_empty.svgz b/chalk/colorspaces/gray_u8/templates/crsc-action-template_gray_empty.svgz
new file mode 100644
index 000000000..93af227f1
Binary files /dev/null and b/chalk/colorspaces/gray_u8/templates/crsc-action-template_gray_empty.svgz differ
diff --git a/chalk/colorspaces/gray_u8/templates/white_640x480.desktop b/chalk/colorspaces/gray_u8/templates/white_640x480.desktop
new file mode 100644
index 000000000..1da17a336
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/templates/white_640x480.desktop
@@ -0,0 +1,99 @@
+[Desktop Entry]
+Type=Link
+URL=.source/white_640x480.kra
+Icon=template_gray_empty
+Name=White Background, 640 x 480
+Name[bg]=Бял фон, 640x480
+Name[ca]=Fons blanc, 640 x 480
+Name[cy]=Cefndir Gwyn, 640 x 480
+Name[da]=Hvid baggrund, 640 x 480
+Name[de]=Weißer Hintergrund, 640 x 480
+Name[el]=Λευκό φόντο, 640 x 480
+Name[eo]=Blanka fono, 640 x 480
+Name[es]=Fondo blanco, 640 x 480
+Name[et]=Valge taust, 640 x 480
+Name[eu]=Atzeko plano zuria, 640 x 480
+Name[fa]=زمینۀ سفید، ۴۸۰ × ۶۴۰
+Name[fi]=Valkoinen tausta, 640 x 480
+Name[fr]=Fond blanc 640 x 480
+Name[fy]=Wite eftergrûn, 640 x 480
+Name[ga]=Cúlra Bán, 640×480
+Name[gl]=Fondo Branco, 640 x 480
+Name[he]=רקע לבן, ‎640 x 480
+Name[hi]=सफेद पृष्ठभूमि, 640 x 480
+Name[hu]=Fehér háttér, 640 x 480
+Name[is]=Hvítur bakgrunnur, 640 x 480
+Name[it]=Sfondo bianco, 640 × 480
+Name[ja]=白い背景 640 x 480
+Name[km]=ផ្ទៃខាងក្រោយ​ពណ៌​ស, 640 x 480
+Name[lt]=Baltas fonas, 640 x 480
+Name[lv]=Balts fons, 640x480
+Name[ms]=Latar Belakang Putih, 640 x 480
+Name[nb]=Hvit bakgrunn, 640 x 480
+Name[nds]=Witt Achtergrund, 640 x 480
+Name[ne]=सेतो पृष्ठभूमि, ६४० x ४८०
+Name[nl]=Witte achtergrond, 640 x 480
+Name[nn]=Kvit bakgrunn, 640 × 480
+Name[pl]=Białe tło, 640 x 480
+Name[pt]=Fundo Branco, 640 x 480
+Name[pt_BR]=Fundo em branco, 640 x 480
+Name[ru]=Рисунок 640x480, белый фон
+Name[se]=Vilges duogáš, 640 × 480
+Name[sk]=Biele pozadie, 640 x 480
+Name[sl]=Belo ozadje, 640 x 480
+Name[sr]=Бела позадина, 640 x 480
+Name[sr@Latn]=Bela pozadina, 640 x 480
+Name[sv]=Vit bakgrund, 640 x 480
+Name[ta]=வெள்ளை பின்னணி, 640 x 480
+Name[tr]=Beyaz Arkaplan, 640 x 480
+Name[uk]=Біле тло, 640 x 480
+Name[uz]=Oq orqa fon 640 x 480
+Name[uz@cyrillic]=Оқ орқа фон 640 x 480
+Name[zh_CN]=白色背景，640 x 480
+Name[zh_TW]=白色背景， 640 x 480
+Comment=Creates an image of 640 x 480 pixels with a white background.
+Comment[bg]=Създаване на изображение с размери 640x480 пиксела и бял фон.
+Comment[ca]=Crea una imatge de 640 x 480 píxels amb el fons blanc.
+Comment[cy]=Creu delwedd o 640 x 480 o bicseli efo cefndir gwyn.
+Comment[da]=Laver et billede på 640 x 480 billedpunkter med en hvid baggrund.
+Comment[de]=Erstellt ein Bild mit 640 x 480 Pixeln mit einem weißen Hintergrund.
+Comment[el]=Δημιουργεί μία εικόνα μεγέθους 640 x 480 εικονοστοιχείων με λευκό φόντο.
+Comment[es]=Crea una imagen de 640 x 480 píxeles con un fondo blanco.
+Comment[et]=Loob valge taustaga pildi mõõtmetega 640 x 800 pikslit.
+Comment[eu]=640 x 480 pixeleko atzeko planoa zuria duen irudi bat sortzen du.
+Comment[fa]=تصویری ۴۸۰ × ۶۴۰ تصویردانه‌ای با یک زمینۀ سفید ایجاد می‌کند.
+Comment[fi]=Luo 640 x 480 pikselin kuvan valkoisella taustalla.
+Comment[fr]=Crée une image de 640 x 480 pixels avec un fond blanc.
+Comment[fy]=Makket in ôfbylding oan fan 640 x 480 byldpunten, mei in wite eftergrûn
+Comment[gl]=Cria unha imaxe de 640 x 480 pixels cun fondo branco.
+Comment[he]=יצירת תמונת בגודל ‎640 x 480 פיקסלים עם רקע לבן
+Comment[hi]=640 x 480 पिक्सेल का, सफेद पृष्ठभूमि युक्त छवि बनाता है
+Comment[hu]=Létrehoz egy 640 x 480 képpontos képet fehér háttérrel.
+Comment[is]=Býr til hvíta mynd í 640 x 480 punkta upplausn með hvítum bakgrunni.
+Comment[it]=Crea un'immagine di 640 × 480 pixel con uno sfondo bianco.
+Comment[ja]=640 x 480 ピクセルの白い背景の画像を作成
+Comment[km]=បង្កើត​រូបភាព​ទំហំ 640 x 480 ភីកសែល ដែល​មាន​ផ្ទៃ​ខាង​ក្រោយ​ពណ៌​ស ។
+Comment[ms]=Cipta imej 640 x 480 piksel dengan latar belakang putih.
+Comment[nb]=Lager et bilde på 640 x 480 piksler med hvit bakgrunn.
+Comment[nds]=Stellt en Bild mit 640 x 480 Pixels mit witten Achtergrund op.
+Comment[ne]=सेतो पृष्ठभूमि सहित ६४० x ४८० पिक्सेलको छवि सिर्जना गर्दछ ।
+Comment[nl]=Maakt een afbeelding aan van 640 x 480 pixels, met een witte achtergrond.
+Comment[nn]=Lagar eit bilete på 640 × 480 pikslar med ein kvit bakgrunn.
+Comment[pl]=Tworzy obrazek z białym tłem o rozmiarach 640 x 480 pikseli.
+Comment[pt]=Cria uma imagem de 640 x 480 pontos com um fundo branco.
+Comment[pt_BR]=Cria uma imagem de 640 x 480 pixéis com um fundo branco.
+Comment[ru]=Рисунок 640x480, белый фон
+Comment[se]=Ráhkada vilges govva mas leat 640 × 480 govvačuogga.
+Comment[sk]=Vytvorí obrázok s rozmermi 640 x 480 pixelov a bielym pozadím.
+Comment[sl]=Ustvari sliko velikosti 640 x 480 pik z belim ozadjem.
+Comment[sr]=Прави слику од 640 x 480 пиксела са белом позадином.
+Comment[sr@Latn]=Pravi sliku od 640 x 480 piksela sa belom pozadinom.
+Comment[sv]=Skapar en bild med 640 x 480 bildpunkter och en vit bakgrund.
+Comment[ta]=640 x 480 படத்துணுக்குகளில் வெள்ளை பின்னணியுடன் ஒரு பிம்பத்தை உருவாக்குகிறது.
+Comment[tr]=640 x 480 piksel ebadında beyaz arkaplana sahip bir görüntü oluşturur
+Comment[uk]=Створює зображення 640 x 480 пікселів з білим тлом.
+Comment[uz]=Oʻlchami 640 x 480 nuqta va foni oq boʻlgan rasmni yaratish.
+Comment[uz@cyrillic]=Ўлчами 640 x 480 нуқта ва фони оқ бўлган расмни яратиш.
+Comment[zh_CN]=创建白色背景的 640 x 480 像素的图像。
+Comment[zh_TW]=建立一個 640 x 480 像素，白色背景的圖片。
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/gray_u8/templates/white_640x480.kra b/chalk/colorspaces/gray_u8/templates/white_640x480.kra
new file mode 100644
index 000000000..534368ef7
Binary files /dev/null and b/chalk/colorspaces/gray_u8/templates/white_640x480.kra differ
diff --git a/chalk/colorspaces/gray_u8/tests/Makefile.am b/chalk/colorspaces/gray_u8/tests/Makefile.am
new file mode 100644
index 000000000..35e83689a
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/tests/Makefile.am
@@ -0,0 +1,17 @@
+AM_CPPFLAGS = -I$(srcdir)/.. \
+	 -I$(srcdir)/../../../sdk \
+	-I$(srcdir)/../../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../../color_strategy/ \
+	$(all_includes)
+
+# The check_ target makes sure we don't install the modules,
+# $(KDE_CHECK_PLUGIN) assures a shared library is created.
+check_LTLIBRARIES = kunittest_kis_strategy_colorspace_grayscale_tester.la
+
+kunittest_kis_strategy_colorspace_grayscale_tester_la_SOURCES = kis_strategy_colorspace_grayscale_tester.cpp
+kunittest_kis_strategy_colorspace_grayscale_tester_la_LIBADD = -lkunittest ../libchalkgrayscale.la
+kunittest_kis_strategy_colorspace_grayscale_tester_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+check-local: kunittest_kis_strategy_colorspace_grayscale_tester.la
+	kunittestmodrunner
+
diff --git a/chalk/colorspaces/gray_u8/tests/kis_strategy_colorspace_grayscale_tester.cpp b/chalk/colorspaces/gray_u8/tests/kis_strategy_colorspace_grayscale_tester.cpp
new file mode 100644
index 000000000..0374c0727
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/tests/kis_strategy_colorspace_grayscale_tester.cpp
@@ -0,0 +1,155 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "kis_factory.h"
+#include "kis_strategy_colorspace_grayscale_tester.h"
+#include "kis_gray_colorspace.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE( kunittest_kis_strategy_colorspace_grayscale_tester, "Greyscale ColorSpace Tester" );
+KUNITTEST_MODULE_REGISTER_TESTER( KisGrayColorSpaceTester );
+
+void KisGrayColorSpaceTester::allTests()
+{
+    // We need this so that the colour profile loading can operate without crashing.
+    KisFactory *factory = new KisFactory();
+
+    testBasics();
+    testMixColors();
+
+    delete factory;
+}
+
+#define MAX_CHANNEL_GRAYSCALEA 2
+
+#define GRAY_CHANNEL 0
+#define ALPHA_CHANNEL 1
+
+void KisGrayColorSpaceTester::testBasics()
+{
+    KisProfile *profile = new KisProfile(cmsCreate_sRGBProfile());
+    KisGrayColorSpace *cs = new KisGrayColorSpace(profile);
+
+
+    TQ_UINT8 pixel[MAX_CHANNEL_GRAYSCALEA];
+
+    pixel[KisGrayColorSpace::PIXEL_GRAY] = 255;
+    pixel[KisGrayColorSpace::PIXEL_GRAY_ALPHA] = 128;
+
+    TQString valueText = cs->channelValueText(pixel, GRAY_CHANNEL);
+    CHECK(valueText, TQString("255"));
+
+    valueText = cs->channelValueText(pixel, ALPHA_CHANNEL);
+    CHECK(valueText, TQString("128"));
+
+    valueText = cs->normalisedChannelValueText(pixel, GRAY_CHANNEL);
+    CHECK(valueText, TQString().setNum(1.0));
+
+    valueText = cs->normalisedChannelValueText(pixel, ALPHA_CHANNEL);
+    CHECK(valueText, TQString().setNum(128.0 / 255.0));
+
+    cs->setPixel(pixel, 128, 192l);
+    CHECK((uint)pixel[KisGrayColorSpace::PIXEL_GRAY], 128u);
+    CHECK((uint)pixel[KisGrayColorSpace::PIXEL_GRAY_ALPHA], 192u);
+
+    TQ_UINT8 gray;
+    TQ_UINT8 alpha;
+
+    cs->getPixel(pixel, &gray, &alpha);
+    CHECK((uint)gray, 128u);
+    CHECK((uint)alpha, 192u);
+
+    delete cs;
+}
+
+void KisGrayColorSpaceTester::testMixColors()
+{
+    KisProfile *profile = new KisProfile(cmsCreate_sRGBProfile());
+    KisAbstractColorSpace * cs = new KisGrayColorSpace(profile);
+
+    TQ_UINT8 pixel1[MAX_CHANNEL_GRAYSCALEA];
+    TQ_UINT8 pixel2[MAX_CHANNEL_GRAYSCALEA];
+    TQ_UINT8 outputPixel[MAX_CHANNEL_GRAYSCALEA];
+
+    pixel1[KisGrayColorSpace::PIXEL_GRAY] = 255;
+    pixel1[KisGrayColorSpace::PIXEL_GRAY_ALPHA] = 255;
+
+    pixel2[KisGrayColorSpace::PIXEL_GRAY] = 0;
+    pixel2[KisGrayColorSpace::PIXEL_GRAY_ALPHA] = 0;
+
+    const TQ_UINT8 *pixelPtrs[2];
+    TQ_UINT8 weights[2];
+
+    pixelPtrs[0] = pixel1;
+    pixelPtrs[1] = pixel2;
+
+    weights[0] = 255;
+    weights[1] = 0;
+
+    cs->mixColors(pixelPtrs, weights, 2, outputPixel);
+
+    CHECK((int)outputPixel[KisGrayColorSpace::PIXEL_GRAY], 255);
+    CHECK((int)outputPixel[KisGrayColorSpace::PIXEL_GRAY_ALPHA], 255);
+
+    weights[0] = 0;
+    weights[1] = 255;
+
+    cs->mixColors(pixelPtrs, weights, 2, outputPixel);
+
+    CHECK((int)outputPixel[KisGrayColorSpace::PIXEL_GRAY], 0);
+    CHECK((int)outputPixel[KisGrayColorSpace::PIXEL_GRAY_ALPHA], 0);
+
+    weights[0] = 128;
+    weights[1] = 127;
+
+    cs->mixColors(pixelPtrs, weights, 2, outputPixel);
+     
+    CHECK((int)outputPixel[KisGrayColorSpace::PIXEL_GRAY], 255);
+    CHECK((int)outputPixel[KisGrayColorSpace::PIXEL_GRAY_ALPHA], 128);
+
+    pixel1[KisGrayColorSpace::PIXEL_GRAY] = 200;
+    pixel1[KisGrayColorSpace::PIXEL_GRAY_ALPHA] = 255;
+
+    pixel2[KisGrayColorSpace::PIXEL_GRAY] = 100;
+    pixel2[KisGrayColorSpace::PIXEL_GRAY_ALPHA] = 255;
+
+    cs->mixColors(pixelPtrs, weights, 2, outputPixel);
+
+    CHECK((int)outputPixel[KisGrayColorSpace::PIXEL_GRAY], 150);
+    CHECK((int)outputPixel[KisGrayColorSpace::PIXEL_GRAY_ALPHA], 255);
+
+    pixel1[KisGrayColorSpace::PIXEL_GRAY] = 0;
+    pixel1[KisGrayColorSpace::PIXEL_GRAY_ALPHA] = 0;
+
+    pixel2[KisGrayColorSpace::PIXEL_GRAY] = 255;
+    pixel2[KisGrayColorSpace::PIXEL_GRAY_ALPHA] = 254;
+
+    weights[0] = 89;
+    weights[1] = 166;
+
+    cs->mixColors(pixelPtrs, weights, 2, outputPixel);
+
+    CHECK((int)outputPixel[KisGrayColorSpace::PIXEL_GRAY], 255);
+    CHECK((int)outputPixel[KisGrayColorSpace::PIXEL_GRAY_ALPHA], 165);
+}
+
+
diff --git a/chalk/colorspaces/gray_u8/tests/kis_strategy_colorspace_grayscale_tester.h b/chalk/colorspaces/gray_u8/tests/kis_strategy_colorspace_grayscale_tester.h
new file mode 100644
index 000000000..9b5f8d5e0
--- /dev/null
+++ b/chalk/colorspaces/gray_u8/tests/kis_strategy_colorspace_grayscale_tester.h
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef KIS_STRATEGY_COLORSPACE_GRAYSCALE_TESTER_H
+#define KIS_STRATEGY_COLORSPACE_GRAYSCALE_TESTER_H
+
+#include <kunittest/tester.h>
+
+class KisGrayColorSpaceTester : public KUnitTest::Tester
+{
+public:
+        void allTests();
+    void testMixColors();
+    void testBasics();
+};
+
+#endif
+
diff --git a/chalk/colorspaces/lms_f32/Makefile.am b/chalk/colorspaces/lms_f32/Makefile.am
new file mode 100644
index 000000000..537ba370d
--- /dev/null
+++ b/chalk/colorspaces/lms_f32/Makefile.am
@@ -0,0 +1,28 @@
+# Install the desktop file needed to detect the plugin
+kde_services_DATA = chalk_lms_f32_plugin.desktop
+
+INCLUDES  = \
+	-I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../chalkcolor/ \
+	$(KOFFICE_INCLUDES) \
+	$(all_includes)
+
+
+lib_LTLIBRARIES = libchalk_lms_f32.la
+libchalk_lms_f32_la_SOURCES = kis_lms_f32_colorspace.cc
+libchalk_lms_f32_la_LDFLAGS = $(all_libraries)
+libchalk_lms_f32_la_LIBADD =  ../../chalkcolor/libchalkcolor.la
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = chalk_lms_f32_plugin.la
+
+# Srcs for the plugin
+chalk_lms_f32_plugin_la_SOURCES = lms_f32_plugin.cc
+noinst_HEADERS = lms_f32_plugin.h kis_lms_f32_colorspace.h
+
+chalk_lms_f32_plugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms
+chalk_lms_f32_plugin_la_LIBADD =  libchalk_lms_f32.la ../../chalkcolor/libchalkcolor.la
+
+chalk_lms_f32_plugin_la_METASOURCES = AUTO
+
diff --git a/chalk/colorspaces/lms_f32/chalk_lms_f32_plugin.desktop b/chalk/colorspaces/lms_f32/chalk_lms_f32_plugin.desktop
new file mode 100644
index 000000000..9f4dab258
--- /dev/null
+++ b/chalk/colorspaces/lms_f32/chalk_lms_f32_plugin.desktop
@@ -0,0 +1,77 @@
+[Desktop Entry]
+Name=LMS Color Model (32-bit float)
+Name[bg]=Цветови модел LMS (32 бита)
+Name[ca]=Model de color LMS (paleta de 32 bits)
+Name[cy]=Model Lliw LMS (arnawf 32-did)
+Name[da]=LMS-farvemodel (32-bit float)
+Name[de]=LMS-Farbmodell (32-bit Fließkomma)
+Name[el]=Χρωματικό μοντέλο LMS (32 bit δεκαδικοί)
+Name[en_GB]=LMS Colour Model (32-bit float)
+Name[eo]=LMS-kolormodelo (32-bita flupunkto)
+Name[es]=Modelo de color LMS (decimal de 32 bits)
+Name[et]=LMS värvimudel (32-bitine murdarv)
+Name[fa]=مدل رنگ LMS )شناور ۳۲ بیتی(
+Name[fr]=Modèle de couleurs LMS (flottants 32 bits)
+Name[fy]=LMS-kleurmodel (32-bit float)
+Name[gl]=Modelo de Cores LMS (vírgula flutuante 32-bit)
+Name[he]=מודל צבעים LMS (32 סיביות)
+Name[hu]=LMS színmodell (32 bites lebegőpontos)
+Name[is]=LMS litategund (32-bita fleytitala)
+Name[it]=Modello di colore LMS (virgola mobile a 32 bit)
+Name[ja]=LMS カラーモデル (32 ビット浮動小数)
+Name[km]=គំរូ​ពណ៌ LMS (ចំនួន​ទស្សភាគ ៣២ ប៊ីត)
+Name[nb]=LMS-fargemodell (32-bit flyttall)
+Name[nds]=LMS-Klöörmodell (32-Bit Fleetkomma)
+Name[ne]=LMS रङ मोडेल (३२-बिट उत्प्लावन)
+Name[nl]=LMS-kleurmodel (32-bit float)
+Name[pl]=Przestrzeń barw LMS (32-bitowa liczba zmiennoprzecinkowa)
+Name[pt]=Modelo de Cor LMS (v. flutuante de 32-bits)
+Name[pt_BR]=Modelo de Cor LMS (ponto flutuante de 32-bits)
+Name[ru]=LMS (32-бит с плавающей точкой)
+Name[sk]=Model farieb LMS (32-bitové reálne čísla)
+Name[sl]=Barvni model LMS (32-bitna decimalno število)
+Name[sr]=LMS модел боја (32-битно реално)
+Name[sr@Latn]=LMS model boja (32-bitno realno)
+Name[sv]=LMS-färgmodell (32-bitars flyttal)
+Name[uk]=Модель кольору LMS (32-бітне дробове число)
+Name[uz]=LMS rang usuli (32-bit kasr)
+Name[uz@cyrillic]=LMS ранг усули (32-бит каср)
+Name[zh_CN]=LMS 色彩模型(32 位浮点)
+Name[zh_TW]=LMS 色彩模型 (32-bit 浮點數)
+Comment=Color model for LMS cone space (Long Middle and Short wavelengths)
+Comment[bg]=Цветови модел за интервали LMS (дълги, средни и къси вълни)
+Comment[ca]=Model de color per a conus d'espai LMC (amples d'ona llargs, mitjos i curts)
+Comment[cy]=Model lliw ar gyfer gofod côn LMS (tonfeddi Hir, Canolig a Byr)
+Comment[da]=Farvemodel for LMS-keglerum (Lange, mellemliggende og korte bølgelængder)
+Comment[de]=Farbmodell für LMS cone space (Lange, Mittelere und Kurze Wellenlängen)
+Comment[el]=Χρωματικό μοντέλο για χώρο χρωμάτων LMS (Μακρά μεσαία και σύντομα μήκη κύματος)
+Comment[en_GB]=Colour model for LMS cone space (Long Middle and Short wavelengths)
+Comment[es]=Modelo de color para el espacio cónico LMS (con longitudes de onda larga, media y corta)
+Comment[et]=LMS koonuse (pikad, keskmised ja lühikesed lainepikkused) värvimudel
+Comment[fa]=مدل رنگ برای فضای مخروط LMS )طول موج بلند، متوسط و کوتاه(
+Comment[fr]=Modèle de couleurs pour l'espace conique LMS (longueurs d'ondes longues, moyennes et courtes)
+Comment[fy]=Kleurmodel Foar LMS-kegelromte (lange, middelt en koarte golflingten)
+Comment[gl]=Modelo de Cores para o espazo do cone LMS (Long Middle and Short wavelengths)
+Comment[hu]=Színmodell az LMS kúptérhez (hosszú, közepes és rövid hullámhosszak)
+Comment[is]=Litategund fyrir LMS keilubil (löng miðlungs og stutt bylgjulengd)
+Comment[it]=Modello di colore per lo spazio conico LMS (lunghezze d'onda lunghe, medie e corte)
+Comment[km]=មូដែល​ពណ៌​សម្រាប់ LMS ដែល​មាន​ចន្លោះ​រាង​សាជី​មូល​ (ប្រវែង​រលក​ខ្លី និង​ពាក់​កណ្ដាល​វែង)
+Comment[nb]=Fargemodell for LMS-kjeglerom (Long Middle og Short bølgelengder)
+Comment[nds]=Klöörmodell för LMS-Kegelruum (Lang, middel un kort Bülgenlängden)
+Comment[ne]=LMS शंकु खाली स्थान (लामो मध्य र छोटो तरङलम्बाइहरू) का लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor LMS-kegelruimte (lange, middel en korte golflengten)
+Comment[pl]=Przestrzeń barw dla przestrzeni stożkowej LMS (średnie długie i krótkie długości fal)
+Comment[pt]=Modelo de cor para o espaço cónico do LMS (comprimentos de onda longos, médios e curtos)
+Comment[pt_BR]=Modelo de cor para o espaço cônico do LMS (comprimentos de onda longos, médios e curtos)
+Comment[ru]=Цветовое пространство LMS (Long Middle and Short wavelengths)
+Comment[sk]=Model farieb pre LMS kónický priestor (dlhé, stredné a krátke vlnové dĺžky)
+Comment[sl]=Barvni model za prostor stožca LMS (dolge, srednje in kratke valovne dolžine)
+Comment[sr]=Модел боја за LMS конусни простор (дуге средње и кратке таласне дужине)
+Comment[sr@Latn]=Model boja za LMS konusni prostor (duge srednje i kratke talasne dužine)
+Comment[sv]=Färgmodell för LMS-konrymd (Långa, mellanliggande och korta våglängder)
+Comment[uk]=Модель кольорів для конусного простору LMS (довгі середні і короткі довжини кольорів)
+Comment[zh_TW]=LMS cone space 顏色模式（Long Middle and Short 波長）
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-KDE-Library=chalk_lms_f32_plugin
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/lms_f32/kis_lms_f32_colorspace.cc b/chalk/colorspaces/lms_f32/kis_lms_f32_colorspace.cc
new file mode 100644
index 000000000..57475a03a
--- /dev/null
+++ b/chalk/colorspaces/lms_f32/kis_lms_f32_colorspace.cc
@@ -0,0 +1,385 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <limits.h>
+#include <stdlib.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_lms_f32_colorspace.h"
+#include "kis_color_conversions.h"
+
+namespace {
+    const TQ_INT32 MAX_CHANNEL_LMS = 3;
+    const TQ_INT32 MAX_CHANNEL_LMSA = 4;
+}
+
+#include "kis_integer_maths.h"
+
+#define FLOAT_MAX 1.0f //temp
+
+#define EPSILON 1e-6
+
+// FIXME: lcms doesn't support 32-bit float
+#define F32_LCMS_TYPE TYPE_BGRA_16
+
+// disable the lcms handling by setting profile=0
+KisLmsF32ColorSpace::KisLmsF32ColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile */*p*/) :
+    KisF32BaseColorSpace(KisID("LMSAF32", i18n("LMS (32-bit float/channel)")), F32_LCMS_TYPE, icSig3colorData, tqparent, 0)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Long"), i18n("L"), PIXEL_LONGWAVE * sizeof(float), KisChannelInfo::COLOR, KisChannelInfo::FLOAT32, sizeof(float)));
+    m_channels.push_back(new KisChannelInfo(i18n("Middle"), i18n("M"), PIXEL_MIDDLEWAVE * sizeof(float), KisChannelInfo::COLOR, KisChannelInfo::FLOAT32, sizeof(float)));
+    m_channels.push_back(new KisChannelInfo(i18n("Short"), i18n("S"), PIXEL_SHORTWAVE * sizeof(float), KisChannelInfo::COLOR, KisChannelInfo::FLOAT32, sizeof(float)));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), PIXEL_ALPHA * sizeof(float), KisChannelInfo::ALPHA, KisChannelInfo::FLOAT32, sizeof(float)));
+
+    m_alphaPos = PIXEL_ALPHA * sizeof(float);
+}
+
+KisLmsF32ColorSpace::~KisLmsF32ColorSpace()
+{
+}
+
+void KisLmsF32ColorSpace::setPixel(TQ_UINT8 *dst, float longWave, float middleWave, float shortWave, float alpha) const
+{
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->longWave = longWave;
+    dstPixel->middleWave = middleWave;
+    dstPixel->shortWave = shortWave;
+    dstPixel->alpha = alpha;
+}
+
+void KisLmsF32ColorSpace::getPixel(const TQ_UINT8 *src, float *longWave, float *middleWave, float *shortWave, float *alpha) const
+{
+    const Pixel *srcPixel = reinterpret_cast<const Pixel *>(src);
+
+    *longWave = srcPixel->longWave;
+    *middleWave = srcPixel->middleWave;
+    *shortWave = srcPixel->shortWave;
+    *alpha = srcPixel->alpha;
+}
+
+void KisLmsF32ColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 *dstU8, KisProfile * /*profile*/)
+{
+    Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
+
+    dst->longWave = computeLong(c.red(),c.green(),c.blue());
+    dst->middleWave = computeMiddle(c.red(),c.green(),c.blue());
+    dst->shortWave = computeShort(c.red(),c.green(),c.blue());
+}
+
+void KisLmsF32ColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dstU8, KisProfile * /*profile*/)
+{
+    Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
+
+    dst->longWave = computeLong(c.red(),c.green(),c.blue());
+    dst->middleWave = computeMiddle(c.red(),c.green(),c.blue());
+    dst->shortWave = computeShort(c.red(),c.green(),c.blue());
+    dst->alpha = UINT8_TO_FLOAT(opacity);
+}
+
+void KisLmsF32ColorSpace::toTQColor(const TQ_UINT8 *srcU8, TQColor *c, KisProfile * /*profile*/)
+{
+    const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
+
+    c->setRgb(computeRed(src->longWave,src->middleWave,src->shortWave), computeGreen(src->longWave,src->middleWave,src->shortWave), computeBlue(src->longWave,src->middleWave,src->shortWave));
+}
+
+void KisLmsF32ColorSpace::toTQColor(const TQ_UINT8 *srcU8, TQColor *c, TQ_UINT8 *opacity, KisProfile * /*profile*/)
+{
+   const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
+
+   c->setRgb(computeRed(src->longWave,src->middleWave,src->shortWave), computeGreen(src->longWave,src->middleWave,src->shortWave), computeBlue(src->longWave,src->middleWave,src->shortWave));
+   *opacity = FLOAT_TO_UINT8(src->alpha);
+}
+
+TQ_UINT8 KisLmsF32ColorSpace::difference(const TQ_UINT8 *src1U8, const TQ_UINT8 *src2U8)
+{
+    const Pixel *src1 = reinterpret_cast<const Pixel *>(src1U8);
+    const Pixel *src2 = reinterpret_cast<const Pixel *>(src2U8);
+
+    return FLOAT_TO_UINT8(TQMAX(TQABS(src2->longWave - src1->longWave),
+                          TQMAX(TQABS(src2->middleWave - src1->middleWave),
+                               TQABS(src2->shortWave - src1->shortWave))));
+}
+
+void KisLmsF32ColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    float totalLong = 0, totalMiddle = 0, totalShort = 0, newAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel *pixel = reinterpret_cast<const Pixel *>(*colors);
+
+        float alpha = pixel->alpha;
+        float alphaTimesWeight = alpha * UINT8_TO_FLOAT(*weights);
+
+        totalLong += pixel->longWave * alphaTimesWeight;
+        totalMiddle += pixel->middleWave * alphaTimesWeight;
+        totalShort += pixel->shortWave * alphaTimesWeight;
+        newAlpha += alphaTimesWeight;
+
+        weights++;
+        colors++;
+    }
+
+    Q_ASSERT(newAlpha <= F32_OPACITY_OPAQUE);
+
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->alpha = newAlpha;
+
+    if (newAlpha > EPSILON) {
+        totalLong = totalLong / newAlpha;
+        totalMiddle = totalMiddle / newAlpha;
+        totalShort = totalShort / newAlpha;
+    }
+
+    dstPixel->longWave = totalLong;
+    dstPixel->middleWave = totalMiddle;
+    dstPixel->shortWave = totalShort;
+}
+
+TQValueVector<KisChannelInfo *> KisLmsF32ColorSpace::channels() const
+{
+    return m_channels;
+}
+
+TQ_UINT32 KisLmsF32ColorSpace::nChannels() const
+{
+    return MAX_CHANNEL_LMSA;
+}
+
+TQ_UINT32 KisLmsF32ColorSpace::nColorChannels() const
+{
+    return MAX_CHANNEL_LMS;
+}
+
+TQ_UINT32 KisLmsF32ColorSpace::pixelSize() const
+{
+    return MAX_CHANNEL_LMSA * sizeof(float);
+}
+
+TQImage KisLmsF32ColorSpace::convertToTQImage(const TQ_UINT8 *dataU8, TQ_INT32 width, TQ_INT32 height,
+                                            KisProfile *  /*dstProfile*/,
+                                            TQ_INT32 /*renderingIntent*/, float /*exposure*/)
+
+{
+    const float *data = reinterpret_cast<const float *>(dataU8);
+
+    TQImage img = TQImage(width, height, 32, 0, TQImage::LittleEndian);
+    img.setAlphaBuffer(true);
+
+    TQ_INT32 i = 0;
+    uchar *j = img.bits();
+
+    while ( i < width * height * MAX_CHANNEL_LMSA) {
+        double l = *( data + i + PIXEL_LONGWAVE );
+        double m = *( data + i + PIXEL_MIDDLEWAVE );
+        double s = *( data + i + PIXEL_SHORTWAVE );
+        *( j + 3)  = FLOAT_TO_UINT8(*( data + i + PIXEL_ALPHA ));
+        *( j + 2 ) = computeRed(l,m,s);
+        *( j + 1 ) = computeGreen(l,m,s);
+        *( j + 0 ) = computeBlue(l,m,s);
+        i += MAX_CHANNEL_LMSA;
+        j += MAX_CHANNEL_LMSA;
+    }
+
+    /*
+    if (srcProfile != 0 && dstProfile != 0) {
+        convertPixelsTo(img.bits(), srcProfile,
+                img.bits(), this, dstProfile,
+                width * height, renderingIntent);
+    }
+    */
+    return img;
+}
+
+
+void KisLmsF32ColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    while (rows > 0) {
+
+        const float *src = reinterpret_cast<const float *>(srcRowStart);
+        float *dst = reinterpret_cast<float *>(dstRowStart);
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            float srcAlpha = src[PIXEL_ALPHA];
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha *= UINT8_TO_FLOAT(U8_tqmask);
+                }
+                tqmask++;
+            }
+
+            if (srcAlpha > F32_OPACITY_TRANSPARENT + EPSILON) {
+
+                if (opacity < F32_OPACITY_OPAQUE - EPSILON) {
+                    srcAlpha *= opacity;
+                }
+
+                if (srcAlpha > F32_OPACITY_OPAQUE - EPSILON) {
+                    memcpy(dst, src, MAX_CHANNEL_LMSA * sizeof(float));
+                } else {
+                    float dstAlpha = dst[PIXEL_ALPHA];
+
+                    float srcBlend;
+
+                    if (dstAlpha > F32_OPACITY_OPAQUE - EPSILON) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        float newAlpha = dstAlpha + (F32_OPACITY_OPAQUE - dstAlpha) * srcAlpha;
+                        dst[PIXEL_ALPHA] = newAlpha;
+
+                        if (newAlpha > EPSILON) {
+                            srcBlend = srcAlpha / newAlpha;
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend > F32_OPACITY_OPAQUE - EPSILON) {
+                        memcpy(dst, src, MAX_CHANNEL_LMS * sizeof(float));
+                    } else {
+                        dst[PIXEL_LONGWAVE] = FLOAT_BLEND(src[PIXEL_LONGWAVE], dst[PIXEL_LONGWAVE], srcBlend);
+                        dst[PIXEL_MIDDLEWAVE] = FLOAT_BLEND(src[PIXEL_MIDDLEWAVE], dst[PIXEL_MIDDLEWAVE], srcBlend);
+                        dst[PIXEL_SHORTWAVE] = FLOAT_BLEND(src[PIXEL_SHORTWAVE], dst[PIXEL_SHORTWAVE], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_LMSA;
+            dst += MAX_CHANNEL_LMSA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart) {
+            tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+}
+
+void KisLmsF32ColorSpace::compositeErase(TQ_UINT8 *dst,
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src,
+            TQ_INT32 srcRowSize,
+            const TQ_UINT8 *srcAlphaMask,
+            TQ_INT32 tqmaskRowStride,
+            TQ_INT32 rows,
+            TQ_INT32 cols,
+            float /*opacity*/)
+{
+    while (rows-- > 0)
+    {
+        const Pixel *s = reinterpret_cast<const Pixel *>(src);
+        Pixel *d = reinterpret_cast<Pixel *>(dst);
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (TQ_INT32 i = cols; i > 0; i--, s++, d++)
+        {
+            float srcAlpha = s->alpha;
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = FLOAT_BLEND(srcAlpha, F32_OPACITY_OPAQUE, UINT8_TO_FLOAT(U8_tqmask));
+                }
+                tqmask++;
+            }
+            d->alpha = srcAlpha * d->alpha;
+        }
+
+        dst += dstRowSize;
+        src += srcRowSize;
+        if(srcAlphaMask) {
+            srcAlphaMask += tqmaskRowStride;
+        }
+    }
+}
+
+void KisLmsF32ColorSpace::compositeCopy(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride,
+                        const TQ_UINT8 */*tqmaskRowStart*/, TQ_INT32 /*tqmaskRowStride*/, TQ_INT32 rows, TQ_INT32 numColumns, float /*opacity*/)
+{
+    while (rows > 0) {
+        memcpy(dstRowStart, srcRowStart, numColumns * sizeof(Pixel));
+        --rows;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+    }
+}
+
+void KisLmsF32ColorSpace::bitBlt(TQ_UINT8 *dst,
+                      TQ_INT32 dstRowStride,
+                      const TQ_UINT8 *src,
+                      TQ_INT32 srcRowStride,
+                      const TQ_UINT8 *tqmask,
+                      TQ_INT32 tqmaskRowStride,
+                      TQ_UINT8 U8_opacity,
+                      TQ_INT32 rows,
+                      TQ_INT32 cols,
+                      const KisCompositeOp& op)
+{
+    float opacity = UINT8_TO_FLOAT(U8_opacity);
+
+    switch (op.op()) {
+    case COMPOSITE_UNDEF:
+        // Undefined == no composition
+        break;
+    case COMPOSITE_OVER:
+        compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY:
+        compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ERASE:
+        compositeErase(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    default:
+        break;
+    }
+}
+
+KisCompositeOpList KisLmsF32ColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    return list;
+}
+
diff --git a/chalk/colorspaces/lms_f32/kis_lms_f32_colorspace.h b/chalk/colorspaces/lms_f32/kis_lms_f32_colorspace.h
new file mode 100644
index 000000000..36e9a01cf
--- /dev/null
+++ b/chalk/colorspaces/lms_f32/kis_lms_f32_colorspace.h
@@ -0,0 +1,157 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_STRATEGY_COLORSPACE_LMS_F32_H_
+#define KIS_STRATEGY_COLORSPACE_LMS_F32_H_
+
+#include <tqcolor.h>
+
+#include <klocale.h>
+
+#include <koffice_export.h>
+
+#include "kis_global.h"
+#include "kis_f32_base_colorspace.h"
+
+class KisColorSpaceFactoryRegistry;
+
+class KRITATOOL_EXPORT KisLmsF32ColorSpace : public KisF32BaseColorSpace {
+public:
+    KisLmsF32ColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p);
+    virtual ~KisLmsF32ColorSpace();
+
+    virtual bool willDegrade(ColorSpaceIndependence independence)
+        {
+            if (independence == TO_RGBA8 || independence == TO_LAB16)
+                return true;
+            else
+                return false;
+        };
+
+
+public:
+    void setPixel(TQ_UINT8 *pixel, float longWave, float middleWave, float shortWave, float alpha) const;
+    void getPixel(const TQ_UINT8 *pixel, float *longWave, float *middleWave, float *shortWave, float *alpha) const;
+
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile * profile = 0);
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * profile = 0);
+
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * profile = 0);
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile = 0);
+
+    virtual TQ_UINT8 difference(const TQ_UINT8 *src1, const TQ_UINT8 *src2);
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const;
+    virtual TQ_UINT32 nColorChannels() const;
+    virtual TQ_UINT32 pixelSize() const;
+
+    virtual bool hasHighDynamicRange() const { return false; }
+
+    virtual TQImage convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                       KisProfile *  dstProfile,
+                       TQ_INT32 renderingIntent,
+                       float exposure = 0.0f);
+
+    virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+
+protected:
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dstRowStride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeCopy(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+
+private:
+    inline TQ_UINT8 computeRed(float l, float m, float s) const
+    {
+        return FLOAT_TO_UINT8(4.4679*l - 3.58738*m + 0.1193*s);
+    }
+    inline TQ_UINT8 computeGreen(float l, float m, float s) const
+    {
+        return FLOAT_TO_UINT8(-1.2186*l + 2.3809*m - 0.1624*s);
+    }
+    inline TQ_UINT8 computeBlue(float l, float m, float s) const
+    {
+        return FLOAT_TO_UINT8(0.0497*l - 0.2439*m + 1.2045*s);
+    }
+    inline float computeLong(TQ_UINT8 r, TQ_UINT8 g, TQ_UINT8 b) const
+    {
+        return 0.3811*UINT8_TO_FLOAT(r) + 0.5783*UINT8_TO_FLOAT(g) + 0.0402*UINT8_TO_FLOAT(b);
+    }
+    inline float computeMiddle(TQ_UINT8 r, TQ_UINT8 g, TQ_UINT8 b) const
+    {
+        return 0.1967*UINT8_TO_FLOAT(r) + 0.7244*UINT8_TO_FLOAT(g) + 0.0782*UINT8_TO_FLOAT(b);
+    }
+    inline float computeShort(TQ_UINT8 r, TQ_UINT8 g, TQ_UINT8 b) const
+    {
+        return 0.0241*UINT8_TO_FLOAT(r) + 0.1288*UINT8_TO_FLOAT(g) + 0.8444*UINT8_TO_FLOAT(b);
+    }
+
+    friend class KisLmsF32ColorSpaceTester;
+
+    static const TQ_UINT8 PIXEL_LONGWAVE = 0;
+    static const TQ_UINT8 PIXEL_MIDDLEWAVE = 1;
+    static const TQ_UINT8 PIXEL_SHORTWAVE = 2;
+    static const TQ_UINT8 PIXEL_ALPHA = 3;
+
+    struct Pixel {
+        float longWave;
+        float middleWave;
+        float shortWave;
+        float alpha;
+    };
+};
+
+class KisLmsF32ColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const { return KisID("LMSAF32", i18n("LMS Cone Space (32-bit float/channel)")); };
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() { return 0; }; // FIXME: lcms do not support LMS cone space
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return icMaxEnumData; };
+
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisLmsF32ColorSpace(tqparent, p); };
+
+    virtual TQString defaultProfile() { return "sRGB built-in - (lcms internal)"; };
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_LMS_F32_H_
+
diff --git a/chalk/colorspaces/lms_f32/lms_f32_plugin.cc b/chalk/colorspaces/lms_f32/lms_f32_plugin.cc
new file mode 100644
index 000000000..d137c8e82
--- /dev/null
+++ b/chalk/colorspaces/lms_f32/lms_f32_plugin.cc
@@ -0,0 +1,64 @@
+/*
+* lms_f32_plugin.cc -- Part of Chalk
+*
+* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+*  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
+*
+*  This program is free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  This program is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  You should have received a copy of the GNU General Public License
+*  along with this program; if not, write to the Free Software
+*  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include <kinstance.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+
+#include <kis_debug_areas.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_basic_histogram_producers.h>
+
+#include "lms_f32_plugin.h"
+#include "kis_lms_f32_colorspace.h"
+
+typedef KGenericFactory<LMSF32Plugin> LMSF32PluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalk_lms_f32_plugin, LMSF32PluginFactory( "chalk" ) )
+
+
+LMSF32Plugin::LMSF32Plugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(LMSF32PluginFactory::instance());
+
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") )
+    {
+	KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>(tqparent);
+
+        KisColorSpace * colorSpaceLMSF32  = new KisLmsF32ColorSpace(f, 0);
+
+        KisColorSpaceFactory * csf  = new KisLmsF32ColorSpaceFactory();
+        f->add(csf);
+
+        KisHistogramProducerFactoryRegistry::instance()->add(
+            new KisBasicHistogramProducerFactory<KisBasicF32HistogramProducer>
+            (KisID("LMSF32HISTO", i18n("Float32")), colorSpaceLMSF32) );
+    }
+
+}
+
+LMSF32Plugin::~LMSF32Plugin()
+{
+}
+
+#include "lms_f32_plugin.moc"
diff --git a/chalk/colorspaces/lms_f32/lms_f32_plugin.h b/chalk/colorspaces/lms_f32/lms_f32_plugin.h
new file mode 100644
index 000000000..7d9229a69
--- /dev/null
+++ b/chalk/colorspaces/lms_f32/lms_f32_plugin.h
@@ -0,0 +1,40 @@
+/*
+ *  Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
+ *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef LMS_F32_PLUGIN_H_
+#define LMS_F32_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the LMS F32 colour space strategy.
+ */
+class LMSF32Plugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    LMSF32Plugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~LMSF32Plugin();
+
+};
+
+
+#endif // LMS_F32_PLUGIN_H_
diff --git a/chalk/colorspaces/lms_f32/lms_f32_plugin.rc b/chalk/colorspaces/lms_f32/lms_f32_plugin.rc
new file mode 100644
index 000000000..ec36156c7
--- /dev/null
+++ b/chalk/colorspaces/lms_f32/lms_f32_plugin.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui library="chalk_lms_f32_plugin" version="1">
+<Menu name="Image"><text>&amp;Image</text>
+    <Menu name="Mode"><text>&amp;Mode</text>
+            <Action name="convert to RGB(A) (32-bit float)"/>
+    </Menu>
+</Menu>
+
+</kpartgui>
diff --git a/chalk/colorspaces/rgb_f16half/Makefile.am b/chalk/colorspaces/rgb_f16half/Makefile.am
new file mode 100644
index 000000000..2c3bbfa17
--- /dev/null
+++ b/chalk/colorspaces/rgb_f16half/Makefile.am
@@ -0,0 +1,35 @@
+# Install the desktop file needed to detect the plugin
+kde_services_DATA = chalk_rgb_f16half_plugin.desktop
+
+INCLUDES  = \
+	-I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../chalkcolor/ \
+	$(OPENEXR_CFLAGS) \
+	$(KOFFICE_INCLUDES) \
+	$(all_includes)
+
+
+lib_LTLIBRARIES = libchalk_rgb_f16half.la
+libchalk_rgb_f16half_la_SOURCES = kis_rgb_f16half_colorspace.cc
+libchalk_rgb_f16half_la_LDFLAGS = $(all_libraries)
+libchalk_rgb_f16half_la_LIBADD =  ../../chalkcolor/libchalkcolor.la
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = chalk_rgb_f16half_plugin.la
+
+# Srcs for the plugin
+chalk_rgb_f16half_plugin_la_SOURCES = rgb_f16half_plugin.cc
+noinst_HEADERS = rgb_f16half_plugin.h kis_rgb_f16half_colorspace.h
+
+chalk_rgb_f16half_plugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms
+chalk_rgb_f16half_plugin_la_LIBADD = libchalk_rgb_f16half.la ../../chalkcolor/libchalkcolor.la
+
+chalk_rgb_f16half_plugin_la_METASOURCES = AUTO
+
+if include_kunittest_tests
+TESTSDIR = tests
+endif
+
+SUBDIRS = . $(TESTSDIR)
+
diff --git a/chalk/colorspaces/rgb_f16half/chalk_rgb_f16half_plugin.desktop b/chalk/colorspaces/rgb_f16half/chalk_rgb_f16half_plugin.desktop
new file mode 100644
index 000000000..523903bf3
--- /dev/null
+++ b/chalk/colorspaces/rgb_f16half/chalk_rgb_f16half_plugin.desktop
@@ -0,0 +1,76 @@
+[Desktop Entry]
+Name=RGB Color Model (16-bit float 'half')
+Name[bg]=Цветови модел RGB (16-bit float 'half')
+Name[ca]=Model de color RGB (paleta 'mitja' de 16 bits)
+Name[cy]=Model Lliw RGB (arnawf 16-did 'hanner')
+Name[da]=RGB-farvemodel (16-bit heltal 'halv')
+Name[de]=RGB-Farbmodell (16-bit Fließkomma 'Halb')
+Name[el]=Χρωματικό μοντέλο RGB (16 bit μισοί δεκαδικοί)
+Name[en_GB]=RGB Colour Model (16-bit float 'half')
+Name[es]=Modelo de color RGB (decimal «medio» de 16 bits)
+Name[et]=RGB värvimudel (16-bitine murdarv 'half')
+Name[fa]=مدل رنگ RGB )»نیمه« شناور ۱۶ بیتی(
+Name[fr]=Modèle de couleurs RVB (demi flottants 16 bits)
+Name[fy]=RGB-kleurmodel (16-bit float 'heal')
+Name[gl]=Modelo de Cores RGB (vírgula flutuante 16-bit 'half')
+Name[he]=מודל צבעים RGB (16 סיביות)
+Name[hu]=RGB színmodell (16 bites lebegőpontos - 'feles')
+Name[is]=RGB litategund (16-bita fleytitala)
+Name[it]=Modello di colore RGB (semi-virgola mobile a 16 bit)
+Name[ja]=RGB カラーモデル (16-bit float 'half')
+Name[km]=ម៉ូដែល​ពណ៌​RGB  (ចំនួន​ទសភាគ 16 ប៊ីត​ 'ពាក់​កណ្ដាល')
+Name[nb]=RGB-fargemodell (16-bit flytende 'halv')
+Name[nds]=RGB-Klöörmodell (16-Bit Fleetkomma "half")
+Name[ne]=RGB रङ मोडेल (१६-बिट उत्प्लावन 'आधा')
+Name[nl]=RGB-kleurmodel (16-bit float 'half')
+Name[pl]=Przestrzeń barw RGB ("połowa" 16-bitowej liczby zmiennoprzecinkowej)
+Name[pt]=Modelo de Cor RGB (v. flutuante de 16-bits 'half')
+Name[pt_BR]=Modelo de Cor RGB (ponto flutuante de 16-bits 'half')
+Name[ru]=RGB (16-бит с плавающей точкой)
+Name[sk]=Model farieb RGB (16-bitové reálne čísla 'half')
+Name[sl]=Barvni model RGB (16-bitno celo število, »polovica«)
+Name[sr]=RGB модел боја (16-битно реално „полу“)
+Name[sr@Latn]=RGB model boja (16-bitno realno „polu“)
+Name[sv]=RGB-färgmodell (16-bitars flyttal 'halva')
+Name[uk]=Модель кольору RGB (16-бітне дробове число "half")
+Name[uz]=RGB rang usuli (16-bit 'yarim' kasr)
+Name[uz@cyrillic]=RGB ранг усули (16-бит 'ярим' каср)
+Name[zh_TW]=RGB 色彩模型 (32-bit 浮點數「半」)
+Comment=Color model for 16-bit floating point 'half' per channel RGB images
+Comment[bg]=Цветови модел за 16 битови изображения RGB за полуканал
+Comment[ca]=Model de color per a paleta 'mitja' de 16 bits-canal d'imatges RGB
+Comment[da]=Farvemodel for 16-bit decimaltal 'halvdel' pr kanal RGB-billeder
+Comment[de]=Farbmodell für 16-bit Fließkomma 'Halb' pro Kanal RGB-Bilder
+Comment[el]=Χρωματικό μοντέλο για 16-bit μισούς δεκαδικούς ανά κανάλι RGB εικόνες
+Comment[en_GB]=Colour model for 16-bit floating point 'half' per channel RGB images
+Comment[es]=Modelo de color decimal «medio» de 16 bits por canal para imágenes RGB
+Comment[et]=16-bitiste murdarvuliste ('half') kanalitega RGB-piltide värvimudel
+Comment[fa]=مدل رنگ برای ممیز »نیمه« شناور برای هر تصویر RGB مجرا
+Comment[fi]=Värimalli 16-bittisille/kanavaisille RGB-kuville
+Comment[fr]=Modèle de couleurs pour des images RVB en 16 bits flottants (demi) par canal
+Comment[fy]=Kleurmodel foar RGB-ôfbeeldings mei 16-bit driuwende komma 'heal' de kanaal
+Comment[gl]=Espazo de cores para imaxes RGB de 16-bit de vírgula flutuante 'half' por canal
+Comment[he]=מודל צבעים עבור תמונות RGB של 16 סיביות/ערוצים
+Comment[hu]=Színmodell 16 bit (lebegőpontos, 'feles')/csatorna RGB képekhez
+Comment[is]=Litategund fyrir 16-bita fleytitölu á rás RGB myndir
+Comment[it]=Modello di colore per immagini RGB in semi-virgola mobile a canale di 16 bit
+Comment[km]=ម៉ូលដែល​ពណ៌​ 16 ប៊ីត​ចំណុច​ដែល​អណ្ដែត​ 'ពាក្យ​កណ្ដាល' ក្នុង​ឆានែល​រូបភាព​ RGB 
+Comment[nb]=Fargemodell for RGB-bilde med 16 bit flyttall 'halv' per kanal
+Comment[nds]=Klöörmodell för RGB-Biller mit 16-Bit Fleetkomma "half" per Kanaal
+Comment[ne]='आधा' प्रति च्यानल RGB छविहरूको १६-बिट उत्प्लावन बिन्दुका लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor RGB-afbeeldingen met 16-bit drijvende komma 'half' per kanaal
+Comment[pl]=Przestrzeń barw dla obrazków RGB z "połową" 16-bitowej liczby zmiennoprzecinkowej na kanał
+Comment[pt]=Modelo de cor para imagens RGB com 16 bits de vírgula flutuante 'half' por canal
+Comment[pt_BR]=Modelo de cor para imagens RGB com 16 bits de ponto flutuante 'half' por canal
+Comment[ru]=Цветовое пространство RGB (16-бит/канал с плавающей точкой)
+Comment[sk]=Model farieb pre RGB obrázky so 16-bitovými reálnymi číslami 'half' na kanál
+Comment[sl]=Barvni model za slike RGB s 16-bitno plavajočo vejico na kanal
+Comment[sr]=Модел боја за RGB слике, 16-битно реално „полу“ по каналу
+Comment[sr@Latn]=Model boja za RGB slike, 16-bitno realno „polu“ po kanalu
+Comment[sv]=Färgmodell för 16-bitars flyttal 'halva' per kanal RGB-bilder
+Comment[uk]=Модель кольорів для 16-бітних зображень RGB, з плаваючою комою, "половина" на канал
+Comment[zh_TW]=每色頻 16-bit 半浮點 RGB 圖片的色彩模型
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-KDE-Library=chalk_rgb_f16half_plugin
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/rgb_f16half/kis_rgb_f16half_colorspace.cc b/chalk/colorspaces/rgb_f16half/kis_rgb_f16half_colorspace.cc
new file mode 100644
index 000000000..fb2df8c1a
--- /dev/null
+++ b/chalk/colorspaces/rgb_f16half/kis_rgb_f16half_colorspace.cc
@@ -0,0 +1,952 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <limits.h>
+#include <stdlib.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_rgb_f16half_colorspace.h"
+#include "kis_f32_base_colorspace.h"
+#include "kis_color_conversions.h"
+
+namespace {
+    const TQ_INT32 MAX_CHANNEL_RGB = 3;
+    const TQ_INT32 MAX_CHANNEL_RGBA = 4;
+}
+
+#include "kis_integer_maths.h"
+
+#ifndef HAVE_POWF
+#undef powf
+#define powf pow
+#endif
+
+//#define HALF_MAX ((half)1.0f) //temp
+
+#define EPSILON HALF_EPSILON
+
+// FIXME: lcms doesn't support 16-bit float
+#define RGBAF16HALF_LCMS_TYPE TYPE_BGRA_16
+
+KisRgbF16HalfColorSpace::KisRgbF16HalfColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) :
+    KisF16HalfBaseColorSpace(KisID("RGBAF16HALF", i18n("RGB (16-bit float/channel)")), RGBAF16HALF_LCMS_TYPE, icSigRgbData, tqparent, p)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Red"), i18n("R"), PIXEL_RED * sizeof(half), KisChannelInfo::COLOR, KisChannelInfo::FLOAT16, sizeof(half)));
+    m_channels.push_back(new KisChannelInfo(i18n("Green"), i18n("G"), PIXEL_GREEN * sizeof(half), KisChannelInfo::COLOR, KisChannelInfo::FLOAT16, sizeof(half)));
+    m_channels.push_back(new KisChannelInfo(i18n("Blue"), i18n("B"), PIXEL_BLUE * sizeof(half), KisChannelInfo::COLOR, KisChannelInfo::FLOAT16, sizeof(half)));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), PIXEL_ALPHA * sizeof(half), KisChannelInfo::ALPHA, KisChannelInfo::FLOAT16, sizeof(half)));
+
+    //cmsHPROFILE hProfile = cmsCreate_sRGBProfile();
+    //setDefaultProfile( new KisProfile(hProfile, RGBAF16HALF_LCMS_TYPE) );
+
+    m_alphaPos = PIXEL_ALPHA * sizeof(half);
+}
+
+KisRgbF16HalfColorSpace::~KisRgbF16HalfColorSpace()
+{
+}
+
+void KisRgbF16HalfColorSpace::setPixel(TQ_UINT8 *dst, half red, half green, half blue, half alpha) const
+{
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->red = red;
+    dstPixel->green = green;
+    dstPixel->blue = blue;
+    dstPixel->alpha = alpha;
+}
+
+void KisRgbF16HalfColorSpace::getPixel(const TQ_UINT8 *src, half *red, half *green, half *blue, half *alpha) const
+{
+    const Pixel *srcPixel = reinterpret_cast<const Pixel *>(src);
+
+    *red = srcPixel->red;
+    *green = srcPixel->green;
+    *blue = srcPixel->blue;
+    *alpha = srcPixel->alpha;
+}
+
+void KisRgbF16HalfColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 *dstU8, KisProfile *)
+{
+    Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
+
+    dst->red = UINT8_TO_HALF(c.red());
+    dst->green = UINT8_TO_HALF(c.green());
+    dst->blue = UINT8_TO_HALF(c.blue());
+}
+
+void KisRgbF16HalfColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dstU8, KisProfile *)
+{
+    Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
+
+    dst->red = UINT8_TO_HALF(c.red());
+    dst->green = UINT8_TO_HALF(c.green());
+    dst->blue = UINT8_TO_HALF(c.blue());
+    dst->alpha = UINT8_TO_HALF(opacity);
+}
+
+void KisRgbF16HalfColorSpace::toTQColor(const TQ_UINT8 *srcU8, TQColor *c, KisProfile *)
+{
+    const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
+
+    c->setRgb(HALF_TO_UINT8(src->red), HALF_TO_UINT8(src->green), HALF_TO_UINT8(src->blue));
+}
+
+void KisRgbF16HalfColorSpace::toTQColor(const TQ_UINT8 *srcU8, TQColor *c, TQ_UINT8 *opacity, KisProfile *)
+{
+    const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
+
+    c->setRgb(HALF_TO_UINT8(src->red), HALF_TO_UINT8(src->green), HALF_TO_UINT8(src->blue));
+    *opacity = HALF_TO_UINT8(src->alpha);
+}
+
+TQ_UINT8 KisRgbF16HalfColorSpace::difference(const TQ_UINT8 *src1U8, const TQ_UINT8 *src2U8)
+{
+    const Pixel *src1 = reinterpret_cast<const Pixel *>(src1U8);
+    const Pixel *src2 = reinterpret_cast<const Pixel *>(src2U8);
+
+    return HALF_TO_UINT8(TQMAX(TQABS(src2->red - src1->red),
+                TQMAX(TQABS(src2->green - src1->green),
+                     TQABS(src2->blue - src1->blue))));
+}
+
+void KisRgbF16HalfColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    half totalRed = 0, totalGreen = 0, totalBlue = 0, newAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel *pixel = reinterpret_cast<const Pixel *>(*colors);
+
+        half alpha = pixel->alpha;
+        half alphaTimesWeight = alpha * UINT8_TO_HALF(*weights);
+
+        totalRed += pixel->red * alphaTimesWeight;
+        totalGreen += pixel->green * alphaTimesWeight;
+        totalBlue += pixel->blue * alphaTimesWeight;
+        newAlpha += alphaTimesWeight;
+
+        weights++;
+        colors++;
+    }
+
+    Q_ASSERT(newAlpha <= F16HALF_OPACITY_OPAQUE);
+
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->alpha = newAlpha;
+
+    if (newAlpha > EPSILON) {
+        totalRed = totalRed / newAlpha;
+        totalGreen = totalGreen / newAlpha;
+        totalBlue = totalBlue / newAlpha;
+    }
+
+    dstPixel->red = totalRed;
+    dstPixel->green = totalGreen;
+    dstPixel->blue = totalBlue;
+}
+
+void KisRgbF16HalfColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const
+{
+    half totalRed = 0, totalGreen = 0, totalBlue = 0, totalAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel * pixel = reinterpret_cast<const Pixel *>( *colors );
+
+        half weight = *kernelValues;
+
+        if (weight != 0) {
+            totalRed += pixel->red * UINT8_TO_HALF(weight);
+            totalGreen += pixel->green * UINT8_TO_HALF(weight);
+            totalBlue += pixel->blue * UINT8_TO_HALF(weight);
+            totalAlpha += pixel->alpha * UINT8_TO_HALF(weight);
+        }
+        colors++;
+        kernelValues++;
+    }
+
+    Pixel * p = reinterpret_cast< Pixel *>( dst );
+
+    if (channelFlags & KisChannelInfo::FLAG_COLOR) {
+        p->red = CLAMP( ( totalRed / factor) + offset, 0, HALF_MAX);
+        p->green = CLAMP( ( totalGreen / factor) + offset, 0, HALF_MAX);
+        p->blue = CLAMP( ( totalBlue / factor) + offset, 0, HALF_MAX);
+    }
+    if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+        p->alpha = CLAMP((totalAlpha/ factor) + offset, 0, HALF_MAX);
+    }
+}
+
+
+void KisRgbF16HalfColorSpace::invertColor(TQ_UINT8 * src, TQ_INT32 nPixels)
+{
+    TQ_UINT32 psize = pixelSize();
+
+    while (nPixels--)
+    {
+        Pixel * p = reinterpret_cast< Pixel *>( src );
+        p->red = 1.0 - p->red;
+        p->green = 1.0 - p->green;
+        p->blue = 1.0 - p->blue;
+        src += psize;
+    }
+
+}
+
+
+TQ_UINT8 KisRgbF16HalfColorSpace::intensity8(const TQ_UINT8 * src) const
+{
+    const Pixel * p = reinterpret_cast<const Pixel *>( src );
+
+    return HALF_TO_UINT8((p->red * 0.30 + p->green * 0.59 + p->blue * 0.11) + 0.5);
+}
+
+
+TQValueVector<KisChannelInfo *> KisRgbF16HalfColorSpace::channels() const
+{
+    return m_channels;
+}
+
+TQ_UINT32 KisRgbF16HalfColorSpace::nChannels() const
+{
+    return MAX_CHANNEL_RGBA;
+}
+
+TQ_UINT32 KisRgbF16HalfColorSpace::nColorChannels() const
+{
+    return MAX_CHANNEL_RGB;
+}
+
+TQ_UINT32 KisRgbF16HalfColorSpace::pixelSize() const
+{
+    return MAX_CHANNEL_RGBA * sizeof(half);
+}
+
+TQ_UINT8 convertToDisplay(float value, float exposureFactor, float gamma)
+{
+    //value *= pow(2, exposure + 2.47393);
+    value *= exposureFactor;
+
+    value = powf(value, gamma);
+
+    // scale middle gray to the target framebuffer value
+
+    value *= 84.66f;
+
+    int valueInt = (int)(value + 0.5);
+
+    return CLAMP(valueInt, 0, 255);
+}
+
+TQImage KisRgbF16HalfColorSpace::convertToTQImage(const TQ_UINT8 *dataU8, TQ_INT32 width, TQ_INT32 height,
+                         KisProfile *  /*dstProfile*/,
+                         TQ_INT32 /*renderingIntent*/, float exposure)
+
+{
+    const half *data = reinterpret_cast<const half *>(dataU8);
+
+    TQImage img = TQImage(width, height, 32, 0, TQImage::LittleEndian);
+    img.setAlphaBuffer(true);
+
+    TQ_INT32 i = 0;
+    uchar *j = img.bits();
+
+    // XXX: For now assume gamma 2.2.
+    float gamma = 1 / 2.2;
+    float exposureFactor = powf(2, exposure + 2.47393);
+
+    while ( i < width * height * MAX_CHANNEL_RGBA) {
+        *( j + 3)  = HALF_TO_UINT8(*( data + i + PIXEL_ALPHA ));
+        *( j + 2 ) = convertToDisplay(*( data + i + PIXEL_RED ), exposureFactor, gamma);
+        *( j + 1 ) = convertToDisplay(*( data + i + PIXEL_GREEN ), exposureFactor, gamma);
+        *( j + 0 ) = convertToDisplay(*( data + i + PIXEL_BLUE ), exposureFactor, gamma);
+        i += MAX_CHANNEL_RGBA;
+        j += MAX_CHANNEL_RGBA;
+    }
+
+    /*
+    if (srcProfile != 0 && dstProfile != 0) {
+        convertPixelsTo(img.bits(), srcProfile,
+                img.bits(), this, dstProfile,
+                width * height, renderingIntent);
+    }
+    */
+    return img;
+}
+
+
+void KisRgbF16HalfColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    while (rows > 0) {
+
+        const half *src = reinterpret_cast<const half *>(srcRowStart);
+        half *dst = reinterpret_cast<half *>(dstRowStart);
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            half srcAlpha = src[PIXEL_ALPHA];
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha *= UINT8_TO_HALF(U8_tqmask);
+                }
+                tqmask++;
+            }
+
+            if (srcAlpha > F16HALF_OPACITY_TRANSPARENT + EPSILON) {
+
+                if (opacity < F16HALF_OPACITY_OPAQUE - EPSILON) {
+                    srcAlpha *= opacity;
+                }
+
+                if (srcAlpha > F16HALF_OPACITY_OPAQUE - EPSILON) {
+                    memcpy(dst, src, MAX_CHANNEL_RGBA * sizeof(half));
+                } else {
+                    half dstAlpha = dst[PIXEL_ALPHA];
+
+                    half srcBlend;
+
+                    if (dstAlpha > F16HALF_OPACITY_OPAQUE - EPSILON) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        half newAlpha = dstAlpha + (F16HALF_OPACITY_OPAQUE - dstAlpha) * srcAlpha;
+                        dst[PIXEL_ALPHA] = newAlpha;
+
+                        if (newAlpha > EPSILON) {
+                            srcBlend = srcAlpha / newAlpha;
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend > F16HALF_OPACITY_OPAQUE - EPSILON) {
+                        memcpy(dst, src, MAX_CHANNEL_RGB * sizeof(half));
+                    } else {
+                        dst[PIXEL_RED] = HALF_BLEND(src[PIXEL_RED], dst[PIXEL_RED], srcBlend);
+                        dst[PIXEL_GREEN] = HALF_BLEND(src[PIXEL_GREEN], dst[PIXEL_GREEN], srcBlend);
+                        dst[PIXEL_BLUE] = HALF_BLEND(src[PIXEL_BLUE], dst[PIXEL_BLUE], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart) {
+            tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+}
+
+#define COMMON_COMPOSITE_OP_PROLOG() \
+    while (rows > 0) { \
+    \
+        const half *src = reinterpret_cast<const half *>(srcRowStart); \
+        half *dst = reinterpret_cast<half *>(dstRowStart); \
+        TQ_INT32 columns = numColumns; \
+        const TQ_UINT8 *tqmask = tqmaskRowStart; \
+    \
+        while (columns > 0) { \
+    \
+            half srcAlpha = src[PIXEL_ALPHA]; \
+            half dstAlpha = dst[PIXEL_ALPHA]; \
+    \
+            srcAlpha = TQMIN(srcAlpha, dstAlpha); \
+    \
+            if (tqmask != 0) { \
+                TQ_UINT8 U8_tqmask = *tqmask; \
+    \
+                if (U8_tqmask != OPACITY_OPAQUE) { \
+                    srcAlpha *= UINT8_TO_HALF(U8_tqmask); \
+                } \
+                tqmask++; \
+            } \
+    \
+            if (srcAlpha > F16HALF_OPACITY_TRANSPARENT + EPSILON) { \
+    \
+                if (opacity < F16HALF_OPACITY_OPAQUE - EPSILON) { \
+                    srcAlpha *= opacity; \
+                } \
+    \
+                half srcBlend; \
+    \
+                if (dstAlpha > F16HALF_OPACITY_OPAQUE - EPSILON) { \
+                    srcBlend = srcAlpha; \
+                } else { \
+                    half newAlpha = dstAlpha + (F16HALF_OPACITY_OPAQUE - dstAlpha) * srcAlpha; \
+                    dst[PIXEL_ALPHA] = newAlpha; \
+    \
+                    if (newAlpha > EPSILON) { \
+                        srcBlend = srcAlpha / newAlpha; \
+                    } else { \
+                        srcBlend = srcAlpha; \
+                    } \
+                }
+
+#define COMMON_COMPOSITE_OP_EPILOG() \
+            } \
+    \
+            columns--; \
+            src += MAX_CHANNEL_RGBA; \
+            dst += MAX_CHANNEL_RGBA; \
+        } \
+    \
+        rows--; \
+        srcRowStart += srcRowStride; \
+        dstRowStart += dstRowStride; \
+        if(tqmaskRowStart) { \
+            tqmaskRowStart += tqmaskRowStride; \
+        } \
+    }
+
+void KisRgbF16HalfColorSpace::compositeMultiply(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        half srcColor = src[PIXEL_RED];
+        half dstColor = dst[PIXEL_RED];
+
+        srcColor = srcColor * dstColor;
+
+        dst[PIXEL_RED] = HALF_BLEND(srcColor, dstColor, srcBlend);
+
+        srcColor = src[PIXEL_GREEN];
+        dstColor = dst[PIXEL_GREEN];
+
+        srcColor = srcColor * dstColor;
+
+        dst[PIXEL_GREEN] = HALF_BLEND(srcColor, dstColor, srcBlend);
+
+        srcColor = src[PIXEL_BLUE];
+        dstColor = dst[PIXEL_BLUE];
+
+        srcColor = srcColor * dstColor;
+
+        dst[PIXEL_BLUE] = HALF_BLEND(srcColor, dstColor, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeDivide(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            half srcColor = src[channel];
+            half dstColor = dst[channel];
+
+            srcColor = TQMIN(dstColor / (srcColor + EPSILON), HALF_MAX);
+
+            half newColor = HALF_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeScreen(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            half srcColor = src[channel];
+            half dstColor = dst[channel];
+
+            srcColor = HALF_MAX - ((HALF_MAX - dstColor) * (HALF_MAX - srcColor));
+
+            half newColor = HALF_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeOverlay(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            half srcColor = src[channel];
+            half dstColor = dst[channel];
+
+            srcColor = dstColor * (dstColor + 2 * (srcColor * (HALF_MAX - dstColor)));
+
+            half newColor = HALF_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeDodge(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            half srcColor = src[channel];
+            half dstColor = dst[channel];
+
+            srcColor = TQMIN(dstColor / (HALF_MAX + EPSILON - srcColor), HALF_MAX);
+
+            half newColor = HALF_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            half srcColor = src[channel];
+            half dstColor = dst[channel];
+
+            srcColor = TQMIN((HALF_MAX - dstColor) / (srcColor + EPSILON), HALF_MAX);
+            srcColor = CLAMP(HALF_MAX - srcColor, 0, HALF_MAX);
+
+            half newColor = HALF_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            half srcColor = src[channel];
+            half dstColor = dst[channel];
+
+            srcColor = TQMIN(srcColor, dstColor);
+
+            half newColor = HALF_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeLighten(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            half srcColor = src[channel];
+            half dstColor = dst[channel];
+
+            srcColor = TQMAX(srcColor, dstColor);
+
+            half newColor = HALF_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeHue(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float srcRed = src[PIXEL_RED];
+        float srcGreen = src[PIXEL_GREEN];
+        float srcBlue = src[PIXEL_BLUE];
+
+        float dstRed = dst[PIXEL_RED];
+        float dstGreen = dst[PIXEL_GREEN];
+        float dstBlue = dst[PIXEL_BLUE];
+
+        float srcHue;
+        float srcSaturation;
+        float srcValue;
+
+        float dstHue;
+        float dstSaturation;
+        float dstValue;
+
+        RGBToHSV(srcRed, srcGreen, srcBlue, &srcHue, &srcSaturation, &srcValue);
+        RGBToHSV(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
+
+        HSVToRGB(srcHue, dstSaturation, dstValue, &srcRed, &srcGreen, &srcBlue);
+
+        dst[PIXEL_RED] = FLOAT_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = FLOAT_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = FLOAT_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeSaturation(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float srcRed = src[PIXEL_RED];
+        float srcGreen = src[PIXEL_GREEN];
+        float srcBlue = src[PIXEL_BLUE];
+
+        float dstRed = dst[PIXEL_RED];
+        float dstGreen = dst[PIXEL_GREEN];
+        float dstBlue = dst[PIXEL_BLUE];
+
+        float srcHue;
+        float srcSaturation;
+        float srcValue;
+
+        float dstHue;
+        float dstSaturation;
+        float dstValue;
+
+        RGBToHSV(srcRed, srcGreen, srcBlue, &srcHue, &srcSaturation, &srcValue);
+        RGBToHSV(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
+
+        HSVToRGB(dstHue, srcSaturation, dstValue, &srcRed, &srcGreen, &srcBlue);
+
+        dst[PIXEL_RED] = FLOAT_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = FLOAT_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = FLOAT_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeValue(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float srcRed = src[PIXEL_RED];
+        float srcGreen = src[PIXEL_GREEN];
+        float srcBlue = src[PIXEL_BLUE];
+
+        float dstRed = dst[PIXEL_RED];
+        float dstGreen = dst[PIXEL_GREEN];
+        float dstBlue = dst[PIXEL_BLUE];
+
+        float srcHue;
+        float srcSaturation;
+        float srcValue;
+
+        float dstHue;
+        float dstSaturation;
+        float dstValue;
+
+        RGBToHSV(srcRed, srcGreen, srcBlue, &srcHue, &srcSaturation, &srcValue);
+        RGBToHSV(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
+
+        HSVToRGB(dstHue, dstSaturation, srcValue, &srcRed, &srcGreen, &srcBlue);
+
+        dst[PIXEL_RED] = FLOAT_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = FLOAT_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = FLOAT_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeColor(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, half opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float srcRed = src[PIXEL_RED];
+        float srcGreen = src[PIXEL_GREEN];
+        float srcBlue = src[PIXEL_BLUE];
+
+        float dstRed = dst[PIXEL_RED];
+        float dstGreen = dst[PIXEL_GREEN];
+        float dstBlue = dst[PIXEL_BLUE];
+
+        float srcHue;
+        float srcSaturation;
+        float srcLightness;
+
+        float dstHue;
+        float dstSaturation;
+        float dstLightness;
+
+        RGBToHSL(srcRed, srcGreen, srcBlue, &srcHue, &srcSaturation, &srcLightness);
+        RGBToHSL(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstLightness);
+
+        HSLToRGB(srcHue, srcSaturation, dstLightness, &srcRed, &srcGreen, &srcBlue);
+
+        dst[PIXEL_RED] = FLOAT_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = FLOAT_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = FLOAT_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF16HalfColorSpace::compositeErase(TQ_UINT8 *dst,
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src,
+            TQ_INT32 srcRowSize,
+            const TQ_UINT8 *srcAlphaMask,
+            TQ_INT32 tqmaskRowStride,
+            TQ_INT32 rows,
+            TQ_INT32 cols,
+            half /*opacity*/)
+{
+    while (rows-- > 0)
+    {
+        const Pixel *s = reinterpret_cast<const Pixel *>(src);
+        Pixel *d = reinterpret_cast<Pixel *>(dst);
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (TQ_INT32 i = cols; i > 0; i--, s++, d++)
+        {
+            half srcAlpha = s->alpha;
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = HALF_BLEND(srcAlpha, F16HALF_OPACITY_OPAQUE, UINT8_TO_HALF(U8_tqmask));
+                }
+                tqmask++;
+            }
+            d->alpha = srcAlpha * d->alpha;
+        }
+
+        dst += dstRowSize;
+        src += srcRowSize;
+        if(srcAlphaMask) {
+            srcAlphaMask += tqmaskRowStride;
+        }
+    }
+}
+
+void KisRgbF16HalfColorSpace::bitBlt(TQ_UINT8 *dst,
+                      TQ_INT32 dstRowStride,
+                      const TQ_UINT8 *src,
+                      TQ_INT32 srcRowStride,
+                      const TQ_UINT8 *tqmask,
+                      TQ_INT32 tqmaskRowStride,
+                      TQ_UINT8 U8_opacity,
+                      TQ_INT32 rows,
+                      TQ_INT32 cols,
+                      const KisCompositeOp& op)
+{
+    half opacity = UINT8_TO_HALF(U8_opacity);
+
+    switch (op.op()) {
+    case COMPOSITE_UNDEF:
+        // Undefined == no composition
+        break;
+    case COMPOSITE_OVER:
+        compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_IN:
+        //compositeIn(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+    case COMPOSITE_OUT:
+        //compositeOut(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ATOP:
+        //compositeAtop(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_XOR:
+        //compositeXor(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_PLUS:
+        //compositePlus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MINUS:
+        //compositeMinus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ADD:
+        //compositeAdd(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SUBTRACT:
+        //compositeSubtract(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIFF:
+        //compositeDiff(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MULT:
+        compositeMultiply(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIVIDE:
+        compositeDivide(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BUMPMAP:
+        //compositeBumpmap(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY:
+        compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, U8_opacity);
+        break;
+    case COMPOSITE_COPY_RED:
+        //compositeCopyRed(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_GREEN:
+        //compositeCopyGreen(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_BLUE:
+        //compositeCopyBlue(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_OPACITY:
+        //compositeCopyOpacity(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_CLEAR:
+        //compositeClear(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISSOLVE:
+        //compositeDissolve(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISPLACE:
+        //compositeDisplace(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#if 0
+    case COMPOSITE_MODULATE:
+        compositeModulate(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_THRESHOLD:
+        compositeThreshold(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#endif
+    case COMPOSITE_NO:
+        // No composition.
+        break;
+    case COMPOSITE_DARKEN:
+        compositeDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LIGHTEN:
+        compositeLighten(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_HUE:
+        compositeHue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SATURATION:
+        compositeSaturation(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_VALUE:
+        compositeValue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLOR:
+        compositeColor(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLORIZE:
+        //compositeColorize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LUMINIZE:
+        //compositeLuminize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SCREEN:
+        compositeScreen(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_OVERLAY:
+        compositeOverlay(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ERASE:
+        compositeErase(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DODGE:
+        compositeDodge(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BURN:
+        compositeBurn(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ALPHA_DARKEN:
+        abstractCompositeAlphaDarken<half, F16HalfMult, Uint8ToF16Half, F16HalfOpacityTest,
+                    PIXEL_ALPHA, MAX_CHANNEL_RGB, MAX_CHANNEL_RGBA>(
+                    dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride,
+                    rows, cols,
+                    U8_opacity, F16HalfMult(), Uint8ToF16Half(), F16HalfOpacityTest());
+        break;
+    default:
+        break;
+    }
+}
+
+KisCompositeOpList KisRgbF16HalfColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    list.append(KisCompositeOp(COMPOSITE_ALPHA_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_MULT));
+    list.append(KisCompositeOp(COMPOSITE_BURN));
+    list.append(KisCompositeOp(COMPOSITE_DODGE));
+    list.append(KisCompositeOp(COMPOSITE_DIVIDE));
+    list.append(KisCompositeOp(COMPOSITE_SCREEN));
+    list.append(KisCompositeOp(COMPOSITE_OVERLAY));
+    list.append(KisCompositeOp(COMPOSITE_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_LIGHTEN));
+    list.append(KisCompositeOp(COMPOSITE_HUE));
+    list.append(KisCompositeOp(COMPOSITE_SATURATION));
+    list.append(KisCompositeOp(COMPOSITE_VALUE));
+    list.append(KisCompositeOp(COMPOSITE_COLOR));
+
+    return list;
+}
+
diff --git a/chalk/colorspaces/rgb_f16half/kis_rgb_f16half_colorspace.h b/chalk/colorspaces/rgb_f16half/kis_rgb_f16half_colorspace.h
new file mode 100644
index 000000000..a148a8f94
--- /dev/null
+++ b/chalk/colorspaces/rgb_f16half/kis_rgb_f16half_colorspace.h
@@ -0,0 +1,144 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_RGB_F16HALF_COLORSPACE_H_
+#define KIS_RGB_F16HALF_COLORSPACE_H_
+
+#include <tqcolor.h>
+
+#include <klocale.h>
+
+#include <koffice_export.h>
+
+#include "kis_global.h"
+#include "kis_f16half_base_colorspace.h"
+
+
+class KRITATOOL_EXPORT KisRgbF16HalfColorSpace : public KisF16HalfBaseColorSpace {
+public:
+    KisRgbF16HalfColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p);
+    virtual ~KisRgbF16HalfColorSpace();
+
+    virtual bool willDegrade(ColorSpaceIndependence independence)
+        {
+            if (independence == TO_RGBA8 || independence == TO_LAB16)
+                return true;
+            else
+                return false;
+        };
+
+
+public:
+    void setPixel(TQ_UINT8 *pixel, half red, half green, half blue, half alpha) const;
+    void getPixel(const TQ_UINT8 *pixel, half *red, half *green, half *blue, half *alpha) const;
+
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile * profile = 0);
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * profile = 0);
+
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * profile = 0);
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile = 0);
+
+    virtual TQ_UINT8 difference(const TQ_UINT8 *src1, const TQ_UINT8 *src2);
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
+    virtual TQ_UINT8 intensity8(const TQ_UINT8 * src) const;
+            
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const;
+    virtual TQ_UINT32 nColorChannels() const;
+    virtual TQ_UINT32 pixelSize() const;
+
+    virtual TQImage convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                       KisProfile *  dstProfile,
+                       TQ_INT32 renderingIntent,
+                       float exposure = 0.0f);
+
+    virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+
+protected:
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dstRowStride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeMultiply(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeDivide(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeScreen(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeOverlay(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeDodge(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeBurn(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeLighten(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeHue(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeSaturation(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeValue(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeColor(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+    void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, half opacity);
+
+private:
+    friend class KisRgbF16HalfColorSpaceTester;
+
+    static const TQ_UINT8 PIXEL_BLUE = 0;
+    static const TQ_UINT8 PIXEL_GREEN = 1;
+    static const TQ_UINT8 PIXEL_RED = 2;
+    static const TQ_UINT8 PIXEL_ALPHA = 3;
+
+    struct Pixel {
+        half blue;
+        half green;
+        half red;
+        half alpha;
+    };
+};
+
+// FIXME: lcms doesn't support 16-bit float
+#define RGBAF16HALF_LCMS_TYPE TYPE_BGRA_16
+
+class KisRgbF16HalfColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const { return KisID("RGBAF16HALF", i18n("RGB (16-bit float/channel)")); };
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() { return RGBAF16HALF_LCMS_TYPE; };
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return icSigRgbData; };
+
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisRgbF16HalfColorSpace(tqparent, p); };
+
+    virtual TQString defaultProfile() { return "sRGB built-in - (lcms internal)"; };
+};
+
+#endif // KIS_RGB_F16HALF_COLORSPACE_H_
+
diff --git a/chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.cc b/chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.cc
new file mode 100644
index 000000000..f50672b9d
--- /dev/null
+++ b/chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.cc
@@ -0,0 +1,63 @@
+/*
+* rgb_f32_plugin.cc -- Part of Chalk
+*
+* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+*
+*  This program is free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  This program is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  You should have received a copy of the GNU General Public License
+*  along with this program; if not, write to the Free Software
+*  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include <kinstance.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+
+#include <kis_debug_areas.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_basic_histogram_producers.h>
+
+#include "rgb_f16half_plugin.h"
+#include "kis_rgb_f16half_colorspace.h"
+
+typedef KGenericFactory<RGBF16HalfPlugin> RGBF16HalfPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalk_rgb_f16half_plugin, RGBF16HalfPluginFactory( "chalk" ) )
+
+
+RGBF16HalfPlugin::RGBF16HalfPlugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(RGBF16HalfPluginFactory::instance());
+
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") )
+    {
+        KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( tqparent );
+
+        KisColorSpace * colorSpaceRGBF16Half  = new KisRgbF16HalfColorSpace(f, 0);
+        KisColorSpaceFactory *csf  = new KisRgbF16HalfColorSpaceFactory();
+        Q_CHECK_PTR(colorSpaceRGBF16Half);
+        f->add(csf);
+        KisHistogramProducerFactoryRegistry::instance()->add(
+                new KisBasicHistogramProducerFactory<KisBasicF16HalfHistogramProducer>
+                (KisID("RGBF16HALFHISTO", i18n("Float16 Half")), colorSpaceRGBF16Half) );
+    }
+
+}
+
+RGBF16HalfPlugin::~RGBF16HalfPlugin()
+{
+}
+
+#include "rgb_f16half_plugin.moc"
+
diff --git a/chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.h b/chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.h
new file mode 100644
index 000000000..a970247c2
--- /dev/null
+++ b/chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.h
@@ -0,0 +1,39 @@
+/*
+ *  Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RGB_F16HALF_PLUGIN_H_
+#define RGB_F16HALF_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the RGB F16Half colour space strategy.
+ */
+class RGBF16HalfPlugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    RGBF16HalfPlugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~RGBF16HalfPlugin();
+
+};
+
+
+#endif // RGB_F16HALF_PLUGIN_H_
diff --git a/chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.rc b/chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.rc
new file mode 100644
index 000000000..125060aed
--- /dev/null
+++ b/chalk/colorspaces/rgb_f16half/rgb_f16half_plugin.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui library="chalk_rgb_f16half_plugin" version="1">
+<Menu name="Image"><text>&amp;Image</text>
+    <Menu name="Mode"><text>&amp;Mode</text>
+            <Action name="convert to RGB(A) (16-bit float 'half')"/>
+    </Menu>
+</Menu>
+
+</kpartgui>
diff --git a/chalk/colorspaces/rgb_f16half/tests/Makefile.am b/chalk/colorspaces/rgb_f16half/tests/Makefile.am
new file mode 100644
index 000000000..284359ee1
--- /dev/null
+++ b/chalk/colorspaces/rgb_f16half/tests/Makefile.am
@@ -0,0 +1,19 @@
+AM_CPPFLAGS = -I$(srcdir)/.. \
+	-I$(srcdir)/../../../sdk \
+	-I$(srcdir)/../../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../../color_strategy/ \
+	-I$(srcdir)/../../../modules/rgb_f32 \
+	$(OPENEXR_CFLAGS) \
+	$(all_includes)
+
+# The check_ target makes sure we don't install the modules,
+# $(KDE_CHECK_PLUGIN) assures a shared library is created.
+check_LTLIBRARIES = kunittest_kis_rgb_f16half_colorspace_tester.la
+
+kunittest_kis_rgb_f16half_colorspace_tester_la_SOURCES = kis_rgb_f16half_colorspace_tester.cc
+kunittest_kis_rgb_f16half_colorspace_tester_la_LIBADD = -lkunittest ../libchalk_rgb_f16half.la
+kunittest_kis_rgb_f16half_colorspace_tester_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+check-local: kunittest_kis_rgb_f16half_colorspace_tester.la
+	kunittestmodrunner
+
diff --git a/chalk/colorspaces/rgb_f16half/tests/kis_rgb_f16half_colorspace_tester.cc b/chalk/colorspaces/rgb_f16half/tests/kis_rgb_f16half_colorspace_tester.cc
new file mode 100644
index 000000000..59eb8e5f1
--- /dev/null
+++ b/chalk/colorspaces/rgb_f16half/tests/kis_rgb_f16half_colorspace_tester.cc
@@ -0,0 +1,545 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "kis_factory.h"
+#include "kis_rgb_f16half_colorspace.h"
+#include "kis_rgb_f16half_colorspace_tester.h"
+#include "kis_rgb_f32_colorspace.h"
+#include "kis_integer_maths.h"
+#include "kis_paint_device.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE( kunittest_kis_rgb_f16half_colorspace_tester, "RGBA 16-bit float half colorspace tester" );
+KUNITTEST_MODULE_REGISTER_TESTER( KisRgbF16HalfColorSpaceTester );
+
+#define PIXEL_BLUE 0
+#define PIXEL_GREEN 1
+#define PIXEL_RED 2
+#define PIXEL_ALPHA 3
+
+#define NUM_CHANNELS 4
+#define NUM_COLOUR_CHANNELS 3
+#define CHANNEL_SIZE ((int)sizeof(half))
+
+#define RED_CHANNEL 0
+#define GREEN_CHANNEL 1
+#define BLUE_CHANNEL 2
+#define ALPHA_CHANNEL 3
+
+//#define MAX_CHANNEL_VALUE 1.0f
+//#define MIN_CHANNEL_VALUE 0.0f
+
+#define CHANNEL_VALUE_ZERO ((half)0)
+#define CHANNEL_VALUE_ONE ((half)1)
+
+void KisRgbF16HalfColorSpaceTester::allTests()
+{
+    // We need this so that the colour profile loading can operate without crashing.
+    KisFactory *factory = new KisFactory();
+
+    testBasics();
+    testToTQImage();
+    testCompositeOps();
+    testMixColors();
+
+    delete factory;
+}
+
+void KisRgbF16HalfColorSpaceTester::testBasics()
+{
+
+
+    KisProfile *profile = new KisProfile(cmsCreate_sRGBProfile());
+
+    KisRgbF16HalfColorSpace *cs = new KisRgbF16HalfColorSpace(profile);
+    KisAbstractColorSpace * csSP = cs;
+
+    CHECK(cs->hasAlpha(), true);
+    CHECK(cs->nChannels(), NUM_CHANNELS);
+    CHECK(cs->nColorChannels(), NUM_COLOUR_CHANNELS);
+    CHECK(cs->pixelSize(), NUM_CHANNELS * CHANNEL_SIZE);
+
+    TQValueVector<KisChannelInfo *> channels = cs->channels();
+
+    // Red
+    CHECK(channels[0]->pos(), PIXEL_RED * CHANNEL_SIZE);
+    CHECK(channels[0]->size(), CHANNEL_SIZE);
+    CHECK(channels[0]->channelType(), COLOR);
+
+    // Green
+    CHECK(channels[1]->pos(), PIXEL_GREEN * CHANNEL_SIZE);
+    CHECK(channels[1]->size(), CHANNEL_SIZE);
+    CHECK(channels[1]->channelType(), COLOR);
+
+    // Blue
+    CHECK(channels[2]->pos(), PIXEL_BLUE * CHANNEL_SIZE);
+    CHECK(channels[2]->size(), CHANNEL_SIZE);
+    CHECK(channels[2]->channelType(), COLOR);
+
+    // Alpha
+    CHECK(channels[3]->pos(), PIXEL_ALPHA * CHANNEL_SIZE);
+    CHECK(channels[3]->size(), CHANNEL_SIZE);
+    CHECK(channels[3]->channelType(), ALPHA);
+
+    KisPaintDeviceSP pd = new KisPaintDevice(cs, "test");
+
+    KisRgbF16HalfColorSpace::Pixel defaultPixel;
+
+    memcpy(&defaultPixel, pd->dataManager()->defaultPixel(), sizeof(defaultPixel));
+
+    CHECK(defaultPixel.red, CHANNEL_VALUE_ZERO);
+    CHECK(defaultPixel.green, CHANNEL_VALUE_ZERO);
+    CHECK(defaultPixel.blue, CHANNEL_VALUE_ZERO);
+    CHECK(defaultPixel.alpha, F16HALF_OPACITY_TRANSPARENT);
+
+    half pixel[NUM_CHANNELS];
+
+    cs->fromTQColor(tqRgb(255, 255, 255), reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], CHANNEL_VALUE_ONE);
+    CHECK(pixel[PIXEL_GREEN], CHANNEL_VALUE_ONE);
+    CHECK(pixel[PIXEL_BLUE], CHANNEL_VALUE_ONE);
+
+    cs->fromTQColor(tqRgb(0, 0, 0), reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], CHANNEL_VALUE_ZERO);
+    CHECK(pixel[PIXEL_GREEN], CHANNEL_VALUE_ZERO);
+    CHECK(pixel[PIXEL_BLUE], CHANNEL_VALUE_ZERO);
+
+    cs->fromTQColor(tqRgb(128, 64, 192), reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], UINT8_TO_HALF(128));
+    CHECK(pixel[PIXEL_GREEN], UINT8_TO_HALF(64));
+    CHECK(pixel[PIXEL_BLUE], UINT8_TO_HALF(192));
+
+    cs->fromTQColor(tqRgb(255, 255, 255), OPACITY_OPAQUE, reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], CHANNEL_VALUE_ONE);
+    CHECK(pixel[PIXEL_GREEN], CHANNEL_VALUE_ONE);
+    CHECK(pixel[PIXEL_BLUE], CHANNEL_VALUE_ONE);
+    CHECK(pixel[PIXEL_ALPHA], CHANNEL_VALUE_ONE);
+
+    cs->fromTQColor(tqRgb(255, 255, 255), OPACITY_TRANSPARENT, reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], CHANNEL_VALUE_ONE);
+    CHECK(pixel[PIXEL_GREEN], CHANNEL_VALUE_ONE);
+    CHECK(pixel[PIXEL_BLUE], CHANNEL_VALUE_ONE);
+    CHECK(pixel[PIXEL_ALPHA], F16HALF_OPACITY_TRANSPARENT);
+
+    cs->fromTQColor(tqRgb(255, 255, 255), OPACITY_OPAQUE / 2, reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], CHANNEL_VALUE_ONE);
+    CHECK(pixel[PIXEL_GREEN], CHANNEL_VALUE_ONE);
+    CHECK(pixel[PIXEL_BLUE], CHANNEL_VALUE_ONE);
+    CHECK(pixel[PIXEL_ALPHA], UINT8_TO_HALF(OPACITY_OPAQUE / 2));
+
+    pixel[PIXEL_RED] = CHANNEL_VALUE_ONE;
+    pixel[PIXEL_GREEN] = CHANNEL_VALUE_ONE;
+    pixel[PIXEL_BLUE] = CHANNEL_VALUE_ONE;
+
+    TQColor c;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c);
+
+    CHECK(c.red(), 255);
+    CHECK(c.green(), 255);
+    CHECK(c.blue(), 255);
+
+    pixel[PIXEL_RED] = CHANNEL_VALUE_ZERO;
+    pixel[PIXEL_GREEN] = CHANNEL_VALUE_ZERO;
+    pixel[PIXEL_BLUE] = CHANNEL_VALUE_ZERO;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c);
+
+    CHECK(c.red(), 0);
+    CHECK(c.green(), 0);
+    CHECK(c.blue(), 0);
+
+    pixel[PIXEL_RED] = CHANNEL_VALUE_ONE / 4;
+    pixel[PIXEL_GREEN] = CHANNEL_VALUE_ONE / 2;
+    pixel[PIXEL_BLUE] = (3 * CHANNEL_VALUE_ONE) / 4;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c);
+
+    CHECK(c.red(), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE / 4));
+    CHECK(c.green(), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE / 2));
+    CHECK(c.blue(), (int)HALF_TO_UINT8((3 * CHANNEL_VALUE_ONE) / 4));
+
+    pixel[PIXEL_RED] = CHANNEL_VALUE_ONE;
+    pixel[PIXEL_GREEN] = CHANNEL_VALUE_ONE;
+    pixel[PIXEL_BLUE] = CHANNEL_VALUE_ONE;
+    pixel[PIXEL_ALPHA] = CHANNEL_VALUE_ONE;
+
+    TQ_UINT8 opacity;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), 255);
+    CHECK(c.green(), 255);
+    CHECK(c.blue(), 255);
+    CHECK(opacity, OPACITY_OPAQUE);
+
+    pixel[PIXEL_ALPHA] = F16HALF_OPACITY_OPAQUE;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), 255);
+    CHECK(c.green(), 255);
+    CHECK(c.blue(), 255);
+    CHECK(opacity, OPACITY_OPAQUE);
+
+    pixel[PIXEL_RED] = CHANNEL_VALUE_ZERO;
+    pixel[PIXEL_GREEN] = CHANNEL_VALUE_ZERO;
+    pixel[PIXEL_BLUE] = CHANNEL_VALUE_ZERO;
+    pixel[PIXEL_ALPHA] = F16HALF_OPACITY_TRANSPARENT;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), 0);
+    CHECK(c.green(), 0);
+    CHECK(c.blue(), 0);
+    CHECK(opacity, OPACITY_TRANSPARENT);
+
+    pixel[PIXEL_RED] = CHANNEL_VALUE_ONE / 4;
+    pixel[PIXEL_GREEN] = CHANNEL_VALUE_ONE / 2;
+    pixel[PIXEL_BLUE] = (3 * CHANNEL_VALUE_ONE) / 4;
+    pixel[PIXEL_ALPHA] = CHANNEL_VALUE_ONE / 2;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE / 4));
+    CHECK(c.green(), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE / 2));
+    CHECK(c.blue(), (int)HALF_TO_UINT8((3 * CHANNEL_VALUE_ONE) / 4));
+    CHECK((int)opacity, (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE / 2));
+
+    #define NUM_PIXELS 4
+
+    KisRgbF16HalfColorSpace::Pixel pixels[NUM_PIXELS] = {
+        {CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE / 4},
+        {CHANNEL_VALUE_ONE / 4, CHANNEL_VALUE_ONE / 2, CHANNEL_VALUE_ONE / 3, CHANNEL_VALUE_ONE / 2},
+        {CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ZERO},
+        {CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ONE}
+    };
+
+    cs->setAlpha(reinterpret_cast<TQ_UINT8 *>(pixels), OPACITY_OPAQUE / 2, NUM_PIXELS);
+
+    CHECK(pixels[0].red, CHANNEL_VALUE_ONE);
+    CHECK(pixels[0].green, CHANNEL_VALUE_ONE);
+    CHECK(pixels[0].blue, CHANNEL_VALUE_ONE);
+    CHECK(pixels[0].alpha, UINT8_TO_HALF(OPACITY_OPAQUE / 2));
+
+    CHECK(pixels[1].red, (half)(CHANNEL_VALUE_ONE / 3));
+    CHECK(pixels[1].green, (half)(CHANNEL_VALUE_ONE / 2));
+    CHECK(pixels[1].blue, (half)(CHANNEL_VALUE_ONE / 4));
+    CHECK(pixels[1].alpha, UINT8_TO_HALF(OPACITY_OPAQUE / 2));
+
+    CHECK(pixels[2].red, CHANNEL_VALUE_ONE);
+    CHECK(pixels[2].green, CHANNEL_VALUE_ONE);
+    CHECK(pixels[2].blue, CHANNEL_VALUE_ONE);
+    CHECK(pixels[2].alpha, UINT8_TO_HALF(OPACITY_OPAQUE / 2));
+
+    CHECK(pixels[3].red, CHANNEL_VALUE_ZERO);
+    CHECK(pixels[3].green, CHANNEL_VALUE_ZERO);
+    CHECK(pixels[3].blue, CHANNEL_VALUE_ZERO);
+    CHECK(pixels[3].alpha, UINT8_TO_HALF(OPACITY_OPAQUE / 2));
+
+    pixel[PIXEL_RED] = CHANNEL_VALUE_ONE;
+    pixel[PIXEL_GREEN] = CHANNEL_VALUE_ONE / 2;
+    pixel[PIXEL_BLUE] = CHANNEL_VALUE_ONE / 4;
+    pixel[PIXEL_ALPHA] = CHANNEL_VALUE_ZERO;
+
+    TQString valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), RED_CHANNEL);
+    CHECK(valueText, TQString().setNum(CHANNEL_VALUE_ONE));
+
+    valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), GREEN_CHANNEL);
+    CHECK(valueText, TQString().setNum(CHANNEL_VALUE_ONE / 2));
+
+    valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), BLUE_CHANNEL);
+    CHECK(valueText, TQString().setNum(CHANNEL_VALUE_ONE / 4));
+
+    valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), ALPHA_CHANNEL);
+    CHECK(valueText, TQString().setNum(CHANNEL_VALUE_ZERO));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), RED_CHANNEL);
+    CHECK(valueText, TQString().setNum(CHANNEL_VALUE_ONE));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), GREEN_CHANNEL);
+    CHECK(valueText, TQString().setNum(CHANNEL_VALUE_ONE / 2));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), BLUE_CHANNEL);
+    CHECK(valueText, TQString().setNum(CHANNEL_VALUE_ONE / 4));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), ALPHA_CHANNEL);
+    CHECK(valueText, TQString().setNum(CHANNEL_VALUE_ZERO));
+
+    cs->setPixel(reinterpret_cast<TQ_UINT8 *>(pixel), 0.128, 0.192, 0.64, 0.99);
+    CHECK(pixel[PIXEL_RED], (half)0.128f);
+    CHECK(pixel[PIXEL_GREEN], (half)0.192f);
+    CHECK(pixel[PIXEL_BLUE], (half)0.64f);
+    CHECK(pixel[PIXEL_ALPHA], (half)0.99f);
+
+    half red;
+    half green;
+    half blue;
+    half alpha;
+
+    cs->getPixel(reinterpret_cast<const TQ_UINT8 *>(pixel), &red, &green, &blue, &alpha);
+    CHECK(red, (half)0.128f);
+    CHECK(green, (half)0.192f);
+    CHECK(blue, (half)0.64f);
+    CHECK(alpha, (half)0.99f);
+
+    CHECK(HALF_TO_UINT8(-0.5), 0u);
+    CHECK(HALF_TO_UINT8(0), 0u);
+    CHECK_TOLERANCE(HALF_TO_UINT8(0.5), UINT8_MAX / 2, 1u);
+    CHECK(HALF_TO_UINT8(1), UINT8_MAX);
+    CHECK(HALF_TO_UINT8(1.5), UINT8_MAX);
+
+    CHECK(HALF_TO_UINT16(-0.5), 0u);
+    CHECK(HALF_TO_UINT16(0), 0u);
+    CHECK_TOLERANCE(HALF_TO_UINT16(0.5), UINT16_MAX / 2, 1u);
+    CHECK(HALF_TO_UINT16(1), UINT16_MAX);
+    CHECK(HALF_TO_UINT16(1.5), UINT16_MAX);
+}
+
+void KisRgbF16HalfColorSpaceTester::testMixColors()
+{
+    KisProfile *profile = new KisProfile(cmsCreate_sRGBProfile());
+    KisAbstractColorSpace * cs = new KisRgbF16HalfColorSpace(profile);
+
+    // Test mixColors.
+    half pixel1[NUM_CHANNELS];
+    half pixel2[NUM_CHANNELS];
+    half outputPixel[NUM_CHANNELS];
+
+    outputPixel[PIXEL_RED] = 0;
+    outputPixel[PIXEL_GREEN] = 0;
+    outputPixel[PIXEL_BLUE] = 0;
+    outputPixel[PIXEL_ALPHA] = 0;
+
+    pixel1[PIXEL_RED] = CHANNEL_VALUE_ONE;
+    pixel1[PIXEL_GREEN] = CHANNEL_VALUE_ONE;
+    pixel1[PIXEL_BLUE] = CHANNEL_VALUE_ONE;
+    pixel1[PIXEL_ALPHA] = CHANNEL_VALUE_ONE;
+
+    pixel2[PIXEL_RED] = 0;
+    pixel2[PIXEL_GREEN] = 0;
+    pixel2[PIXEL_BLUE] = 0;
+    pixel2[PIXEL_ALPHA] = 0;
+
+    const TQ_UINT8 *pixelPtrs[2];
+    TQ_UINT8 weights[2];
+
+    pixelPtrs[0] = reinterpret_cast<const TQ_UINT8 *>(pixel1);
+    pixelPtrs[1] = reinterpret_cast<const TQ_UINT8 *>(pixel2);
+
+    weights[0] = 255;
+    weights[1] = 0;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK(outputPixel[PIXEL_RED], CHANNEL_VALUE_ONE);
+    CHECK(outputPixel[PIXEL_GREEN], CHANNEL_VALUE_ONE);
+    CHECK(outputPixel[PIXEL_BLUE], CHANNEL_VALUE_ONE);
+    CHECK(outputPixel[PIXEL_ALPHA], CHANNEL_VALUE_ONE);
+
+    weights[0] = 0;
+    weights[1] = 255;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK(outputPixel[PIXEL_RED], (half)0.0f);
+    CHECK(outputPixel[PIXEL_GREEN], (half)0.0f);
+    CHECK(outputPixel[PIXEL_BLUE], (half)0.0f);
+    CHECK(outputPixel[PIXEL_ALPHA], (half)0.0f);
+
+    weights[0] = 128;
+    weights[1] = 127;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK(outputPixel[PIXEL_RED], CHANNEL_VALUE_ONE);
+    CHECK(outputPixel[PIXEL_GREEN], CHANNEL_VALUE_ONE);
+    CHECK(outputPixel[PIXEL_BLUE], CHANNEL_VALUE_ONE);
+    CHECK(outputPixel[PIXEL_ALPHA], (half)((128 * CHANNEL_VALUE_ONE) / 255));
+
+    pixel1[PIXEL_RED] = 20000;
+    pixel1[PIXEL_GREEN] = 10000;
+    pixel1[PIXEL_BLUE] = 5000;
+    pixel1[PIXEL_ALPHA] = CHANNEL_VALUE_ONE;
+
+    pixel2[PIXEL_RED] = 10000;
+    pixel2[PIXEL_GREEN] = 20000;
+    pixel2[PIXEL_BLUE] = 2000;
+    pixel2[PIXEL_ALPHA] = CHANNEL_VALUE_ONE;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK_TOLERANCE(outputPixel[PIXEL_RED], (128 * 20000 + 127 * 10000) / 255, 5);
+    CHECK_TOLERANCE(outputPixel[PIXEL_GREEN], (128 * 10000 + 127 * 20000) / 255, 5);
+    CHECK_TOLERANCE(outputPixel[PIXEL_BLUE], (128 * 5000 + 127 * 2000) / 255, 5);
+    CHECK(outputPixel[PIXEL_ALPHA], CHANNEL_VALUE_ONE);
+
+    pixel1[PIXEL_RED] = 0;
+    pixel1[PIXEL_GREEN] = 0;
+    pixel1[PIXEL_BLUE] = 0;
+    pixel1[PIXEL_ALPHA] = 0;
+
+    pixel2[PIXEL_RED] = CHANNEL_VALUE_ONE;
+    pixel2[PIXEL_GREEN] = CHANNEL_VALUE_ONE;
+    pixel2[PIXEL_BLUE] = CHANNEL_VALUE_ONE;
+    pixel2[PIXEL_ALPHA] = CHANNEL_VALUE_ONE;
+
+    weights[0] = 89;
+    weights[1] = 166;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK(outputPixel[PIXEL_RED], CHANNEL_VALUE_ONE);
+    CHECK(outputPixel[PIXEL_GREEN], CHANNEL_VALUE_ONE);
+    CHECK(outputPixel[PIXEL_BLUE], CHANNEL_VALUE_ONE);
+    CHECK_TOLERANCE(outputPixel[PIXEL_ALPHA], (89 * 0 + 166 * CHANNEL_VALUE_ONE) / 255, 5);
+}
+
+#define PIXELS_WIDTH 2
+#define PIXELS_HEIGHT 2
+
+void KisRgbF16HalfColorSpaceTester::testToTQImage()
+{
+    KisProfile *profile = new KisProfile(cmsCreate_sRGBProfile());
+
+    KisAbstractColorSpace * cs = new KisRgbF16HalfColorSpace(profile);
+
+    KisRgbF16HalfColorSpace::Pixel pixels[PIXELS_WIDTH * PIXELS_HEIGHT] = {
+        {CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE / 4},
+        {CHANNEL_VALUE_ONE / 4, CHANNEL_VALUE_ONE / 2, CHANNEL_VALUE_ONE / 3, CHANNEL_VALUE_ONE / 2},
+        {CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ZERO},
+        {CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ONE}
+    };
+
+    TQImage image = cs->convertToTQImage(reinterpret_cast<const TQ_UINT8 *>(pixels), PIXELS_WIDTH, PIXELS_HEIGHT, 0, 0);
+
+    TQRgb c = image.pixel(0, 0);
+
+    // Exposure comes into play here.
+    /*
+    CHECK(tqRed(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE));
+    CHECK(tqGreen(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE));
+    CHECK(tqBlue(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE));
+    CHECK(tqAlpha(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE / 4));
+
+    c = image.pixel(1, 0);
+
+    CHECK(tqRed(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE / 3));
+    CHECK(tqGreen(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE / 2));
+    CHECK(tqBlue(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE / 4));
+    CHECK(tqAlpha(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE / 2));
+
+    c = image.pixel(0, 1);
+
+    CHECK(tqRed(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE));
+    CHECK(tqGreen(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE));
+    CHECK(tqBlue(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE));
+    CHECK(tqAlpha(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ZERO));
+
+    c = image.pixel(1, 1);
+
+    CHECK(tqRed(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ZERO));
+    CHECK(tqGreen(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ZERO));
+    CHECK(tqBlue(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ZERO));
+    CHECK(tqAlpha(c), (int)HALF_TO_UINT8(CHANNEL_VALUE_ONE));
+    */
+}
+
+#define NUM_ROWS 2
+#define NUM_COLUMNS 2
+#define SRC_ROW_STRIDE (NUM_COLUMNS * CHANNEL_SIZE)
+#define DST_ROW_STRIDE (NUM_COLUMNS * CHANNEL_SIZE)
+#define MASK_ROW_STRIDE NUM_COLUMNS
+
+/*
+1 alpha 1    0 alpha 1
+1 alpha 0.5  0 alpha 1
+1 alpha 0.5  0 alpha 0.5
+1 alpha 0    0 alpha 0.5
+
+*/
+
+void  KisRgbF16HalfColorSpaceTester::testCompositeOps()
+{
+    KisProfile *profile = new KisProfile(cmsCreate_sRGBProfile());
+
+    KisRgbF16HalfColorSpace *cs = new KisRgbF16HalfColorSpace(profile);
+
+    KisRgbF16HalfColorSpace::Pixel srcPixel;
+    KisRgbF16HalfColorSpace::Pixel dstPixel;
+
+    srcPixel.red = UINT8_TO_HALF(102);
+    srcPixel.green = UINT8_TO_HALF(170);
+    srcPixel.blue = UINT8_TO_HALF(238);
+    srcPixel.alpha = F16HALF_OPACITY_OPAQUE;
+
+    dstPixel = srcPixel;
+
+    cs->compositeDivide(reinterpret_cast<TQ_UINT8 *>(&dstPixel), 1, reinterpret_cast<const TQ_UINT8 *>(&srcPixel),
+                1, 0, 0, 1, 1, F16HALF_OPACITY_OPAQUE);
+    /*
+    CHECK(dstPixel.red, (TQ_UINT16)UINT8_TO_UINT16(253));
+    CHECK(dstPixel.green, (TQ_UINT16)UINT8_TO_UINT16(254));
+    CHECK(dstPixel.blue, (TQ_UINT16)UINT8_TO_UINT16(254));
+    CHECK(dstPixel.alpha, KisRgbF16HalfColorSpace::F16HALF_OPACITY_OPAQUE);
+
+    TQ_UINT16 srcColor = 43690;
+    TQ_UINT16 dstColor = 43690;
+
+    srcColor = TQMIN((dstColor * (65535u + 1u) + (srcColor / 2u)) / (1u + srcColor), 65535u);
+
+    CHECK((int)srcColor, 65534);
+
+    TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, 65535u);
+
+    CHECK((int)newColor, 65534);
+    */
+
+    /*
+    KisRgbF16HalfColorSpace::Pixel srcPixels[NUM_ROWS * NUM_COLUMNS] = {
+        {CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE / 4},
+        {CHANNEL_VALUE_ONE / 4, CHANNEL_VALUE_ONE / 2, CHANNEL_VALUE_ONE / 3, CHANNEL_VALUE_ONE / 2},
+        {CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ZERO},
+        {CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ONE}
+    };
+
+    KisRgbF16HalfColorSpace::Pixel dstPixels[NUM_ROWS * NUM_COLUMNS] = {
+        {CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE / 4},
+        {CHANNEL_VALUE_ONE / 4, CHANNEL_VALUE_ONE / 2, CHANNEL_VALUE_ONE / 3, CHANNEL_VALUE_ONE / 2},
+        {CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ONE, CHANNEL_VALUE_ZERO},
+        {CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ZERO, CHANNEL_VALUE_ONE}
+    };
+
+    cs->compositeOver(reinterpret_cast<TQ_UINT8 *>(dstPixels), DST_ROW_STRIDE, reinterpret_cast<const TQ_UINT8 *>(srcPixels),
+                SRC_ROW_STRIDE, tqmask, MASK_ROW_STRIDE, NUM_ROWS, NUM_COLUMNS, opacity);
+    */
+
+    delete cs;
+}
+
diff --git a/chalk/colorspaces/rgb_f16half/tests/kis_rgb_f16half_colorspace_tester.h b/chalk/colorspaces/rgb_f16half/tests/kis_rgb_f16half_colorspace_tester.h
new file mode 100644
index 000000000..6547e35ba
--- /dev/null
+++ b/chalk/colorspaces/rgb_f16half/tests/kis_rgb_f16half_colorspace_tester.h
@@ -0,0 +1,47 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef KIS_RGB_F16HALF_COLORSPACE_TESTER_H
+#define KIS_RGB_F16HALF_COLORSPACE_TESTER_H
+
+#include <kunittest/tester.h>
+
+#define CHECK_TOLERANCE( x, y, tolerance ) \
+if ((x) <= (y) + (tolerance) && (x) >= (y) - (tolerance)) \
+{ \
+    success(TQString(__FILE__) + "[" + TQString::number(__LINE__) + "]: passed " + #x); \
+} \
+else \
+{ \
+    failure(TQString(__FILE__) + "[" + TQString::number(__LINE__) + TQString("]: failed ") + #x + "\n Expected " + #y + ", Actual result " + TQString::number(x)); \
+} \
+
+class KisRgbF16HalfColorSpaceTester : public KUnitTest::Tester
+{
+public:
+    void allTests();
+    void testBasics();
+    void testMixColors();
+    void testToTQImage();
+    void testCompositeOps();
+};
+
+#endif
+
diff --git a/chalk/colorspaces/rgb_f32/Makefile.am b/chalk/colorspaces/rgb_f32/Makefile.am
new file mode 100644
index 000000000..edcf26a9e
--- /dev/null
+++ b/chalk/colorspaces/rgb_f32/Makefile.am
@@ -0,0 +1,34 @@
+# Install the desktop file needed to detect the plugin
+kde_services_DATA = chalk_rgb_f32_plugin.desktop
+
+INCLUDES  = \
+	-I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../chalkcolor/ \
+	$(KOFFICE_INCLUDES) \
+	$(all_includes)
+
+
+lib_LTLIBRARIES = libchalk_rgb_f32.la
+libchalk_rgb_f32_la_SOURCES = kis_rgb_f32_colorspace.cc
+libchalk_rgb_f32_la_LDFLAGS = $(all_libraries)
+libchalk_rgb_f32_la_LIBADD =  ../../chalkcolor/libchalkcolor.la
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = chalk_rgb_f32_plugin.la
+
+# Srcs for the plugin
+chalk_rgb_f32_plugin_la_SOURCES = rgb_f32_plugin.cc
+noinst_HEADERS = rgb_f32_plugin.h kis_rgb_f32_colorspace.h
+
+chalk_rgb_f32_plugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms
+chalk_rgb_f32_plugin_la_LIBADD =  libchalk_rgb_f32.la ../../chalkcolor/libchalkcolor.la
+
+chalk_rgb_f32_plugin_la_METASOURCES = AUTO
+
+if include_kunittest_tests
+TESTSDIR = tests
+endif
+
+SUBDIRS = . $(TESTSDIR)
+
diff --git a/chalk/colorspaces/rgb_f32/chalk_rgb_f32_plugin.desktop b/chalk/colorspaces/rgb_f32/chalk_rgb_f32_plugin.desktop
new file mode 100644
index 000000000..7f238a471
--- /dev/null
+++ b/chalk/colorspaces/rgb_f32/chalk_rgb_f32_plugin.desktop
@@ -0,0 +1,77 @@
+[Desktop Entry]
+Name=RGB Color Model (32-bit float)
+Name[bg]=Цветови модел RGB (32 бита)
+Name[ca]=Model de color RGB (paleta de 32 bits)
+Name[cy]=Model Lliw RGB (arnawf 32-did)
+Name[da]=RGB-farvemodel (32-bit float)
+Name[de]=RGB-Farbmodell (32-bit Fließkomma)
+Name[el]=Χρωματικό μοντέλο RGB (32 bit δεκαδικοί)
+Name[en_GB]=RGB Colour Model (32-bit float)
+Name[eo]=RGB-kolormodelo (32-bita flupunkto)
+Name[es]=Modelo de color RGB (decimal de 32 bits)
+Name[et]=RGB värvimudel (32-bitine murdarv)
+Name[fa]=مدل رنگ RGB )شناور ۳۲ بیتی(
+Name[fr]=Modèle de couleurs RVB (flottants 32 bits)
+Name[fy]=RGB-kleurmodel (32-bit float)
+Name[gl]=Espazo de Cores RGB (flutuante de 32-bit)
+Name[he]=מודל צבעים RGB (32 סיביות)
+Name[hu]=RGB színmodell (32 bites lebegőpontos)
+Name[is]=RGB litategund (32-bita fleytitala)
+Name[it]=Modello di colore RGB (virgola mobile a 32 bit)
+Name[ja]=RGB カラーモデル (32 ビット浮動小数)
+Name[km]=គំរូ​ពណ៌ RGB (ចំនួន​ទស្សភាគ 32 ប៊ីត)
+Name[nb]=RGB-fargemodell (32-bit flyttall)
+Name[nds]=RGB-Klöörmodell (32-Bit Fleetkomma)
+Name[ne]=RGB रङ मोडेल (३२-बिट उत्प्लावन)
+Name[nl]=RGB-kleurmodel (32-bit float)
+Name[pl]=Przestrzeń barw RGB (32-bitowa zmiennoprzecinkowa)
+Name[pt]=Modelo de Cor RGB (v. flutuante de 32-bits)
+Name[pt_BR]=Modelo de Cor RGB (ponto flutuante de 32-bits)
+Name[ru]=RGB (32-бит с плавающей точкой)
+Name[sk]=Model farieb RGB (32-bitové reálne čísla)
+Name[sl]=Barvni model RGB (32-bitno celo število)
+Name[sr]=RGB модел боја (32-битно реално)
+Name[sr@Latn]=RGB model boja (32-bitno realno)
+Name[sv]=RGB-färgmodell (32-bitars heltal)
+Name[uk]=Модель кольорів RGB (32-бітне дробове число)
+Name[uz]=RGB rang usuli (32-bit kasr)
+Name[uz@cyrillic]=RGB ранг усули (32-бит каср)
+Name[zh_TW]=RGB 色彩模型 (32-bit 浮點數)
+Comment=Color model for 32-bit floating point per channel RGB images
+Comment[bg]=Цветови модел за 32 битови изображения RGB
+Comment[ca]=Model de color per a punt flotant de 32 bits-canal d'imatges RGB
+Comment[da]=Farvemodel for 32-bit decimaltal pr kanal RGB-billeder
+Comment[de]=Farbmodell für 32-bit Fließkomma pro Kanal RGB-Bilder
+Comment[el]=Χρωματικό μοντέλο για 32-bit δεκαδικούς ανά κανάλι RGB εικόνες
+Comment[en_GB]=Colour model for 32-bit floating point per channel RGB images
+Comment[es]=Modelo de color decimal de 32 bits por canal para imágenes RGB
+Comment[et]=32-bitiste murdarvuliste kanalitega RGB-piltide värvimudel
+Comment[fa]=مدل رنگ برای ممیز شناور ۳۲ بیتی برای هر تصویر RGB مجرا
+Comment[fr]=Modèle de couleurs pour des images RVB en 32 bits flottants par canal
+Comment[fy]=Kleurmodel foar RGB-ôfbyldings mei 32-bit Driuwende komma de kanaal
+Comment[gl]=Espazo de cores para imaxes RGB de 32-bit vírgula flutuante por canal
+Comment[he]=מודל צבעים עבור תמונות RGB של 32 סיביות/ערוצים
+Comment[hu]=Színmodell 32 bit (lebegőpontos)/csatorna RGB képekhez
+Comment[is]=Litategund fyrir 32-bita fleytitölu á rás RGB myndir
+Comment[it]=Modello di colore per immagini RGB in virgola mobile a canale di 32 bit
+Comment[ja]=32 ビット浮動小数/チャンネル RGB 画像のためのカラーモデル
+Comment[km]=ម៉ូដែល​ពណ៌​សម្រាប់​ចំណុច​ចំនួន​ទស្សភាគ 32-bit ក្នុង​ឆានែល​រូបភាព RGB
+Comment[nb]=Fargemodell for RGB-bilde med 32 bit flyttall per kanal
+Comment[nds]=Klöörmodell för RGB-Biller mit 32-Bit Fleetkomma per Kanaal
+Comment[ne]=प्रति च्यानल RGB छविहरूको ३२-बिट उत्प्लावन बिन्दुका लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor RGB-afbeeldingen met 32-bit drijvende komma per kanaal
+Comment[pl]=Przestrzeń barw dla obrazków RGB z 32-bitową liczbą zmiennoprzecinkową na kanał
+Comment[pt]=Modelo de cor para imagens RGB com 32 bits de vírgula flutuante por canal
+Comment[pt_BR]=Modelo de cor para imagens RGB com 32 bits de ponto flutuante por canal
+Comment[ru]=Цветовое пространство RGB (32-бит/канал с плавающей точкой)
+Comment[sk]=Model farieb pre RGB obrázky s 32-bitovými reálnymi číslami na kanál
+Comment[sl]=Barvni model za slike RGB z 32-bitno plavajočo vejico na kanal
+Comment[sr]=Модел боја за RGB слике, 32-битно реално по каналу
+Comment[sr@Latn]=Model boja za RGB slike, 32-bitno realno po kanalu
+Comment[sv]=Färgmodell för 32-bitars flyttal per kanal RGB-bilder
+Comment[uk]=Модель кольорів для зображень RGB 32-біт з плаваючою комою на канал
+Comment[zh_TW]=每色頻 32-bit 浮點 RGB 圖片的色彩模型
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-Chalk-Version=2
+X-KDE-Library=chalk_rgb_f32_plugin
diff --git a/chalk/colorspaces/rgb_f32/kis_rgb_f32_colorspace.cc b/chalk/colorspaces/rgb_f32/kis_rgb_f32_colorspace.cc
new file mode 100644
index 000000000..98e0b28bf
--- /dev/null
+++ b/chalk/colorspaces/rgb_f32/kis_rgb_f32_colorspace.cc
@@ -0,0 +1,949 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <limits.h>
+#include <stdlib.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_rgb_f32_colorspace.h"
+#include "kis_color_conversions.h"
+
+namespace {
+    const TQ_INT32 MAX_CHANNEL_RGB = 3;
+    const TQ_INT32 MAX_CHANNEL_RGBA = 4;
+}
+
+#include "kis_integer_maths.h"
+
+#ifndef HAVE_POWF
+#undef powf
+#define powf pow
+#endif
+
+#define FLOAT_MAX 1.0f //temp
+
+#define EPSILON 1e-6
+
+// FIXME: lcms doesn't support 32-bit float
+#define F32_LCMS_TYPE TYPE_BGRA_16
+
+// disable the lcms handling by setting profile=0
+KisRgbF32ColorSpace::KisRgbF32ColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile */*p*/) :
+    KisF32BaseColorSpace(KisID("RGBAF32", i18n("RGB (32-bit float/channel)")), F32_LCMS_TYPE, icSigRgbData, tqparent, 0)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Red"), i18n("R"), PIXEL_RED * sizeof(float), KisChannelInfo::COLOR, KisChannelInfo::FLOAT32, sizeof(float)));
+    m_channels.push_back(new KisChannelInfo(i18n("Green"), i18n("G"), PIXEL_GREEN * sizeof(float), KisChannelInfo::COLOR, KisChannelInfo::FLOAT32, sizeof(float)));
+    m_channels.push_back(new KisChannelInfo(i18n("Blue"), i18n("B"), PIXEL_BLUE * sizeof(float), KisChannelInfo::COLOR, KisChannelInfo::FLOAT32, sizeof(float)));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), PIXEL_ALPHA * sizeof(float), KisChannelInfo::ALPHA, KisChannelInfo::FLOAT32, sizeof(float)));
+
+    m_alphaPos = PIXEL_ALPHA * sizeof(float);
+}
+
+KisRgbF32ColorSpace::~KisRgbF32ColorSpace()
+{
+}
+
+void KisRgbF32ColorSpace::setPixel(TQ_UINT8 *dst, float red, float green, float blue, float alpha) const
+{
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->red = red;
+    dstPixel->green = green;
+    dstPixel->blue = blue;
+    dstPixel->alpha = alpha;
+}
+
+void KisRgbF32ColorSpace::getPixel(const TQ_UINT8 *src, float *red, float *green, float *blue, float *alpha) const
+{
+    const Pixel *srcPixel = reinterpret_cast<const Pixel *>(src);
+
+    *red = srcPixel->red;
+    *green = srcPixel->green;
+    *blue = srcPixel->blue;
+    *alpha = srcPixel->alpha;
+}
+
+void KisRgbF32ColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 *dstU8, KisProfile * /*profile*/)
+{
+    Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
+
+    dst->red = UINT8_TO_FLOAT(c.red());
+    dst->green = UINT8_TO_FLOAT(c.green());
+    dst->blue = UINT8_TO_FLOAT(c.blue());
+}
+
+void KisRgbF32ColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dstU8, KisProfile * /*profile*/)
+{
+    Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
+
+    dst->red = UINT8_TO_FLOAT(c.red());
+    dst->green = UINT8_TO_FLOAT(c.green());
+    dst->blue = UINT8_TO_FLOAT(c.blue());
+    dst->alpha = UINT8_TO_FLOAT(opacity);
+}
+
+void KisRgbF32ColorSpace::toTQColor(const TQ_UINT8 *srcU8, TQColor *c, KisProfile * /*profile*/)
+{
+    const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
+
+    c->setRgb(FLOAT_TO_UINT8(src->red), FLOAT_TO_UINT8(src->green), FLOAT_TO_UINT8(src->blue));
+}
+
+void KisRgbF32ColorSpace::toTQColor(const TQ_UINT8 *srcU8, TQColor *c, TQ_UINT8 *opacity, KisProfile * /*profile*/)
+{
+    const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
+
+    c->setRgb(FLOAT_TO_UINT8(src->red), FLOAT_TO_UINT8(src->green), FLOAT_TO_UINT8(src->blue));
+    *opacity = FLOAT_TO_UINT8(src->alpha);
+}
+
+TQ_UINT8 KisRgbF32ColorSpace::difference(const TQ_UINT8 *src1U8, const TQ_UINT8 *src2U8)
+{
+    const Pixel *src1 = reinterpret_cast<const Pixel *>(src1U8);
+    const Pixel *src2 = reinterpret_cast<const Pixel *>(src2U8);
+
+    return FLOAT_TO_UINT8(TQMAX(TQABS(src2->red - src1->red),
+                TQMAX(TQABS(src2->green - src1->green),
+                     TQABS(src2->blue - src1->blue))));
+}
+
+void KisRgbF32ColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    float totalRed = 0, totalGreen = 0, totalBlue = 0, newAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel *pixel = reinterpret_cast<const Pixel *>(*colors);
+
+        float alpha = pixel->alpha;
+        float alphaTimesWeight = alpha * UINT8_TO_FLOAT(*weights);
+
+        totalRed += pixel->red * alphaTimesWeight;
+        totalGreen += pixel->green * alphaTimesWeight;
+        totalBlue += pixel->blue * alphaTimesWeight;
+        newAlpha += alphaTimesWeight;
+
+        weights++;
+        colors++;
+    }
+
+    Q_ASSERT(newAlpha <= F32_OPACITY_OPAQUE);
+
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->alpha = newAlpha;
+
+    if (newAlpha > EPSILON) {
+        totalRed = totalRed / newAlpha;
+        totalGreen = totalGreen / newAlpha;
+        totalBlue = totalBlue / newAlpha;
+    }
+
+    dstPixel->red = totalRed;
+    dstPixel->green = totalGreen;
+    dstPixel->blue = totalBlue;
+}
+
+void KisRgbF32ColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const
+{
+    float totalRed = 0, totalGreen = 0, totalBlue = 0, totalAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel * pixel = reinterpret_cast<const Pixel *>( *colors );
+
+        float weight = *kernelValues;
+
+        if (weight != 0) {
+            totalRed += pixel->red * weight;
+            totalGreen += pixel->green * weight;
+            totalBlue += pixel->blue * weight;
+            totalAlpha += pixel->alpha * weight;
+        }
+        colors++;
+        kernelValues++;
+    }
+
+    Pixel * p = reinterpret_cast< Pixel *>( dst );
+
+    if (channelFlags & KisChannelInfo::FLAG_COLOR) {
+        p->red = CLAMP( ( totalRed / factor) + offset, 0, FLOAT_MAX);
+        p->green = CLAMP( ( totalGreen / factor) + offset, 0, FLOAT_MAX);
+        p->blue = CLAMP( ( totalBlue / factor) + offset, 0, FLOAT_MAX);
+    }
+    if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+        p->alpha = CLAMP((totalAlpha/ factor) + offset, 0, FLOAT_MAX);
+    }
+}
+
+
+void KisRgbF32ColorSpace::invertColor(TQ_UINT8 * src, TQ_INT32 nPixels)
+{
+    TQ_UINT32 psize = pixelSize();
+
+    while (nPixels--)
+    {
+        Pixel * p = reinterpret_cast< Pixel *>( src );
+        p->red = FLOAT_MAX - p->red;
+        p->green = FLOAT_MAX - p->green;
+        p->blue = FLOAT_MAX - p->blue;
+        src += psize;
+    }
+
+}
+
+TQ_UINT8 KisRgbF32ColorSpace::intensity8(const TQ_UINT8 * src) const
+{
+    const Pixel * p = reinterpret_cast<const Pixel *>( src );
+
+    return FLOAT_TO_UINT8((p->red * 0.30 + p->green * 0.59 + p->blue * 0.11) + 0.5);
+}
+
+
+
+TQValueVector<KisChannelInfo *> KisRgbF32ColorSpace::channels() const
+{
+    return m_channels;
+}
+
+TQ_UINT32 KisRgbF32ColorSpace::nChannels() const
+{
+    return MAX_CHANNEL_RGBA;
+}
+
+TQ_UINT32 KisRgbF32ColorSpace::nColorChannels() const
+{
+    return MAX_CHANNEL_RGB;
+}
+
+TQ_UINT32 KisRgbF32ColorSpace::pixelSize() const
+{
+    return MAX_CHANNEL_RGBA * sizeof(float);
+}
+
+TQ_UINT8 convertToDisplay(float value, float exposureFactor, float gamma)
+{
+    //value *= pow(2, exposure + 2.47393);
+    value *= exposureFactor;
+
+    value = powf(value, gamma);
+
+    // scale middle gray to the target framebuffer value
+
+    value *= 84.66f;
+
+    int valueInt = (int)(value + 0.5);
+
+    return CLAMP(valueInt, 0, 255);
+}
+
+TQImage KisRgbF32ColorSpace::convertToTQImage(const TQ_UINT8 *dataU8, TQ_INT32 width, TQ_INT32 height,
+                                            KisProfile *  /*dstProfile*/,
+                                            TQ_INT32 /*renderingIntent*/, float exposure)
+
+{
+    const float *data = reinterpret_cast<const float *>(dataU8);
+
+    TQImage img = TQImage(width, height, 32, 0, TQImage::LittleEndian);
+    img.setAlphaBuffer(true);
+
+    TQ_INT32 i = 0;
+    uchar *j = img.bits();
+
+    // XXX: For now assume gamma 2.2.
+    float gamma = 1 / 2.2;
+    float exposureFactor = powf(2, exposure + 2.47393);
+
+    while ( i < width * height * MAX_CHANNEL_RGBA) {
+        *( j + 3)  = FLOAT_TO_UINT8(*( data + i + PIXEL_ALPHA ));
+        *( j + 2 ) = convertToDisplay(*( data + i + PIXEL_RED ), exposureFactor, gamma);
+        *( j + 1 ) = convertToDisplay(*( data + i + PIXEL_GREEN ), exposureFactor, gamma);
+        *( j + 0 ) = convertToDisplay(*( data + i + PIXEL_BLUE ), exposureFactor, gamma);
+        i += MAX_CHANNEL_RGBA;
+        j += MAX_CHANNEL_RGBA;
+    }
+
+    /*
+    if (srcProfile != 0 && dstProfile != 0) {
+        convertPixelsTo(img.bits(), srcProfile,
+                img.bits(), this, dstProfile,
+                width * height, renderingIntent);
+    }
+    */
+    return img;
+}
+
+
+void KisRgbF32ColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    while (rows > 0) {
+
+        const float *src = reinterpret_cast<const float *>(srcRowStart);
+        float *dst = reinterpret_cast<float *>(dstRowStart);
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            float srcAlpha = src[PIXEL_ALPHA];
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha *= UINT8_TO_FLOAT(U8_tqmask);
+                }
+                tqmask++;
+            }
+
+            if (srcAlpha > F32_OPACITY_TRANSPARENT + EPSILON) {
+
+                if (opacity < F32_OPACITY_OPAQUE - EPSILON) {
+                    srcAlpha *= opacity;
+                }
+
+                if (srcAlpha > F32_OPACITY_OPAQUE - EPSILON) {
+                    memcpy(dst, src, MAX_CHANNEL_RGBA * sizeof(float));
+                } else {
+                    float dstAlpha = dst[PIXEL_ALPHA];
+
+                    float srcBlend;
+
+                    if (dstAlpha > F32_OPACITY_OPAQUE - EPSILON) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        float newAlpha = dstAlpha + (F32_OPACITY_OPAQUE - dstAlpha) * srcAlpha;
+                        dst[PIXEL_ALPHA] = newAlpha;
+
+                        if (newAlpha > EPSILON) {
+                            srcBlend = srcAlpha / newAlpha;
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend > F32_OPACITY_OPAQUE - EPSILON) {
+                        memcpy(dst, src, MAX_CHANNEL_RGB * sizeof(float));
+                    } else {
+                        dst[PIXEL_RED] = FLOAT_BLEND(src[PIXEL_RED], dst[PIXEL_RED], srcBlend);
+                        dst[PIXEL_GREEN] = FLOAT_BLEND(src[PIXEL_GREEN], dst[PIXEL_GREEN], srcBlend);
+                        dst[PIXEL_BLUE] = FLOAT_BLEND(src[PIXEL_BLUE], dst[PIXEL_BLUE], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart) {
+            tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+}
+
+#define COMMON_COMPOSITE_OP_PROLOG() \
+    while (rows > 0) { \
+    \
+        const float *src = reinterpret_cast<const float *>(srcRowStart); \
+        float *dst = reinterpret_cast<float *>(dstRowStart); \
+        TQ_INT32 columns = numColumns; \
+        const TQ_UINT8 *tqmask = tqmaskRowStart; \
+    \
+        while (columns > 0) { \
+    \
+            float srcAlpha = src[PIXEL_ALPHA]; \
+            float dstAlpha = dst[PIXEL_ALPHA]; \
+    \
+            srcAlpha = TQMIN(srcAlpha, dstAlpha); \
+    \
+            if (tqmask != 0) { \
+                TQ_UINT8 U8_tqmask = *tqmask; \
+    \
+                if (U8_tqmask != OPACITY_OPAQUE) { \
+                    srcAlpha *= UINT8_TO_FLOAT(U8_tqmask); \
+                } \
+                tqmask++; \
+            } \
+    \
+            if (srcAlpha > F32_OPACITY_TRANSPARENT + EPSILON) { \
+    \
+                if (opacity < F32_OPACITY_OPAQUE - EPSILON) { \
+                    srcAlpha *= opacity; \
+                } \
+    \
+                float srcBlend; \
+    \
+                if (dstAlpha > F32_OPACITY_OPAQUE - EPSILON) { \
+                    srcBlend = srcAlpha; \
+                } else { \
+                    float newAlpha = dstAlpha + (F32_OPACITY_OPAQUE - dstAlpha) * srcAlpha; \
+                    dst[PIXEL_ALPHA] = newAlpha; \
+    \
+                    if (newAlpha > EPSILON) { \
+                        srcBlend = srcAlpha / newAlpha; \
+                    } else { \
+                        srcBlend = srcAlpha; \
+                    } \
+                }
+
+#define COMMON_COMPOSITE_OP_EPILOG() \
+            } \
+    \
+            columns--; \
+            src += MAX_CHANNEL_RGBA; \
+            dst += MAX_CHANNEL_RGBA; \
+        } \
+    \
+        rows--; \
+        srcRowStart += srcRowStride; \
+        dstRowStart += dstRowStride; \
+        if(tqmaskRowStart) { \
+            tqmaskRowStart += tqmaskRowStride; \
+        } \
+    }
+
+void KisRgbF32ColorSpace::compositeMultiply(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float srcColor = src[PIXEL_RED];
+        float dstColor = dst[PIXEL_RED];
+
+        srcColor = srcColor * dstColor;
+
+        dst[PIXEL_RED] = FLOAT_BLEND(srcColor, dstColor, srcBlend);
+
+        srcColor = src[PIXEL_GREEN];
+        dstColor = dst[PIXEL_GREEN];
+
+        srcColor = srcColor * dstColor;
+
+        dst[PIXEL_GREEN] = FLOAT_BLEND(srcColor, dstColor, srcBlend);
+
+        srcColor = src[PIXEL_BLUE];
+        dstColor = dst[PIXEL_BLUE];
+
+        srcColor = srcColor * dstColor;
+
+        dst[PIXEL_BLUE] = FLOAT_BLEND(srcColor, dstColor, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeDivide(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            float srcColor = src[channel];
+            float dstColor = dst[channel];
+
+            srcColor = TQMIN(dstColor / (srcColor + EPSILON), FLOAT_MAX);
+
+            float newColor = FLOAT_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeScreen(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            float srcColor = src[channel];
+            float dstColor = dst[channel];
+
+            srcColor = FLOAT_MAX - ((FLOAT_MAX - dstColor) * (FLOAT_MAX - srcColor));
+
+            float newColor = FLOAT_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeOverlay(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            float srcColor = src[channel];
+            float dstColor = dst[channel];
+
+            srcColor = dstColor * (dstColor + 2 * (srcColor * (FLOAT_MAX - dstColor)));
+
+            float newColor = FLOAT_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeDodge(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            float srcColor = src[channel];
+            float dstColor = dst[channel];
+
+            srcColor = TQMIN(dstColor / (FLOAT_MAX + EPSILON - srcColor), FLOAT_MAX);
+
+            float newColor = FLOAT_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            float srcColor = src[channel];
+            float dstColor = dst[channel];
+
+            srcColor = TQMIN((FLOAT_MAX - dstColor) / (srcColor + EPSILON), FLOAT_MAX);
+            srcColor = CLAMP(FLOAT_MAX - srcColor, 0, FLOAT_MAX);
+
+            float newColor = FLOAT_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            float srcColor = src[channel];
+            float dstColor = dst[channel];
+
+            srcColor = TQMIN(srcColor, dstColor);
+
+            float newColor = FLOAT_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeLighten(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            float srcColor = src[channel];
+            float dstColor = dst[channel];
+
+            srcColor = TQMAX(srcColor, dstColor);
+
+            float newColor = FLOAT_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeHue(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float srcRed = src[PIXEL_RED];
+        float srcGreen = src[PIXEL_GREEN];
+        float srcBlue = src[PIXEL_BLUE];
+
+        float dstRed = dst[PIXEL_RED];
+        float dstGreen = dst[PIXEL_GREEN];
+        float dstBlue = dst[PIXEL_BLUE];
+
+        float srcHue;
+        float srcSaturation;
+        float srcValue;
+
+        float dstHue;
+        float dstSaturation;
+        float dstValue;
+
+        RGBToHSV(srcRed, srcGreen, srcBlue, &srcHue, &srcSaturation, &srcValue);
+        RGBToHSV(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
+
+        HSVToRGB(srcHue, dstSaturation, dstValue, &srcRed, &srcGreen, &srcBlue);
+
+        dst[PIXEL_RED] = FLOAT_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = FLOAT_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = FLOAT_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeSaturation(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float srcRed = src[PIXEL_RED];
+        float srcGreen = src[PIXEL_GREEN];
+        float srcBlue = src[PIXEL_BLUE];
+
+        float dstRed = dst[PIXEL_RED];
+        float dstGreen = dst[PIXEL_GREEN];
+        float dstBlue = dst[PIXEL_BLUE];
+
+        float srcHue;
+        float srcSaturation;
+        float srcValue;
+
+        float dstHue;
+        float dstSaturation;
+        float dstValue;
+
+        RGBToHSV(srcRed, srcGreen, srcBlue, &srcHue, &srcSaturation, &srcValue);
+        RGBToHSV(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
+
+        HSVToRGB(dstHue, srcSaturation, dstValue, &srcRed, &srcGreen, &srcBlue);
+
+        dst[PIXEL_RED] = FLOAT_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = FLOAT_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = FLOAT_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeValue(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float srcRed = src[PIXEL_RED];
+        float srcGreen = src[PIXEL_GREEN];
+        float srcBlue = src[PIXEL_BLUE];
+
+        float dstRed = dst[PIXEL_RED];
+        float dstGreen = dst[PIXEL_GREEN];
+        float dstBlue = dst[PIXEL_BLUE];
+
+        float srcHue;
+        float srcSaturation;
+        float srcValue;
+
+        float dstHue;
+        float dstSaturation;
+        float dstValue;
+
+        RGBToHSV(srcRed, srcGreen, srcBlue, &srcHue, &srcSaturation, &srcValue);
+        RGBToHSV(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
+
+        HSVToRGB(dstHue, dstSaturation, srcValue, &srcRed, &srcGreen, &srcBlue);
+
+        dst[PIXEL_RED] = FLOAT_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = FLOAT_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = FLOAT_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeColor(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, float opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float srcRed = src[PIXEL_RED];
+        float srcGreen = src[PIXEL_GREEN];
+        float srcBlue = src[PIXEL_BLUE];
+
+        float dstRed = dst[PIXEL_RED];
+        float dstGreen = dst[PIXEL_GREEN];
+        float dstBlue = dst[PIXEL_BLUE];
+
+        float srcHue;
+        float srcSaturation;
+        float srcLightness;
+
+        float dstHue;
+        float dstSaturation;
+        float dstLightness;
+
+        RGBToHSL(srcRed, srcGreen, srcBlue, &srcHue, &srcSaturation, &srcLightness);
+        RGBToHSL(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstLightness);
+
+        HSLToRGB(srcHue, srcSaturation, dstLightness, &srcRed, &srcGreen, &srcBlue);
+
+        dst[PIXEL_RED] = FLOAT_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = FLOAT_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = FLOAT_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbF32ColorSpace::compositeErase(TQ_UINT8 *dst,
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src,
+            TQ_INT32 srcRowSize,
+            const TQ_UINT8 *srcAlphaMask,
+            TQ_INT32 tqmaskRowStride,
+            TQ_INT32 rows,
+            TQ_INT32 cols,
+            float /*opacity*/)
+{
+    while (rows-- > 0)
+    {
+        const Pixel *s = reinterpret_cast<const Pixel *>(src);
+        Pixel *d = reinterpret_cast<Pixel *>(dst);
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (TQ_INT32 i = cols; i > 0; i--, s++, d++)
+        {
+            float srcAlpha = s->alpha;
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = FLOAT_BLEND(srcAlpha, F32_OPACITY_OPAQUE, UINT8_TO_FLOAT(U8_tqmask));
+                }
+                tqmask++;
+            }
+            d->alpha = srcAlpha * d->alpha;
+        }
+
+        dst += dstRowSize;
+        src += srcRowSize;
+        if(srcAlphaMask) {
+            srcAlphaMask += tqmaskRowStride;
+        }
+    }
+}
+
+void KisRgbF32ColorSpace::bitBlt(TQ_UINT8 *dst,
+                      TQ_INT32 dstRowStride,
+                      const TQ_UINT8 *src,
+                      TQ_INT32 srcRowStride,
+                      const TQ_UINT8 *tqmask,
+                      TQ_INT32 tqmaskRowStride,
+                      TQ_UINT8 U8_opacity,
+                      TQ_INT32 rows,
+                      TQ_INT32 cols,
+                      const KisCompositeOp& op)
+{
+    float opacity = UINT8_TO_FLOAT(U8_opacity);
+
+    switch (op.op()) {
+    case COMPOSITE_UNDEF:
+        // Undefined == no composition
+        break;
+    case COMPOSITE_OVER:
+        compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_IN:
+        //compositeIn(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+    case COMPOSITE_OUT:
+        //compositeOut(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ATOP:
+        //compositeAtop(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_XOR:
+        //compositeXor(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_PLUS:
+        //compositePlus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MINUS:
+        //compositeMinus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ADD:
+        //compositeAdd(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SUBTRACT:
+        //compositeSubtract(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIFF:
+        //compositeDiff(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MULT:
+        compositeMultiply(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIVIDE:
+        compositeDivide(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BUMPMAP:
+        //compositeBumpmap(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY:
+        compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, U8_opacity);
+        break;
+    case COMPOSITE_COPY_RED:
+        //compositeCopyRed(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_GREEN:
+        //compositeCopyGreen(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_BLUE:
+        //compositeCopyBlue(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_OPACITY:
+        //compositeCopyOpacity(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_CLEAR:
+        //compositeClear(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISSOLVE:
+        //compositeDissolve(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISPLACE:
+        //compositeDisplace(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#if 0
+    case COMPOSITE_MODULATE:
+        compositeModulate(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_THRESHOLD:
+        compositeThreshold(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#endif
+    case COMPOSITE_NO:
+        // No composition.
+        break;
+    case COMPOSITE_DARKEN:
+        compositeDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LIGHTEN:
+        compositeLighten(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_HUE:
+        compositeHue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SATURATION:
+        compositeSaturation(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_VALUE:
+        compositeValue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLOR:
+        compositeColor(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLORIZE:
+        //compositeColorize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LUMINIZE:
+        //compositeLuminize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SCREEN:
+        compositeScreen(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_OVERLAY:
+        compositeOverlay(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ERASE:
+        compositeErase(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DODGE:
+        compositeDodge(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BURN:
+        compositeBurn(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ALPHA_DARKEN:
+        abstractCompositeAlphaDarken<float, F32Mult, Uint8ToF32, F32OpacityTest,
+                    PIXEL_ALPHA, MAX_CHANNEL_RGB, MAX_CHANNEL_RGBA>(
+                    dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride,
+                    rows, cols, U8_opacity, F32Mult(), Uint8ToF32(), F32OpacityTest());
+    default:
+        break;
+    }
+}
+
+KisCompositeOpList KisRgbF32ColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    list.append(KisCompositeOp(COMPOSITE_ALPHA_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_MULT));
+    list.append(KisCompositeOp(COMPOSITE_BURN));
+    list.append(KisCompositeOp(COMPOSITE_DODGE));
+    list.append(KisCompositeOp(COMPOSITE_DIVIDE));
+    list.append(KisCompositeOp(COMPOSITE_SCREEN));
+    list.append(KisCompositeOp(COMPOSITE_OVERLAY));
+    list.append(KisCompositeOp(COMPOSITE_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_LIGHTEN));
+    list.append(KisCompositeOp(COMPOSITE_HUE));
+    list.append(KisCompositeOp(COMPOSITE_SATURATION));
+    list.append(KisCompositeOp(COMPOSITE_VALUE));
+    list.append(KisCompositeOp(COMPOSITE_COLOR));
+
+    return list;
+}
+
diff --git a/chalk/colorspaces/rgb_f32/kis_rgb_f32_colorspace.h b/chalk/colorspaces/rgb_f32/kis_rgb_f32_colorspace.h
new file mode 100644
index 000000000..6f2ff3aef
--- /dev/null
+++ b/chalk/colorspaces/rgb_f32/kis_rgb_f32_colorspace.h
@@ -0,0 +1,165 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_STRATEGY_COLORSPACE_RGB_F32_H_
+#define KIS_STRATEGY_COLORSPACE_RGB_F32_H_
+
+#include <tqcolor.h>
+
+#include <klocale.h>
+
+#include <koffice_export.h>
+
+#include "kis_global.h"
+#include "kis_f32_base_colorspace.h"
+
+class KisColorSpaceFactoryRegistry;
+
+class KRITATOOL_EXPORT KisRgbF32ColorSpace : public KisF32BaseColorSpace {
+public:
+    KisRgbF32ColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p);
+    virtual ~KisRgbF32ColorSpace();
+
+    virtual bool willDegrade(ColorSpaceIndependence independence)
+        {
+            if (independence == TO_RGBA8 || independence == TO_LAB16)
+                return true;
+            else
+                return false;
+        };
+
+
+
+public:
+    void setPixel(TQ_UINT8 *pixel, float red, float green, float blue, float alpha) const;
+    void getPixel(const TQ_UINT8 *pixel, float *red, float *green, float *blue, float *alpha) const;
+
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile * profile = 0);
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * profile = 0);
+
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * profile = 0);
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile = 0);
+
+    virtual TQ_UINT8 difference(const TQ_UINT8 *src1, const TQ_UINT8 *src2);
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
+    virtual TQ_UINT8 intensity8(const TQ_UINT8 * src) const;
+
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const;
+    virtual TQ_UINT32 nColorChannels() const;
+    virtual TQ_UINT32 pixelSize() const;
+
+
+    virtual TQImage convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                       KisProfile *  dstProfile,
+                       TQ_INT32 renderingIntent,
+                       float exposure = 0.0f);
+
+    virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+
+protected:
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dstRowStride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeMultiply(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeDivide(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeScreen(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeOverlay(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeDodge(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeBurn(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeLighten(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeHue(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeSaturation(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeValue(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeColor(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+    void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, float opacity);
+
+private:
+    friend class KisRgbF32ColorSpaceTester;
+
+    static const TQ_UINT8 PIXEL_BLUE = 0;
+    static const TQ_UINT8 PIXEL_GREEN = 1;
+    static const TQ_UINT8 PIXEL_RED = 2;
+    static const TQ_UINT8 PIXEL_ALPHA = 3;
+
+    struct Pixel {
+        float blue;
+        float green;
+        float red;
+        float alpha;
+    };
+
+    // For Alpha Composite
+    struct F32Mult {
+        inline float operator()(const float& a, const float& b) const {
+            return a * b;
+        }
+    };
+    struct Uint8ToF32 {
+        inline float operator()(const TQ_UINT8 src) const {
+            return UINT8_TO_FLOAT(src);
+        }
+    };
+    struct F32OpacityTest {
+        inline bool operator()(const float& opacity) const {
+            return opacity > F32_OPACITY_TRANSPARENT + 1e-6; // #define EPSILON in the .cc
+        }
+    };
+};
+
+// FIXME: lcms doesn't support 32-bit float
+#define F32_LCMS_TYPE TYPE_BGRA_16
+
+class KisRgbF32ColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const { return KisID("RGBAF32", i18n("RGB (32-bit float/channel)")); };
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() { return F32_LCMS_TYPE; };
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return icSigRgbData; };
+
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisRgbF32ColorSpace(tqparent, p); };
+
+    virtual TQString defaultProfile() { return "sRGB built-in - (lcms internal)"; };
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_RGB_F32_H_
+
diff --git a/chalk/colorspaces/rgb_f32/rgb_f32_plugin.cc b/chalk/colorspaces/rgb_f32/rgb_f32_plugin.cc
new file mode 100644
index 000000000..4e11e36c6
--- /dev/null
+++ b/chalk/colorspaces/rgb_f32/rgb_f32_plugin.cc
@@ -0,0 +1,63 @@
+/*
+* rgb_f32_plugin.cc -- Part of Chalk
+*
+* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+*
+*  This program is free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  This program is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  You should have received a copy of the GNU General Public License
+*  along with this program; if not, write to the Free Software
+*  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include <kinstance.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+
+#include <kis_debug_areas.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_basic_histogram_producers.h>
+
+#include "rgb_f32_plugin.h"
+#include "kis_rgb_f32_colorspace.h"
+
+typedef KGenericFactory<RGBF32Plugin> RGBF32PluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalk_rgb_f32_plugin, RGBF32PluginFactory( "chalk" ) )
+
+
+RGBF32Plugin::RGBF32Plugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(RGBF32PluginFactory::instance());
+
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") )
+    {
+	KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>(tqparent);
+
+        KisColorSpace * colorSpaceRGBF32  = new KisRgbF32ColorSpace(f, 0);
+
+        KisColorSpaceFactory * csf  = new KisRgbF32ColorSpaceFactory();
+        f->add(csf);
+
+        KisHistogramProducerFactoryRegistry::instance()->add(
+            new KisBasicHistogramProducerFactory<KisBasicF32HistogramProducer>
+            (KisID("RGBF32HISTO", i18n("Float32")), colorSpaceRGBF32) );
+    }
+
+}
+
+RGBF32Plugin::~RGBF32Plugin()
+{
+}
+
+#include "rgb_f32_plugin.moc"
diff --git a/chalk/colorspaces/rgb_f32/rgb_f32_plugin.h b/chalk/colorspaces/rgb_f32/rgb_f32_plugin.h
new file mode 100644
index 000000000..22ec674f1
--- /dev/null
+++ b/chalk/colorspaces/rgb_f32/rgb_f32_plugin.h
@@ -0,0 +1,39 @@
+/*
+ *  Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RGB_F32_PLUGIN_H_
+#define RGB_F32_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the RGB F32 colour space strategy.
+ */
+class RGBF32Plugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    RGBF32Plugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~RGBF32Plugin();
+
+};
+
+
+#endif // RGB_F32_PLUGIN_H_
diff --git a/chalk/colorspaces/rgb_f32/rgb_f32_plugin.rc b/chalk/colorspaces/rgb_f32/rgb_f32_plugin.rc
new file mode 100644
index 000000000..88b13f856
--- /dev/null
+++ b/chalk/colorspaces/rgb_f32/rgb_f32_plugin.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui library="chalk_rgb_f32_plugin" version="1">
+<Menu name="Image"><text>&amp;Image</text>
+    <Menu name="Mode"><text>&amp;Mode</text>
+            <Action name="convert to RGB(A) (32-bit float)"/>
+    </Menu>
+</Menu>
+
+</kpartgui>
diff --git a/chalk/colorspaces/rgb_f32/tests/Makefile.am b/chalk/colorspaces/rgb_f32/tests/Makefile.am
new file mode 100644
index 000000000..5980c24ed
--- /dev/null
+++ b/chalk/colorspaces/rgb_f32/tests/Makefile.am
@@ -0,0 +1,17 @@
+AM_CPPFLAGS = -I$(srcdir)/.. \
+	-I$(srcdir)/../../../sdk \
+	-I$(srcdir)/../../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../../color_strategy/ \
+	$(all_includes)
+
+# The check_ target makes sure we don't install the modules,
+# $(KDE_CHECK_PLUGIN) assures a shared library is created.
+check_LTLIBRARIES = kunittest_kis_strategy_colorspace_rgb_f32_tester.la
+
+kunittest_kis_strategy_colorspace_rgb_f32_tester_la_SOURCES = kis_strategy_colorspace_rgb_f32_tester.cc
+kunittest_kis_strategy_colorspace_rgb_f32_tester_la_LIBADD = -lkunittest ../libchalk_rgb_f32.la
+kunittest_kis_strategy_colorspace_rgb_f32_tester_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+check-local: kunittest_kis_strategy_colorspace_rgb_f32_tester.la
+	kunittestmodrunner
+
diff --git a/chalk/colorspaces/rgb_f32/tests/kis_strategy_colorspace_rgb_f32_tester.cc b/chalk/colorspaces/rgb_f32/tests/kis_strategy_colorspace_rgb_f32_tester.cc
new file mode 100644
index 000000000..b4ec34e9b
--- /dev/null
+++ b/chalk/colorspaces/rgb_f32/tests/kis_strategy_colorspace_rgb_f32_tester.cc
@@ -0,0 +1,541 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "kis_factory.h"
+#include "kis_strategy_colorspace_rgb_f32_tester.h"
+#include "kis_rgb_f32_colorspace.h"
+#include "kis_integer_maths.h"
+#include "kis_paint_device.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE( kunittest_kis_strategy_colorspace_rgb_f32_tester, "RGBA 32-bit float colorspace tester" );
+KUNITTEST_MODULE_REGISTER_TESTER( KisRgbF32ColorSpaceTester );
+
+#define PIXEL_BLUE 0
+#define PIXEL_GREEN 1
+#define PIXEL_RED 2
+#define PIXEL_ALPHA 3
+
+#define NUM_CHANNELS 4
+#define NUM_COLOUR_CHANNELS 3
+#define CHANNEL_SIZE ((int)sizeof(float))
+
+#define RED_CHANNEL 0
+#define GREEN_CHANNEL 1
+#define BLUE_CHANNEL 2
+#define ALPHA_CHANNEL 3
+
+#define MAX_CHANNEL_VALUE 1.0f
+#define MIN_CHANNEL_VALUE 0.0f
+
+
+void KisRgbF32ColorSpaceTester::allTests()
+{
+    // We need this so that the colour profile loading can operate without crashing.
+    KisFactory *factory = new KisFactory();
+
+    testBasics();
+    testToTQImage();
+    testCompositeOps();
+        testMixColors();
+
+    delete factory;
+}
+
+void KisRgbF32ColorSpaceTester::testBasics()
+{
+    KisProfile *profile = new KisProfile(cmsCreate_sRGBProfile());
+
+    KisRgbF32ColorSpace *cs = new KisRgbF32ColorSpace(profile);
+    KisAbstractColorSpace * csSP = cs;
+
+    CHECK(cs->hasAlpha(), true);
+    CHECK(cs->nChannels(), NUM_CHANNELS);
+    CHECK(cs->nColorChannels(), NUM_COLOUR_CHANNELS);
+    CHECK(cs->pixelSize(), NUM_CHANNELS * CHANNEL_SIZE);
+
+    TQValueVector<KisChannelInfo *> channels = cs->channels();
+
+    // Red
+    CHECK(channels[0]->pos(), PIXEL_RED * CHANNEL_SIZE);
+    CHECK(channels[0]->size(), CHANNEL_SIZE);
+    CHECK(channels[0]->channelType(), COLOR);
+
+    // Green
+    CHECK(channels[1]->pos(), PIXEL_GREEN * CHANNEL_SIZE);
+    CHECK(channels[1]->size(), CHANNEL_SIZE);
+    CHECK(channels[1]->channelType(), COLOR);
+
+    // Blue
+    CHECK(channels[2]->pos(), PIXEL_BLUE * CHANNEL_SIZE);
+    CHECK(channels[2]->size(), CHANNEL_SIZE);
+    CHECK(channels[2]->channelType(), COLOR);
+
+    // Alpha
+    CHECK(channels[3]->pos(), PIXEL_ALPHA * CHANNEL_SIZE);
+    CHECK(channels[3]->size(), CHANNEL_SIZE);
+    CHECK(channels[3]->channelType(), ALPHA);
+
+    KisPaintDeviceSP pd = new KisPaintDevice(cs, "test");
+
+    KisRgbF32ColorSpace::Pixel defaultPixel;
+
+    memcpy(&defaultPixel, pd->dataManager()->defaultPixel(), sizeof(defaultPixel));
+
+    CHECK(defaultPixel.red, 0.0f);
+    CHECK(defaultPixel.green, 0.0f);
+    CHECK(defaultPixel.blue, 0.0f);
+    CHECK(defaultPixel.alpha, F32_OPACITY_TRANSPARENT);
+
+    float pixel[NUM_CHANNELS];
+
+    cs->fromTQColor(tqRgb(255, 255, 255), reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], MAX_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_GREEN], MAX_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_BLUE], MAX_CHANNEL_VALUE);
+
+    cs->fromTQColor(tqRgb(0, 0, 0), reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], MIN_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_GREEN], MIN_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_BLUE], MIN_CHANNEL_VALUE);
+
+    cs->fromTQColor(tqRgb(128, 64, 192), reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], UINT8_TO_FLOAT(128));
+    CHECK(pixel[PIXEL_GREEN], UINT8_TO_FLOAT(64));
+    CHECK(pixel[PIXEL_BLUE], UINT8_TO_FLOAT(192));
+
+    cs->fromTQColor(tqRgb(255, 255, 255), OPACITY_OPAQUE, reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], MAX_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_GREEN], MAX_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_BLUE], MAX_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_ALPHA], MAX_CHANNEL_VALUE);
+
+    cs->fromTQColor(tqRgb(255, 255, 255), OPACITY_TRANSPARENT, reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], MAX_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_GREEN], MAX_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_BLUE], MAX_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_ALPHA], F32_OPACITY_TRANSPARENT);
+
+    cs->fromTQColor(tqRgb(255, 255, 255), OPACITY_OPAQUE / 2, reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK(pixel[PIXEL_RED], MAX_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_GREEN], MAX_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_BLUE], MAX_CHANNEL_VALUE);
+    CHECK(pixel[PIXEL_ALPHA], UINT8_TO_FLOAT(OPACITY_OPAQUE / 2));
+
+    pixel[PIXEL_RED] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_GREEN] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_BLUE] = MAX_CHANNEL_VALUE;
+
+    TQColor c;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c);
+
+    CHECK(c.red(), 255);
+    CHECK(c.green(), 255);
+    CHECK(c.blue(), 255);
+
+    pixel[PIXEL_RED] = MIN_CHANNEL_VALUE;
+    pixel[PIXEL_GREEN] = MIN_CHANNEL_VALUE;
+    pixel[PIXEL_BLUE] = MIN_CHANNEL_VALUE;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c);
+
+    CHECK(c.red(), 0);
+    CHECK(c.green(), 0);
+    CHECK(c.blue(), 0);
+
+    pixel[PIXEL_RED] = MAX_CHANNEL_VALUE / 4;
+    pixel[PIXEL_GREEN] = MAX_CHANNEL_VALUE / 2;
+    pixel[PIXEL_BLUE] = (3 * MAX_CHANNEL_VALUE) / 4;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c);
+
+    CHECK(c.red(), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE / 4));
+    CHECK(c.green(), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE / 2));
+    CHECK(c.blue(), (int)FLOAT_TO_UINT8((3 * MAX_CHANNEL_VALUE) / 4));
+
+    pixel[PIXEL_RED] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_GREEN] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_BLUE] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_ALPHA] = MAX_CHANNEL_VALUE;
+
+    TQ_UINT8 opacity;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), 255);
+    CHECK(c.green(), 255);
+    CHECK(c.blue(), 255);
+    CHECK(opacity, OPACITY_OPAQUE);
+
+    pixel[PIXEL_ALPHA] = F32_OPACITY_OPAQUE;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), 255);
+    CHECK(c.green(), 255);
+    CHECK(c.blue(), 255);
+    CHECK(opacity, OPACITY_OPAQUE);
+
+    pixel[PIXEL_RED] = MIN_CHANNEL_VALUE;
+    pixel[PIXEL_GREEN] = MIN_CHANNEL_VALUE;
+    pixel[PIXEL_BLUE] = MIN_CHANNEL_VALUE;
+    pixel[PIXEL_ALPHA] = F32_OPACITY_TRANSPARENT;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), 0);
+    CHECK(c.green(), 0);
+    CHECK(c.blue(), 0);
+    CHECK(opacity, OPACITY_TRANSPARENT);
+
+    pixel[PIXEL_RED] = MAX_CHANNEL_VALUE / 4;
+    pixel[PIXEL_GREEN] = MAX_CHANNEL_VALUE / 2;
+    pixel[PIXEL_BLUE] = (3 * MAX_CHANNEL_VALUE) / 4;
+    pixel[PIXEL_ALPHA] = MAX_CHANNEL_VALUE / 2;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE / 4));
+    CHECK(c.green(), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE / 2));
+    CHECK(c.blue(), (int)FLOAT_TO_UINT8((3 * MAX_CHANNEL_VALUE) / 4));
+    CHECK((int)opacity, (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE / 2));
+
+    #define NUM_PIXELS 4
+
+    KisRgbF32ColorSpace::Pixel pixels[NUM_PIXELS] = {
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE / 4},
+        {MAX_CHANNEL_VALUE / 4, MAX_CHANNEL_VALUE / 2, MAX_CHANNEL_VALUE / 3, MAX_CHANNEL_VALUE / 2},
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MIN_CHANNEL_VALUE},
+        {MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MAX_CHANNEL_VALUE}
+    };
+
+    cs->setAlpha(reinterpret_cast<TQ_UINT8 *>(pixels), OPACITY_OPAQUE / 2, NUM_PIXELS);
+
+    CHECK(pixels[0].red, MAX_CHANNEL_VALUE);
+    CHECK(pixels[0].green, MAX_CHANNEL_VALUE);
+    CHECK(pixels[0].blue, MAX_CHANNEL_VALUE);
+    CHECK(pixels[0].alpha, UINT8_TO_FLOAT(OPACITY_OPAQUE / 2));
+
+    CHECK(pixels[1].red, MAX_CHANNEL_VALUE / 3);
+    CHECK(pixels[1].green, MAX_CHANNEL_VALUE / 2);
+    CHECK(pixels[1].blue, MAX_CHANNEL_VALUE / 4);
+    CHECK(pixels[1].alpha, UINT8_TO_FLOAT(OPACITY_OPAQUE / 2));
+
+    CHECK(pixels[2].red, MAX_CHANNEL_VALUE);
+    CHECK(pixels[2].green, MAX_CHANNEL_VALUE);
+    CHECK(pixels[2].blue, MAX_CHANNEL_VALUE);
+    CHECK(pixels[2].alpha, UINT8_TO_FLOAT(OPACITY_OPAQUE / 2));
+
+    CHECK(pixels[3].red, MIN_CHANNEL_VALUE);
+    CHECK(pixels[3].green, MIN_CHANNEL_VALUE);
+    CHECK(pixels[3].blue, MIN_CHANNEL_VALUE);
+    CHECK(pixels[3].alpha, UINT8_TO_FLOAT(OPACITY_OPAQUE / 2));
+
+    pixel[PIXEL_RED] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_GREEN] = MAX_CHANNEL_VALUE / 2;
+    pixel[PIXEL_BLUE] = MAX_CHANNEL_VALUE / 4;
+    pixel[PIXEL_ALPHA] = MIN_CHANNEL_VALUE;
+
+    TQString valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), RED_CHANNEL);
+    CHECK(valueText, TQString().setNum(MAX_CHANNEL_VALUE));
+
+    valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), GREEN_CHANNEL);
+    CHECK(valueText, TQString().setNum(MAX_CHANNEL_VALUE / 2));
+
+    valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), BLUE_CHANNEL);
+    CHECK(valueText, TQString().setNum(MAX_CHANNEL_VALUE / 4));
+
+    valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), ALPHA_CHANNEL);
+    CHECK(valueText, TQString().setNum(MIN_CHANNEL_VALUE));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), RED_CHANNEL);
+    CHECK(valueText, TQString().setNum(MAX_CHANNEL_VALUE));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), GREEN_CHANNEL);
+    CHECK(valueText, TQString().setNum(MAX_CHANNEL_VALUE / 2));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), BLUE_CHANNEL);
+    CHECK(valueText, TQString().setNum(MAX_CHANNEL_VALUE / 4));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), ALPHA_CHANNEL);
+    CHECK(valueText, TQString().setNum(MIN_CHANNEL_VALUE));
+
+    cs->setPixel(reinterpret_cast<TQ_UINT8 *>(pixel), 0.128, 0.192, 0.64, 0.99);
+    CHECK(pixel[PIXEL_RED], 0.128f);
+    CHECK(pixel[PIXEL_GREEN], 0.192f);
+    CHECK(pixel[PIXEL_BLUE], 0.64f);
+    CHECK(pixel[PIXEL_ALPHA], 0.99f);
+
+    float red;
+    float green;
+    float blue;
+    float alpha;
+
+    cs->getPixel(reinterpret_cast<const TQ_UINT8 *>(pixel), &red, &green, &blue, &alpha);
+    CHECK(red, 0.128f);
+    CHECK(green, 0.192f);
+    CHECK(blue, 0.64f);
+    CHECK(alpha, 0.99f);
+
+    CHECK(FLOAT_TO_UINT8(-0.5), 0u);
+    CHECK(FLOAT_TO_UINT8(0), 0u);
+    CHECK_TOLERANCE(FLOAT_TO_UINT8(0.5), UINT8_MAX / 2, 1u);
+    CHECK(FLOAT_TO_UINT8(1), UINT8_MAX);
+    CHECK(FLOAT_TO_UINT8(1.5), UINT8_MAX);
+
+    CHECK(FLOAT_TO_UINT16(-0.5), 0u);
+    CHECK(FLOAT_TO_UINT16(0), 0u);
+    CHECK_TOLERANCE(FLOAT_TO_UINT16(0.5), UINT16_MAX / 2, 1u);
+    CHECK(FLOAT_TO_UINT16(1), UINT16_MAX);
+    CHECK(FLOAT_TO_UINT16(1.5), UINT16_MAX);
+}
+
+void KisRgbF32ColorSpaceTester::testMixColors()
+{
+    KisProfile *profile = new KisProfile(cmsCreate_sRGBProfile());
+
+    KisAbstractColorSpace * cs = new KisRgbF32ColorSpace(profile);
+
+    // Test mixColors.
+    float pixel1[NUM_CHANNELS];
+    float pixel2[NUM_CHANNELS];
+    float outputPixel[NUM_CHANNELS];
+
+    outputPixel[PIXEL_RED] = 0;
+    outputPixel[PIXEL_GREEN] = 0;
+    outputPixel[PIXEL_BLUE] = 0;
+    outputPixel[PIXEL_ALPHA] = 0;
+
+    pixel1[PIXEL_RED] = MAX_CHANNEL_VALUE;
+    pixel1[PIXEL_GREEN] = MAX_CHANNEL_VALUE;
+    pixel1[PIXEL_BLUE] = MAX_CHANNEL_VALUE;
+    pixel1[PIXEL_ALPHA] = MAX_CHANNEL_VALUE;
+
+    pixel2[PIXEL_RED] = 0;
+    pixel2[PIXEL_GREEN] = 0;
+    pixel2[PIXEL_BLUE] = 0;
+    pixel2[PIXEL_ALPHA] = 0;
+
+    const TQ_UINT8 *pixelPtrs[2];
+    TQ_UINT8 weights[2];
+
+    pixelPtrs[0] = reinterpret_cast<const TQ_UINT8 *>(pixel1);
+    pixelPtrs[1] = reinterpret_cast<const TQ_UINT8 *>(pixel2);
+
+    weights[0] = 255;
+    weights[1] = 0;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK(outputPixel[PIXEL_RED], MAX_CHANNEL_VALUE);
+    CHECK(outputPixel[PIXEL_GREEN], MAX_CHANNEL_VALUE);
+    CHECK(outputPixel[PIXEL_BLUE], MAX_CHANNEL_VALUE);
+    CHECK(outputPixel[PIXEL_ALPHA], MAX_CHANNEL_VALUE);
+
+    weights[0] = 0;
+    weights[1] = 255;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK(outputPixel[PIXEL_RED], 0.0f);
+    CHECK(outputPixel[PIXEL_GREEN], 0.0f);
+    CHECK(outputPixel[PIXEL_BLUE], 0.0f);
+    CHECK(outputPixel[PIXEL_ALPHA], 0.0f);
+
+    weights[0] = 128;
+    weights[1] = 127;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK(outputPixel[PIXEL_RED], MAX_CHANNEL_VALUE);
+    CHECK(outputPixel[PIXEL_GREEN], MAX_CHANNEL_VALUE);
+    CHECK(outputPixel[PIXEL_BLUE], MAX_CHANNEL_VALUE);
+    CHECK(outputPixel[PIXEL_ALPHA], (128 * MAX_CHANNEL_VALUE) / 255);
+
+    pixel1[PIXEL_RED] = 20000;
+    pixel1[PIXEL_GREEN] = 10000;
+    pixel1[PIXEL_BLUE] = 5000;
+    pixel1[PIXEL_ALPHA] = MAX_CHANNEL_VALUE;
+
+    pixel2[PIXEL_RED] = 10000;
+    pixel2[PIXEL_GREEN] = 20000;
+    pixel2[PIXEL_BLUE] = 2000;
+    pixel2[PIXEL_ALPHA] = MAX_CHANNEL_VALUE;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK_TOLERANCE(outputPixel[PIXEL_RED], (128 * 20000 + 127 * 10000) / 255, 5);
+    CHECK_TOLERANCE(outputPixel[PIXEL_GREEN], (128 * 10000 + 127 * 20000) / 255, 5);
+    CHECK_TOLERANCE(outputPixel[PIXEL_BLUE], (128 * 5000 + 127 * 2000) / 255, 5);
+    CHECK(outputPixel[PIXEL_ALPHA], MAX_CHANNEL_VALUE);
+
+    pixel1[PIXEL_RED] = 0;
+    pixel1[PIXEL_GREEN] = 0;
+    pixel1[PIXEL_BLUE] = 0;
+    pixel1[PIXEL_ALPHA] = 0;
+
+    pixel2[PIXEL_RED] = MAX_CHANNEL_VALUE;
+    pixel2[PIXEL_GREEN] = MAX_CHANNEL_VALUE;
+    pixel2[PIXEL_BLUE] = MAX_CHANNEL_VALUE;
+    pixel2[PIXEL_ALPHA] = MAX_CHANNEL_VALUE;
+
+    weights[0] = 89;
+    weights[1] = 166;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK(outputPixel[PIXEL_RED], MAX_CHANNEL_VALUE);
+    CHECK(outputPixel[PIXEL_GREEN], MAX_CHANNEL_VALUE);
+    CHECK(outputPixel[PIXEL_BLUE], MAX_CHANNEL_VALUE);
+    CHECK_TOLERANCE(outputPixel[PIXEL_ALPHA], (89 * 0 + 166 * MAX_CHANNEL_VALUE) / 255, 5);
+}
+
+#define PIXELS_WIDTH 2
+#define PIXELS_HEIGHT 2
+
+void KisRgbF32ColorSpaceTester::testToTQImage()
+{
+    KisProfile *profile = new KisProfile(cmsCreate_sRGBProfile());
+
+    KisAbstractColorSpace * cs = new KisRgbF32ColorSpace(profile);
+
+    KisRgbF32ColorSpace::Pixel pixels[PIXELS_WIDTH * PIXELS_HEIGHT] = {
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE / 4},
+        {MAX_CHANNEL_VALUE / 4, MAX_CHANNEL_VALUE / 2, MAX_CHANNEL_VALUE / 3, MAX_CHANNEL_VALUE / 2},
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MIN_CHANNEL_VALUE},
+        {MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MAX_CHANNEL_VALUE}
+    };
+
+    TQImage image = cs->convertToTQImage(reinterpret_cast<const TQ_UINT8 *>(pixels), PIXELS_WIDTH, PIXELS_HEIGHT, 0, 0);
+
+    TQRgb c = image.pixel(0, 0);
+
+    // Exposure comes into play here.
+    /*
+    CHECK(tqRed(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqGreen(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqBlue(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqAlpha(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE / 4));
+
+    c = image.pixel(1, 0);
+
+    CHECK(tqRed(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE / 3));
+    CHECK(tqGreen(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE / 2));
+    CHECK(tqBlue(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE / 4));
+    CHECK(tqAlpha(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE / 2));
+
+    c = image.pixel(0, 1);
+
+    CHECK(tqRed(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqGreen(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqBlue(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqAlpha(c), (int)FLOAT_TO_UINT8(MIN_CHANNEL_VALUE));
+
+    c = image.pixel(1, 1);
+
+    CHECK(tqRed(c), (int)FLOAT_TO_UINT8(MIN_CHANNEL_VALUE));
+    CHECK(tqGreen(c), (int)FLOAT_TO_UINT8(MIN_CHANNEL_VALUE));
+    CHECK(tqBlue(c), (int)FLOAT_TO_UINT8(MIN_CHANNEL_VALUE));
+    CHECK(tqAlpha(c), (int)FLOAT_TO_UINT8(MAX_CHANNEL_VALUE));
+    */
+}
+
+#define NUM_ROWS 2
+#define NUM_COLUMNS 2
+#define SRC_ROW_STRIDE (NUM_COLUMNS * CHANNEL_SIZE)
+#define DST_ROW_STRIDE (NUM_COLUMNS * CHANNEL_SIZE)
+#define MASK_ROW_STRIDE NUM_COLUMNS
+
+/*
+1 alpha 1    0 alpha 1
+1 alpha 0.5  0 alpha 1
+1 alpha 0.5  0 alpha 0.5
+1 alpha 0    0 alpha 0.5
+
+*/
+
+void KisRgbF32ColorSpaceTester::testCompositeOps()
+{
+    KisProfile *profile = new KisProfile(cmsCreate_sRGBProfile());
+
+    KisRgbF32ColorSpace *cs = new KisRgbF32ColorSpace(profile);
+
+    KisRgbF32ColorSpace::Pixel srcPixel;
+    KisRgbF32ColorSpace::Pixel dstPixel;
+
+    srcPixel.red = UINT8_TO_FLOAT(102);
+    srcPixel.green = UINT8_TO_FLOAT(170);
+    srcPixel.blue = UINT8_TO_FLOAT(238);
+    srcPixel.alpha = F32_OPACITY_OPAQUE;
+
+    dstPixel = srcPixel;
+
+    cs->compositeDivide(reinterpret_cast<TQ_UINT8 *>(&dstPixel), 1, reinterpret_cast<const TQ_UINT8 *>(&srcPixel),
+                1, 0, 0, 1, 1, F32_OPACITY_OPAQUE);
+    /*
+    CHECK(dstPixel.red, (TQ_UINT16)UINT8_TO_UINT16(253));
+    CHECK(dstPixel.green, (TQ_UINT16)UINT8_TO_UINT16(254));
+    CHECK(dstPixel.blue, (TQ_UINT16)UINT8_TO_UINT16(254));
+    CHECK(dstPixel.alpha, KisRgbF32ColorSpace::F32_OPACITY_OPAQUE);
+
+    TQ_UINT16 srcColor = 43690;
+    TQ_UINT16 dstColor = 43690;
+
+    srcColor = TQMIN((dstColor * (65535u + 1u) + (srcColor / 2u)) / (1u + srcColor), 65535u);
+
+    CHECK((int)srcColor, 65534);
+
+    TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, 65535u);
+
+    CHECK((int)newColor, 65534);
+    */
+
+    /*
+    KisRgbF32ColorSpace::Pixel srcPixels[NUM_ROWS * NUM_COLUMNS] = {
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE / 4},
+        {MAX_CHANNEL_VALUE / 4, MAX_CHANNEL_VALUE / 2, MAX_CHANNEL_VALUE / 3, MAX_CHANNEL_VALUE / 2},
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MIN_CHANNEL_VALUE},
+        {MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MAX_CHANNEL_VALUE}
+    };
+
+    KisRgbF32ColorSpace::Pixel dstPixels[NUM_ROWS * NUM_COLUMNS] = {
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE / 4},
+        {MAX_CHANNEL_VALUE / 4, MAX_CHANNEL_VALUE / 2, MAX_CHANNEL_VALUE / 3, MAX_CHANNEL_VALUE / 2},
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MIN_CHANNEL_VALUE},
+        {MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MAX_CHANNEL_VALUE}
+    };
+
+    cs->compositeOver(reinterpret_cast<TQ_UINT8 *>(dstPixels), DST_ROW_STRIDE, reinterpret_cast<const TQ_UINT8 *>(srcPixels),
+                SRC_ROW_STRIDE, tqmask, MASK_ROW_STRIDE, NUM_ROWS, NUM_COLUMNS, opacity);
+    */
+
+    delete cs;
+}
+
diff --git a/chalk/colorspaces/rgb_f32/tests/kis_strategy_colorspace_rgb_f32_tester.h b/chalk/colorspaces/rgb_f32/tests/kis_strategy_colorspace_rgb_f32_tester.h
new file mode 100644
index 000000000..1153f1473
--- /dev/null
+++ b/chalk/colorspaces/rgb_f32/tests/kis_strategy_colorspace_rgb_f32_tester.h
@@ -0,0 +1,47 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef KIS_STRATEGY_COLORSPACE_RGB_F32_TESTER_H
+#define KIS_STRATEGY_COLORSPACE_RGB_F32_TESTER_H
+
+#include <kunittest/tester.h>
+
+#define CHECK_TOLERANCE( x, y, tolerance ) \
+if ((x) <= (y) + (tolerance) && (x) >= (y) - (tolerance)) \
+{ \
+    success(TQString(__FILE__) + "[" + TQString::number(__LINE__) + "]: passed " + #x); \
+} \
+else \
+{ \
+    failure(TQString(__FILE__) + "[" + TQString::number(__LINE__) + TQString("]: failed ") + #x + "\n Expected " + #y + ", Actual result " + TQString::number(x)); \
+} \
+
+class KisRgbF32ColorSpaceTester : public KUnitTest::Tester
+{
+public:
+        void allTests();
+    void testBasics();
+    void testMixColors();
+    void testToTQImage();
+    void testCompositeOps();
+};
+
+#endif
+
diff --git a/chalk/colorspaces/rgb_u16/Makefile.am b/chalk/colorspaces/rgb_u16/Makefile.am
new file mode 100644
index 000000000..28ef3e620
--- /dev/null
+++ b/chalk/colorspaces/rgb_u16/Makefile.am
@@ -0,0 +1,32 @@
+# location for the rc file
+kde_services_DATA = chalk_rgb_u16_plugin.desktop
+
+INCLUDES  =  -I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../chalkcolor \
+	$(KOFFICE_INCLUDES) \
+	$(all_includes)
+
+lib_LTLIBRARIES = libchalk_rgb_u16.la
+libchalk_rgb_u16_la_SOURCES = kis_rgb_u16_colorspace.cc
+libchalk_rgb_u16_la_LDFLAGS = $(all_libraries)
+libchalk_rgb_u16_la_LIBADD = ../../chalkcolor/libchalkcolor.la
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = chalk_rgb_u16_plugin.la
+
+# Srcs for the plugin
+chalk_rgb_u16_plugin_la_SOURCES = rgb_u16_plugin.cc
+noinst_HEADERS = rgb_u16_plugin.h kis_rgb_u16_colorspace.h
+
+chalk_rgb_u16_plugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms
+chalk_rgb_u16_plugin_la_LIBADD = libchalk_rgb_u16.la ../../chalkcolor/libchalkcolor.la
+
+chalk_rgb_u16_plugin_la_METASOURCES = AUTO
+
+if include_kunittest_tests
+TESTSDIR = tests
+endif
+
+SUBDIRS = . $(TESTSDIR)
+
diff --git a/chalk/colorspaces/rgb_u16/chalk_rgb_u16_plugin.desktop b/chalk/colorspaces/rgb_u16/chalk_rgb_u16_plugin.desktop
new file mode 100644
index 000000000..36ff23554
--- /dev/null
+++ b/chalk/colorspaces/rgb_u16/chalk_rgb_u16_plugin.desktop
@@ -0,0 +1,80 @@
+[Desktop Entry]
+Name=RGB Color Model (16-bit integer)
+Name[bg]=Цветови модел RGB (16 бита)
+Name[ca]=Model de color RGB (enter de 16 bits)
+Name[cy]=Model Lliw RGB (cyfanrif 16-did)
+Name[da]=RGB-farvemodel (16-bit heltal)
+Name[de]=RGB-Farbmodell (16-bit Ganzzahl)
+Name[el]=Χρωματικό μοντέλο RGB (16 bit ακέραιοι)
+Name[en_GB]=RGB Colour Model (16-bit integer)
+Name[eo]=RGB-kolormodelo (16-bita entjero)
+Name[es]=Modelo de color RGB (entero de 16 bits)
+Name[et]=RGB värvimudel (16-bitine täisarv)
+Name[fa]=مدل رنگ RGB )عدد صحیح ۱۶ بیتی(
+Name[fr]=Modèle de couleurs RVB (entiers 16 bits)
+Name[fy]=RGB-kleurmodel (16-bit integer)
+Name[gl]=Modelo de Cores RGB (inteiros de 16-bit)
+Name[he]=מודל צבעים RGB (16 סיביות)
+Name[hu]=RGB színmodell (16 bites egész)
+Name[is]=RGB litategund (16-bita heiltala)
+Name[it]=Modello di colore RGB (intero a 16 bit)
+Name[ja]=RGB カラーモデル (16 ビット整数)
+Name[km]=គំរូ​ពណ៌ RGB (ចំនួនគត់ 16 ប៊ីត)
+Name[lt]=RGB spalvų modelis (16-bitų sveikasis)
+Name[nb]=RGB-fargemodell (16-bit heltall)
+Name[nds]=RGB-Klöörmodell (16-Bit Heeltall)
+Name[ne]=RGB रङ मोडेल (१६-बिट इन्टिजर)
+Name[nl]=RGB-kleurmodel (16-bit integer)
+Name[pl]=Przestrzeń barw RGB (16-bitowa liczba całkowita)
+Name[pt]=Modelo de Cor RGB (inteiro de 16-bits)
+Name[pt_BR]=Modelo de Cor RGB (inteiro de 16-bits)
+Name[ru]=RGB (целое 16-бит)
+Name[sk]=Model farieb RGB (16-bitové čísla)
+Name[sl]=Barvni model RGB (16-bitno celo število)
+Name[sr]=RGB модел боја (16-битно целобројно)
+Name[sr@Latn]=RGB model boja (16-bitno celobrojno)
+Name[sv]=RGB-färgmodell (16-bitars heltal)
+Name[uk]=Модель кольору RGB (16-бітне ціле число)
+Name[uz]=RGB rang usuli (16-bit butun)
+Name[uz@cyrillic]=RGB ранг усули (16-бит бутун)
+Name[zh_TW]=RGB 色彩模型 (16-bit 整數)
+Comment=Color model for 16-bit integer per channel RGB images
+Comment[bg]=Цветови модел за 16 битови изображения RGB
+Comment[ca]=Model de color enter de 16 bits per canal d'imatges RGB
+Comment[cy]=Model lliw ar gyfer delweddau RGB â chyfanrif 16-did/sianel
+Comment[da]=Farvemodel for 16-bit heltal pr kanal RGB-billeder
+Comment[de]=Farbmodell für 16-bit Ganzzahl pro Kanal RGB-Bilder
+Comment[el]=Χρωματικό μοντέλο για 16-bit ακέραιους ανά κανάλι RGB εικόνες
+Comment[en_GB]=Colour model for 16-bit integer per channel RGB images
+Comment[es]=Modelo de color de entero de 16 bits por canal para imágenes RGB
+Comment[et]=16-bitiste täisarvuliste kanalitega RGB-piltide värvimudel
+Comment[fa]=مدل رنگ برای عدد صحیح ۱۶ بیتی برای هر تصویر RGB مجرا
+Comment[fr]=Modèle de couleurs pour des images RVB en 16 bits/plage
+Comment[fy]=Kleurmodel foar RGB-ôfbyldings mei16-bit/kanaal
+Comment[gl]=Modelo de cores para imaxes RGB de inteiro de 16-bit por canal
+Comment[he]=מודל צבעים עבור תמונות RGB של 16 סיביות/ערוצים
+Comment[hu]=Színmodell 16 bites egész/csatorna RGB képekhez
+Comment[is]=Litategund fyrir 16-bita heiltölu á rás RGB myndir
+Comment[it]=Modello di colore per immagini RGB in interi a canale di 16 bit
+Comment[ja]=16 ビット整数/チャンネル RGB 画像のためのカラーモデル
+Comment[km]=គំរូ​ពណ៌​សម្រាប់​រូបភាព RGB ចំនួនគត់ 16 ប៊ីត​ក្នុង​មួយ​ឆានែល
+Comment[nb]=Fargemodell for RGB-bilde med 16 bit heltall per kanal
+Comment[nds]=Klöörmodell för RGB-Biller mit 16-Bit Heeltall per Kanaal
+Comment[ne]=प्रति च्यानल RGB छविहरूको १६-बिट इन्टिजरका लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor RGB-afbeeldingen met 16-bit/kanaal
+Comment[pl]=Przestrzeń barw dla obrazków RGB o 16-bitowych liczbach całkowitych na kanał
+Comment[pt]=Modelo de cor para imagens RGB com 16 bits por canal
+Comment[pt_BR]=Modelo de cor para imagens RGB com 16 bits por canal
+Comment[ru]=Цветовое пространство RGB (целое 16-бит/канал)
+Comment[sk]=Model farieb pre RGB obrázky so 16-bitovými číslami na kanál
+Comment[sl]=Barvni model za slike RGB s 16-bitnim celim številom na kanal
+Comment[sr]=Модел боја за RGB слике, 16-битно целобројно по каналу
+Comment[sr@Latn]=Model boja za RGB slike, 16-bitno celobrojno po kanalu
+Comment[sv]=Färgmodell för 16-bitars heltal/kanal RGB-bilder
+Comment[uk]=Модель кольорів для зображень RGB 32-біт ціле число на канал
+Comment[zh_TW]=每色頻 16-bit 整數 RGB 圖片的色彩模型
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-KDE-Library=chalk_rgb_u16_plugin
+X-Chalk-Version=2
+
diff --git a/chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc b/chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc
new file mode 100644
index 000000000..c61433d2e
--- /dev/null
+++ b/chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc
@@ -0,0 +1,869 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <limits.h>
+#include <stdlib.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+#include <tqcolor.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+#include <kglobal.h>
+
+#include "kis_rgb_u16_colorspace.h"
+#include "kis_u16_base_colorspace.h"
+#include "kis_color_conversions.h"
+#include "kis_integer_maths.h"
+
+namespace {
+    const TQ_INT32 MAX_CHANNEL_RGB = 3;
+    const TQ_INT32 MAX_CHANNEL_RGBA = 4;
+}
+
+// XXX: already defined is superclass?
+//const TQ_UINT16 KisRgbU16ColorSpace::U16_OPACITY_OPAQUE;
+//const TQ_UINT16 KisRgbU16ColorSpace::U16_OPACITY_TRANSPARENT;
+
+KisRgbU16ColorSpace::KisRgbU16ColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) :
+    KisU16BaseColorSpace(KisID("RGBA16", i18n("RGB (16-bit integer/channel)")), TYPE_BGRA_16, icSigRgbData, tqparent, p)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Red"), i18n("R"), PIXEL_RED * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16), TQColor(255,0,0)));
+    m_channels.push_back(new KisChannelInfo(i18n("Green"), i18n("G"), PIXEL_GREEN * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16), TQColor(0,255,0)));
+    m_channels.push_back(new KisChannelInfo(i18n("Blue"), i18n("B"), PIXEL_BLUE * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16), TQColor(0,0,255)));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), PIXEL_ALPHA * sizeof(TQ_UINT16), KisChannelInfo::ALPHA, KisChannelInfo::UINT16, sizeof(TQ_UINT16)));
+
+    m_alphaPos = PIXEL_ALPHA * sizeof(TQ_UINT16);
+
+    init();
+}
+
+KisRgbU16ColorSpace::~KisRgbU16ColorSpace()
+{
+}
+
+void KisRgbU16ColorSpace::setPixel(TQ_UINT8 *dst, TQ_UINT16 red, TQ_UINT16 green, TQ_UINT16 blue, TQ_UINT16 alpha) const
+{
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->red = red;
+    dstPixel->green = green;
+    dstPixel->blue = blue;
+    dstPixel->alpha = alpha;
+}
+
+void KisRgbU16ColorSpace::getPixel(const TQ_UINT8 *src, TQ_UINT16 *red, TQ_UINT16 *green, TQ_UINT16 *blue, TQ_UINT16 *alpha) const
+{
+    const Pixel *srcPixel = reinterpret_cast<const Pixel *>(src);
+
+    *red = srcPixel->red;
+    *green = srcPixel->green;
+    *blue = srcPixel->blue;
+    *alpha = srcPixel->alpha;
+}
+
+void KisRgbU16ColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    TQ_UINT32 totalRed = 0, totalGreen = 0, totalBlue = 0, newAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel *pixel = reinterpret_cast<const Pixel *>(*colors);
+
+        TQ_UINT32 alpha = pixel->alpha;
+        TQ_UINT32 alphaTimesWeight = UINT16_MULT(alpha, UINT8_TO_UINT16(*weights));
+
+        totalRed += UINT16_MULT(pixel->red, alphaTimesWeight);
+        totalGreen += UINT16_MULT(pixel->green, alphaTimesWeight);
+        totalBlue += UINT16_MULT(pixel->blue, alphaTimesWeight);
+        newAlpha += alphaTimesWeight;
+
+        weights++;
+        colors++;
+    }
+
+    Q_ASSERT(newAlpha <= U16_OPACITY_OPAQUE);
+
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->alpha = newAlpha;
+
+    if (newAlpha > 0) {
+        totalRed = UINT16_DIVIDE(totalRed, newAlpha);
+        totalGreen = UINT16_DIVIDE(totalGreen, newAlpha);
+        totalBlue = UINT16_DIVIDE(totalBlue, newAlpha);
+    }
+
+    dstPixel->red = totalRed;
+    dstPixel->green = totalGreen;
+    dstPixel->blue = totalBlue;
+}
+
+
+void KisRgbU16ColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst,
+                                         TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const
+{
+    TQ_INT32 totalRed = 0, totalGreen = 0, totalBlue = 0, totalAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel * pixel = reinterpret_cast<const Pixel *>( *colors );
+
+        TQ_INT32 weight = *kernelValues;
+
+        if (weight != 0) {
+            totalRed += pixel->red * weight;
+            totalGreen += pixel->green * weight;
+            totalBlue += pixel->blue * weight;
+            totalAlpha +=pixel->alpha * weight;
+        }
+        colors++;
+        kernelValues++;
+    }
+
+    Pixel * p = reinterpret_cast< Pixel *>( dst );
+
+    if (channelFlags & KisChannelInfo::FLAG_COLOR) {
+        p->red = CLAMP( ( totalRed / factor) + offset, 0, TQ_UINT16_MAX);
+        p->green = CLAMP( ( totalGreen / factor) + offset, 0, TQ_UINT16_MAX);
+        p->blue = CLAMP( ( totalBlue / factor) + offset, 0, TQ_UINT16_MAX);
+    }
+    if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+        p->alpha = CLAMP((totalAlpha/ factor) + offset, 0, TQ_UINT16_MAX);
+    }
+}
+
+
+void KisRgbU16ColorSpace::invertColor(TQ_UINT8 * src, TQ_INT32 nPixels)
+{
+    TQ_UINT32 psize = pixelSize();
+
+    while (nPixels--)
+    {
+        Pixel * p = reinterpret_cast< Pixel *>( src );
+        p->red = TQ_UINT16_MAX - p->red;
+        p->green = TQ_UINT16_MAX - p->green;
+        p->blue = TQ_UINT16_MAX - p->blue;
+        src += psize;
+    }
+}
+
+TQ_UINT8 KisRgbU16ColorSpace::intensity8(const TQ_UINT8 * src) const
+{
+    const Pixel * p = reinterpret_cast<const Pixel *>( src );
+    
+    return UINT16_TO_UINT8(static_cast<TQ_UINT16>((p->red * 0.30 + p->green * 0.59 + p->blue * 0.11) + 0.5));
+}
+
+
+TQValueVector<KisChannelInfo *> KisRgbU16ColorSpace::channels() const
+{
+    return m_channels;
+}
+
+TQ_UINT32 KisRgbU16ColorSpace::nChannels() const
+{
+    return MAX_CHANNEL_RGBA;
+}
+
+TQ_UINT32 KisRgbU16ColorSpace::nColorChannels() const
+{
+    return MAX_CHANNEL_RGB;
+}
+
+TQ_UINT32 KisRgbU16ColorSpace::pixelSize() const
+{
+    return MAX_CHANNEL_RGBA * sizeof(TQ_UINT16);
+}
+
+
+void KisRgbU16ColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT16 *src = reinterpret_cast<const TQ_UINT16 *>(srcRowStart);
+        TQ_UINT16 *dst = reinterpret_cast<TQ_UINT16 *>(dstRowStart);
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            TQ_UINT16 srcAlpha = src[PIXEL_ALPHA];
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, UINT8_TO_UINT16(U8_tqmask));
+                }
+                tqmask++;
+            }
+
+            if (srcAlpha != U16_OPACITY_TRANSPARENT) {
+
+                if (opacity != U16_OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, opacity);
+                }
+
+                if (srcAlpha == U16_OPACITY_OPAQUE) {
+                    memcpy(dst, src, MAX_CHANNEL_RGBA * sizeof(TQ_UINT16));
+                } else {
+                    TQ_UINT16 dstAlpha = dst[PIXEL_ALPHA];
+
+                    TQ_UINT16 srcBlend;
+
+                    if (dstAlpha == U16_OPACITY_OPAQUE) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        TQ_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                        dst[PIXEL_ALPHA] = newAlpha;
+
+                        if (newAlpha != 0) {
+                            srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha);
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend == U16_OPACITY_OPAQUE) {
+                        memcpy(dst, src, MAX_CHANNEL_RGB * sizeof(TQ_UINT16));
+                    } else {
+                        dst[PIXEL_RED] = UINT16_BLEND(src[PIXEL_RED], dst[PIXEL_RED], srcBlend);
+                        dst[PIXEL_GREEN] = UINT16_BLEND(src[PIXEL_GREEN], dst[PIXEL_GREEN], srcBlend);
+                        dst[PIXEL_BLUE] = UINT16_BLEND(src[PIXEL_BLUE], dst[PIXEL_BLUE], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart) {
+            tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+}
+
+#define COMMON_COMPOSITE_OP_PROLOG() \
+    while (rows > 0) { \
+    \
+        const TQ_UINT16 *src = reinterpret_cast<const TQ_UINT16 *>(srcRowStart); \
+        TQ_UINT16 *dst = reinterpret_cast<TQ_UINT16 *>(dstRowStart); \
+        TQ_INT32 columns = numColumns; \
+        const TQ_UINT8 *tqmask = tqmaskRowStart; \
+    \
+        while (columns > 0) { \
+    \
+            TQ_UINT16 srcAlpha = src[PIXEL_ALPHA]; \
+            TQ_UINT16 dstAlpha = dst[PIXEL_ALPHA]; \
+    \
+            srcAlpha = TQMIN(srcAlpha, dstAlpha); \
+    \
+            if (tqmask != 0) { \
+                TQ_UINT8 U8_tqmask = *tqmask; \
+    \
+                if (U8_tqmask != OPACITY_OPAQUE) { \
+                    srcAlpha = UINT16_MULT(srcAlpha, UINT8_TO_UINT16(U8_tqmask)); \
+                } \
+                tqmask++; \
+            } \
+    \
+            if (srcAlpha != U16_OPACITY_TRANSPARENT) { \
+    \
+                if (opacity != U16_OPACITY_OPAQUE) { \
+                    srcAlpha = UINT16_MULT(srcAlpha, opacity); \
+                } \
+    \
+                TQ_UINT16 srcBlend; \
+    \
+                if (dstAlpha == U16_OPACITY_OPAQUE) { \
+                    srcBlend = srcAlpha; \
+                } else { \
+                    TQ_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha); \
+                    dst[PIXEL_ALPHA] = newAlpha; \
+    \
+                    if (newAlpha != 0) { \
+                        srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha); \
+                    } else { \
+                        srcBlend = srcAlpha; \
+                    } \
+                }
+
+#define COMMON_COMPOSITE_OP_EPILOG() \
+            } \
+    \
+            columns--; \
+            src += MAX_CHANNEL_RGBA; \
+            dst += MAX_CHANNEL_RGBA; \
+        } \
+    \
+        rows--; \
+        srcRowStart += srcRowStride; \
+        dstRowStart += dstRowStride; \
+        if(tqmaskRowStart) { \
+            tqmaskRowStart += tqmaskRowStride; \
+        } \
+    }
+
+void KisRgbU16ColorSpace::compositeMultiply(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = UINT16_MULT(srcColor, dstColor);
+
+            dst[channel] = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeDivide(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN((dstColor * (UINT16_MAX + 1u) + (srcColor / 2u)) / (1u + srcColor), UINT16_MAX);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeScreen(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = UINT16_MAX - UINT16_MULT(UINT16_MAX - dstColor, UINT16_MAX - srcColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeOverlay(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = UINT16_MULT(dstColor, dstColor + 2u * UINT16_MULT(srcColor, UINT16_MAX - dstColor));
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeDodge(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN((dstColor * (UINT16_MAX + 1u)) / (UINT16_MAX + 1u - srcColor), UINT16_MAX);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = kMin(((UINT16_MAX - dstColor) * (UINT16_MAX + 1u)) / (srcColor + 1u), UINT16_MAX);
+            srcColor = kClamp(UINT16_MAX - srcColor, 0u, UINT16_MAX);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMIN(srcColor, dstColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeLighten(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+            TQ_UINT16 srcColor = src[channel];
+            TQ_UINT16 dstColor = dst[channel];
+
+            srcColor = TQMAX(srcColor, dstColor);
+
+            TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
+
+            dst[channel] = newColor;
+        }
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeHue(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float FSrcRed = static_cast<float>(src[PIXEL_RED]) / UINT16_MAX;
+        float FSrcGreen = static_cast<float>(src[PIXEL_GREEN]) / UINT16_MAX;
+        float FSrcBlue = static_cast<float>(src[PIXEL_BLUE]) / UINT16_MAX;
+
+        TQ_UINT16 dstRed = dst[PIXEL_RED];
+        TQ_UINT16 dstGreen = dst[PIXEL_GREEN];
+        TQ_UINT16 dstBlue = dst[PIXEL_BLUE];
+
+        float FDstRed = static_cast<float>(dstRed) / UINT16_MAX;
+        float FDstGreen = static_cast<float>(dstGreen) / UINT16_MAX;
+        float FDstBlue = static_cast<float>(dstBlue) / UINT16_MAX;
+
+        float srcHue;
+        float srcSaturation;
+        float srcValue;
+
+        float dstHue;
+        float dstSaturation;
+        float dstValue;
+
+        RGBToHSV(FSrcRed, FSrcGreen, FSrcBlue, &srcHue, &srcSaturation, &srcValue);
+        RGBToHSV(FDstRed, FDstGreen, FDstBlue, &dstHue, &dstSaturation, &dstValue);
+
+        HSVToRGB(srcHue, dstSaturation, dstValue, &FSrcRed, &FSrcGreen, &FSrcBlue);
+
+        TQ_UINT16 srcRed = static_cast<TQ_UINT16>(FSrcRed * UINT16_MAX + 0.5);
+        TQ_UINT16 srcGreen = static_cast<TQ_UINT16>(FSrcGreen * UINT16_MAX + 0.5);
+        TQ_UINT16 srcBlue = static_cast<TQ_UINT16>(FSrcBlue * UINT16_MAX + 0.5);
+
+        dst[PIXEL_RED] = UINT16_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = UINT16_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = UINT16_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeSaturation(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float FSrcRed = static_cast<float>(src[PIXEL_RED]) / UINT16_MAX;
+        float FSrcGreen = static_cast<float>(src[PIXEL_GREEN]) / UINT16_MAX;
+        float FSrcBlue = static_cast<float>(src[PIXEL_BLUE]) / UINT16_MAX;
+
+        TQ_UINT16 dstRed = dst[PIXEL_RED];
+        TQ_UINT16 dstGreen = dst[PIXEL_GREEN];
+        TQ_UINT16 dstBlue = dst[PIXEL_BLUE];
+
+        float FDstRed = static_cast<float>(dstRed) / UINT16_MAX;
+        float FDstGreen = static_cast<float>(dstGreen) / UINT16_MAX;
+        float FDstBlue = static_cast<float>(dstBlue) / UINT16_MAX;
+
+        float srcHue;
+        float srcSaturation;
+        float srcValue;
+
+        float dstHue;
+        float dstSaturation;
+        float dstValue;
+
+        RGBToHSV(FSrcRed, FSrcGreen, FSrcBlue, &srcHue, &srcSaturation, &srcValue);
+        RGBToHSV(FDstRed, FDstGreen, FDstBlue, &dstHue, &dstSaturation, &dstValue);
+
+        HSVToRGB(dstHue, srcSaturation, dstValue, &FSrcRed, &FSrcGreen, &FSrcBlue);
+
+        TQ_UINT16 srcRed = static_cast<TQ_UINT16>(FSrcRed * UINT16_MAX + 0.5);
+        TQ_UINT16 srcGreen = static_cast<TQ_UINT16>(FSrcGreen * UINT16_MAX + 0.5);
+        TQ_UINT16 srcBlue = static_cast<TQ_UINT16>(FSrcBlue * UINT16_MAX + 0.5);
+
+        dst[PIXEL_RED] = UINT16_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = UINT16_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = UINT16_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeValue(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float FSrcRed = static_cast<float>(src[PIXEL_RED]) / UINT16_MAX;
+        float FSrcGreen = static_cast<float>(src[PIXEL_GREEN]) / UINT16_MAX;
+        float FSrcBlue = static_cast<float>(src[PIXEL_BLUE]) / UINT16_MAX;
+
+        TQ_UINT16 dstRed = dst[PIXEL_RED];
+        TQ_UINT16 dstGreen = dst[PIXEL_GREEN];
+        TQ_UINT16 dstBlue = dst[PIXEL_BLUE];
+
+        float FDstRed = static_cast<float>(dstRed) / UINT16_MAX;
+        float FDstGreen = static_cast<float>(dstGreen) / UINT16_MAX;
+        float FDstBlue = static_cast<float>(dstBlue) / UINT16_MAX;
+
+        float srcHue;
+        float srcSaturation;
+        float srcValue;
+
+        float dstHue;
+        float dstSaturation;
+        float dstValue;
+
+        RGBToHSV(FSrcRed, FSrcGreen, FSrcBlue, &srcHue, &srcSaturation, &srcValue);
+        RGBToHSV(FDstRed, FDstGreen, FDstBlue, &dstHue, &dstSaturation, &dstValue);
+
+        HSVToRGB(dstHue, dstSaturation, srcValue, &FSrcRed, &FSrcGreen, &FSrcBlue);
+
+        TQ_UINT16 srcRed = static_cast<TQ_UINT16>(FSrcRed * UINT16_MAX + 0.5);
+        TQ_UINT16 srcGreen = static_cast<TQ_UINT16>(FSrcGreen * UINT16_MAX + 0.5);
+        TQ_UINT16 srcBlue = static_cast<TQ_UINT16>(FSrcBlue * UINT16_MAX + 0.5);
+
+        dst[PIXEL_RED] = UINT16_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = UINT16_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = UINT16_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeColor(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT16 opacity)
+{
+    COMMON_COMPOSITE_OP_PROLOG();
+
+    {
+        float FSrcRed = static_cast<float>(src[PIXEL_RED]) / UINT16_MAX;
+        float FSrcGreen = static_cast<float>(src[PIXEL_GREEN]) / UINT16_MAX;
+        float FSrcBlue = static_cast<float>(src[PIXEL_BLUE]) / UINT16_MAX;
+
+        TQ_UINT16 dstRed = dst[PIXEL_RED];
+        TQ_UINT16 dstGreen = dst[PIXEL_GREEN];
+        TQ_UINT16 dstBlue = dst[PIXEL_BLUE];
+
+        float FDstRed = static_cast<float>(dstRed) / UINT16_MAX;
+        float FDstGreen = static_cast<float>(dstGreen) / UINT16_MAX;
+        float FDstBlue = static_cast<float>(dstBlue) / UINT16_MAX;
+
+        float srcHue;
+        float srcSaturation;
+        float srcLightness;
+
+        float dstHue;
+        float dstSaturation;
+        float dstLightness;
+
+        RGBToHSL(FSrcRed, FSrcGreen, FSrcBlue, &srcHue, &srcSaturation, &srcLightness);
+        RGBToHSL(FDstRed, FDstGreen, FDstBlue, &dstHue, &dstSaturation, &dstLightness);
+
+        HSLToRGB(srcHue, srcSaturation, dstLightness, &FSrcRed, &FSrcGreen, &FSrcBlue);
+
+        TQ_UINT16 srcRed = static_cast<TQ_UINT16>(FSrcRed * UINT16_MAX + 0.5);
+        TQ_UINT16 srcGreen = static_cast<TQ_UINT16>(FSrcGreen * UINT16_MAX + 0.5);
+        TQ_UINT16 srcBlue = static_cast<TQ_UINT16>(FSrcBlue * UINT16_MAX + 0.5);
+
+        dst[PIXEL_RED] = UINT16_BLEND(srcRed, dstRed, srcBlend);
+        dst[PIXEL_GREEN] = UINT16_BLEND(srcGreen, dstGreen, srcBlend);
+        dst[PIXEL_BLUE] = UINT16_BLEND(srcBlue, dstBlue, srcBlend);
+    }
+
+    COMMON_COMPOSITE_OP_EPILOG();
+}
+
+void KisRgbU16ColorSpace::compositeErase(TQ_UINT8 *dst,
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src,
+            TQ_INT32 srcRowSize,
+            const TQ_UINT8 *srcAlphaMask,
+            TQ_INT32 tqmaskRowStride,
+            TQ_INT32 rows,
+            TQ_INT32 cols,
+            TQ_UINT16 /*opacity*/)
+{
+    while (rows-- > 0)
+    {
+        const Pixel *s = reinterpret_cast<const Pixel *>(src);
+        Pixel *d = reinterpret_cast<Pixel *>(dst);
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (TQ_INT32 i = cols; i > 0; i--, s++, d++)
+        {
+            TQ_UINT16 srcAlpha = s->alpha;
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_BLEND(srcAlpha, U16_OPACITY_OPAQUE, UINT8_TO_UINT16(U8_tqmask));
+                }
+                tqmask++;
+            }
+            d->alpha = UINT16_MULT(srcAlpha, d->alpha);
+        }
+
+        dst += dstRowSize;
+        src += srcRowSize;
+        if(srcAlphaMask) {
+            srcAlphaMask += tqmaskRowStride;
+        }
+    }
+}
+
+void KisRgbU16ColorSpace::bitBlt(TQ_UINT8 *dst,
+                      TQ_INT32 dstRowStride,
+                      const TQ_UINT8 *src,
+                      TQ_INT32 srcRowStride,
+                      const TQ_UINT8 *tqmask,
+                      TQ_INT32 tqmaskRowStride,
+                      TQ_UINT8 U8_opacity,
+                      TQ_INT32 rows,
+                      TQ_INT32 cols,
+                      const KisCompositeOp& op)
+{
+    TQ_UINT16 opacity = UINT8_TO_UINT16(U8_opacity);
+
+    switch (op.op()) {
+    case COMPOSITE_UNDEF:
+        // Undefined == no composition
+        break;
+    case COMPOSITE_OVER:
+        compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_IN:
+        //compositeIn(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+    case COMPOSITE_OUT:
+        //compositeOut(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ATOP:
+        //compositeAtop(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_XOR:
+        //compositeXor(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_PLUS:
+        //compositePlus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MINUS:
+        //compositeMinus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ADD:
+        //compositeAdd(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SUBTRACT:
+        //compositeSubtract(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIFF:
+        //compositeDiff(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MULT:
+        compositeMultiply(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIVIDE:
+        compositeDivide(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BUMPMAP:
+        //compositeBumpmap(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY:
+        compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, U8_opacity);
+        break;
+    case COMPOSITE_COPY_RED:
+        //compositeCopyRed(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_GREEN:
+        //compositeCopyGreen(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_BLUE:
+        //compositeCopyBlue(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_OPACITY:
+        //compositeCopyOpacity(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_CLEAR:
+        //compositeClear(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISSOLVE:
+        //compositeDissolve(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISPLACE:
+        //compositeDisplace(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#if 0
+    case COMPOSITE_MODULATE:
+        compositeModulate(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_THRESHOLD:
+        compositeThreshold(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#endif
+    case COMPOSITE_NO:
+        // No composition.
+        break;
+    case COMPOSITE_DARKEN:
+        compositeDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LIGHTEN:
+        compositeLighten(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_HUE:
+        compositeHue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SATURATION:
+        compositeSaturation(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_VALUE:
+        compositeValue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLOR:
+        compositeColor(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLORIZE:
+        //compositeColorize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LUMINIZE:
+        //compositeLuminize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SCREEN:
+        compositeScreen(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_OVERLAY:
+        compositeOverlay(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ERASE:
+        compositeErase(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DODGE:
+        compositeDodge(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BURN:
+        compositeBurn(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ALPHA_DARKEN:
+        abstractCompositeAlphaDarken<TQ_UINT16, U16Mult, Uint8ToU16, U16OpacityTest,
+                    PIXEL_ALPHA, MAX_CHANNEL_RGB, MAX_CHANNEL_RGBA>(
+                    dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride,
+                    rows, cols, opacity, U16Mult(), Uint8ToU16(), U16OpacityTest());
+                    break;
+    default:
+        break;
+    }
+}
+
+KisCompositeOpList KisRgbU16ColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    list.append(KisCompositeOp(COMPOSITE_ALPHA_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_MULT));
+    list.append(KisCompositeOp(COMPOSITE_BURN));
+    list.append(KisCompositeOp(COMPOSITE_DODGE));
+    list.append(KisCompositeOp(COMPOSITE_DIVIDE));
+    list.append(KisCompositeOp(COMPOSITE_SCREEN));
+    list.append(KisCompositeOp(COMPOSITE_OVERLAY));
+    list.append(KisCompositeOp(COMPOSITE_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_LIGHTEN));
+    list.append(KisCompositeOp(COMPOSITE_HUE));
+    list.append(KisCompositeOp(COMPOSITE_SATURATION));
+    list.append(KisCompositeOp(COMPOSITE_VALUE));
+    list.append(KisCompositeOp(COMPOSITE_COLOR));
+
+    return list;
+}
diff --git a/chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.h b/chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.h
new file mode 100644
index 000000000..a4edbffa1
--- /dev/null
+++ b/chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.h
@@ -0,0 +1,128 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_STRATEGY_COLORSPACE_RGB_U16_H_
+#define KIS_STRATEGY_COLORSPACE_RGB_U16_H_
+
+#include <klocale.h>
+
+#include <koffice_export.h>
+
+#include "kis_global.h"
+#include "kis_u16_base_colorspace.h"
+#include "kis_integer_maths.h"
+
+
+class KRITATOOL_EXPORT KisRgbU16ColorSpace : public KisU16BaseColorSpace {
+public:
+
+    struct Pixel {
+        TQ_UINT16 blue;
+        TQ_UINT16 green;
+        TQ_UINT16 red;
+        TQ_UINT16 alpha;
+    };
+public:
+    KisRgbU16ColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p);
+    virtual ~KisRgbU16ColorSpace();
+
+    virtual bool willDegrade(ColorSpaceIndependence independence)
+        {
+            if (independence == TO_RGBA8)
+                return true;
+            else
+                return false;
+        };
+
+
+
+public:
+    void setPixel(TQ_UINT8 *pixel, TQ_UINT16 red, TQ_UINT16 green, TQ_UINT16 blue, TQ_UINT16 alpha) const;
+    void getPixel(const TQ_UINT8 *pixel, TQ_UINT16 *red, TQ_UINT16 *green, TQ_UINT16 *blue, TQ_UINT16 *alpha) const;
+
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    virtual TQ_UINT8 intensity8(const TQ_UINT8 * src) const;
+
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const;
+    virtual TQ_UINT32 nColorChannels() const;
+    virtual TQ_UINT32 pixelSize() const;
+
+    virtual KisCompositeOpList userVisiblecompositeOps() const;
+    
+protected:
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dstRowStride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeMultiply(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDivide(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeScreen(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeOverlay(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDodge(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeBurn(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeLighten(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeHue(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeSaturation(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeValue(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeColor(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+    void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT16 opacity);
+
+private:
+    friend class KisRgbU16ColorSpaceTester;
+
+    static const TQ_UINT8 PIXEL_BLUE = 0;
+    static const TQ_UINT8 PIXEL_GREEN = 1;
+    static const TQ_UINT8 PIXEL_RED = 2;
+    static const TQ_UINT8 PIXEL_ALPHA = 3;
+};
+
+class KisRgbU16ColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const { return KisID("RGBA16", i18n("RGB (16-bit integer/channel)")); };
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() { return TYPE_BGRA_16; };
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return icSigRgbData; };
+
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisRgbU16ColorSpace(tqparent, p); };
+
+    virtual TQString defaultProfile() { return "sRGB built-in - (lcms internal)"; };
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_RGB_U16_H_
diff --git a/chalk/colorspaces/rgb_u16/rgb_u16_plugin.cc b/chalk/colorspaces/rgb_u16/rgb_u16_plugin.cc
new file mode 100644
index 000000000..828298c34
--- /dev/null
+++ b/chalk/colorspaces/rgb_u16/rgb_u16_plugin.cc
@@ -0,0 +1,61 @@
+/*
+* rgb_u16_plugin.cc -- Part of Chalk
+*
+* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+*
+*  This program is free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  This program is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  You should have received a copy of the GNU General Public License
+*  along with this program; if not, write to the Free Software
+*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include <kinstance.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+
+#include <kis_debug_areas.h>
+#include <kis_colorspace_factory_registry.h>
+
+#include "rgb_u16_plugin.h"
+#include "kis_rgb_u16_colorspace.h"
+#include "kis_basic_histogram_producers.h"
+
+typedef KGenericFactory<RGBU16Plugin> RGBU16PluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalk_rgb_u16_plugin, RGBU16PluginFactory( "chalk" ) )
+
+
+RGBU16Plugin::RGBU16Plugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(RGBU16PluginFactory::instance());
+
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") )
+    {
+        KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry *>( tqparent );
+
+        KisColorSpace * colorSpaceRGBU16 = new KisRgbU16ColorSpace(f, 0);
+        KisColorSpaceFactory * csFactory = new KisRgbU16ColorSpaceFactory();
+        f->add( csFactory );
+
+        KisHistogramProducerFactoryRegistry::instance()->add(
+                new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
+                (KisID("RGB16HISTO", i18n("RGB16")), colorSpaceRGBU16) );
+    }
+
+}
+
+RGBU16Plugin::~RGBU16Plugin()
+{
+}
+
+#include "rgb_u16_plugin.moc"
diff --git a/chalk/colorspaces/rgb_u16/rgb_u16_plugin.h b/chalk/colorspaces/rgb_u16/rgb_u16_plugin.h
new file mode 100644
index 000000000..d5cf4d140
--- /dev/null
+++ b/chalk/colorspaces/rgb_u16/rgb_u16_plugin.h
@@ -0,0 +1,37 @@
+/*
+ *  Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RGB_U16_PLUGIN_H_
+#define RGB_U16_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the RGB U16 colour space strategy.
+ */
+class RGBU16Plugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    RGBU16Plugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~RGBU16Plugin();
+};
+
+
+#endif // RGB_U16_PLUGIN_H_
diff --git a/chalk/colorspaces/rgb_u16/tests/Makefile.am b/chalk/colorspaces/rgb_u16/tests/Makefile.am
new file mode 100644
index 000000000..dcf23893b
--- /dev/null
+++ b/chalk/colorspaces/rgb_u16/tests/Makefile.am
@@ -0,0 +1,17 @@
+AM_CPPFLAGS = -I$(srcdir)/.. \
+	 -I$(srcdir)/../../../sdk \
+	-I$(srcdir)/../../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../../color_strategy/ \
+	$(all_includes)
+
+# The check_ target makes sure we don't install the modules,
+# $(KDE_CHECK_PLUGIN) assures a shared library is created.
+check_LTLIBRARIES = kunittest_kis_strategy_colorspace_rgb_u16_tester.la
+
+kunittest_kis_strategy_colorspace_rgb_u16_tester_la_SOURCES = kis_strategy_colorspace_rgb_u16_tester.cc
+kunittest_kis_strategy_colorspace_rgb_u16_tester_la_LIBADD = -lkunittest ../libchalk_rgb_u16.la
+kunittest_kis_strategy_colorspace_rgb_u16_tester_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+check-local: kunittest_kis_strategy_colorspace_rgb_u16_tester.la
+	kunittestmodrunner
+
diff --git a/chalk/colorspaces/rgb_u16/tests/kis_strategy_colorspace_rgb_u16_tester.cc b/chalk/colorspaces/rgb_u16/tests/kis_strategy_colorspace_rgb_u16_tester.cc
new file mode 100644
index 000000000..7861b8e1a
--- /dev/null
+++ b/chalk/colorspaces/rgb_u16/tests/kis_strategy_colorspace_rgb_u16_tester.cc
@@ -0,0 +1,524 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "kis_factory.h"
+#include "kis_strategy_colorspace_rgb_u16_tester.h"
+#include "kis_rgb_u16_colorspace.h"
+#include "kis_integer_maths.h"
+#include "kis_paint_device.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE( kunittest_kis_strategy_colorspace_rgb_u16_tester, "RGB 16-bit integer colorspace tester" );
+KUNITTEST_MODULE_REGISTER_TESTER( KisRgbU16ColorSpaceTester );
+
+#define PIXEL_BLUE 0
+#define PIXEL_GREEN 1
+#define PIXEL_RED 2
+#define PIXEL_ALPHA 3
+
+#define NUM_CHANNELS 4
+#define NUM_COLOUR_CHANNELS 3
+#define CHANNEL_SIZE 2
+
+#define RED_CHANNEL 0
+#define GREEN_CHANNEL 1
+#define BLUE_CHANNEL 2
+#define ALPHA_CHANNEL 3
+
+#define MAX_CHANNEL_VALUE UINT16_MAX
+#define MIN_CHANNEL_VALUE UINT16_MIN
+
+void KisRgbU16ColorSpaceTester::allTests()
+{
+    // We need this so that the colour profile loading can operate without crashing.
+    KisFactory *factory = new KisFactory();
+
+    testBasics();
+    testToTQImage();
+    testCompositeOps();
+    testMixColors();
+
+    delete factory;
+}
+
+void KisRgbU16ColorSpaceTester::testBasics()
+{
+    KisProfile *defProfile = new KisProfile(cmsCreate_sRGBProfile());
+
+    KisRgbU16ColorSpace *cs = new KisRgbU16ColorSpace(defProfile);
+    KisAbstractColorSpace * csSP = cs;
+
+    CHECK(cs->hasAlpha(), true);
+    CHECK(cs->nChannels(), NUM_CHANNELS);
+    CHECK(cs->nColorChannels(), NUM_COLOUR_CHANNELS);
+    CHECK(cs->pixelSize(), NUM_CHANNELS * CHANNEL_SIZE);
+
+    TQValueVector<KisChannelInfo *> channels = cs->channels();
+
+    // Red
+    CHECK(channels[0]->pos(), PIXEL_RED * CHANNEL_SIZE);
+    CHECK(channels[0]->size(), CHANNEL_SIZE);
+    CHECK(channels[0]->channelType(), COLOR);
+
+    // Green
+    CHECK(channels[1]->pos(), PIXEL_GREEN * CHANNEL_SIZE);
+    CHECK(channels[1]->size(), CHANNEL_SIZE);
+    CHECK(channels[1]->channelType(), COLOR);
+
+    // Blue
+    CHECK(channels[2]->pos(), PIXEL_BLUE * CHANNEL_SIZE);
+    CHECK(channels[2]->size(), CHANNEL_SIZE);
+    CHECK(channels[2]->channelType(), COLOR);
+
+    // Alpha
+    CHECK(channels[3]->pos(), PIXEL_ALPHA * CHANNEL_SIZE);
+    CHECK(channels[3]->size(), CHANNEL_SIZE);
+    CHECK(channels[3]->channelType(), ALPHA);
+
+    KisPaintDeviceSP pd = new KisPaintDevice(cs, "test");
+
+    KisRgbU16ColorSpace::Pixel defaultPixel;
+
+    memcpy(&defaultPixel, pd->dataManager()->defaultPixel(), sizeof(defaultPixel));
+
+    CHECK((int)defaultPixel.red, 0);
+    CHECK((int)defaultPixel.green, 0);
+    CHECK((int)defaultPixel.blue, 0);
+    CHECK((int)defaultPixel.alpha, 0);
+
+    TQ_UINT16 pixel[NUM_CHANNELS];
+
+    cs->fromTQColor(tqRgb(255, 255, 255), reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK((uint)pixel[PIXEL_RED], MAX_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_GREEN], MAX_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_BLUE], MAX_CHANNEL_VALUE);
+
+    cs->fromTQColor(tqRgb(0, 0, 0), reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK((uint)pixel[PIXEL_RED], MIN_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_GREEN], MIN_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_BLUE], MIN_CHANNEL_VALUE);
+
+    cs->fromTQColor(tqRgb(128, 64, 192), reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK((uint)pixel[PIXEL_RED], (uint)UINT8_TO_UINT16(128));
+    CHECK((uint)pixel[PIXEL_GREEN], (uint)UINT8_TO_UINT16(64));
+    CHECK((uint)pixel[PIXEL_BLUE], (uint)UINT8_TO_UINT16(192));
+
+    cs->fromTQColor(tqRgb(255, 255, 255), OPACITY_OPAQUE, reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK((uint)pixel[PIXEL_RED], MAX_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_GREEN], MAX_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_BLUE], MAX_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_ALPHA], MAX_CHANNEL_VALUE);
+
+    cs->fromTQColor(tqRgb(255, 255, 255), OPACITY_TRANSPARENT, reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK((uint)pixel[PIXEL_RED], MAX_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_GREEN], MAX_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_BLUE], MAX_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_ALPHA], MIN_CHANNEL_VALUE);
+
+    cs->fromTQColor(tqRgb(255, 255, 255), OPACITY_OPAQUE / 2, reinterpret_cast<TQ_UINT8 *>(pixel));
+
+    CHECK((uint)pixel[PIXEL_RED], MAX_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_GREEN], MAX_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_BLUE], MAX_CHANNEL_VALUE);
+    CHECK((uint)pixel[PIXEL_ALPHA], UINT8_TO_UINT16(OPACITY_OPAQUE / 2));
+
+    pixel[PIXEL_RED] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_GREEN] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_BLUE] = MAX_CHANNEL_VALUE;
+
+    TQColor c;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c);
+
+    CHECK(c.red(), 255);
+    CHECK(c.green(), 255);
+    CHECK(c.blue(), 255);
+
+    pixel[PIXEL_RED] = MIN_CHANNEL_VALUE;
+    pixel[PIXEL_GREEN] = MIN_CHANNEL_VALUE;
+    pixel[PIXEL_BLUE] = MIN_CHANNEL_VALUE;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c);
+
+    CHECK(c.red(), 0);
+    CHECK(c.green(), 0);
+    CHECK(c.blue(), 0);
+
+    pixel[PIXEL_RED] = MAX_CHANNEL_VALUE / 4;
+    pixel[PIXEL_GREEN] = MAX_CHANNEL_VALUE / 2;
+    pixel[PIXEL_BLUE] = (3 * MAX_CHANNEL_VALUE) / 4;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c);
+
+    CHECK(c.red(), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE / 4));
+    CHECK(c.green(), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE / 2));
+    CHECK(c.blue(), (int)UINT16_TO_UINT8((3 * MAX_CHANNEL_VALUE) / 4));
+
+    pixel[PIXEL_RED] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_GREEN] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_BLUE] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_ALPHA] = MAX_CHANNEL_VALUE;
+
+    TQ_UINT8 opacity;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), 255);
+    CHECK(c.green(), 255);
+    CHECK(c.blue(), 255);
+    CHECK(opacity, OPACITY_OPAQUE);
+
+    pixel[PIXEL_ALPHA] = MAX_CHANNEL_VALUE;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), 255);
+    CHECK(c.green(), 255);
+    CHECK(c.blue(), 255);
+    CHECK(opacity, OPACITY_OPAQUE);
+
+    pixel[PIXEL_RED] = MIN_CHANNEL_VALUE;
+    pixel[PIXEL_GREEN] = MIN_CHANNEL_VALUE;
+    pixel[PIXEL_BLUE] = MIN_CHANNEL_VALUE;
+    pixel[PIXEL_ALPHA] = MIN_CHANNEL_VALUE;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), 0);
+    CHECK(c.green(), 0);
+    CHECK(c.blue(), 0);
+    CHECK(opacity, OPACITY_TRANSPARENT);
+
+    pixel[PIXEL_RED] = MAX_CHANNEL_VALUE / 4;
+    pixel[PIXEL_GREEN] = MAX_CHANNEL_VALUE / 2;
+    pixel[PIXEL_BLUE] = (3 * MAX_CHANNEL_VALUE) / 4;
+    pixel[PIXEL_ALPHA] = MAX_CHANNEL_VALUE / 2;
+
+    cs->toTQColor(reinterpret_cast<const TQ_UINT8 *>(pixel), &c, &opacity);
+
+    CHECK(c.red(), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE / 4));
+    CHECK(c.green(), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE / 2));
+    CHECK(c.blue(), (int)UINT16_TO_UINT8((3 * MAX_CHANNEL_VALUE) / 4));
+    CHECK((int)opacity, (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE / 2));
+
+    #define NUM_PIXELS 4
+
+    KisRgbU16ColorSpace::Pixel pixels[NUM_PIXELS] = {
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE / 4},
+        {MAX_CHANNEL_VALUE / 4, MAX_CHANNEL_VALUE / 2, MAX_CHANNEL_VALUE / 3, MAX_CHANNEL_VALUE / 2},
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MIN_CHANNEL_VALUE},
+        {MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MAX_CHANNEL_VALUE}
+    };
+
+    cs->setAlpha(reinterpret_cast<TQ_UINT8 *>(pixels), OPACITY_OPAQUE / 2, NUM_PIXELS);
+
+    CHECK((uint)pixels[0].red, MAX_CHANNEL_VALUE);
+    CHECK((uint)pixels[0].green, MAX_CHANNEL_VALUE);
+    CHECK((uint)pixels[0].blue, MAX_CHANNEL_VALUE);
+    CHECK((uint)pixels[0].alpha, (uint)UINT8_TO_UINT16(OPACITY_OPAQUE / 2));
+
+    CHECK((uint)pixels[1].red, MAX_CHANNEL_VALUE / 3);
+    CHECK((uint)pixels[1].green, MAX_CHANNEL_VALUE / 2);
+    CHECK((uint)pixels[1].blue, MAX_CHANNEL_VALUE / 4);
+    CHECK((uint)pixels[1].alpha, (uint)UINT8_TO_UINT16(OPACITY_OPAQUE / 2));
+
+    CHECK((uint)pixels[2].red, MAX_CHANNEL_VALUE);
+    CHECK((uint)pixels[2].green, MAX_CHANNEL_VALUE);
+    CHECK((uint)pixels[2].blue, MAX_CHANNEL_VALUE);
+    CHECK((uint)pixels[2].alpha, (uint)UINT8_TO_UINT16(OPACITY_OPAQUE / 2));
+
+    CHECK((uint)pixels[3].red, MIN_CHANNEL_VALUE);
+    CHECK((uint)pixels[3].green, MIN_CHANNEL_VALUE);
+    CHECK((uint)pixels[3].blue, MIN_CHANNEL_VALUE);
+    CHECK((uint)pixels[3].alpha, (uint)UINT8_TO_UINT16(OPACITY_OPAQUE / 2));
+
+    pixel[PIXEL_RED] = MAX_CHANNEL_VALUE;
+    pixel[PIXEL_GREEN] = MAX_CHANNEL_VALUE / 2;
+    pixel[PIXEL_BLUE] = MAX_CHANNEL_VALUE / 4;
+    pixel[PIXEL_ALPHA] = MIN_CHANNEL_VALUE;
+
+    TQString valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), RED_CHANNEL);
+    CHECK(valueText, TQString().setNum(MAX_CHANNEL_VALUE));
+
+    valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), GREEN_CHANNEL);
+    CHECK(valueText, TQString().setNum(MAX_CHANNEL_VALUE / 2));
+
+    valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), BLUE_CHANNEL);
+    CHECK(valueText, TQString().setNum(MAX_CHANNEL_VALUE / 4));
+
+    valueText = cs->channelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), ALPHA_CHANNEL);
+    CHECK(valueText, TQString().setNum(MIN_CHANNEL_VALUE));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), RED_CHANNEL);
+    CHECK(valueText, TQString().setNum(static_cast<float>(MAX_CHANNEL_VALUE) / MAX_CHANNEL_VALUE));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), GREEN_CHANNEL);
+    CHECK(valueText, TQString().setNum(static_cast<float>(MAX_CHANNEL_VALUE / 2) / MAX_CHANNEL_VALUE));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), BLUE_CHANNEL);
+    CHECK(valueText, TQString().setNum(static_cast<float>(MAX_CHANNEL_VALUE / 4) / MAX_CHANNEL_VALUE));
+
+    valueText = cs->normalisedChannelValueText(reinterpret_cast<TQ_UINT8 *>(pixel), ALPHA_CHANNEL);
+    CHECK(valueText, TQString().setNum(static_cast<float>(MIN_CHANNEL_VALUE) / MAX_CHANNEL_VALUE));
+
+    cs->setPixel(reinterpret_cast<TQ_UINT8 *>(pixel), 128, 192, 64, 99);
+    CHECK((uint)pixel[PIXEL_RED], 128u);
+    CHECK((uint)pixel[PIXEL_GREEN], 192u);
+    CHECK((uint)pixel[PIXEL_BLUE], 64u);
+    CHECK((uint)pixel[PIXEL_ALPHA], 99u);
+
+    TQ_UINT16 red;
+    TQ_UINT16 green;
+    TQ_UINT16 blue;
+    TQ_UINT16 alpha;
+
+    cs->getPixel(reinterpret_cast<const TQ_UINT8 *>(pixel), &red, &green, &blue, &alpha);
+    CHECK((uint)red, 128u);
+    CHECK((uint)green, 192u);
+    CHECK((uint)blue, 64u);
+    CHECK((uint)alpha, 99u);
+}
+
+void KisRgbU16ColorSpaceTester::testMixColors()
+{
+    KisProfile *defProfile = new KisProfile(cmsCreate_sRGBProfile());
+
+    KisAbstractColorSpace * cs = new KisRgbU16ColorSpace(defProfile);
+
+    // Test mixColors.
+    TQ_UINT16 pixel1[NUM_CHANNELS];
+    TQ_UINT16 pixel2[NUM_CHANNELS];
+    TQ_UINT16 outputPixel[NUM_CHANNELS];
+
+    outputPixel[PIXEL_RED] = 0;
+    outputPixel[PIXEL_GREEN] = 0;
+    outputPixel[PIXEL_BLUE] = 0;
+    outputPixel[PIXEL_ALPHA] = 0;
+
+    pixel1[PIXEL_RED] = UINT16_MAX;
+    pixel1[PIXEL_GREEN] = UINT16_MAX;
+    pixel1[PIXEL_BLUE] = UINT16_MAX;
+    pixel1[PIXEL_ALPHA] = UINT16_MAX;
+
+    pixel2[PIXEL_RED] = 0;
+    pixel2[PIXEL_GREEN] = 0;
+    pixel2[PIXEL_BLUE] = 0;
+    pixel2[PIXEL_ALPHA] = 0;
+
+    const TQ_UINT8 *pixelPtrs[2];
+    TQ_UINT8 weights[2];
+
+    pixelPtrs[0] = reinterpret_cast<const TQ_UINT8 *>(pixel1);
+    pixelPtrs[1] = reinterpret_cast<const TQ_UINT8 *>(pixel2);
+
+    weights[0] = 255;
+    weights[1] = 0;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK((uint)outputPixel[PIXEL_RED], UINT16_MAX);
+    CHECK((uint)outputPixel[PIXEL_GREEN], UINT16_MAX);
+    CHECK((uint)outputPixel[PIXEL_BLUE], UINT16_MAX);
+    CHECK((uint)outputPixel[PIXEL_ALPHA], UINT16_MAX);
+
+    weights[0] = 0;
+    weights[1] = 255;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK((int)outputPixel[PIXEL_RED], 0);
+    CHECK((int)outputPixel[PIXEL_GREEN], 0);
+    CHECK((int)outputPixel[PIXEL_BLUE], 0);
+    CHECK((int)outputPixel[PIXEL_ALPHA], 0);
+
+    weights[0] = 128;
+    weights[1] = 127;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK((uint)outputPixel[PIXEL_RED], UINT16_MAX);
+    CHECK((uint)outputPixel[PIXEL_GREEN], UINT16_MAX);
+    CHECK((uint)outputPixel[PIXEL_BLUE], UINT16_MAX);
+    CHECK((uint)outputPixel[PIXEL_ALPHA], (128u * UINT16_MAX) / 255u);
+
+    pixel1[PIXEL_RED] = 20000;
+    pixel1[PIXEL_GREEN] = 10000;
+    pixel1[PIXEL_BLUE] = 5000;
+    pixel1[PIXEL_ALPHA] = UINT16_MAX;
+
+    pixel2[PIXEL_RED] = 10000;
+    pixel2[PIXEL_GREEN] = 20000;
+    pixel2[PIXEL_BLUE] = 2000;
+    pixel2[PIXEL_ALPHA] = UINT16_MAX;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK_TOLERANCE((uint)outputPixel[PIXEL_RED], (128u * 20000u + 127u * 10000u) / 255u, 5u);
+    CHECK_TOLERANCE((uint)outputPixel[PIXEL_GREEN], (128u * 10000u + 127u * 20000u) / 255u, 5u);
+    CHECK_TOLERANCE((uint)outputPixel[PIXEL_BLUE], (128u * 5000u + 127u * 2000u) / 255u, 5u);
+    CHECK((uint)outputPixel[PIXEL_ALPHA], UINT16_MAX);
+
+    pixel1[PIXEL_RED] = 0;
+    pixel1[PIXEL_GREEN] = 0;
+    pixel1[PIXEL_BLUE] = 0;
+    pixel1[PIXEL_ALPHA] = 0;
+
+    pixel2[PIXEL_RED] = UINT16_MAX;
+    pixel2[PIXEL_GREEN] = UINT16_MAX;
+    pixel2[PIXEL_BLUE] = UINT16_MAX;
+    pixel2[PIXEL_ALPHA] = UINT16_MAX;
+
+    weights[0] = 89;
+    weights[1] = 166;
+
+    cs->mixColors(pixelPtrs, weights, 2, reinterpret_cast<TQ_UINT8 *>(outputPixel));
+
+    CHECK((uint)outputPixel[PIXEL_RED], UINT16_MAX);
+    CHECK((uint)outputPixel[PIXEL_GREEN], UINT16_MAX);
+    CHECK((uint)outputPixel[PIXEL_BLUE], UINT16_MAX);
+    CHECK_TOLERANCE((uint)outputPixel[PIXEL_ALPHA], (89u * 0u + 166u * UINT16_MAX) / 255u, 5u);
+}
+
+#define PIXELS_WIDTH 2
+#define PIXELS_HEIGHT 2
+
+void KisRgbU16ColorSpaceTester::testToTQImage()
+{
+    KisProfile *defProfile = new KisProfile(cmsCreate_sRGBProfile());
+
+    KisAbstractColorSpace * cs = new KisRgbU16ColorSpace(defProfile);
+
+    KisRgbU16ColorSpace::Pixel pixels[PIXELS_WIDTH * PIXELS_HEIGHT] = {
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE / 4},
+        {MAX_CHANNEL_VALUE / 4, MAX_CHANNEL_VALUE / 2, MAX_CHANNEL_VALUE / 3, MAX_CHANNEL_VALUE / 2},
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MIN_CHANNEL_VALUE},
+        {MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MAX_CHANNEL_VALUE}
+    };
+
+    TQImage image = cs->convertToTQImage(reinterpret_cast<const TQ_UINT8 *>(pixels), PIXELS_WIDTH, PIXELS_HEIGHT, 0, 0);
+
+    TQRgb c = image.pixel(0, 0);
+
+    CHECK(tqRed(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqGreen(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqBlue(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqAlpha(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE / 4));
+
+    c = image.pixel(1, 0);
+
+    CHECK(tqRed(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE / 3));
+    CHECK(tqGreen(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE / 2));
+    CHECK_TOLERANCE(tqBlue(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE / 4), 1u);
+    CHECK(tqAlpha(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE / 2));
+
+    c = image.pixel(0, 1);
+
+    CHECK(tqRed(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqGreen(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqBlue(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE));
+    CHECK(tqAlpha(c), (int)UINT16_TO_UINT8(MIN_CHANNEL_VALUE));
+
+    c = image.pixel(1, 1);
+
+    CHECK(tqRed(c), (int)UINT16_TO_UINT8(MIN_CHANNEL_VALUE));
+    CHECK(tqGreen(c), (int)UINT16_TO_UINT8(MIN_CHANNEL_VALUE));
+    CHECK(tqBlue(c), (int)UINT16_TO_UINT8(MIN_CHANNEL_VALUE));
+    CHECK(tqAlpha(c), (int)UINT16_TO_UINT8(MAX_CHANNEL_VALUE));
+}
+
+#define NUM_ROWS 2
+#define NUM_COLUMNS 2
+#define SRC_ROW_STRIDE (NUM_COLUMNS * CHANNEL_SIZE)
+#define DST_ROW_STRIDE (NUM_COLUMNS * CHANNEL_SIZE)
+#define MASK_ROW_STRIDE NUM_COLUMNS
+
+/*
+1 alpha 1    0 alpha 1
+1 alpha 0.5  0 alpha 1
+1 alpha 0.5  0 alpha 0.5
+1 alpha 0    0 alpha 0.5
+
+*/
+
+void  KisRgbU16ColorSpaceTester::testCompositeOps()
+{
+    KisProfile *defProfile = new KisProfile(cmsCreate_sRGBProfile());
+
+    KisRgbU16ColorSpace *cs = new KisRgbU16ColorSpace(defProfile);
+
+    KisRgbU16ColorSpace::Pixel srcPixel;
+    KisRgbU16ColorSpace::Pixel dstPixel;
+
+    srcPixel.red = UINT8_TO_UINT16(102);
+    srcPixel.green = UINT8_TO_UINT16(170);
+    srcPixel.blue = UINT8_TO_UINT16(238);
+    srcPixel.alpha = KisRgbU16ColorSpace::U16_OPACITY_OPAQUE;
+
+    dstPixel = srcPixel;
+
+    cs->compositeDivide(reinterpret_cast<TQ_UINT8 *>(&dstPixel), 1, reinterpret_cast<const TQ_UINT8 *>(&srcPixel),
+                1, 0, 0, 1, 1, KisRgbU16ColorSpace::U16_OPACITY_OPAQUE);
+    /*
+    CHECK(dstPixel.red, (TQ_UINT16)UINT8_TO_UINT16(253));
+    CHECK(dstPixel.green, (TQ_UINT16)UINT8_TO_UINT16(254));
+    CHECK(dstPixel.blue, (TQ_UINT16)UINT8_TO_UINT16(254));
+    CHECK(dstPixel.alpha, KisRgbU16ColorSpace::U16_OPACITY_OPAQUE);
+
+    TQ_UINT16 srcColor = 43690;
+    TQ_UINT16 dstColor = 43690;
+
+    srcColor = TQMIN((dstColor * (65535u + 1u) + (srcColor / 2u)) / (1u + srcColor), 65535u);
+
+    CHECK((int)srcColor, 65534);
+
+    TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, 65535u);
+
+    CHECK((int)newColor, 65534);
+    */
+
+    /*
+    KisRgbU16ColorSpace::Pixel srcPixels[NUM_ROWS * NUM_COLUMNS] = {
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE / 4},
+        {MAX_CHANNEL_VALUE / 4, MAX_CHANNEL_VALUE / 2, MAX_CHANNEL_VALUE / 3, MAX_CHANNEL_VALUE / 2},
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MIN_CHANNEL_VALUE},
+        {MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MAX_CHANNEL_VALUE}
+    };
+
+    KisRgbU16ColorSpace::Pixel dstPixels[NUM_ROWS * NUM_COLUMNS] = {
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE / 4},
+        {MAX_CHANNEL_VALUE / 4, MAX_CHANNEL_VALUE / 2, MAX_CHANNEL_VALUE / 3, MAX_CHANNEL_VALUE / 2},
+        {MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MAX_CHANNEL_VALUE, MIN_CHANNEL_VALUE},
+        {MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MIN_CHANNEL_VALUE, MAX_CHANNEL_VALUE}
+    };
+
+    cs->compositeOver(reinterpret_cast<TQ_UINT8 *>(dstPixels), DST_ROW_STRIDE, reinterpret_cast<const TQ_UINT8 *>(srcPixels),
+                SRC_ROW_STRIDE, tqmask, MASK_ROW_STRIDE, NUM_ROWS, NUM_COLUMNS, opacity);
+    */
+
+    delete cs;
+}
+
diff --git a/chalk/colorspaces/rgb_u16/tests/kis_strategy_colorspace_rgb_u16_tester.h b/chalk/colorspaces/rgb_u16/tests/kis_strategy_colorspace_rgb_u16_tester.h
new file mode 100644
index 000000000..848cf1ac2
--- /dev/null
+++ b/chalk/colorspaces/rgb_u16/tests/kis_strategy_colorspace_rgb_u16_tester.h
@@ -0,0 +1,46 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef KIS_STRATEGY_COLORSPACE_RGB_U16_TESTER_H
+#define KIS_STRATEGY_COLORSPACE_RGB_U16_TESTER_H
+
+#include <kunittest/tester.h>
+
+#define CHECK_TOLERANCE( x, y, tolerance ) \
+if ((x) <= (y) + (tolerance) && (x) >= (y) - (tolerance)) \
+{ \
+    success(TQString(__FILE__) + "[" + TQString::number(__LINE__) + "]: passed " + #x); \
+} \
+else \
+{ \
+    failure(TQString(__FILE__) + "[" + TQString::number(__LINE__) + TQString("]: failed ") + #x + "\n Expected " + #y + ", Actual result " + TQString::number(x)); \
+} \
+
+class KisRgbU16ColorSpaceTester : public KUnitTest::Tester
+{
+public:
+        void allTests();
+    void testBasics();
+    void testMixColors();
+    void testToTQImage();
+    void testCompositeOps();
+};
+
+#endif
+
diff --git a/chalk/colorspaces/rgb_u8/Makefile.am b/chalk/colorspaces/rgb_u8/Makefile.am
new file mode 100644
index 000000000..0b692fdfe
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/Makefile.am
@@ -0,0 +1,33 @@
+# Install the desktop file needed to detect the plugin
+kde_services_DATA = chalkrgbplugin.desktop
+
+INCLUDES  =  -I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../chalkcolor/ \
+	$(KOFFICE_INCLUDES) \
+	$(all_includes)
+
+lib_LTLIBRARIES = libchalkrgb.la
+libchalkrgb_la_SOURCES = kis_rgb_colorspace.cc
+libchalkrgb_la_LDFLAGS = $(all_libraries) $(LIB_QT)
+libchalkrgb_la_LIBADD =  ../../chalkcolor/libchalkcolor.la
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = chalkrgbplugin.la
+
+# Srcs for the plugin
+chalkrgbplugin_la_SOURCES = rgb_plugin.cc
+noinst_HEADERS = rgb_plugin.h kis_rgb_colorspace.h
+
+chalkrgbplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms
+chalkrgbplugin_la_LIBADD =  libchalkrgb.la ../../chalkcolor/libchalkcolor.la
+
+chalkrgbplugin_la_METASOURCES = AUTO
+#METASOURCES = AUTO # XXX: which of the two?
+
+if include_kunittest_tests
+TESTSDIR = tests
+endif
+
+SUBDIRS = . templates $(TESTSDIR)
+
diff --git a/chalk/colorspaces/rgb_u8/chalkrgbplugin.desktop b/chalk/colorspaces/rgb_u8/chalkrgbplugin.desktop
new file mode 100644
index 000000000..1a65c7730
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/chalkrgbplugin.desktop
@@ -0,0 +1,99 @@
+[Desktop Entry]
+Name=RGB Color Model
+Name[bg]=Цветови модел RGB
+Name[br]=Gobari al livioù RGB
+Name[ca]=Model de color RGB
+Name[cy]=Model Lliw RGB
+Name[da]=RGB-farvemodel
+Name[de]=RGB-Farbmodell
+Name[el]=Χρωματικό μοντέλο RGB
+Name[en_GB]=RGB Colour Model
+Name[eo]=RGB-kolormodelo
+Name[es]=Modelo de color RGB
+Name[et]=RGB värvimudel
+Name[eu]=RGB kolore-eredua
+Name[fa]=مدل رنگ RGB
+Name[fi]=RGB-värimalli
+Name[fr]=Modèle de couleurs RVB
+Name[fy]=RGB-kleurmodel
+Name[gl]=Modelo de Cores RGB
+Name[he]=מודל צבעים RGB
+Name[hi]=आरजीबी रंग नमूना
+Name[hu]=RGB színmodell
+Name[is]=RGB litategund
+Name[it]=Modello di colore RGB
+Name[ja]=RGB カラーモデル
+Name[km]=គំរូ​ពណ៌ RGB
+Name[lt]=RGB spalvų modelis
+Name[lv]=RGB krāsu modelis
+Name[ms]=Model Warna RGB
+Name[nb]=RGB-fargemodell
+Name[nds]=RGB-Klöörmodell
+Name[ne]=RGB रङ मोडेल
+Name[nl]=RGB-kleurmodel
+Name[nn]=RGB-fargemodell
+Name[pl]=Przestrzeń barw RGB
+Name[pt]=Modelo de Cor RGB
+Name[pt_BR]=Modelo de Cor RGB
+Name[ru]=RGB
+Name[se]=RGB-ivdnemálle
+Name[sk]=Model farieb RGB
+Name[sl]=Barvni model RGB
+Name[sr]=RGB модел боја
+Name[sr@Latn]=RGB model boja
+Name[sv]=RGB-färgmodell
+Name[ta]=RGB வண்ண மாதிரி
+Name[tr]=RGB Renk Modeli
+Name[uk]=Модель кольору RGB
+Name[uz]=RGB rang usuli
+Name[uz@cyrillic]=RGB ранг усули
+Name[zh_CN]=RGB 色彩模型
+Name[zh_TW]=RGB 色彩模型
+Comment=Color model for 8-bit/channel RGB images
+Comment[bg]=Цветови модел за 8 битови изображения RGB
+Comment[ca]=Model de color per a 8 bits/canal d'imatges RGB
+Comment[cy]=Model lliw ar gyfer delweddau RGB 8-did/sianel
+Comment[da]=Farvemodel for 8-bit/kanal RGB-billeder
+Comment[de]=Farbmodell für 8-bit pro Kanal RGB-Bilder
+Comment[el]=Χρωματικό μοντέλο για 8-bit/κανάλι RGB εικόνες
+Comment[en_GB]=Colour model for 8-bit/channel RGB images
+Comment[es]=Modelo de color para imágenes de 8 bits/canal RGB
+Comment[et]=8-bitiste kanalitega RGB-piltide värvimudel
+Comment[eu]=8-bit/kanaleko RGB irudien kolore-eredua
+Comment[fa]=مدل رنگ برای تصاویر ۸ بیتی/RGB مجرا
+Comment[fi]=Värimalli 8-bittisille/kanavaisille RGB-kuville
+Comment[fr]=Modèle de couleurs pour des images RVB en 8 bits/plage
+Comment[fy]=Kleurmodel foar 8-bit/kanaal RGB-ôfbyldings
+Comment[gl]=Modelo de Cores para imaxe RGB de 8-bit/canal
+Comment[he]=מודל צבעים עבור תמונות RGB של 8 סיביות/ערוצים
+Comment[hi]=8-बिट/चैनल आरजीबी छवियों के लिए रंग नमूना
+Comment[hu]=Színmodell 8 bit/csatorna RGB képekhez
+Comment[is]=Litategund fyrir 8-bita/rás RGB myndir
+Comment[it]=Modello di colore per immagini RGB a canale di 8 bit
+Comment[ja]=8 ビット/チャンネル RGB 画像のためのカラーモデル
+Comment[km]=គំរូ​ពណ៌​សម្រាប់​រូបភាព RGB ៨ ប៊ីត/មួយ​ឆានែល
+Comment[ms]=Model warna imej RGB 8-bit/saluran
+Comment[nb]=Fargemodell for RGB-bilde med 8 bit per kanal
+Comment[nds]=Klöörmodell för RGB-Biller mit 8-Bit per Kanaal
+Comment[ne]=८-बिट/च्यानल RGB छविहरूका लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor 8-bit/kanaal RGB-afbeeldingen
+Comment[nn]=Fargemodell for RGB-bilete med 8 bit per kanal
+Comment[pl]=Przestrzeń barw dla obrazków RGB 8-bitów/kanał
+Comment[pt]=Modelo de cor para imagens RGB com 8 bits por canal
+Comment[pt_BR]=Modelo de cor para imagens com 8-bits de canal RGB
+Comment[ru]=Цветовое пространство RGB (8-бит/канал)
+Comment[sk]=Model farieb pre RGB obrázky s 8-bitovými číslami na kanál
+Comment[sl]=Barvni model za slike RGB z 8 biti/kanal
+Comment[sr]=Модел боја за RGB слике са 8 битова/каналу
+Comment[sr@Latn]=Model boja za RGB slike sa 8 bitova/kanalu
+Comment[sv]=Färgmodell för 8-bitar/kanal RGB-bilder
+Comment[ta]=8/பிட்/வழி RGB பிம்பங்களுக்கான வண்ண முறை
+Comment[tg]=Mодели ранга барои 8-бит /канал тасвирҳои RGB
+Comment[tr]=8-bit/kanal RGB görüntüler için renk modeli.
+Comment[uk]=Модель кольорів для зображень RGB з 8-бітами/канал
+Comment[zh_CN]=8 位/通道 RGB 图像的色彩模型
+Comment[zh_TW]=8-bit/色頻 RGB 圖片的色彩模型
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-KDE-Library=chalkrgbplugin
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/rgb_u8/composite.h b/chalk/colorspaces/rgb_u8/composite.h
new file mode 100644
index 000000000..fbd02778c
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/composite.h
@@ -0,0 +1,868 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+
+ Some code is derived from GraphicsMagick/magick/composite.c and is 
+ subject to the following license and copyright:
+
+  Copyright (C) 2002 GraphicsMagick Group, an organization dedicated
+  to making software imaging solutions freely available.
+
+  Permission is hereby granted, free of charge, to any person obtaining
+  a copy of this software and associated documentation files
+  ("GraphicsMagick"), to deal in GraphicsMagick without restriction,
+  including without limitation the rights to use, copy, modify, merge,
+  publish, distribute, sublicense, and/or sell copies of GraphicsMagick,
+  and to permit persons to whom GraphicsMagick is furnished to do so,
+  subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of GraphicsMagick.
+
+  The software is provided "as is", without warranty of any kind, express
+  or implied, including but not limited to the warranties of
+  merchantability, fitness for a particular purpose and noninfringement.
+  In no event shall GraphicsMagick Group be liable for any claim,
+  damages or other liability, whether in an action of contract, tort or
+  otherwise, arising from, out of or in connection with GraphicsMagick
+  or the use or other dealings in GraphicsMagick.
+
+  Except as contained in this notice, the name of the GraphicsMagick
+  Group shall not be used in advertising or otherwise to promote the
+  sale, use or other dealings in GraphicsMagick without prior written
+  authorization from the GraphicsMagick Group.
+
+ Other code is derived from gwenview/src/qxcfi.* - this is released under
+  the terms of the LGPL
+
+ */
+
+#ifndef COMPOSITE_H_
+#define COMPOSITE_H_
+
+#include <kdebug.h>
+
+#include <kis_global.h>
+
+/**
+ * Image composition functions that can be used by the colour strategies. 
+ *
+ * XXX: perhaps each composition function ought to be a strategy of itself.
+ * Chalk is still missing something like a capabilities database that ties 
+ * together image formats, colour systems, composition functions etc., that
+ * determines which goes with which and defines user visible text for all this.
+ * 
+ * For now, this is a quick hack; once things are working again, I'll investigate
+ * doing this nicely (famous last words...)
+ *
+ * XXX: Except for Over, none of the operators uses the opacity parameter
+ */
+
+
+// Straight from image.h
+
+#define PixelIntensity(pixel) ((unsigned int) \
+   (((double)306.0 * (pixel[PIXEL_RED]) + \
+     (double)601.0 * (pixel[PIXEL_GREEN]) + \
+     (double)117.0 * (pixel[PIXEL_BLUE)) \
+    / 1024.0))
+
+#define PixelIntensityToQuantum(pixel) ((TQ_UINT8)PixelIntensity(pixel))
+
+#define PixelIntensityToDouble(pixel) ((double)PixelIntensity(pixel))
+
+#define RoundSignedToQuantum(value) ((TQ_UINT8) (value < 0 ? 0 : \
+  (value > TQ_UINT8_MAX) ? TQ_UINT8_MAX : value + 0.5))
+
+#define RoundToQuantum(value) ((TQ_UINT8) (value > TQ_UINT8_MAX ? TQ_UINT8_MAX : \
+  value + 0.5))
+
+// And from studio.h
+#define AbsoluteValue(x)  ((x) < 0 ? -(x) : (x))
+
+void compositeIn(TQ_INT32 pixelSize,
+         TQ_UINT8 *dst, 
+         TQ_INT32 dstRowSize,
+         const TQ_UINT8 *src, 
+         TQ_INT32 srcRowSize,
+         TQ_INT32 rows, 
+         TQ_INT32 cols, 
+         TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+    
+    double sAlpha, dAlpha;
+    double alpha;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            
+            if (s[PIXEL_ALPHA] == OPACITY_TRANSPARENT)
+            {
+                memcpy(d, s, pixelSize * sizeof(TQ_UINT8));
+                continue;
+            }
+            if (d[PIXEL_ALPHA] == OPACITY_TRANSPARENT)
+                continue;
+ 
+            sAlpha = UINT8_MAX - s[PIXEL_ALPHA];
+            dAlpha = UINT8_MAX - d[PIXEL_ALPHA];
+
+            alpha=(double) (((double) UINT8_MAX - sAlpha) * (UINT8_MAX - dAlpha) / UINT8_MAX);
+            d[PIXEL_RED]=(TQ_UINT8) (((double) UINT8_MAX - sAlpha) *
+                        (UINT8_MAX-dAlpha) * s[PIXEL_RED] / UINT8_MAX / alpha + 0.5);
+            d[PIXEL_GREEN]=(TQ_UINT8) (((double) UINT8_MAX - sAlpha)*
+                          (UINT8_MAX-dAlpha) * s[PIXEL_GREEN] / UINT8_MAX / alpha + 0.5);
+            d[PIXEL_BLUE]=(TQ_UINT8) (((double) UINT8_MAX - sAlpha)*
+                         (UINT8_MAX - dAlpha) * s[PIXEL_BLUE] / UINT8_MAX / alpha + 0.5);
+            d[PIXEL_ALPHA]=(TQ_UINT8) ((d[PIXEL_ALPHA] * (UINT8_MAX - alpha) / UINT8_MAX) + 0.5);
+            
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+
+}
+
+void compositeOut(TQ_INT32 pixelSize,
+           TQ_UINT8 *dst, 
+           TQ_INT32 dstRowSize,
+           const TQ_UINT8 *src, 
+           TQ_INT32 srcRowSize,
+           TQ_INT32 rows, 
+           TQ_INT32 cols, 
+           TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+
+    double sAlpha, dAlpha;
+    double alpha;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            if (s[PIXEL_ALPHA] == OPACITY_TRANSPARENT)
+            {
+                memcpy(d, s, pixelSize * sizeof(TQ_UINT8));
+                break;
+            }
+            if (d[PIXEL_ALPHA] == OPACITY_OPAQUE)
+            {
+                d[PIXEL_ALPHA]=OPACITY_TRANSPARENT;
+                break;
+            }
+            sAlpha = UINT8_MAX - s[PIXEL_ALPHA];
+            dAlpha = UINT8_MAX - d[PIXEL_ALPHA];
+
+            alpha=(double) (UINT8_MAX - sAlpha) * d[PIXEL_ALPHA]/UINT8_MAX;
+            d[PIXEL_RED] = (TQ_UINT8) (((double) UINT8_MAX - sAlpha) * dAlpha * s[PIXEL_RED] / UINT8_MAX / alpha + 0.5);
+            d[PIXEL_GREEN] = (TQ_UINT8) (((double) UINT8_MAX - sAlpha) * dAlpha * s[PIXEL_GREEN] / UINT8_MAX / alpha + 0.5);
+            d[PIXEL_BLUE] = (TQ_UINT8) (((double) UINT8_MAX - sAlpha) * dAlpha * s[PIXEL_BLUE] / UINT8_MAX / alpha + 0.5);
+            d[PIXEL_ALPHA]=(TQ_UINT8) ((d[PIXEL_ALPHA] * (UINT8_MAX - alpha) / UINT8_MAX) + 0.5);
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+        
+}
+
+void compositeAtop(TQ_INT32 pixelSize,
+           TQ_UINT8 *dst, 
+           TQ_INT32 dstRowSize,
+           const TQ_UINT8 *src, 
+           TQ_INT32 srcRowSize,
+           TQ_INT32 rows, 
+           TQ_INT32 cols, 
+           TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+
+    double sAlpha, dAlpha;
+    double alpha, red, green, blue;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            sAlpha = UINT8_MAX - s[PIXEL_ALPHA];
+            dAlpha = UINT8_MAX - d[PIXEL_ALPHA];
+            
+            alpha = ((double)(UINT8_MAX - sAlpha) *
+                   (UINT8_MAX - dAlpha) + (double) sAlpha *
+                   (UINT8_MAX - dAlpha)) / UINT8_MAX;
+
+            red = ((double)(UINT8_MAX - sAlpha) * (UINT8_MAX - dAlpha) *  s[PIXEL_RED] / UINT8_MAX +
+                 (double) sAlpha * (UINT8_MAX-dAlpha) * d[PIXEL_RED]/UINT8_MAX) / alpha;
+            d[PIXEL_RED] = (TQ_UINT8) (red > UINT8_MAX ? UINT8_MAX : red + 0.5);
+
+            green = ((double) (UINT8_MAX - sAlpha) * (UINT8_MAX - dAlpha) * s[PIXEL_GREEN] / UINT8_MAX + 
+                 (double) sAlpha * (UINT8_MAX-dAlpha) * d[PIXEL_GREEN]/UINT8_MAX)/alpha;
+            d[PIXEL_GREEN] = (TQ_UINT8) (green > UINT8_MAX ? UINT8_MAX : green + 0.5);
+
+            blue = ((double) (UINT8_MAX - sAlpha) * (UINT8_MAX- dAlpha) * s[PIXEL_BLUE] / UINT8_MAX +
+                     (double) sAlpha * (UINT8_MAX - dAlpha) * d[PIXEL_BLUE]/UINT8_MAX) / alpha;
+            d[PIXEL_BLUE] = (TQ_UINT8) (blue > UINT8_MAX ? UINT8_MAX : blue + 0.5);
+            d[PIXEL_ALPHA]=(TQ_UINT8) (UINT8_MAX - (alpha > UINT8_MAX ? UINT8_MAX : alpha) + 0.5);
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+}
+
+
+void compositeXor(TQ_INT32 pixelSize,
+          TQ_UINT8 *dst, 
+          TQ_INT32 dstRowSize,
+          const TQ_UINT8 *src, 
+          TQ_INT32 srcRowSize,
+          TQ_INT32 rows, 
+          TQ_INT32 cols, 
+          TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+
+    double sAlpha, dAlpha;
+    double alpha, red, green, blue;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            sAlpha = UINT8_MAX - s[PIXEL_ALPHA];
+            dAlpha = UINT8_MAX - d[PIXEL_ALPHA];
+            
+            alpha =((double) (UINT8_MAX -sAlpha)*
+                dAlpha+(double) (UINT8_MAX -dAlpha)*
+                sAlpha)/UINT8_MAX ;
+            red=((double) (UINT8_MAX -sAlpha)*dAlpha*
+                 s[PIXEL_RED]/UINT8_MAX +(double) (UINT8_MAX -dAlpha)*
+                 sAlpha*d[PIXEL_RED]/UINT8_MAX )/alpha ;
+            d[PIXEL_RED]=RoundSignedToQuantum(red);
+            green=((double) (UINT8_MAX -sAlpha)*dAlpha*
+                   s[PIXEL_GREEN]/UINT8_MAX +(double) (UINT8_MAX -dAlpha)*
+                   sAlpha*d[PIXEL_GREEN]/UINT8_MAX )/alpha ;
+            d[PIXEL_GREEN]=RoundSignedToQuantum(green);
+            blue=((double) (UINT8_MAX -sAlpha)*dAlpha*
+                  s[PIXEL_BLUE]/UINT8_MAX +(double) (UINT8_MAX -dAlpha)*
+                  sAlpha*d[PIXEL_BLUE]/UINT8_MAX )/alpha ;
+            d[PIXEL_BLUE]=RoundSignedToQuantum(blue);
+            d[PIXEL_ALPHA]=UINT8_MAX -RoundSignedToQuantum(alpha );
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+
+}
+
+
+void compositePlus(TQ_INT32 pixelSize,
+           TQ_UINT8 *dst, 
+           TQ_INT32 dstRowSize,
+           const TQ_UINT8 *src, 
+           TQ_INT32 srcRowSize,
+           TQ_INT32 rows, 
+           TQ_INT32 cols, 
+           TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+
+    double sAlpha, dAlpha;
+    double alpha, red, green, blue;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            sAlpha = UINT8_MAX - s[PIXEL_ALPHA];
+            dAlpha = UINT8_MAX - d[PIXEL_ALPHA];
+
+            red=((double) (UINT8_MAX -sAlpha)*s[PIXEL_RED]+(double)
+                 (UINT8_MAX -dAlpha)*d[PIXEL_RED])/UINT8_MAX ;
+            d[PIXEL_RED]=RoundSignedToQuantum(red);
+            green=((double) (UINT8_MAX -sAlpha)*s[PIXEL_GREEN]+(double)
+                   (UINT8_MAX -dAlpha)*d[PIXEL_GREEN])/UINT8_MAX ;
+            d[PIXEL_GREEN]=RoundSignedToQuantum(green);
+            blue=((double) (UINT8_MAX -sAlpha)*s[PIXEL_BLUE]+(double)
+                  (UINT8_MAX -dAlpha)*d[PIXEL_BLUE])/UINT8_MAX ;
+            d[PIXEL_BLUE]=RoundSignedToQuantum(blue);
+            alpha =((double) (UINT8_MAX -sAlpha)+
+                (double) (UINT8_MAX -dAlpha))/UINT8_MAX ;
+            d[PIXEL_ALPHA]=UINT8_MAX -RoundSignedToQuantum(alpha );    
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+}
+
+
+
+void compositeMinus(TQ_INT32 pixelSize,
+            TQ_UINT8 *dst, 
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src, 
+            TQ_INT32 srcRowSize,
+            TQ_INT32 rows, 
+            TQ_INT32 cols,
+            TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+
+    double sAlpha, dAlpha;
+    double alpha, red, green, blue;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            sAlpha = UINT8_MAX - s[PIXEL_ALPHA];
+            dAlpha = UINT8_MAX - d[PIXEL_ALPHA];
+
+            red=((double) (UINT8_MAX -dAlpha)*d[PIXEL_RED]-
+                 (double) (UINT8_MAX -sAlpha)*s[PIXEL_RED])/UINT8_MAX ;
+            d[PIXEL_RED]=RoundSignedToQuantum(red);
+            green=((double) (UINT8_MAX -dAlpha)*d[PIXEL_GREEN]-
+                   (double) (UINT8_MAX -sAlpha)*s[PIXEL_GREEN])/UINT8_MAX ;
+            d[PIXEL_GREEN]=RoundSignedToQuantum(green);
+            blue=((double) (UINT8_MAX -dAlpha)*d[PIXEL_BLUE]-
+                  (double) (UINT8_MAX -sAlpha)*s[PIXEL_BLUE])/UINT8_MAX ;
+            d[PIXEL_BLUE]=RoundSignedToQuantum(blue);
+            alpha =((double) (UINT8_MAX -dAlpha)-
+                (double) (UINT8_MAX -sAlpha))/UINT8_MAX ;
+            d[PIXEL_ALPHA]=UINT8_MAX -RoundSignedToQuantum(alpha );
+            
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+
+}
+
+void compositeAdd(TQ_INT32 pixelSize,
+          TQ_UINT8 *dst, 
+          TQ_INT32 dstRowSize,
+          const TQ_UINT8 *src, 
+          TQ_INT32 srcRowSize,
+          TQ_INT32 rows, 
+          TQ_INT32 cols, 
+          TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+
+    double sAlpha, dAlpha;
+    double red, green, blue;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            sAlpha = UINT8_MAX - s[PIXEL_ALPHA];
+            dAlpha = UINT8_MAX - d[PIXEL_ALPHA];
+
+            red=(double) s[PIXEL_RED]+d[PIXEL_RED];
+            d[PIXEL_RED]=(TQ_UINT8)
+                (red > UINT8_MAX  ? red-=UINT8_MAX  : red+0.5);
+            green=(double) s[PIXEL_GREEN]+d[PIXEL_GREEN];
+            d[PIXEL_GREEN]=(TQ_UINT8)
+                (green > UINT8_MAX  ? green-=UINT8_MAX  : green+0.5);
+            blue=(double) s[PIXEL_BLUE]+d[PIXEL_BLUE];
+            d[PIXEL_BLUE]=(TQ_UINT8)
+                (blue > UINT8_MAX  ? blue-=UINT8_MAX  : blue+0.5);
+            d[PIXEL_ALPHA]=OPACITY_OPAQUE;    
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+
+}
+
+void compositeSubtract(TQ_INT32 pixelSize,
+               TQ_UINT8 *dst, 
+               TQ_INT32 dstRowSize,
+               const TQ_UINT8 *src, 
+               TQ_INT32 srcRowSize,
+               TQ_INT32 rows, 
+               TQ_INT32 cols, 
+               TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+
+    double red, green, blue;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+
+            red=(double) s[PIXEL_RED]-d[PIXEL_RED];
+            d[PIXEL_RED]=(TQ_UINT8)
+                (red < 0 ? red+=UINT8_MAX  : red+0.5);
+            green=(double) s[PIXEL_GREEN]-d[PIXEL_GREEN];
+            d[PIXEL_GREEN]=(TQ_UINT8)
+                (green < 0 ? green+=UINT8_MAX  : green+0.5);
+            blue=(double) s[PIXEL_BLUE]-d[PIXEL_BLUE];
+            d[PIXEL_BLUE]=(TQ_UINT8)
+                (blue < 0 ? blue+=UINT8_MAX  : blue+0.5);
+            d[PIXEL_ALPHA]=OPACITY_OPAQUE;
+            
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+
+}
+
+void compositeDiff(TQ_INT32 pixelSize,
+           TQ_UINT8 *dst, 
+           TQ_INT32 dstRowSize,
+           const TQ_UINT8 *src, 
+           TQ_INT32 srcRowSize,
+           TQ_INT32 rows, 
+           TQ_INT32 cols, 
+           TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+
+    double sAlpha, dAlpha;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            sAlpha = UINT8_MAX - s[PIXEL_ALPHA];
+            dAlpha = UINT8_MAX - d[PIXEL_ALPHA];
+
+            d[PIXEL_RED]=(TQ_UINT8)
+                AbsoluteValue(s[PIXEL_RED]-(double) d[PIXEL_RED]);
+            d[PIXEL_GREEN]=(TQ_UINT8)
+                AbsoluteValue(s[PIXEL_GREEN]-(double) d[PIXEL_GREEN]);
+            d[PIXEL_BLUE]=(TQ_UINT8)
+                AbsoluteValue(s[PIXEL_BLUE]-(double) d[PIXEL_BLUE]);
+            d[PIXEL_ALPHA]=UINT8_MAX - (TQ_UINT8)
+                AbsoluteValue(sAlpha-(double) dAlpha);
+
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+
+}
+
+void compositeBumpmap(TQ_INT32 pixelSize,
+              TQ_UINT8 *dst, 
+              TQ_INT32 dstRowSize,
+              const TQ_UINT8 *src, 
+              TQ_INT32 srcRowSize,
+              TQ_INT32 rows, 
+              TQ_INT32 cols, 
+              TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+
+    double intensity;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            // Is this correct? It's not this way in GM.
+            if (s[PIXEL_ALPHA] == OPACITY_TRANSPARENT)
+                continue;
+
+            // And I'm not sure whether this is correct, either.
+            intensity = ((double)306.0 * s[PIXEL_RED] + 
+                     (double)601.0 * s[PIXEL_GREEN] + 
+                     (double)117.0 * s[PIXEL_BLUE]) / 1024.0;
+            
+            d[PIXEL_RED]=(TQ_UINT8) (((double)
+                         intensity * d[PIXEL_RED])/UINT8_MAX +0.5);
+            d[PIXEL_GREEN]=(TQ_UINT8) (((double)
+                           intensity * d[PIXEL_GREEN])/UINT8_MAX +0.5);
+            d[PIXEL_BLUE]=(TQ_UINT8) (((double)
+                          intensity * d[PIXEL_BLUE])/UINT8_MAX +0.5);
+            d[PIXEL_ALPHA]= (TQ_UINT8) (((double)
+                           intensity * d[PIXEL_ALPHA])/UINT8_MAX +0.5);
+            
+            
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+
+}
+
+void compositeCopy(TQ_INT32 pixelSize,
+           TQ_UINT8 *dst, 
+           TQ_INT32 dstRowSize,
+           const TQ_UINT8 *src, 
+           TQ_INT32 srcRowSize,
+           TQ_INT32 rows, 
+           TQ_INT32 cols, 
+           TQ_UINT8 /*opacity*/ = OPACITY_OPAQUE)
+{
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+    d = dst;
+    s = src;
+    TQ_UINT32 len = cols * pixelSize;
+    
+    while (rows-- > 0) {
+        memcpy(d, s, len);
+        d += dstRowSize;
+        s += srcRowSize;
+    }
+}
+
+void compositeCopyChannel(TQ_UINT8 pixel, 
+               TQ_INT32 pixelSize,
+               TQ_UINT8 *dst, 
+               TQ_INT32 dstRowSize,
+               const TQ_UINT8 *src, 
+               TQ_INT32 srcRowSize,
+               TQ_INT32 rows, 
+               TQ_INT32 cols, 
+              TQ_UINT8 /*opacity*/ = OPACITY_OPAQUE)
+{
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+    TQ_INT32 i;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            d[pixel] = s[pixel];
+        }
+        
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+
+}
+
+void compositeCopyRed(TQ_INT32 pixelSize,
+              TQ_UINT8 *dst, 
+              TQ_INT32 dstRowSize,
+              const TQ_UINT8 *src, 
+              TQ_INT32 srcRowSize,
+              TQ_INT32 rows, 
+              TQ_INT32 cols, 
+              TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    compositeCopyChannel(PIXEL_RED, pixelSize, dst, dstRowSize, src, srcRowSize, rows, cols, opacity);
+}
+
+void compositeCopyGreen(TQ_INT32 pixelSize,
+            TQ_UINT8 *dst, 
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src, 
+            TQ_INT32 srcRowSize,
+            TQ_INT32 rows, 
+            TQ_INT32 cols, 
+            TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    compositeCopyChannel(PIXEL_GREEN, pixelSize, dst, dstRowSize, src, srcRowSize, rows, cols, opacity);
+}
+
+void compositeCopyBlue(TQ_INT32 pixelSize,
+               TQ_UINT8 *dst, 
+               TQ_INT32 dstRowSize,
+               const TQ_UINT8 *src, 
+               TQ_INT32 srcRowSize,
+               TQ_INT32 rows, 
+               TQ_INT32 cols, 
+               TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    compositeCopyChannel(PIXEL_BLUE, pixelSize, dst, dstRowSize, src, srcRowSize, rows, cols, opacity);
+}
+
+
+void compositeCopyOpacity(TQ_INT32 pixelSize,
+              TQ_UINT8 *dst, 
+              TQ_INT32 dstRowSize,
+              const TQ_UINT8 *src, 
+              TQ_INT32 srcRowSize,
+              TQ_INT32 rows, 
+              TQ_INT32 cols, 
+              TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+
+    // XXX: mess with intensity if there isn't an alpha channel, according to GM.
+    compositeCopyChannel(PIXEL_ALPHA, pixelSize, dst, dstRowSize, src, srcRowSize, rows, cols, opacity);
+
+}
+
+
+void compositeClear(TQ_INT32 pixelSize,
+            TQ_UINT8 *dst, 
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src, 
+            TQ_INT32 /*srcRowSize*/,
+            TQ_INT32 rows, 
+            TQ_INT32 cols,
+            TQ_UINT8 /*opacity*/ = OPACITY_OPAQUE)
+{
+
+    TQ_INT32 linesize = pixelSize * sizeof(TQ_UINT8) * cols;
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    d = dst;
+    s = src;
+    
+    while (rows-- > 0) {
+        memset(d, 0, linesize);
+        d += dstRowSize;
+    }
+    
+}
+
+
+void compositeDissolve(TQ_INT32 pixelSize,
+               TQ_UINT8 *dst, 
+               TQ_INT32 dstRowSize,
+               const TQ_UINT8 *src, 
+               TQ_INT32 srcRowSize,
+               TQ_INT32 rows, 
+               TQ_INT32 cols, 
+               TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+
+    double sAlpha, dAlpha;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            // XXX: correct?
+            if (s[PIXEL_ALPHA] == OPACITY_TRANSPARENT) continue;
+
+            sAlpha = UINT8_MAX - s[PIXEL_ALPHA];
+            dAlpha = UINT8_MAX - d[PIXEL_ALPHA];
+            
+            d[PIXEL_RED]=(TQ_UINT8) (((double) sAlpha*s[PIXEL_RED]+
+                          (UINT8_MAX -sAlpha)*d[PIXEL_RED])/UINT8_MAX +0.5);
+            d[PIXEL_GREEN]= (TQ_UINT8) (((double) sAlpha*s[PIXEL_GREEN]+
+                           (UINT8_MAX -sAlpha)*d[PIXEL_GREEN])/UINT8_MAX +0.5);
+            d[PIXEL_BLUE] = (TQ_UINT8) (((double) sAlpha*s[PIXEL_BLUE]+
+                          (UINT8_MAX -sAlpha)*d[PIXEL_BLUE])/UINT8_MAX +0.5);
+            d[PIXEL_ALPHA] = OPACITY_OPAQUE;
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+
+}
+
+
+void compositeDisplace(TQ_INT32 pixelSize,
+               TQ_UINT8 *dst, 
+               TQ_INT32 dstRowSize,
+               const TQ_UINT8 *src, 
+               TQ_INT32 srcRowSize,
+               TQ_INT32 rows, 
+               TQ_INT32 cols, 
+               TQ_UINT8 /*opacity*/ = OPACITY_OPAQUE)
+{
+    TQ_INT32 linesize = pixelSize * sizeof(TQ_UINT8) * cols;
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+    d = dst;
+    s = src;
+    
+    while (rows-- > 0) {
+        memcpy(d, s, linesize);
+        d += dstRowSize;
+        s += srcRowSize;
+    }
+
+}
+
+#if 0
+void compositeModulate(TQ_INT32 pixelSize,
+               TQ_UINT8 *dst, 
+               TQ_INT32 dstRowSize,
+               const TQ_UINT8 *src, 
+               TQ_INT32 srcRowSize,
+               TQ_INT32 rows, 
+               TQ_INT32 cols, 
+               TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    if (opacity == OPACITY_TRANSPARENT) 
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 i;
+
+    double sAlpha, dAlpha;
+    long offset;
+
+    while (rows-- > 0) {
+        d = dst;
+        s = src;
+        for (i = cols; i > 0; i--, d += pixelSize, s += pixelSize) {
+            // XXX: correct?
+            if (s[PIXEL_ALPHA] == OPACITY_TRANSPARENT) continue;
+
+            sAlpha = UINT8_MAX - s[PIXEL_ALPHA];
+            dAlpha = UINT8_MAX - d[PIXEL_ALPHA];
+            
+
+            offset=(long) (PixelIntensityToQuantum(&source)-midpoint);
+            if (offset == 0)
+                continue;
+            TransformHSL(d[PIXEL_RED],d[PIXEL_GREEN],d[PIXEL_BLUE],
+                     &hue,&saturation,&brightness);
+            brightness+=(percent_brightness*offset)/midpoint;
+            if (brightness < 0.0)
+                brightness=0.0;
+            else
+                if (brightness > 1.0)
+                    brightness=1.0;
+            HSLTransform(hue,saturation,brightness,&d[PIXEL_RED],
+                     &d[PIXEL_GREEN],&d[PIXEL_BLUE]);
+            
+            
+        }
+        dst += dstRowSize;
+        src += srcRowSize;
+    }
+
+
+}
+
+
+void compositeThreshold(TQ_INT32 pixelSize,
+            TQ_UINT8 *dst, 
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src, 
+            TQ_INT32 srcRowSize,
+            TQ_INT32 rows, 
+            TQ_INT32 cols, 
+            TQ_UINT8 opacity = OPACITY_OPAQUE)
+{
+    TQ_INT32 linesize = pixelSize * sizeof(TQ_UINT8) * cols;
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+    TQ_UINT8 alpha;
+    TQ_UINT8 invAlpha;
+    TQ_INT32 i;
+
+}
+
+#endif
+
+void compositeColorize(TQ_INT32,
+               TQ_UINT8 *, 
+               TQ_INT32 ,
+               const TQ_UINT8 *, 
+               TQ_INT32 ,
+               TQ_INT32 , 
+               TQ_INT32 , 
+               TQ_UINT8 )
+{
+}
+
+
+void compositeLuminize(TQ_INT32 ,
+               TQ_UINT8 *, 
+               TQ_INT32 ,
+               const TQ_UINT8 *, 
+               TQ_INT32 ,
+               TQ_INT32 , 
+               TQ_INT32 , 
+               TQ_UINT8 )
+{
+
+}
+
+#endif
+
diff --git a/chalk/colorspaces/rgb_u8/kis_rgb_colorspace.cc b/chalk/colorspaces/rgb_u8/kis_rgb_colorspace.cc
new file mode 100644
index 000000000..34ab79fc1
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/kis_rgb_colorspace.cc
@@ -0,0 +1,1501 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <limits.h>
+#include <stdlib.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+#include <tqcolor.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_rgb_colorspace.h"
+#include "kis_u8_base_colorspace.h"
+#include "kis_color_conversions.h"
+#include "kis_integer_maths.h"
+#include "kis_colorspace_factory_registry.h"
+
+#include "composite.h"
+
+#define downscale(quantum)  (quantum) //((unsigned char) ((quantum)/257UL))
+#define upscale(value)  (value) // ((TQ_UINT8) (257UL*(value)))
+
+namespace {
+    const TQ_INT32 MAX_CHANNEL_RGB = 3;
+    const TQ_INT32 MAX_CHANNEL_RGBA = 4;
+}
+
+KisRgbColorSpace::KisRgbColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) :
+    KisU8BaseColorSpace(KisID("RGBA", i18n("RGB (8-bit integer/channel)")), TYPE_BGRA_8, icSigRgbData, tqparent, p)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Red"), i18n("R"), 2, KisChannelInfo::COLOR, KisChannelInfo::UINT8, 1, TQColor(255,0,0)));
+    m_channels.push_back(new KisChannelInfo(i18n("Green"), i18n("G"), 1, KisChannelInfo::COLOR, KisChannelInfo::UINT8, 1, TQColor(0,255,0)));
+    m_channels.push_back(new KisChannelInfo(i18n("Blue"), i18n("B"), 0, KisChannelInfo::COLOR, KisChannelInfo::UINT8, 1, TQColor(0,0,255)));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), i18n("A"), 3, KisChannelInfo::ALPHA, KisChannelInfo::UINT8));
+
+    m_alphaPos = PIXEL_ALPHA;
+    init();
+}
+
+KisRgbColorSpace::~KisRgbColorSpace()
+{
+}
+
+void KisRgbColorSpace::setPixel(TQ_UINT8 *pixel, TQ_UINT8 red, TQ_UINT8 green, TQ_UINT8 blue, TQ_UINT8 alpha) const
+{
+    pixel[PIXEL_RED] = red;
+    pixel[PIXEL_GREEN] = green;
+    pixel[PIXEL_BLUE] = blue;
+    pixel[PIXEL_ALPHA] = alpha;
+}
+
+void KisRgbColorSpace::getPixel(const TQ_UINT8 *pixel, TQ_UINT8 *red, TQ_UINT8 *green, TQ_UINT8 *blue, TQ_UINT8 *alpha) const
+{
+    *red = pixel[PIXEL_RED];
+    *green = pixel[PIXEL_GREEN];
+    *blue = pixel[PIXEL_BLUE];
+    *alpha = pixel[PIXEL_ALPHA];
+}
+
+void KisRgbColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    TQ_UINT32 totalRed = 0, totalGreen = 0, totalBlue = 0, totalAlpha = 0;
+
+    while (nColors--)
+    {
+        TQ_UINT32 alpha = (*colors)[PIXEL_ALPHA];
+        // although we only mult by weight and not by weight*256/255
+        // we divide by the same amount later, so there is no need
+        TQ_UINT32 alphaTimesWeight = alpha * *weights;
+
+        totalRed += (*colors)[PIXEL_RED] * alphaTimesWeight;
+        totalGreen += (*colors)[PIXEL_GREEN] * alphaTimesWeight;
+        totalBlue += (*colors)[PIXEL_BLUE] * alphaTimesWeight;
+        totalAlpha += alphaTimesWeight;
+
+        weights++;
+        colors++;
+    }
+
+    // note this is correct - if you look at the above calculation
+    if (totalAlpha > 255*255) totalAlpha = 255*255;
+
+    // Divide by 255.
+    dst[PIXEL_ALPHA] =(((totalAlpha + 0x80)>>8)+totalAlpha + 0x80) >>8;
+
+    if (totalAlpha > 0) {
+        totalRed = totalRed / totalAlpha;
+        totalGreen = totalGreen / totalAlpha;
+        totalBlue = totalBlue / totalAlpha;
+    } // else the values are already 0 too
+
+    TQ_UINT32 dstRed = totalRed;
+    //Q_ASSERT(dstRed <= 255);
+    if (dstRed > 255) dstRed = 255;
+    dst[PIXEL_RED] = dstRed;
+
+    TQ_UINT32 dstGreen = totalGreen;
+    //Q_ASSERT(dstGreen <= 255);
+    if (dstGreen > 255) dstGreen = 255;
+    dst[PIXEL_GREEN] = dstGreen;
+
+    TQ_UINT32 dstBlue = totalBlue;
+    //Q_ASSERT(dstBlue <= 255);
+    if (dstBlue > 255) dstBlue = 255;
+    dst[PIXEL_BLUE] = dstBlue;
+}
+
+void KisRgbColorSpace::convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const
+{
+    TQ_INT64 totalRed = 0, totalGreen = 0, totalBlue = 0, totalAlpha = 0;
+    TQ_INT32 totalWeight = 0, totalWeightTransparent = 0;
+    while (nColors--)
+    {
+        TQ_INT32 weight = *kernelValues;
+
+        if (weight != 0) {
+            if((*colors)[PIXEL_ALPHA] == 0)
+            {
+              totalWeightTransparent += weight;
+            } else {
+              totalRed += (*colors)[PIXEL_RED] * weight;
+              totalGreen += (*colors)[PIXEL_GREEN] * weight;
+              totalBlue += (*colors)[PIXEL_BLUE] * weight;
+            }
+            totalAlpha += (*colors)[PIXEL_ALPHA] * weight;
+            totalWeight += weight;
+        }
+        colors++;
+        kernelValues++;
+    }
+    if(totalWeightTransparent == 0)
+    {
+      if (channelFlags & KisChannelInfo::FLAG_COLOR) {
+          dst[PIXEL_RED] = CLAMP((totalRed / factor) + offset, 0, TQ_UINT8_MAX);
+          dst[PIXEL_GREEN] = CLAMP((totalGreen / factor) + offset, 0, TQ_UINT8_MAX);
+          dst[PIXEL_BLUE] =  CLAMP((totalBlue / factor) + offset, 0, TQ_UINT8_MAX);
+      }
+      if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+          dst[PIXEL_ALPHA] = CLAMP((totalAlpha/ factor) + offset, 0, TQ_UINT8_MAX);
+      }
+    } else if(totalWeightTransparent != totalWeight && (channelFlags & KisChannelInfo::FLAG_COLOR)) {
+      if(totalWeight == factor)
+      {
+        TQ_INT64 a = ( totalWeight - totalWeightTransparent );
+        dst[PIXEL_RED] = CLAMP((totalRed / a) + offset, 0, TQ_UINT8_MAX);
+        dst[PIXEL_GREEN] = CLAMP((totalGreen / a) + offset, 0, TQ_UINT8_MAX);
+        dst[PIXEL_BLUE] =  CLAMP((totalBlue / a) + offset, 0, TQ_UINT8_MAX);
+      } else {
+        double a = totalWeight / ( factor * ( totalWeight - totalWeightTransparent ) ); // use double as it can saturate
+        dst[PIXEL_RED] = CLAMP( (TQ_UINT8)(totalRed * a) + offset, 0, TQ_UINT8_MAX);
+        dst[PIXEL_GREEN] = CLAMP( (TQ_UINT8)(totalGreen * a) + offset, 0, TQ_UINT8_MAX);
+        dst[PIXEL_BLUE] =  CLAMP( (TQ_UINT8)(totalBlue * a) + offset, 0, TQ_UINT8_MAX);
+      }
+    }
+    if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
+        dst[PIXEL_ALPHA] = CLAMP((totalAlpha/ factor) + offset, 0, TQ_UINT8_MAX);
+    }
+}
+
+
+void KisRgbColorSpace::invertColor(TQ_UINT8 * src, TQ_INT32 nPixels)
+{
+    TQ_UINT32 psize = pixelSize();
+
+    while (nPixels--)
+    {
+        src[PIXEL_RED] = TQ_UINT8_MAX - src[PIXEL_RED];
+        src[PIXEL_GREEN] = TQ_UINT8_MAX - src[PIXEL_GREEN];
+        src[PIXEL_BLUE] = TQ_UINT8_MAX - src[PIXEL_BLUE];
+
+        src += psize;
+    }
+}
+
+
+void KisRgbColorSpace::darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const
+{
+    TQ_UINT32 pSize = pixelSize();
+
+    while (nPixels--) {
+        if (compensate) {
+            dst[PIXEL_RED]  = (TQ_INT8) TQMIN(255,((src[PIXEL_RED] * shade) / (compensation * 255)));
+            dst[PIXEL_GREEN]  = (TQ_INT8) TQMIN(255,((src[PIXEL_GREEN] * shade) / (compensation * 255)));
+            dst[PIXEL_BLUE]  = (TQ_INT8) TQMIN(255,((src[PIXEL_BLUE] * shade) / (compensation * 255)));
+        }
+        else {
+            dst[PIXEL_RED]  = (TQ_INT8) TQMIN(255, (src[PIXEL_RED] * shade / 255));
+            dst[PIXEL_BLUE]  = (TQ_INT8) TQMIN(255, (src[PIXEL_BLUE] * shade / 255));
+            dst[PIXEL_GREEN]  = (TQ_INT8) TQMIN(255, (src[PIXEL_GREEN] * shade / 255));
+        }
+        dst += pSize;
+        src += pSize;
+    }
+}
+
+TQ_UINT8 KisRgbColorSpace::intensity8(const TQ_UINT8 * src) const
+{
+    return (TQ_UINT8)((src[PIXEL_RED] * 0.30 + src[PIXEL_GREEN] * 0.59 + src[PIXEL_BLUE] * 0.11) + 0.5);
+}
+
+TQValueVector<KisChannelInfo *> KisRgbColorSpace::channels() const
+{
+    return m_channels;
+}
+
+TQ_UINT32 KisRgbColorSpace::nChannels() const
+{
+    return MAX_CHANNEL_RGBA;
+}
+
+TQ_UINT32 KisRgbColorSpace::nColorChannels() const
+{
+    return MAX_CHANNEL_RGB;
+}
+
+TQ_UINT32 KisRgbColorSpace::pixelSize() const
+{
+    return MAX_CHANNEL_RGBA;
+}
+
+TQImage KisRgbColorSpace::convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                                         KisProfile *  dstProfile,
+                                         TQ_INT32 renderingIntent, float /*exposure*/)
+
+{
+    Q_ASSERT(data);
+    TQImage img = TQImage(const_cast<TQ_UINT8 *>(data), width, height, 32, 0, 0, TQImage::LittleEndian);
+    img.setAlphaBuffer(true);
+    // XXX: The previous version of this code used the quantum data directly
+    // as an optimisation. We're introducing a copy overhead here which could
+    // be factored out again if needed.
+    img = img.copy();
+
+    if (dstProfile != 0) {
+        KisColorSpace *dstCS = m_parent->getColorSpace(KisID("RGBA",""),  dstProfile->productName());
+        convertPixelsTo(img.bits(),
+                        img.bits(), dstCS,
+                        width * height, renderingIntent);
+    }
+
+    return img;
+}
+
+
+
+
+void KisRgbColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride,
+                                     const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride,
+                                     const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride,
+                                     TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(srcAlpha, opacity);
+                }
+
+                if (srcAlpha == OPACITY_OPAQUE) {
+                    memcpy(dst, src, MAX_CHANNEL_RGBA * sizeof(TQ_UINT8));
+                } else {
+                    TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+                    TQ_UINT8 srcBlend;
+
+                    if (dstAlpha == OPACITY_OPAQUE) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                        dst[PIXEL_ALPHA] = newAlpha;
+
+                        if (newAlpha != 0) {
+                            srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend == OPACITY_OPAQUE) {
+                        memcpy(dst, src, MAX_CHANNEL_RGB * sizeof(TQ_UINT8));
+                    } else {
+                        dst[PIXEL_RED] = UINT8_BLEND(src[PIXEL_RED], dst[PIXEL_RED], srcBlend);
+                        dst[PIXEL_GREEN] = UINT8_BLEND(src[PIXEL_GREEN], dst[PIXEL_GREEN], srcBlend);
+                        dst[PIXEL_BLUE] = UINT8_BLEND(src[PIXEL_BLUE], dst[PIXEL_BLUE], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+
+void KisRgbColorSpace::compositeAlphaDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride,
+                                     const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride,
+                                     const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride,
+                                     TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (opacity != OPACITY_OPAQUE) {
+                srcAlpha = UINT8_MULT(srcAlpha, opacity);
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT && srcAlpha >= dstAlpha) {
+                dst[PIXEL_ALPHA] = srcAlpha;
+                memcpy(dst, src, MAX_CHANNEL_RGB * sizeof(TQ_UINT8));
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+
+void KisRgbColorSpace::compositeMultiply(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                TQ_UINT8 srcColor = src[PIXEL_RED];
+                TQ_UINT8 dstColor = dst[PIXEL_RED];
+
+                srcColor = UINT8_MULT(srcColor, dstColor);
+
+                dst[PIXEL_RED] = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                srcColor = src[PIXEL_GREEN];
+                dstColor = dst[PIXEL_GREEN];
+
+                srcColor = UINT8_MULT(srcColor, dstColor);
+
+                dst[PIXEL_GREEN] = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                srcColor = src[PIXEL_BLUE];
+                dstColor = dst[PIXEL_BLUE];
+
+                srcColor = UINT8_MULT(srcColor, dstColor);
+
+                dst[PIXEL_BLUE] = UINT8_BLEND(srcColor, dstColor, srcBlend);
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeDivide(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = TQMIN((dstColor * (UINT8_MAX + 1u) + (srcColor / 2u)) / (1u + srcColor), UINT8_MAX);
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeScreen(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = UINT8_MAX - UINT8_MULT(UINT8_MAX - dstColor, UINT8_MAX - srcColor);
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeOverlay(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = UINT8_MULT(dstColor, dstColor + UINT8_MULT(2 * srcColor, UINT8_MAX - dstColor));
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeDodge(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = TQMIN((dstColor * (UINT8_MAX + 1)) / (UINT8_MAX + 1 - srcColor), UINT8_MAX);
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = TQMIN(((UINT8_MAX - dstColor) * (UINT8_MAX + 1)) / (srcColor + 1), UINT8_MAX);
+                    if (UINT8_MAX - srcColor > UINT8_MAX) srcColor = UINT8_MAX;
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeDarken(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = TQMIN(srcColor, dstColor);
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeLighten(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
+
+                    TQ_UINT8 srcColor = src[channel];
+                    TQ_UINT8 dstColor = dst[channel];
+
+                    srcColor = TQMAX(srcColor, dstColor);
+
+                    TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
+
+                    dst[channel] = newColor;
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeHue(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                int dstRed = dst[PIXEL_RED];
+                int dstGreen = dst[PIXEL_GREEN];
+                int dstBlue = dst[PIXEL_BLUE];
+
+                int srcHue;
+                int srcSaturation;
+                int srcValue;
+                int dstHue;
+                int dstSaturation;
+                int dstValue;
+
+                rgb_to_hsv(src[PIXEL_RED], src[PIXEL_GREEN], src[PIXEL_BLUE], &srcHue, &srcSaturation, &srcValue);
+                rgb_to_hsv(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
+
+                int srcRed;
+                int srcGreen;
+                int srcBlue;
+
+                hsv_to_rgb(srcHue, dstSaturation, dstValue, &srcRed, &srcGreen, &srcBlue);
+
+                dst[PIXEL_RED] = UINT8_BLEND(srcRed, dstRed, srcBlend);
+                dst[PIXEL_GREEN] = UINT8_BLEND(srcGreen, dstGreen, srcBlend);
+                dst[PIXEL_BLUE] = UINT8_BLEND(srcBlue, dstBlue, srcBlend);
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeSaturation(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                int dstRed = dst[PIXEL_RED];
+                int dstGreen = dst[PIXEL_GREEN];
+                int dstBlue = dst[PIXEL_BLUE];
+
+                int srcHue;
+                int srcSaturation;
+                int srcValue;
+                int dstHue;
+                int dstSaturation;
+                int dstValue;
+
+                rgb_to_hsv(src[PIXEL_RED], src[PIXEL_GREEN], src[PIXEL_BLUE], &srcHue, &srcSaturation, &srcValue);
+                rgb_to_hsv(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
+
+                int srcRed;
+                int srcGreen;
+                int srcBlue;
+
+                hsv_to_rgb(dstHue, srcSaturation, dstValue, &srcRed, &srcGreen, &srcBlue);
+
+                dst[PIXEL_RED] = UINT8_BLEND(srcRed, dstRed, srcBlend);
+                dst[PIXEL_GREEN] = UINT8_BLEND(srcGreen, dstGreen, srcBlend);
+                dst[PIXEL_BLUE] = UINT8_BLEND(srcBlue, dstBlue, srcBlend);
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeValue(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                int dstRed = dst[PIXEL_RED];
+                int dstGreen = dst[PIXEL_GREEN];
+                int dstBlue = dst[PIXEL_BLUE];
+
+                int srcHue;
+                int srcSaturation;
+                int srcValue;
+                int dstHue;
+                int dstSaturation;
+                int dstValue;
+
+                rgb_to_hsv(src[PIXEL_RED], src[PIXEL_GREEN], src[PIXEL_BLUE], &srcHue, &srcSaturation, &srcValue);
+                rgb_to_hsv(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
+
+                int srcRed;
+                int srcGreen;
+                int srcBlue;
+
+                hsv_to_rgb(dstHue, dstSaturation, srcValue, &srcRed, &srcGreen, &srcBlue);
+
+                dst[PIXEL_RED] = UINT8_BLEND(srcRed, dstRed, srcBlend);
+                dst[PIXEL_GREEN] = UINT8_BLEND(srcGreen, dstGreen, srcBlend);
+                dst[PIXEL_BLUE] = UINT8_BLEND(srcBlue, dstBlue, srcBlend);
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeColor(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        TQ_INT32 columns = numColumns;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+            TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+            srcAlpha = TQMIN(srcAlpha, dstAlpha);
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(src[PIXEL_ALPHA], opacity);
+                }
+
+                TQ_UINT8 srcBlend;
+
+                if (dstAlpha == OPACITY_OPAQUE) {
+                    srcBlend = srcAlpha;
+                } else {
+                    TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                    dst[PIXEL_ALPHA] = newAlpha;
+
+                    if (newAlpha != 0) {
+                        srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                    } else {
+                        srcBlend = srcAlpha;
+                    }
+                }
+
+                int dstRed = dst[PIXEL_RED];
+                int dstGreen = dst[PIXEL_GREEN];
+                int dstBlue = dst[PIXEL_BLUE];
+
+                int srcHue;
+                int srcSaturation;
+                int srcLightness;
+                int dstHue;
+                int dstSaturation;
+                int dstLightness;
+
+                rgb_to_hls(src[PIXEL_RED], src[PIXEL_GREEN], src[PIXEL_BLUE], &srcHue, &srcLightness, &srcSaturation);
+                rgb_to_hls(dstRed, dstGreen, dstBlue, &dstHue, &dstLightness, &dstSaturation);
+
+                TQ_UINT8 srcRed;
+                TQ_UINT8 srcGreen;
+                TQ_UINT8 srcBlue;
+
+                hls_to_rgb(srcHue, dstLightness, srcSaturation, &srcRed, &srcGreen, &srcBlue);
+
+                dst[PIXEL_RED] = UINT8_BLEND(srcRed, dstRed, srcBlend);
+                dst[PIXEL_GREEN] = UINT8_BLEND(srcGreen, dstGreen, srcBlend);
+                dst[PIXEL_BLUE] = UINT8_BLEND(srcBlue, dstBlue, srcBlend);
+            }
+
+            columns--;
+            src += MAX_CHANNEL_RGBA;
+            dst += MAX_CHANNEL_RGBA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+}
+
+void KisRgbColorSpace::compositeErase(TQ_UINT8 *dst,
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src,
+            TQ_INT32 srcRowSize,
+            const TQ_UINT8 *srcAlphaMask,
+            TQ_INT32 tqmaskRowStride,
+            TQ_INT32 rows,
+            TQ_INT32 cols,
+            TQ_UINT8 /*opacity*/)
+{
+    TQ_INT32 i;
+    TQ_UINT8 srcAlpha;
+
+    while (rows-- > 0)
+    {
+        const TQ_UINT8 *s = src;
+        TQ_UINT8 *d = dst;
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (i = cols; i > 0; i--, s+=MAX_CHANNEL_RGBA, d+=MAX_CHANNEL_RGBA)
+        {
+            srcAlpha = s[PIXEL_ALPHA];
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_BLEND(srcAlpha, OPACITY_OPAQUE, *tqmask);
+                tqmask++;
+            }
+            d[PIXEL_ALPHA] = UINT8_MULT(srcAlpha, d[PIXEL_ALPHA]);
+        }
+
+        dst += dstRowSize;
+        if(srcAlphaMask)
+            srcAlphaMask += tqmaskRowStride;
+        src += srcRowSize;
+    }
+}
+
+void KisRgbColorSpace::bitBlt(TQ_UINT8 *dst,
+                      TQ_INT32 dstRowStride,
+                      const TQ_UINT8 *src,
+                      TQ_INT32 srcRowStride,
+                      const TQ_UINT8 *tqmask,
+                      TQ_INT32 tqmaskRowStride,
+                      TQ_UINT8 opacity,
+                      TQ_INT32 rows,
+                      TQ_INT32 cols,
+                      const KisCompositeOp& op)
+{
+
+    switch (op.op()) {
+    case COMPOSITE_UNDEF:
+        // Undefined == no composition
+        break;
+    case COMPOSITE_OVER:
+        compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ALPHA_DARKEN:
+        compositeAlphaDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_IN:
+        compositeIn(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_OUT:
+        compositeOut(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ATOP:
+        compositeAtop(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_XOR:
+        compositeXor(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_PLUS:
+        compositePlus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MINUS:
+        compositeMinus(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ADD:
+        compositeAdd(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SUBTRACT:
+        compositeSubtract(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIFF:
+        compositeDiff(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_MULT:
+        compositeMultiply(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DIVIDE:
+        compositeDivide(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BUMPMAP:
+        compositeBumpmap(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY:
+        compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_RED:
+        compositeCopyRed(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_GREEN:
+        compositeCopyGreen(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_BLUE:
+        compositeCopyBlue(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY_OPACITY:
+        compositeCopyOpacity(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_CLEAR:
+        compositeClear(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISSOLVE:
+        compositeDissolve(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DISPLACE:
+        compositeDisplace(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#if 0
+    case COMPOSITE_MODULATE:
+        compositeModulate(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_THRESHOLD:
+        compositeThreshold(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+#endif
+    case COMPOSITE_NO:
+        // No composition.
+        break;
+    case COMPOSITE_DARKEN:
+        compositeDarken(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LIGHTEN:
+        compositeLighten(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_HUE:
+        compositeHue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SATURATION:
+        compositeSaturation(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_VALUE:
+        compositeValue(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLOR:
+        compositeColor(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COLORIZE:
+        compositeColorize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_LUMINIZE:
+        compositeLuminize(pixelSize(), dst, dstRowStride, src, srcRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_SCREEN:
+        compositeScreen(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_OVERLAY:
+        compositeOverlay(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_ERASE:
+        compositeErase(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_DODGE:
+        compositeDodge(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_BURN:
+        compositeBurn(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    default:
+        break;
+    }
+}
+
+KisCompositeOpList KisRgbColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    list.append(KisCompositeOp(COMPOSITE_ALPHA_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_MULT));
+    list.append(KisCompositeOp(COMPOSITE_BURN));
+    list.append(KisCompositeOp(COMPOSITE_DODGE));
+    list.append(KisCompositeOp(COMPOSITE_DIVIDE));
+    list.append(KisCompositeOp(COMPOSITE_SCREEN));
+    list.append(KisCompositeOp(COMPOSITE_OVERLAY));
+    list.append(KisCompositeOp(COMPOSITE_DARKEN));
+    list.append(KisCompositeOp(COMPOSITE_LIGHTEN));
+    list.append(KisCompositeOp(COMPOSITE_HUE));
+    list.append(KisCompositeOp(COMPOSITE_SATURATION));
+    list.append(KisCompositeOp(COMPOSITE_VALUE));
+    list.append(KisCompositeOp(COMPOSITE_COLOR));
+    list.append(KisCompositeOp(COMPOSITE_PLUS));
+    list.append(KisCompositeOp(COMPOSITE_MINUS));
+    list.append(KisCompositeOp(COMPOSITE_SUBTRACT));
+    list.append(KisCompositeOp(COMPOSITE_ADD));
+
+    return list;
+}
diff --git a/chalk/colorspaces/rgb_u8/kis_rgb_colorspace.h b/chalk/colorspaces/rgb_u8/kis_rgb_colorspace.h
new file mode 100644
index 000000000..53281faff
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/kis_rgb_colorspace.h
@@ -0,0 +1,116 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_STRATEGY_COLORSPACE_RGB_H_
+#define KIS_STRATEGY_COLORSPACE_RGB_H_
+
+#include "klocale.h"
+
+#include "kis_global.h"
+#include "kis_u8_base_colorspace.h"
+#include "koffice_export.h"
+
+const TQ_UINT8 PIXEL_BLUE = 0;
+const TQ_UINT8 PIXEL_GREEN = 1;
+const TQ_UINT8 PIXEL_RED = 2;
+const TQ_UINT8 PIXEL_ALPHA = 3;
+
+class KRITATOOL_EXPORT KisRgbColorSpace : public KisU8BaseColorSpace {
+public:
+    KisRgbColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p);
+    virtual ~KisRgbColorSpace();
+
+    virtual bool willDegrade(ColorSpaceIndependence)
+        {
+            return false;
+        };
+
+
+public:
+    void setPixel(TQ_UINT8 *pixel, TQ_UINT8 red, TQ_UINT8 green, TQ_UINT8 blue, TQ_UINT8 alpha) const;
+    void getPixel(const TQ_UINT8 *pixel, TQ_UINT8 *red, TQ_UINT8 *green, TQ_UINT8 *blue, TQ_UINT8 *alpha) const;
+
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    virtual void darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const;
+    virtual TQ_UINT8 intensity8(const TQ_UINT8 * src) const;
+
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual TQ_UINT32 nChannels() const;
+    virtual TQ_UINT32 nColorChannels() const;
+    virtual TQ_UINT32 pixelSize() const;
+
+    virtual TQImage convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                       KisProfile *  dstProfile = 0,
+                       TQ_INT32 renderingIntent = INTENT_PERCEPTUAL,
+                       float exposure = 0.0f);
+
+    virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+protected:
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dstRowStride,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeAlphaDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeMultiply(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeDivide(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeScreen(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeOverlay(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeDodge(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeBurn(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeDarken(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeLighten(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeHue(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeSaturation(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeValue(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeColor(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+};
+
+class KisRgbColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const { return KisID("RGBA", i18n("RGB (8-bit integer/channel)")); };
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual TQ_UINT32 colorSpaceType() { return TYPE_BGRA_8; };
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return icSigRgbData; };
+
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile * p) { return new KisRgbColorSpace(tqparent, p); };
+
+    virtual TQString defaultProfile() { return "sRGB built-in - (lcms internal)"; };
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_RGB_H_
diff --git a/chalk/colorspaces/rgb_u8/rgb_plugin.cc b/chalk/colorspaces/rgb_u8/rgb_plugin.cc
new file mode 100644
index 000000000..0794456e2
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/rgb_plugin.cc
@@ -0,0 +1,74 @@
+/*
+* rgb_plugin.cc -- Part of Chalk
+*
+* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+*
+*  This program is free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  This program is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  You should have received a copy of the GNU General Public License
+*  along with this program; if not, write to the Free Software
+*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#include <stdlib.h>
+#include <vector>
+
+#include <tqpoint.h>
+
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kinstance.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <ktempfile.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <kis_debug_areas.h>
+
+#include <kis_debug_areas.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_basic_histogram_producers.h>
+
+#include "rgb_plugin.h"
+#include "kis_rgb_colorspace.h"
+
+typedef KGenericFactory<RGBPlugin> RGBPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalkrgbplugin, RGBPluginFactory( "chalk" ) )
+
+
+RGBPlugin::RGBPlugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(RGBPluginFactory::instance());
+
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") )
+    {
+	KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>(tqparent);
+
+        KisProfile *defProfile = new KisProfile(cmsCreate_sRGBProfile());
+        f->addProfile(defProfile);
+
+
+        KisColorSpaceFactory * csFactory = new KisRgbColorSpaceFactory();
+        f->add(csFactory);
+
+        KisColorSpace * colorSpaceRGBA = new KisRgbColorSpace(f, 0);
+        KisHistogramProducerFactoryRegistry::instance()->add(
+                new KisBasicHistogramProducerFactory<KisBasicU8HistogramProducer>
+                (KisID("RGB8HISTO", i18n("RGB8")), colorSpaceRGBA) );
+    }
+
+}
+
+RGBPlugin::~RGBPlugin()
+{
+}
+
+#include "rgb_plugin.moc"
diff --git a/chalk/colorspaces/rgb_u8/rgb_plugin.h b/chalk/colorspaces/rgb_u8/rgb_plugin.h
new file mode 100644
index 000000000..08ccd8908
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/rgb_plugin.h
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef RGB_PLUGIN_H_
+#define RGB_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the RGB colour space strategy.
+ */
+class RGBPlugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    RGBPlugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~RGBPlugin();
+
+};
+
+
+#endif // RGB_PLUGIN_H_
diff --git a/chalk/colorspaces/rgb_u8/rgbplugin.rc b/chalk/colorspaces/rgb_u8/rgbplugin.rc
new file mode 100644
index 000000000..943f5e250
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/rgbplugin.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui library="chalkrgbplugin" version="1">
+<Menu name="Image"><text>&amp;Image</text>
+    <Menu name="Mode"><text>&amp;Mode</text>
+            <Action name="convert to RGB(A)"/>
+    </Menu>
+</Menu>
+
+</kpartgui>
diff --git a/chalk/colorspaces/rgb_u8/templates/.directory b/chalk/colorspaces/rgb_u8/templates/.directory
new file mode 100644
index 000000000..4b475643a
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/templates/.directory
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=RGB
+Name[cy]=CGwGl (RGB)
+Name[fr]=RVB
+Name[hi]=आरजीबी
+X-KDE-DefaultTab=true
diff --git a/chalk/colorspaces/rgb_u8/templates/Makefile.am b/chalk/colorspaces/rgb_u8/templates/Makefile.am
new file mode 100644
index 000000000..216701e76
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/templates/Makefile.am
@@ -0,0 +1,8 @@
+templates_DATA = .directory transparent_1024x768.desktop transparent_1280x1024.desktop transparent_1600x1200.desktop transparent_640x480.desktop white_1024x768.desktop white_1280x1024.desktop white_1600x1200.desktop white_640x480.desktop
+templatesdir = $(kde_datadir)/chalk/templates/rgb
+
+templatesrc_DATA = transparent_1024x768.kra transparent_1280x1024.kra transparent_1600x1200.kra transparent_640x480.kra white_1024x768.kra white_1280x1024.kra white_1600x1200.kra white_640x480.kra
+templatesrcdir = $(kde_datadir)/chalk/templates/rgb/.source
+
+templatesicon_ICON = AUTO
+templatesicondir = $(kde_datadir)/chalk/icons
diff --git a/chalk/colorspaces/rgb_u8/templates/cr48-action-template_rgb_empty.png b/chalk/colorspaces/rgb_u8/templates/cr48-action-template_rgb_empty.png
new file mode 100644
index 000000000..e31085563
Binary files /dev/null and b/chalk/colorspaces/rgb_u8/templates/cr48-action-template_rgb_empty.png differ
diff --git a/chalk/colorspaces/rgb_u8/templates/crsc-action-template_rgb_empty.svgz b/chalk/colorspaces/rgb_u8/templates/crsc-action-template_rgb_empty.svgz
new file mode 100644
index 000000000..3ea7b8546
Binary files /dev/null and b/chalk/colorspaces/rgb_u8/templates/crsc-action-template_rgb_empty.svgz differ
diff --git a/chalk/colorspaces/rgb_u8/templates/transparent_1024x768.desktop b/chalk/colorspaces/rgb_u8/templates/transparent_1024x768.desktop
new file mode 100644
index 000000000..02722c8aa
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/templates/transparent_1024x768.desktop
@@ -0,0 +1,91 @@
+[Desktop Entry]
+Type=Link
+URL=.source/transparent_1024x768.kra
+Icon=template_rgb_empty
+Name=Transparent 1024 x 768
+Name[bg]=Прозрачно 1024x768
+Name[br]=Treuzwelus 1024 x 768
+Name[cy]=Tryloyw 1024 x 768
+Name[da]=Gennemsigtig 1024 x 768
+Name[el]=Διαφανής 1024 x 768
+Name[es]=1024 x 768 transparente
+Name[et]=Läbipaistev 1024 x 768
+Name[eu]=Gardena 1024 x 768
+Name[fa]=شفاف ۷۶۸ × ۱۰۲۴
+Name[fi]=Läpinäkyvä 1024x768
+Name[fr]=Image transparente 1024 x 768
+Name[fy]=Trochsichtich 1024 x 768
+Name[gl]=Transparente 1024 x 768
+Name[he]=‏1024‎ x 768 שקוף
+Name[hu]=Áttetsző 1024 x 768
+Name[is]=Gegnsæ 1024 x 768
+Name[it]=Trasparente 1024 × 768
+Name[ja]=透明 1024 x 768
+Name[km]=ថ្លា 1024 x 768
+Name[lt]=Permatomas 1024 x 768
+Name[lv]=Caurspīdīgs 1024 x 768
+Name[ms]=Lutsinar 1024 x 768
+Name[nb]=Gjennomsiktig 1024 × 768
+Name[nds]=Dörsichtig 1024 x 768
+Name[ne]=पारदर्शी १०२४ x ७६८
+Name[nn]=Gjennomsiktig 1024 × 768
+Name[pl]=Przezroczysty 1024 x 768
+Name[pt]=Transparente 1024 x 768
+Name[pt_BR]=Transparente de 1024 x 768
+Name[ru]=Рисунок 1024x768, прозрачный фон
+Name[se]=Čađačuovgi 1024 × 768
+Name[sk]=Priehľadný 1024 x 768
+Name[sl]=Prosojna 1024 x 768
+Name[sr]=Провидна 1024 x 768
+Name[sr@Latn]=Providna 1024 x 768
+Name[sv]=Genomskinlig 1024 x 768
+Name[uk]=Прозоре 1024 x 768
+Name[uz]=Shaffof 1024 x 768
+Name[uz@cyrillic]=Шаффоф 1024 x 768
+Name[zh_CN]=透明 1024 x 768
+Name[zh_TW]=透明 1024 x 768
+Comment=Creates a transparent image of 1024 x 768 pixels.
+Comment[bg]=Създава прозрачно изображение с размери 1024x768 пиксела.
+Comment[ca]=Crea una imatge transparent de 1024 x 768 píxels.
+Comment[cy]=Creu delwedd dryloyw o 1024 x 768 picsel.
+Comment[da]=Laver et gennemsigtigt billede på 1024 x 768 billedpunkter.
+Comment[de]=Erstellt ein transparentes Bild mit 1024 x 768 Pixeln.
+Comment[el]=Δημιουργεί μία διαφανή εικόνα μεγέθους 1024 x 768 εικονοστοιχείων.
+Comment[eo]=Kreas travideblan bildon el 1024 x 768 rastrumeroj.
+Comment[es]=Crea una imagen transparente de 1024 x 768 píxeles.
+Comment[et]=Loob läbipaistva pildi mõõtmetega 1024 x 768 pikslit.
+Comment[eu]=1024 x 768 pixeleko irudi garden bat sortzen du.
+Comment[fa]=یک تصویر شفاف ۷۶۸ × ۱۰۲۴ تصویردانه‌ای ایجاد می‌کند.
+Comment[fi]=Luo läpinäkyvän 1024x768 pikselin kuvan.
+Comment[fr]=Crée une image transparente de 1024 x 768 pixels.
+Comment[fy]=Makket in trochsichtige ôfbylding oan fan 1024 x 768 byldpunten.
+Comment[gl]=Cria unha imaxe transparente de 1024 x 768 pixels.
+Comment[he]=יצירת תמונה שקופה בגודל ‎1024 x 768 פיקסלים
+Comment[hu]=Létrehoz egy 1024 x 768 képpontos áttetsző képet.
+Comment[is]=Býr til gegnsæja mynd í hlutföllunum 1024 x 768 punktar.
+Comment[it]=Crea un'immagine trasparente di 1024 × 768 pixel.
+Comment[ja]=1024 x 768 ピクセルの透視画像を作成
+Comment[km]=បង្កើត​រូបភាព​ថ្លា​ទំហំ 1024 x 768 ភីកសែល ។
+Comment[lt]=Sukuria permatomą 1024 x 768 pikselių paveiksliuką.
+Comment[ms]=Cipta imej lutsinar 1024 x 768 piksel.
+Comment[nb]=Lager et gjennomsiktig bilde på 1024 x 768 piksler.
+Comment[nds]=Stellt en dörsichtig Bild mit 1024 x 768 Pixels op.
+Comment[ne]=१०२४ x ७६८ पिक्सेलको पारदर्शी छवि सिर्जना गर्दछ ।
+Comment[nl]=Maakt een transparante afbeelding aan van 1024 x 768 pixels.
+Comment[nn]=Lagar eit gjennomsiktig bilete på 1024 × 768 pikslar.
+Comment[pl]=Tworzy przezroczysty obrazek o rozmiarach 1024 x 768 pikseli.
+Comment[pt]=Cria uma imagem transparente com 1024 x 768 pontos.
+Comment[pt_BR]=Cria uma imagem transparente de 1024 x 768 pixels.
+Comment[ru]=Рисунок 1024x768, прозрачный фон
+Comment[se]=Ráhkada čađačuovgi gova mas t 1024 × 768 govvačuoggá
+Comment[sk]=Vytvorí obrázok s rozmermi 1024 x 768 pixelov a priehľadným pozadím.
+Comment[sl]=Ustvari prosojno sliko velikosti 1024 x 768 pik.
+Comment[sr]=Прави провидну слику са 1024 x 768 пиксела.
+Comment[sr@Latn]=Pravi providnu sliku sa 1024 x 768 piksela.
+Comment[sv]=Skapar en genomskinlig bild med 1024 x 768 bildpunkter.
+Comment[uk]=Створює прозоре зображення 1024 x 768 пікселів.
+Comment[uz]=Oʻlchami 1024 x 768 nuqta boʻlgan shaffof rasmni yaratish.
+Comment[uz@cyrillic]=Ўлчами 1024 x 768 нуқта бўлган шаффоф расмни яратиш.
+Comment[zh_CN]=创建 1024 x 768 像素的透明图像。
+Comment[zh_TW]=建立一個 1024 x 768 像素的透明圖片。
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/rgb_u8/templates/transparent_1024x768.kra b/chalk/colorspaces/rgb_u8/templates/transparent_1024x768.kra
new file mode 100644
index 000000000..2eb55d6a1
Binary files /dev/null and b/chalk/colorspaces/rgb_u8/templates/transparent_1024x768.kra differ
diff --git a/chalk/colorspaces/rgb_u8/templates/transparent_1280x1024.desktop b/chalk/colorspaces/rgb_u8/templates/transparent_1280x1024.desktop
new file mode 100644
index 000000000..4d99ddce2
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/templates/transparent_1280x1024.desktop
@@ -0,0 +1,92 @@
+[Desktop Entry]
+Type=Link
+URL=.source/transparent_1280x1024.kra
+Icon=template_rgb_empty
+Name=Transparent 1280 x 1024
+Name[bg]=Прозрачно 1280x1204
+Name[br]=Treuzwelus 1280 x 1024
+Name[cy]=Tryloyw 1280 x 1024
+Name[da]=Gennemsigtig 1280 x 1024
+Name[el]=Διαφανής 1280 x 1024
+Name[eo]=Travidebla 1280 x 1024
+Name[es]=1280 x 1024 transparente
+Name[et]=Läbipaistev 1280 x 1024
+Name[eu]=Gardena 1280 x 1024
+Name[fa]=شفاف ۱۰۲۴ × ۱۲۸۰
+Name[fi]=Läpinäkyvä 1280x1024
+Name[fr]=Image transparente 1280 x 1024
+Name[fy]=Trochsichtich  1280 x 1024
+Name[gl]=Transparente 1280 x 1024
+Name[he]=‏1280‎ x 1024 שקוף
+Name[hu]=Áttetsző 1280 x 1024
+Name[is]=Gegnsæ 1280 x 1024
+Name[it]=Trasparente 1280 × 1024
+Name[ja]=透明 1280 x 1024
+Name[km]=ថ្លា 1280 x 1024
+Name[lt]=Permatomas 1280 x 1024
+Name[lv]=Caurspīdīgs 1280 x 1024
+Name[ms]=Lutsinar 1280 x 1024
+Name[nb]=Gjennomsiktig 1280 x 1024
+Name[nds]=Dörsichtig 1280 x 1024
+Name[ne]=पारदर्शी १२८० x १०२४
+Name[nn]=Gjennomsiktig 1280 × 1024
+Name[pl]=Przezroczysty 1280 x 1024
+Name[pt]=Transparente 1280 x 1024
+Name[pt_BR]=Transparente de 1280 x 1024
+Name[ru]=Рисунок 1280x1024, прозрачный фон
+Name[se]=Čađačuovgi 1280 × 1024
+Name[sk]=Priehľadný 1280 x 1024
+Name[sl]=Prosojna 1280 x 1024
+Name[sr]=Провидна 1280 x 1024
+Name[sr@Latn]=Providna 1280 x 1024
+Name[sv]=Genomskinlig 1280 x 1024
+Name[uk]=Прозоре 1280 x 1024
+Name[uz]=Shaffof 1280 x 1024
+Name[uz@cyrillic]=Шаффоф 1280 x 1024
+Name[zh_CN]=透明 1280 x 1024
+Name[zh_TW]=透明 1280 x 1024
+Comment=Creates a transparent image of 1280 x 1024 pixels.
+Comment[bg]=Създава прозрачно изображение с размери 1280x1024 пиксела.
+Comment[ca]=Crea una imatge transparent de 1280 x 1024 píxels.
+Comment[cy]=Creu delwedd dryloyw o 1280 x 1024 picsel.
+Comment[da]=Laver et gennemsigtigt billede på 1280 x 1024 billedpunkter.
+Comment[de]=Erstellt ein transparentes Bild mit 1280 x 1024 Pixeln.
+Comment[el]=Δημιουργεί μία διαφανή εικόνα μεγέθους 1280 x 1024 εικονοστοιχείων.
+Comment[eo]=Kreas travideblan bildon el 1280 x 1024 rastrumeroj.
+Comment[es]=Crea una imagen transparente de 1280 x 1024 píxeles.
+Comment[et]=Loob läbipaistva pildi mõõtmetega 1280 x 1024 pikslit.
+Comment[eu]=1280 x 1024 pixeleko irudi garden bat sortzen du.
+Comment[fa]=یک تصویر شفاف ۱۰۲۴ × ۱۲۸۰ تصویردانه‌ای ایجاد می‌کند.
+Comment[fi]=Luo läpinäkyvän 1280x1024 pikselin kuvan.
+Comment[fr]=Crée une image transparente de 1280 x 1024 pixels.
+Comment[fy]=Makket in trochsichtige ôfbylding oan fan 1280 x 1024 byldpunten.
+Comment[gl]=Cria unha imaxe transparente de 1280 x 1024 pixels.
+Comment[he]=יצירת תמונה שקופה בגודל ‎1280 x 1024 פיקסלים
+Comment[hu]=Létrehoz egy 1280 x 1024 képpontos áttetsző képet.
+Comment[is]=Býr til gegnsæja mynd í hlutföllunum 1280 x 1024 punktar.
+Comment[it]=Crea un'immagine trasparente di 1280 × 1024 pixel.
+Comment[ja]=1280 x 1024 ピクセルの透視画像を作成
+Comment[km]=បង្កើត​រូបភាព​ថ្លា​ទំហំ 1280 x 1024 ភីកសែល ។
+Comment[lt]=Sukuria permatomą 1280 x 1024 pikselių paveiksliuką.
+Comment[ms]=Cipta imej lutsinar 1280 x 1024 piksel.
+Comment[nb]=Lager et gjennomsiktig bilde på 1280 x 1024 piksler.
+Comment[nds]=Stellt en dörsichtig Bild mit 1280 x 1024 Pixels op.
+Comment[ne]=१२८० x १०२४ पिक्सेलको पारदर्शी छवि सिर्जना गर्दछ ।
+Comment[nl]=Maakt een transparante afbeelding aan van 1280 x 1024 pixels.
+Comment[nn]=Lagar eit gjennomsiktig bilete på 1280 × 1024 pikslar.
+Comment[pl]=Tworzy przezroczysty obrazek o rozmiarach 1280 x 1024 pikseli.
+Comment[pt]=Cria uma imagem transparente com 1280 x 1024 pontos.
+Comment[pt_BR]=Cria uma imagem transparente de 1280 x 1024 pixels.
+Comment[ru]=Рисунок 1280x1024, прозрачный фон
+Comment[se]=Ráhkada čađačuovgi gova mas lea 1280 × 1024 govvačuoggá
+Comment[sk]=Vytvorí obrázok s rozmermi 1280 x 1024 pixelov a priehľadným pozadím.
+Comment[sl]=Ustvari prosojno sliko velikosti 1280 x 1024 pik.
+Comment[sr]=Прави провидну слику са 1280 x 1024 пиксела.
+Comment[sr@Latn]=Pravi providnu sliku sa 1280 x 1024 piksela.
+Comment[sv]=Skapar en genomskinlig bild med 1280 x 1024 bildpunkter.
+Comment[uk]=Створює прозоре зображення 1280 x 1024 пікселів.
+Comment[uz]=Oʻlchami 1280 x 1024 nuqta boʻlgan shaffof rasmni yaratish.
+Comment[uz@cyrillic]=Ўлчами 1280 x 1024 нуқта бўлган шаффоф расмни яратиш.
+Comment[zh_CN]=创建 1280x 1024 像素的透明图像。
+Comment[zh_TW]=建立一個 1280 x 1024 像素的透明圖片。
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/rgb_u8/templates/transparent_1280x1024.kra b/chalk/colorspaces/rgb_u8/templates/transparent_1280x1024.kra
new file mode 100644
index 000000000..09e23256b
Binary files /dev/null and b/chalk/colorspaces/rgb_u8/templates/transparent_1280x1024.kra differ
diff --git a/chalk/colorspaces/rgb_u8/templates/transparent_1600x1200.desktop b/chalk/colorspaces/rgb_u8/templates/transparent_1600x1200.desktop
new file mode 100644
index 000000000..0699b4daf
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/templates/transparent_1600x1200.desktop
@@ -0,0 +1,97 @@
+[Desktop Entry]
+Type=Link
+URL=.source/transparent_1600x1200.kra
+Icon=template_rgb_empty
+Name=Transparent 1600 x 1200
+Name[bg]=Прозрачно 1600x1200
+Name[br]=Treuzwelus 1600 x 1200
+Name[cy]=Tryloyw 1600 x 1200
+Name[da]=Gennemsigtig 1600 x 1200
+Name[el]=Διαφανής 1600 x 1200
+Name[es]=1600 x 1200 transparente
+Name[et]=Läbipaistev 1600 x 1200
+Name[eu]=Gardena 1600 x 1200
+Name[fa]=شفاف ۱۲۰۰ × ۱۶۰۰
+Name[fi]=Läpinäkyvä 1600x1200
+Name[fr]=Image transparente 1600 x 1200
+Name[fy]=Trochsichtich  1600 x 1200
+Name[gl]=Transparente 1600 x 1200
+Name[he]=‏1600‎ x 1200 שקוף
+Name[hi]=पारदर्शी 1600 x 1200
+Name[hu]=Áttetsző 1600 x 1200
+Name[is]=Gegnsæ 1600 x 1200
+Name[it]=Trasparente 1600 × 1200
+Name[ja]=透明 1600 x 1200
+Name[km]=ថ្លា 1600 x 1200
+Name[lt]=Permatomas 1600 x 1200
+Name[lv]=Caurspīdīgs 1600 x 1200
+Name[ms]=Lutsinar 1600 x 1200
+Name[nb]=Gjennomsiktig 1600 × 1200
+Name[nds]=Dörsichtig 1600 x 1200
+Name[ne]=पारदर्शी १६०० x १२००
+Name[nl]=Transparant 1600 x 1200
+Name[nn]=Gjennomsiktig 1600 × 1200
+Name[pl]=Przezroczysty 1600 x 1200
+Name[pt]=Transparente 1600 x 1200
+Name[pt_BR]=Transparente de 1600 x 1200
+Name[ru]=Рисунок 1600x1200, прозрачный фон
+Name[se]=Čađačuovgi 1600 × 1200
+Name[sk]=Priehľadný 1600 x 1200
+Name[sl]=Prosojna 1600 x 1200
+Name[sr]=Провидна 1600 x 1200
+Name[sr@Latn]=Providna 1600 x 1200
+Name[sv]=Genomskinlig 1600 x 1200
+Name[ta]=தெரியக்கூடிய 1600 x 1200
+Name[tr]=Saydam 1600 x 1200
+Name[uk]=Прозоре 1600 x 1200
+Name[uz]=Shaffof 1600 x 1200
+Name[uz@cyrillic]=Шаффоф 1600 x 1200
+Name[zh_CN]=透明 1600 x 1200
+Name[zh_TW]=透明 1600 x 1200
+Comment=Creates a transparent image of 1600 x 1200 pixels.
+Comment[bg]=Създаване на прозрачно изображение с размери 1600x1200 пиксела.
+Comment[ca]=Crea una imatge transparent de 1600 x 1200 píxels.
+Comment[cy]=Creu delwedd dryloyw o 1600 x 1200 picsel.
+Comment[da]=Laver et gennemsigtigt billede på 1600 x 1200 billedpunkter.
+Comment[de]=Erstellt ein transparentes Bild mit 1600 x 1200 Pixeln.
+Comment[el]=Δημιουργεί μία διαφανή εικόνα μεγέθους 1600 x 1200 εικονοστοιχείων.
+Comment[es]=Crea una imagen transparente de 1600 x 1200 píxeles.
+Comment[et]=Loob läbipaistva pildi mõõtmetega 1600 x 1200 pikslit.
+Comment[eu]=1600 x 1200 pixeleko irudi garden bat sortzen du.
+Comment[fa]=یک تصویر شفاف ۱۲۰۰ × ۱۶۰۰ تصویردانه‌ای ایجاد می‌کند.
+Comment[fi]=Luo läpinäkyvän 1600x1200 pikselin kuvan.
+Comment[fr]=Crée une image transparente de 1600 x 1200 pixels.
+Comment[fy]=Makket in trochsichtige ôfbylding oan fan 11600 x 1200 byldpunten.
+Comment[gl]=Cria unha imaxe transparente de 1600 x 1200 pixels.
+Comment[he]=יצירת תמונה שקופה בגודל ‎1600 x 1200 פיקסלים
+Comment[hi]=1600 x 1200 पिक्सेल की पारदर्शी छवि बनाता है.
+Comment[hu]=Létrehoz egy 1600 x 1200 képpontos áttetsző képet.
+Comment[is]=Býr til gegnsæja mynd í hlutföllunum 1600 x 1200 punktar.
+Comment[it]=Crea un'immagine trasparente di 1600 × 1200 pixel.
+Comment[ja]=1600 x 1200 ピクセルの透視画像を作成
+Comment[km]=បង្កើត​រូបភាព​ថ្លា​ទំហំ 1600 x 1200 ភីកសែល ។
+Comment[lt]=Sukuria permatomą 1600 x 1200 pikselių paveiksliuką.
+Comment[ms]=Cipta imej lutsinar 1600 x 1200 piksel.
+Comment[nb]=Lager et gjennomsiktig bilde på 1600 x 1200 piksler.
+Comment[nds]=Stellt en dörsichtig Bild mit 1600 x 1200 Pixels op.
+Comment[ne]=१६०० x १२०० पिक्सेलको पारदर्शी छवि सिर्जना गर्दछ।
+Comment[nl]=Maakt een transparante afbeelding aan van 1600 x 1200 pixels.
+Comment[nn]=Lagar eit gjennomsiktig bilete på 1600 × 1200 pikslar.
+Comment[pl]=Tworzy przezroczysty obrazek o rozmiarach 1600 x 1200 pikseli.
+Comment[pt]=Cria uma imagem transparente com 1600 x 1200 pontos.
+Comment[pt_BR]=Cria uma imagem transparente de 1600 x 1200 pixéis.
+Comment[ru]=Рисунок 1600x1200, прозрачный фон
+Comment[se]=Ráhkada čađačuovgi gova mas lea 1600 × 1200 govvačuoggá.
+Comment[sk]=Vytvorí obrázok s rozmermi 1600 x 1200 pixelov a priehľadným pozadím.
+Comment[sl]=Ustvari prosojno sliko velikosti 1600 x 1200 pik.
+Comment[sr]=Прави провидну слику са 1600 x 1200 пиксела.
+Comment[sr@Latn]=Pravi providnu sliku sa 1600 x 1200 piksela.
+Comment[sv]=Skapar en genomskinlig bild med 1600 x 1200 bildpunkter.
+Comment[ta]=1600 x 1200 படத்துணுக்குகளில் ஒரு தெரியக்கூடிய பிம்பத்தை உருவாக்குகிறது.
+Comment[tr]=1600 x 1200 piksel ebadında transparan bir görüntü oluşturur.
+Comment[uk]=Створює прозоре зображення 1600 x 1200 пікселів.
+Comment[uz]=Oʻlchami 1600 x 1200 nuqta boʻlgan shaffof rasmni yaratish.
+Comment[uz@cyrillic]=Ўлчами 1600 x 1200 нуқта бўлган шаффоф расмни яратиш.
+Comment[zh_CN]=创建 1600 x 1200 像素的透明图像。
+Comment[zh_TW]=建立一個 1600 x 1200 像素的透明圖片。
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/rgb_u8/templates/transparent_1600x1200.kra b/chalk/colorspaces/rgb_u8/templates/transparent_1600x1200.kra
new file mode 100644
index 000000000..beb6dea30
Binary files /dev/null and b/chalk/colorspaces/rgb_u8/templates/transparent_1600x1200.kra differ
diff --git a/chalk/colorspaces/rgb_u8/templates/transparent_640x480.desktop b/chalk/colorspaces/rgb_u8/templates/transparent_640x480.desktop
new file mode 100644
index 000000000..afa115ef7
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/templates/transparent_640x480.desktop
@@ -0,0 +1,92 @@
+[Desktop Entry]
+Type=Link
+URL=.source/transparent_640x480.kra
+Icon=template_rgb_empty
+Name=Transparent 640 x 480
+Name[bg]=Прозрачно 640x480
+Name[br]=Treuzwelus 640 x 480
+Name[cy]=Tryloyw 640 x 480
+Name[da]=Gennemsigtig 640 x 480
+Name[el]=Διαφανής 640 x 480
+Name[eo]=Travidebla 640 x 480
+Name[es]=640 x 480 transparente
+Name[et]=Läbipaistev 640 x 480
+Name[eu]=Gardena 640 x 480
+Name[fa]=شفاف ۴۸۰ × ۶۴۰
+Name[fi]=Läpinäkyvä 640x480
+Name[fr]=Image transparente 640 x 480
+Name[fy]=Trochsichtich  640 x 480
+Name[gl]=Transparente 640 x 480
+Name[he]=‏640 x 480 שקוף
+Name[hu]=Áttetsző 640 x 480
+Name[is]=Gegnsæ 640 x 480
+Name[it]=Trasparente 640 × 480
+Name[ja]=透明 640 x 480
+Name[km]=ថ្លា 640 x 480
+Name[lt]=Permatomas 640 x 480
+Name[lv]=Caurspīdīgs 640 x 480
+Name[ms]=Lutsinar 640 x 480
+Name[nb]=Gjennomsiktig 640 x 480
+Name[nds]=Dörsichtig 640 x 480
+Name[ne]=पारदर्शी ६४० x ४८०
+Name[nn]=Gjennomsiktig 640 × 480
+Name[pl]=Przezroczysty 640 x 480
+Name[pt]=Transparente 640 x 480
+Name[pt_BR]=Transparente de 640 x 480
+Name[ru]=Рисунок 640x480, прозрачный фон
+Name[se]=Čađačuovgi 640 × 480
+Name[sk]=Priehľadný 640 x 480
+Name[sl]=Prosojna 640 x 480
+Name[sr]=Провидна 640 x 480
+Name[sr@Latn]=Providna 640 x 480
+Name[sv]=Genomskinlig 640 x 480
+Name[uk]=Прозоре 640 x 480
+Name[uz]=Shaffof 640 x 480
+Name[uz@cyrillic]=Шаффоф 640 x 480
+Name[zh_CN]=透明 640 x 480
+Name[zh_TW]=透明 640 x 480
+Comment=Creates a transparent image of 640 x 480 pixels.
+Comment[bg]=Създаване на прозрачно изображение с размери 640x480 пиксела.
+Comment[ca]=Crea una imatge transparent de 640 x 480 píxels.
+Comment[cy]=Creu delwedd dryloyw o 640 x 480 picsel.
+Comment[da]=Laver et gennemsigtigt billede på 640 x 480 billedpunkter.
+Comment[de]=Erstellt ein transparentes Bild mit 640 x 480 Pixeln.
+Comment[el]=Δημιουργεί μία διαφανή εικόνα μεγέθους 640 x 480 εικονοστοιχείων.
+Comment[eo]=Kreas travideblan bildon el 640 x 480 rastrumeroj.
+Comment[es]=Crea una imagen transparente de 640 x 480 píxeles.
+Comment[et]=Loob läbipaistva pildi mõõtmetega 640 x 480 pikslit.
+Comment[eu]=640 x 480 pixeleko irudi garden bat sortzen du.
+Comment[fa]=یک تصویر شفاف ۴۸۰ × ۶۴۰ تصویردانه‌ای ایجاد می‌کند.
+Comment[fi]=Luo läpinäkyvän 640x480 pikselin kuvan.
+Comment[fr]=Crée une image transparente de 640 x 480 pixels.
+Comment[fy]=Makket in trochsichtige ôfbylding oan fan 640 x 480 byldpunten.
+Comment[gl]=Cria unha imaxe transparente de 640 x 480 pixels.
+Comment[he]=יצירת תמונה שקופה בגודל ‎640 x 480 פיקסלים
+Comment[hu]=Létrehoz egy 640 x 480 képpontos áttetsző képet.
+Comment[is]=Býr til gegnsæja mynd í hlutföllunum 640 x 480 punktar.
+Comment[it]=Crea un'immagine trasparente di 640 × 480 pixel.
+Comment[ja]=640 x 480 ピクセルの透視画像を作成
+Comment[km]=បង្កើត​រូបភាព​ថ្លា​ទំហំ 640 x 480 ភីកសែល ។
+Comment[lt]=Sukuria permatomą 640 x 480 pikselių paveiksliuką.
+Comment[ms]=Cipta imej lutsinar 640 x 480 piksel.
+Comment[nb]=Lager et gjennomsiktig bilde på 640 x 480 piksler.
+Comment[nds]=Stellt en dörsichtig Bild mit 640 x 480 Pixels op.
+Comment[ne]=६४० x ४८० पिक्सेलको पारदर्शी सिर्जना गर्दछ ।
+Comment[nl]=Maakt een transparante afbeelding aan van 640 x 480 pixels.
+Comment[nn]=Lagar eit gjennomsiktig bilete på 640 × 480 pikslar.
+Comment[pl]=Tworzy przezroczysty obrazek o rozmiarach 640 x 480 pikseli.
+Comment[pt]=Cria uma imagem transparente com 640 x 480 pontos.
+Comment[pt_BR]=Cria uma imagem transparente de 640 x 480 pixels.
+Comment[ru]=Рисунок 640x480, прозрачный фон
+Comment[se]=Ráhkada čađačuovgi gova mas lea 640 × 480 govvačuoggá.
+Comment[sk]=Vytvorí obrázok s rozmermi 640 x 480 pixelov a priehľadným pozadím.
+Comment[sl]=Ustvari prosojno sliko velikosti 640 x 480 pik.
+Comment[sr]=Прави провидну слику са 640 x 480 пиксела.
+Comment[sr@Latn]=Pravi providnu sliku sa 640 x 480 piksela.
+Comment[sv]=Skapar en genomskinlig bild med 640 x 480 bildpunkter.
+Comment[uk]=Створює прозоре зображення 640 x 480 пікселів.
+Comment[uz]=Oʻlchami 640 x 480 nuqta boʻlgan shaffof rasmni yaratish.
+Comment[uz@cyrillic]=Ўлчами 640 x 480 нуқта бўлган шаффоф расмни яратиш.
+Comment[zh_CN]=创建 640 x 480 像素的透明图像。
+Comment[zh_TW]=建立一個 640 x 480 像素的透明圖片。
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/rgb_u8/templates/transparent_640x480.kra b/chalk/colorspaces/rgb_u8/templates/transparent_640x480.kra
new file mode 100644
index 000000000..064a77d35
Binary files /dev/null and b/chalk/colorspaces/rgb_u8/templates/transparent_640x480.kra differ
diff --git a/chalk/colorspaces/rgb_u8/templates/white_1024x768.desktop b/chalk/colorspaces/rgb_u8/templates/white_1024x768.desktop
new file mode 100644
index 000000000..65e416333
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/templates/white_1024x768.desktop
@@ -0,0 +1,102 @@
+[Desktop Entry]
+Type=Link
+URL=.source/white_1024x768.kra
+Icon=template_rgb_empty
+Name=White 1024 x 768
+Name[bg]=Бяло 1024x768
+Name[br]=Gwenn 1024 x 768
+Name[ca]=Blanc 1024 x 768
+Name[cy]=Gwyn 1024 x 768
+Name[da]=Hvidt 1024 x 768
+Name[de]=Weiß 1024 x 768
+Name[el]=Λευκή 1024 x 768
+Name[eo]=Blanka 1024 x 768
+Name[es]=1024 x 768 blanco
+Name[et]=Valge 1024 x 768
+Name[eu]=Zuria 1024 x 768
+Name[fa]=سفید ۷۶۸ × ۱۰۲۴
+Name[fi]=Valkoinen 1024x768
+Name[fr]=Image blanche 1024 x 768
+Name[fy]=Wyt 1024 x 768
+Name[ga]=Bán 1024×768
+Name[gl]=Branca 1024 x 768
+Name[he]=לבן ‎1024 x 768
+Name[hi]=सफेद 1024 x 768
+Name[hu]=Fehér 1024 x 768
+Name[is]=Hvít 1024 x 768
+Name[it]=Bianco 1024 × 768
+Name[ja]=白 1024 x 768
+Name[km]=ពណ៌ស 1024 x 768
+Name[lt]=Baltas 1024 x 768
+Name[lv]=Balts 1024 x 768
+Name[ms]=Putih 1024 x 768
+Name[nb]=Hvitt 1024 x 768
+Name[nds]=Witt 1024 x 768
+Name[ne]=सेतो १०२४ x ७६८
+Name[nl]=Wit 1024 x 768
+Name[nn]=Kvitt 1024 × 768
+Name[pl]=Biały 1024 x 768
+Name[pt]=Branca 1024 x 768
+Name[pt_BR]=1024 x 768 em Branco
+Name[ru]=Рисунок 1024x768, белый фон
+Name[se]=Vilges 1024 × 768
+Name[sk]=Biely 1024 x 768
+Name[sl]=Bela 1024 x 768
+Name[sr]=Бела 1024 x 768
+Name[sr@Latn]=Bela 1024 x 768
+Name[sv]=Vit 1024 x 768
+Name[ta]=வெள்ளை 1024 x 768
+Name[tr]=Beyaz 1024 x 768
+Name[uk]=Біле 1024 x 768
+Name[uz]=Oq 1024 x 768
+Name[uz@cyrillic]=Оқ 1024 x 768
+Name[zh_CN]=白色 1024 x 768
+Name[zh_TW]=白色 1024 x 768
+Comment=Creates a white RGB image of 1024 x 768 pixels.
+Comment[bg]=Създаване на бяло изображение RGB с размери 1024x768 пиксела.
+Comment[ca]=Crea una imatge blanca RGB de 1024 x 768 píxels.
+Comment[cy]=Creu delwedd RGB wen o 1024 x 768 picsel.
+Comment[da]=Laver et hvidt RGB-billede på 1024 x 768 billedpunkter.
+Comment[de]=Erstellt ein weißes RGB-Bild mit 1024 x 768 Pixeln.
+Comment[el]=Δημιουργεί μία λευκή RGB εικόνα μεγέθους 1024 x 768 εικονοστοιχείων.
+Comment[eo]=Kreas blankan RGB-bildon el 1024 x 768 rastrumeroj.
+Comment[es]=Crea una imagen RGB de 1024 x 768 píxeles.
+Comment[et]=Loob valge RGB-pildi mõõtmetega 1024 x 768 pikslit.
+Comment[eu]=1024 x 768 pixeleko RGB irudi zuri bat sortzen du.
+Comment[fa]=یک تصویر RGB سفید ۷۶۸ × ۱۰۲۴ تصویردانه‌ای ایجاد می‌کند.
+Comment[fi]=Luo valkoisen 1024x768 pikselin RGB-kuvan.
+Comment[fr]=Crée une image blanche RVB de 1024 x 768 pixels.
+Comment[fy]=Makket in wite RGB-ôfbylding oan fan 1024 x 768 byldpunten.
+Comment[gl]=Cria unha imaxe RGB branca de 1024 x 768 pixels.
+Comment[he]=יצירת תמונת RGB לבנה בגודל ‎1024 x 768 פיקסלים
+Comment[hi]=1024 x 768 पिक्सेल की सफेद आरजीबी छवि बनाता है.
+Comment[hu]=Létrehoz egy 1024 x 768 képpontos fehér RGB képet.
+Comment[is]=Býr til hvíta RGB mynd í hlutföllunum 1024 x 768 punktar.
+Comment[it]=Crea un'immagine RGB bianca di 1024 × 768 pixel.
+Comment[ja]=1024 x 768 ピクセルの RGB 画像を作成
+Comment[km]=បង្កើត​រូបភាព RGB ពណ៌​ស​ទំហំ 1024 x 768 ភីកសែល ។
+Comment[lt]=Sukuria baltą 1024 x 768 pikselių RGB paveiksliuką.
+Comment[ms]=Cipta imej RGB putih 1024 x 768 piksel.
+Comment[nb]=Lager et hvitt RGB-bilde på 1024 x 768 piksler.
+Comment[nds]=Stellt en witt RGB-Bild mit 1024 x 768 Pixels op.
+Comment[ne]=१०२४ x ७६८ पिक्सेलको सेतो RGB छवि सिर्जना गर्दछ ।
+Comment[nl]=Maakt een witte RGB-afbeelding aan van 1024 x 768 pixels.
+Comment[nn]=Lagar eit kvitt RGB-bilete på 1024 × 768 pikslar.
+Comment[pl]=Tworzy biały obrazek RGB o rozmiarach 1024 x 768 pikseli.
+Comment[pt]=Cria uma imagem RGB branca com 1024 x 768 pontos.
+Comment[pt_BR]=Cria uma imagem RGB em branco de 1024 x 768 pixéis.
+Comment[ru]=Рисунок RGB 1024x768, белый фон
+Comment[se]=Ráhkada vilges RGB-gova mas lea 1024 × 768 govvačuoggá.
+Comment[sk]=Vytvorí RGB obrázok s rozmermi 1024 x 768 pixelov a bielym pozadím.
+Comment[sl]=Ustvari belo sliko RGB velikosti 1024 x 768 pik.
+Comment[sr]=Прави белу RGB слику са 1024 x 768 пиксела.
+Comment[sr@Latn]=Pravi belu RGB sliku sa 1024 x 768 piksela.
+Comment[sv]=Skapar en vit RGB-bild med 1024 x 768 bildpunkter.
+Comment[ta]=1024 x 768 படத்துணுக்குகளில் ஒரு வெள்ளை RGB பிம்பத்தை உருவாக்குகிறது.
+Comment[tr]=1024 x 768 piksel ebadında beyaz bir RGB görüntü oluşturur.
+Comment[uk]=Створює біле зображення у форматі RGB, 640 x 480 пікселів.
+Comment[uz]=Oʻlchami 1024 x 768 nuqta boʻlgan oq RGB rasmni yaratish.
+Comment[uz@cyrillic]=Ўлчами 1024 x 768 нуқта бўлган оқ RGB расмни яратиш.
+Comment[zh_CN]=创建 1024 x 768 像素的 RGB 白色背景图像。
+Comment[zh_TW]=建立一個 1024 x 768 像素的白色 RGB 圖片。
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/rgb_u8/templates/white_1024x768.kra b/chalk/colorspaces/rgb_u8/templates/white_1024x768.kra
new file mode 100644
index 000000000..652392261
Binary files /dev/null and b/chalk/colorspaces/rgb_u8/templates/white_1024x768.kra differ
diff --git a/chalk/colorspaces/rgb_u8/templates/white_1280x1024.desktop b/chalk/colorspaces/rgb_u8/templates/white_1280x1024.desktop
new file mode 100644
index 000000000..e2d4a1a69
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/templates/white_1280x1024.desktop
@@ -0,0 +1,95 @@
+[Desktop Entry]
+Type=Link
+URL=.source/white_1280x1024.kra
+Icon=template_rgb_empty
+Name=White 1280 x 1024
+Name[bg]=Бяло 1280x1024
+Name[br]=Gwenn 1280 x 1024
+Name[ca]=Blanc 1280 x 1024
+Name[cy]=Gwyn 1280 x 1024
+Name[da]=Hvidt 1280 x 1024
+Name[de]=Weiß 1280 x 1024
+Name[el]=Λευκή 1280 x 1024
+Name[eo]=Blanka 1280 x 1024
+Name[es]=1280 x 1024 blanco
+Name[et]=Valge 1280 x 1024
+Name[eu]=Zuria 1280 x 1024
+Name[fa]=سفید ۱۰۲۴ × ۱۲۸۰
+Name[fi]=Valkoinen 1280x1024
+Name[fr]=Image blanche 1280 x 1024
+Name[fy]=Wyt 1280 x 1024
+Name[ga]=Bán 1280×1024
+Name[gl]=Branca 1280 x 1024
+Name[he]=לבן ‎1280 x 1024
+Name[hu]=Fehér 1280 x 1024
+Name[is]=Hvít 1280 x 1024
+Name[it]=Bianco 1280 × 1024
+Name[ja]=白 1280 x 1024
+Name[km]=ពណ៌ស 1280 x 1024
+Name[lt]=Baltas 1280 x 1024
+Name[lv]=Balts 1280 x 1024
+Name[ms]=Putih 1280 x 1024
+Name[nb]=Hvit 1280 x 1024
+Name[nds]=Witt 1280 x 1024
+Name[ne]=सेतो १२८० x १०२४
+Name[nn]=Kvitt 1280 × 1024
+Name[pl]=Biały 1280 x 1024
+Name[pt]=Branca 1280 x 1024
+Name[pt_BR]=1280 x 1024 em Branco
+Name[ru]=Рисунок 1280x1024, белый фон
+Name[se]=Vilges 1280 × 1024
+Name[sk]=Biely 1280 x 1024
+Name[sl]=Bela 1280 x 1024
+Name[sr]=Бела 1280 x 1024
+Name[sr@Latn]=Bela 1280 x 1024
+Name[sv]=Vit 1280 x 1024
+Name[uk]=Біле 1280 x 1024
+Name[uz]=Oq 1280 x 1024
+Name[uz@cyrillic]=Оқ 1280 x 1024
+Name[zh_CN]=白色 1280 x 1024
+Name[zh_TW]=白色 1280 x 1024
+Comment=Creates a white RGB image of 1280 x 1024 pixels.
+Comment[bg]=Създаване на бяло изображение RGB с размери 1280x1024 пиксела.
+Comment[ca]=Crea una imatge blanca RGB de 1280 x 1024 píxels.
+Comment[cy]=Creu delwedd RGB wen o 1280 x 1024 picsel.
+Comment[da]=Laver et hvidt RGB-billede på 1280 x 1024 billedpunkter.
+Comment[de]=Erstellt ein weißes RGB-Bild mit 1280 x 1024 Pixeln.
+Comment[el]=Δημιουργεί μία λευκή RGB εικόνα μεγέθους 1280 x 1024 εικονοστοιχείων.
+Comment[eo]=Kreas blankan RGB-bildon el 1280 x 1024 rastrumeroj.
+Comment[es]=Crea una imagen RGB de 1280 x 1024 píxeles.
+Comment[et]=Loob valge RGB-pildi mõõtmetega 61280 x 1024 pikslit.
+Comment[eu]=1280 x 1024 pixeleko RGB irudi zuri bat sortzen du.
+Comment[fa]=یک تصویر RGB سفید ۱۰۲۴ × ۱۲۸۰ تصویردانه‌ای ایجاد می‌کند.
+Comment[fi]=Luo valkoisen 1280x1024 pikselin RGB-kuvan.
+Comment[fr]=Crée une image blanche RVB de 1280 x 1024 pixels.
+Comment[fy]=Makket in wite RGB-ôfbylding oan fan 1280 x 768 byldpunten.
+Comment[gl]=Cria unha imaxe RGB branca de 1280 x 1024 pixels.
+Comment[he]=יצירת תמונת RGB לבנה בגודל ‎1280 x 1024 פיקסלים
+Comment[hu]=Létrehoz egy 1280 x 1024 képpontos fehér RGB képet.
+Comment[is]=Býr til hvíta RGB mynd í hlutföllunum 1280 x 1024 punktar.
+Comment[it]=Crea un'immagine RGB bianca di 1280 × 1024 pixel.
+Comment[ja]=1280 x 1024 ピクセルの RGB 画像を作成
+Comment[km]=បង្កើត​រូបភាព RGB ពណ៌ស​ទំហំ 1280 x 1024 ភីកសែល ។
+Comment[lt]=Sukuria baltą 1280 x 1024 pikselių RGB paveiksliuką.
+Comment[ms]=Cipta imej RGB putih 1280 x 1024 piksel.
+Comment[nb]=Lager et hvitt bilde på 1280 x 1024 piksler.
+Comment[nds]=Stellt en witt RGB-Bild mit 1280 x 1024 Pixels op.
+Comment[ne]=१२८० x १०२४ पिक्सेलको सेतो RGB छवि सिर्जना गर्दछ ।
+Comment[nl]=Maakt een witte RGB-afbeelding aan van 1280 x 1024 pixels.
+Comment[nn]=Lagar eit kvitt RGB-bilete på 1280 × 1024 pikslar.
+Comment[pl]=Tworzy biały obrazek RGB o rozmiarach 1280 x 1024 pikseli.
+Comment[pt]=Cria uma imagem RGB branca com 1280 x 1024 pontos.
+Comment[pt_BR]=Cria uma imagem RGB em branco de 1280 x 1024 pixels.
+Comment[ru]=Рисунок RGB 1280x1024, белый фон
+Comment[se]=Ráhkada vilges RGB-gova mas lea 1280 × 1024 govvačuoggá.
+Comment[sk]=Vytvorí RGB obrázok s rozmermi 1280 x 1024 pixelov a bielym pozadím.
+Comment[sl]=Ustvari belo sliko RGB velikosti 1280 x 1024 pik.
+Comment[sr]=Прави белу RGB слику са 1280 x 1024 пиксела.
+Comment[sr@Latn]=Pravi belu RGB sliku sa 1280 x 1024 piksela.
+Comment[sv]=Skapar en vit RGB-bild med 1280 x 1024 bildpunkter.
+Comment[uk]=Створює біле зображення у форматі RGB, 1280 x 1024 пікселів.
+Comment[uz]=Oʻlchami 1280 x 1024 nuqta boʻlgan oq RGB rasmni yaratish.
+Comment[uz@cyrillic]=Ўлчами 1280 x 1024 нуқта бўлган оқ RGB расмни яратиш.
+Comment[zh_CN]=创建 1080 x 1024 像素的 RGB 白色背景图像。
+Comment[zh_TW]=建立一個 1280 x 1024 像素的白色 RGB 圖片。
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/rgb_u8/templates/white_1280x1024.kra b/chalk/colorspaces/rgb_u8/templates/white_1280x1024.kra
new file mode 100644
index 000000000..b9e2456ae
Binary files /dev/null and b/chalk/colorspaces/rgb_u8/templates/white_1280x1024.kra differ
diff --git a/chalk/colorspaces/rgb_u8/templates/white_1600x1200.desktop b/chalk/colorspaces/rgb_u8/templates/white_1600x1200.desktop
new file mode 100644
index 000000000..9f27127af
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/templates/white_1600x1200.desktop
@@ -0,0 +1,95 @@
+[Desktop Entry]
+Type=Link
+URL=.source/white_1600x1200.kra
+Icon=template_rgb_empty
+Name=White 1600 x 1200
+Name[bg]=Бяло 1600x1200
+Name[br]=Gwenn 1600 x 1200
+Name[ca]=Blanc 1600 x 1200
+Name[cy]=Gwyn 1600 x 1200
+Name[da]=Hvidt 1600 x 1200
+Name[de]=Weiß 1600 x 1200
+Name[el]=Λευκή 1600 x 1200
+Name[eo]=Blanka 1600 x 1200
+Name[es]=1600 x 1200 blanco
+Name[et]=Valge 1600 x 1200
+Name[eu]=Zuria 1600 x 1200
+Name[fa]=سفید ۱۲۰۰ × ۱۶۰۰
+Name[fi]=Valkoinen 1600x1200
+Name[fr]=Image blanche 1600 x 1200
+Name[fy]=Wyt 1600 x 1200
+Name[ga]=Bán 1600×1200
+Name[gl]=Branca 1600 x 1200
+Name[he]=לבן ‎1600 x 1200
+Name[hu]=Fehér 1600 x 1200
+Name[is]=Hvít 1600 x 1200
+Name[it]=Bianco 1600 × 1200
+Name[ja]=白 1600 x 1200
+Name[km]=ពណ៌ស 1600 x 1200
+Name[lt]=Baltas 1600 x 1200
+Name[lv]=Balts 1600 x 1200
+Name[ms]=Putih 1600 x 1200
+Name[nb]=Hvit 1600 x 1200
+Name[nds]=Witt 1600 x 1200
+Name[ne]=सेतो १६०० x १२००
+Name[nn]=Kvitt 1600 × 1200
+Name[pl]=Biały 1600 x 1200
+Name[pt]=Branca 1600 x 1200
+Name[pt_BR]=1600 x 1200 em Branco
+Name[ru]=Рисунок 1600x1200, белый фон
+Name[se]=Vilges 1600 × 1200
+Name[sk]=Biely 1600 x 1200
+Name[sl]=Bela 1600 x 1200
+Name[sr]=Бела 1600 x 1200
+Name[sr@Latn]=Bela 1600 x 1200
+Name[sv]=Vit 1600 x 1200
+Name[uk]=Біле 1600 x 1200
+Name[uz]=Oq 1600 x 1200
+Name[uz@cyrillic]=Оқ 1600 x 1200
+Name[zh_CN]=白色 1600 x 1200
+Name[zh_TW]=白色 1600 x 1200
+Comment=Creates a white RGB image of 1600 x 1200 pixels.
+Comment[bg]=Създаване на бяло изображение RGB с размери 1600x1200 пиксела.
+Comment[ca]=Crea una imatge blanca RGB de 1600 x 1200 píxels.
+Comment[cy]=Creu delwedd RGB wen o 1600 x 1200 picsel.
+Comment[da]=Laver et hvidt RGB-billede på 1600 x 1200 billedpunkter.
+Comment[de]=Erstellt ein weißes RGB-Bild mit 1600 x 1200 Pixeln.
+Comment[el]=Δημιουργεί μία λευκή RGB εικόνα μεγέθους 1600 x 1200 εικονοστοιχείων.
+Comment[eo]=Kreas blankan RGB-bildon el 1600 x 1200 rastrumeroj.
+Comment[es]=Crea una imagen RGB de 1600 x 1200 píxeles.
+Comment[et]=Loob valge RGB-pildi mõõtmetega 1600 x 1200 pikslit.
+Comment[eu]=1600 x 1200 pixeleko RGB irudi zuri bat sortzen du.
+Comment[fa]=یک تصویر RGB سفید ۱۲۰۰ × ۱۶۰۰ تصویردانه‌ای ایجاد می‌کند.
+Comment[fi]=Luo valkoisen 1600x1200 pikselin RGB-kuvan.
+Comment[fr]=Crée une image blanche RVB de 1600 x 1200 pixels.
+Comment[fy]=Makket in wite RGB-ôfbylding oan fan 1600 x 1200 byldpunten.
+Comment[gl]=Cria unha imaxe RGB branca de 1600 x 1200 pixels.
+Comment[he]=יצירת תמונת RGB לבנה בגודל ‎1600 x 1200 פיקסלים
+Comment[hu]=Létrehoz egy 1600 x 1200 képpontos fehér RGB képet.
+Comment[is]=Býr til hvíta RGB mynd í hlutföllunum 1600 x 1200 punktar.
+Comment[it]=Crea un'immagine RGB bianca di 1600 × 1200 pixel.
+Comment[ja]=1600 x 1200 ピクセルの RGB 画像を作成
+Comment[km]=បង្កើត​រូបភាព RGB ពណ៌ស​ទំហំ 1600 x 1200 ភីកសែល ។
+Comment[lt]=Sukuria baltą 1600 x 1200 pikselių RGB paveiksliuką.
+Comment[ms]=Cipta imej RGB putih 1600 x 1200 piksel.
+Comment[nb]=Lager et hvitt bilde på 1600 x 1200 piksler.
+Comment[nds]=Stellt en witt RGB-Bild mit 1600 x 1200 Pixels op
+Comment[ne]=१६०० x १२०० पिक्सेलको सेतो RGB छवि सिर्जना गर्दछ ।
+Comment[nl]=Maakt een witte RGB-afbeelding aan van 1600 x 1200 pixels.
+Comment[nn]=Lagar eit kvitt RGB-bilete på 1600 × 1200 pikslar.
+Comment[pl]=Tworzy biały obrazek RGB o rozmiarach 1600 x1200 pikseli.
+Comment[pt]=Cria uma imagem RGB branca com 1600 x 1200 pontos.
+Comment[pt_BR]=Cria uma imagem RGB em branco de 1600 x 1200 pixels.
+Comment[ru]=Рисунок RGB 1600x1200, белый фон
+Comment[se]=Ráhkada vilges RGB-gova mas lea 1600 × 1200 govvačuoggá.
+Comment[sk]=Vytvorí RGB obrázok s rozmermi 1600 x 1200 pixelov a bielym pozadím.
+Comment[sl]=Ustvari belo sliko RGB velikosti 1600 x 1200 pik.
+Comment[sr]=Прави белу RGB слику са 1600 x 1200 пиксела.
+Comment[sr@Latn]=Pravi belu RGB sliku sa 1600 x 1200 piksela.
+Comment[sv]=Skapar en vit RGB-bild med 1600 x 1200 bildpunkter.
+Comment[uk]=Створює біле зображення у форматі RGB, 1600 x 1200 пікселів.
+Comment[uz]=Oʻlchami 1600 x 1200 nuqta boʻlgan oq RGB rasmni yaratish.
+Comment[uz@cyrillic]=Ўлчами 1600 x 1200 нуқта бўлган оқ RGB расмни яратиш.
+Comment[zh_CN]=创建 1600 x 1200 像素的 RGB 白色背景图像。
+Comment[zh_TW]=建立一個 1600 x 1200 像素的白色 RGB 圖片。
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/rgb_u8/templates/white_1600x1200.kra b/chalk/colorspaces/rgb_u8/templates/white_1600x1200.kra
new file mode 100644
index 000000000..2576f73e4
Binary files /dev/null and b/chalk/colorspaces/rgb_u8/templates/white_1600x1200.kra differ
diff --git a/chalk/colorspaces/rgb_u8/templates/white_640x480.desktop b/chalk/colorspaces/rgb_u8/templates/white_640x480.desktop
new file mode 100644
index 000000000..7fe13f5a8
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/templates/white_640x480.desktop
@@ -0,0 +1,102 @@
+[Desktop Entry]
+Type=Link
+URL=.source/white_640x480.kra
+Icon=template_rgb_empty
+Name=White 640x480
+Name[bg]=Бяло 640x480
+Name[br]=Gwenn 640x480
+Name[ca]=Blanc 640x480
+Name[cy]=Gwyn 640 x 480
+Name[da]=Hvidt 640x480
+Name[de]=Weiß 640x480
+Name[el]=Λευκή 640x480
+Name[eo]=Blanka 640x480
+Name[es]=640x480 blanco
+Name[et]=Valge 640x480
+Name[eu]=Zuria 640x480
+Name[fa]=سفید ۴۸۰ × ۶۴۰
+Name[fi]=Valkoinen 640x480
+Name[fr]=Image blanche 640 x 480
+Name[fy]=Wyt 640x480
+Name[ga]=Bán 640×480
+Name[gl]=Branca 640x480
+Name[he]=לבן 640x480
+Name[hi]=सफेद 640x480
+Name[hu]=Fehér 640 x 480
+Name[is]=Hvít 640x480
+Name[it]=Bianco 640×480
+Name[ja]=白 640 x 480
+Name[km]=ពណ៌​ស​640 x 480
+Name[lt]=Baltas 640x480
+Name[lv]=Balts 640x480
+Name[ms]=Putih 640x480
+Name[nb]=Hvitt 640 x 480
+Name[nds]=Witt 640x480
+Name[ne]=सेतो ६४०x४८०
+Name[nl]=Wit 640 x 480
+Name[nn]=Kvitt 640 × 480
+Name[pl]=Biały 640x480
+Name[pt]=Branca 640x480
+Name[pt_BR]=640x480 em Branco
+Name[ru]=Рисунок 640x480, белый фон
+Name[se]=Vilges 640 × 480
+Name[sk]=Biely 640x480
+Name[sl]=Bela 640x480
+Name[sr]=Бела 640x480
+Name[sr@Latn]=Bela 640x480
+Name[sv]=Vit 640x480
+Name[ta]=வெள்ளை 640x480
+Name[tr]=Beyaz 640x480
+Name[uk]=Біле 640x480
+Name[uz]=Oq 640 x 480
+Name[uz@cyrillic]=Оқ 640 x 480
+Name[zh_CN]=白色 640 x 480
+Name[zh_TW]=白色 640x480
+Comment=Creates a white RGB image of 640 x 480 pixels.
+Comment[bg]=Създаване на бяло изображение RGB с размери 640x480 пиксела.
+Comment[ca]=Crea una imatge blanca RGB de 640 x 480 píxels.
+Comment[cy]=Creu delwedd RGB wen o 640 x 480 picsel.
+Comment[da]=Laver et hvidt RGB-billede på 640 x 480 billedpunkter.
+Comment[de]=Erstellt ein weißes RGB-Bild mit 640 x 480 Pixeln.
+Comment[el]=Δημιουργεί μία λευκή RGB εικόνα μεγέθους 640 x 480 εικονοστοιχείων.
+Comment[eo]=Kreas blankan RGB-bildon el 640 x 480 rastrumeroj.
+Comment[es]=Crea una imagen RGB de 640 x 480 píxeles.
+Comment[et]=Loob valge RGB pildi mõõtmetega 640 x 480 pikslit.
+Comment[eu]=640 x 480 pixeleko RGB irudi zuri bat sortzen du.
+Comment[fa]=یک تصویر RGB سفید ۴۸۰ × ۶۴۰ تصویردانه‌ای ایجاد می‌کند.
+Comment[fi]=Luo valkoisen 640x480 pikselin RGB-kuvan.
+Comment[fr]=Crée une image blanche RVB de 640 x 480 pixels.
+Comment[fy]=Makket in wite RGB-ôfbylding oan fan 640 x 480 byldpunten.
+Comment[gl]=Cria unha imaxe RGB branca de 640 x 480 pixels.
+Comment[he]=יצירת תמונת RGB לבנה בגודל ‎640 x 480 פיקסלים
+Comment[hi]=640 x 480 पिक्सेल का, सफेद आरजीबी छवि बनाता है
+Comment[hu]=Létrehoz egy 640 x 480 képpontos fehér RGB képet.
+Comment[is]=Býr til hvíta RGB mynd í hlutföllunum 640 x 480 punktar.
+Comment[it]=Crea un'immagine RGB bianca di 640 × 480 pixel.
+Comment[ja]=640 x 480 ピクセルの RGB 画像を作成
+Comment[km]=បង្កើត​រូបភាព RGB ពណ៌ស​ទំហំ 640 x 480 ភីកសែល ។
+Comment[lt]=Sukuria baltą 640 x 480 pikselių RGB paveiksliuką.
+Comment[ms]=Cipta imej RGB putih 640 x 480 piksel.
+Comment[nb]=Lager et hvitt bilde på 640 x 480 piksler.
+Comment[nds]=Stellt en witt RGB-Bild mit 640 x 480 Pixels op.
+Comment[ne]=६४० x ४८० पिक्सेलको सेतो RGB छवि सिर्जना गर्दछ ।
+Comment[nl]=Maakt een witte RGB-afbeelding aan van 640 x 480 pixels.
+Comment[nn]=Lagar eit kvitt RGB-bilete på 640 × 480 pikslar.
+Comment[pl]=Tworzy biały obrazek RGB o rozmiarach 640 x 480 pikseli.
+Comment[pt]=Cria uma imagem RGB branca com 640 x 480 pontos.
+Comment[pt_BR]=Cria uma imagem RGB em branco de 640 x 480 pixéis.
+Comment[ru]=Рисунок RGB 640x480, белый фон
+Comment[se]=Ráhkada vilges RGB-gova mas lea 640 × 480 govvačuoggá.
+Comment[sk]=Vytvorí RGB obrázok s rozmermi 640 x 480 pixelov a bielym pozadím.
+Comment[sl]=Ustvari belo sliko RGB velikosti 640 x 480 pik.
+Comment[sr]=Прави белу RGB слику са 640 x 480 пиксела.
+Comment[sr@Latn]=Pravi belu RGB sliku sa 640 x 480 piksela.
+Comment[sv]=Skapar en vit RGB-bild med 640 x 480 bildpunkter.
+Comment[ta]=640 x 480 படத்துணுக்குகளில் ஒரு வெள்ளை RGB பிம்பத்தை உருவாக்குகிறது.
+Comment[tr]=640 x 480 piksel ebadında beyaz bir RGB görüntü oluşturur.
+Comment[uk]=Створює біле зображення у форматі RGB, 640 x 480 пікселів.
+Comment[uz]=Oʻlchami 640 x 480 nuqta boʻlgan oq RGB rasmni yaratish.
+Comment[uz@cyrillic]=Ўлчами 640 x 480 нуқта бўлган оқ RGB расмни яратиш.
+Comment[zh_CN]=创建 640 x 480 像素的 RGB 白色背景图像。
+Comment[zh_TW]=建立一個 640 x 480 像素的白色 RGB 圖片。
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/rgb_u8/templates/white_640x480.kra b/chalk/colorspaces/rgb_u8/templates/white_640x480.kra
new file mode 100644
index 000000000..559af6273
Binary files /dev/null and b/chalk/colorspaces/rgb_u8/templates/white_640x480.kra differ
diff --git a/chalk/colorspaces/rgb_u8/tests/Makefile.am b/chalk/colorspaces/rgb_u8/tests/Makefile.am
new file mode 100644
index 000000000..5e9497a59
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/tests/Makefile.am
@@ -0,0 +1,17 @@
+AM_CPPFLAGS =  -I$(srcdir)/../../../sdk \
+	 -I$(srcdir)/.. \
+	-I$(srcdir)/../../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../../color_strategy/ \
+	$(all_includes)
+
+# The check_ target makes sure we don't install the modules,
+# $(KDE_CHECK_PLUGIN) assures a shared library is created.
+check_LTLIBRARIES = kunittest_kis_strategy_colorspace_rgb_tester.la
+
+kunittest_kis_strategy_colorspace_rgb_tester_la_SOURCES = kis_strategy_colorspace_rgb_tester.cpp
+kunittest_kis_strategy_colorspace_rgb_tester_la_LIBADD = -lkunittest ../libchalkrgb.la
+kunittest_kis_strategy_colorspace_rgb_tester_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+check-local: kunittest_kis_strategy_colorspace_rgb_tester.la
+	kunittestmodrunner
+
diff --git a/chalk/colorspaces/rgb_u8/tests/kis_strategy_colorspace_rgb_tester.cpp b/chalk/colorspaces/rgb_u8/tests/kis_strategy_colorspace_rgb_tester.cpp
new file mode 100644
index 000000000..1d3526f41
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/tests/kis_strategy_colorspace_rgb_tester.cpp
@@ -0,0 +1,197 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "kis_factory.h"
+#include "kis_strategy_colorspace_rgb_tester.h"
+#include "kis_rgb_colorspace.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE( kunittest_kis_strategy_colorspace_rgb_tester, "RGB ColorSpace Tester" );
+KUNITTEST_MODULE_REGISTER_TESTER( KisRgbColorSpaceTester );
+
+void KisRgbColorSpaceTester::allTests()
+{
+    // We need this so that the colour profile loading can operate without crashing.
+    KisFactory *factory = new KisFactory();
+
+    testBasics();
+    testMixColors();
+
+    delete factory;
+}
+
+#define NUM_CHANNELS 4
+
+#define RED_CHANNEL 0
+#define GREEN_CHANNEL 1
+#define BLUE_CHANNEL 2
+#define ALPHA_CHANNEL 3
+
+void KisRgbColorSpaceTester::testBasics()
+{
+    KisProfile *defProfile = new KisProfile(cmsCreate_sRGBProfile());  
+    KisRgbColorSpace *cs = new KisRgbColorSpace(defProfile);
+
+    TQ_UINT8 pixel[NUM_CHANNELS];
+
+    pixel[PIXEL_RED] = 255;
+    pixel[PIXEL_GREEN] = 128;
+    pixel[PIXEL_BLUE] = 64;
+    pixel[PIXEL_ALPHA] = 0;
+
+    TQString valueText = cs->channelValueText(pixel, RED_CHANNEL);
+    CHECK(valueText, TQString("255"));
+
+    valueText = cs->channelValueText(pixel, GREEN_CHANNEL);
+    CHECK(valueText, TQString("128"));
+
+    valueText = cs->channelValueText(pixel, BLUE_CHANNEL);
+    CHECK(valueText, TQString("64"));
+
+    valueText = cs->channelValueText(pixel, ALPHA_CHANNEL);
+    CHECK(valueText, TQString("0"));
+
+    valueText = cs->normalisedChannelValueText(pixel, RED_CHANNEL);
+    CHECK(valueText, TQString().setNum(1.0));
+
+    valueText = cs->normalisedChannelValueText(pixel, GREEN_CHANNEL);
+    CHECK(valueText, TQString().setNum(128.0 / 255.0));
+
+    valueText = cs->normalisedChannelValueText(pixel, BLUE_CHANNEL);
+    CHECK(valueText, TQString().setNum(64.0 / 255.0));
+
+    valueText = cs->normalisedChannelValueText(pixel, ALPHA_CHANNEL);
+    CHECK(valueText, TQString().setNum(0.0));
+
+    cs->setPixel(pixel, 128, 192, 64, 99);
+    CHECK((uint)pixel[PIXEL_RED], 128u);
+    CHECK((uint)pixel[PIXEL_GREEN], 192u);
+    CHECK((uint)pixel[PIXEL_BLUE], 64u);
+    CHECK((uint)pixel[PIXEL_ALPHA], 99u);
+
+    TQ_UINT8 red;
+    TQ_UINT8 green;
+    TQ_UINT8 blue;
+    TQ_UINT8 alpha;
+
+    cs->getPixel(pixel, &red, &green, &blue, &alpha);
+    CHECK((uint)red, 128u);
+    CHECK((uint)green, 192u);
+    CHECK((uint)blue, 64u);
+    CHECK((uint)alpha, 99u);
+}
+
+void KisRgbColorSpaceTester::testMixColors()
+{
+    KisProfile *defProfile = new KisProfile(cmsCreate_sRGBProfile());
+    KisRgbColorSpace *cs = new KisRgbColorSpace(defProfile);
+
+
+    // Test mixColors.
+    TQ_UINT8 pixel1[4];
+    TQ_UINT8 pixel2[4];
+    TQ_UINT8 outputPixel[4];
+
+    pixel1[PIXEL_RED] = 255;
+    pixel1[PIXEL_GREEN] = 255;
+    pixel1[PIXEL_BLUE] = 255;
+    pixel1[PIXEL_ALPHA] = 255;
+
+    pixel2[PIXEL_RED] = 0;
+    pixel2[PIXEL_GREEN] = 0;
+    pixel2[PIXEL_BLUE] = 0;
+    pixel2[PIXEL_ALPHA] = 0;
+
+    const TQ_UINT8 *pixelPtrs[2];
+    TQ_UINT8 weights[2];
+
+    pixelPtrs[0] = pixel1;
+    pixelPtrs[1] = pixel2;
+
+    weights[0] = 255;
+    weights[1] = 0;
+
+    cs->mixColors(pixelPtrs, weights, 2, outputPixel);
+
+    CHECK((int)outputPixel[PIXEL_RED], 255);
+    CHECK((int)outputPixel[PIXEL_GREEN], 255);
+    CHECK((int)outputPixel[PIXEL_BLUE], 255);
+    CHECK((int)outputPixel[PIXEL_ALPHA], 255);
+
+    weights[0] = 0;
+    weights[1] = 255;
+
+    cs->mixColors(pixelPtrs, weights, 2, outputPixel);
+
+    CHECK((int)outputPixel[PIXEL_RED], 0);
+    CHECK((int)outputPixel[PIXEL_GREEN], 0);
+    CHECK((int)outputPixel[PIXEL_BLUE], 0);
+    CHECK((int)outputPixel[PIXEL_ALPHA], 0);
+
+    weights[0] = 128;
+    weights[1] = 127;
+
+    cs->mixColors(pixelPtrs, weights, 2, outputPixel);
+     
+    CHECK((int)outputPixel[PIXEL_RED], 255);
+    CHECK((int)outputPixel[PIXEL_GREEN], 255);
+    CHECK((int)outputPixel[PIXEL_BLUE], 255);
+    CHECK((int)outputPixel[PIXEL_ALPHA], 128);
+
+    pixel1[PIXEL_RED] = 200;
+    pixel1[PIXEL_GREEN] = 100;
+    pixel1[PIXEL_BLUE] = 50;
+    pixel1[PIXEL_ALPHA] = 255;
+
+    pixel2[PIXEL_RED] = 100;
+    pixel2[PIXEL_GREEN] = 200;
+    pixel2[PIXEL_BLUE] = 20;
+    pixel2[PIXEL_ALPHA] = 255;
+
+    cs->mixColors(pixelPtrs, weights, 2, outputPixel);
+
+    CHECK((int)outputPixel[PIXEL_RED], 150);
+    CHECK((int)outputPixel[PIXEL_GREEN], 150);
+    CHECK((int)outputPixel[PIXEL_BLUE], 35);
+    CHECK((int)outputPixel[PIXEL_ALPHA], 255);
+
+    pixel1[PIXEL_RED] = 0;
+    pixel1[PIXEL_GREEN] = 0;
+    pixel1[PIXEL_BLUE] = 0;
+    pixel1[PIXEL_ALPHA] = 0;
+
+    pixel2[PIXEL_RED] = 255;
+    pixel2[PIXEL_GREEN] = 255;
+    pixel2[PIXEL_BLUE] = 255;
+    pixel2[PIXEL_ALPHA] = 254;
+
+    weights[0] = 89;
+    weights[1] = 166;
+
+    cs->mixColors(pixelPtrs, weights, 2, outputPixel);
+
+    CHECK((int)outputPixel[PIXEL_RED], 255);
+    CHECK((int)outputPixel[PIXEL_GREEN], 255);
+    CHECK((int)outputPixel[PIXEL_BLUE], 255);
+    CHECK((int)outputPixel[PIXEL_ALPHA], 165);
+}
+
diff --git a/chalk/colorspaces/rgb_u8/tests/kis_strategy_colorspace_rgb_tester.h b/chalk/colorspaces/rgb_u8/tests/kis_strategy_colorspace_rgb_tester.h
new file mode 100644
index 000000000..16fc4e837
--- /dev/null
+++ b/chalk/colorspaces/rgb_u8/tests/kis_strategy_colorspace_rgb_tester.h
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef KIS_STRATEGY_COLORSPACE_RGB_TESTER_H
+#define KIS_STRATEGY_COLORSPACE_RGB_TESTER_H
+
+#include <kunittest/tester.h>
+
+class KisRgbColorSpaceTester : public KUnitTest::Tester
+{
+public:
+        void allTests();
+    void testBasics();
+    void testMixColors();
+};
+
+#endif
+
diff --git a/chalk/colorspaces/wet/Makefile.am b/chalk/colorspaces/wet/Makefile.am
new file mode 100644
index 000000000..a5500db55
--- /dev/null
+++ b/chalk/colorspaces/wet/Makefile.am
@@ -0,0 +1,28 @@
+chalkrcdir = $(kde_datadir)/chalkplugins
+chalkrc_DATA = wetplugin.rc
+kde_services_DATA = chalkwetplugin.desktop
+
+EXTRA_DIST = $(chalkrc_DATA)
+
+INCLUDES  = -I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../core \
+	-I$(srcdir)/../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../chalkcolor/ \
+	-I$(srcdir)/../../ui \
+	-I$(srcdir)/../../kopalette \
+	$(KOFFICE_INCLUDES) \
+	-I$(interfacedir) \
+	$(KOPAINTER_INCLUDES) \
+	$(all_includes)
+
+kde_module_LTLIBRARIES = chalkwetplugin.la
+
+chalkwetplugin_la_SOURCES = kis_wet_colorspace.cc wet_plugin.cc kis_wetop.cc kis_wet_palette_widget.cc kis_wetness_visualisation_filter.cc kis_texture_painter.cc kis_texture_filter.cc wetphysicsfilter.cc wdgpressure.ui
+noinst_HEADERS = kis_wet_colorspace.h wet_plugin.h wetphysicsfilter.h kis_wetop.cc kis_wet_palette_widget.h kis_texture_painter.h kis_wetness_visualisation_filter.h kis_texture_filter.h wetphysicsfilter.h
+
+chalkwetplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms -L../../../chalk/chalkcolor/.libs -lchalkcolor -L../../../chalk/core/.libs -lchalkimage \
+	-L../../../chalk/ui/.libs -lchalkui
+chalkwetplugin_la_LIBADD =  ../../libchalkcommon.la $(LIB_KOPAINTER) $(LIB_KOFFICECORE)
+
+chalkwetplugin_la_METASOURCES = AUTO
+
diff --git a/chalk/colorspaces/wet/chalkwetplugin.desktop b/chalk/colorspaces/wet/chalkwetplugin.desktop
new file mode 100644
index 000000000..28a33d9b7
--- /dev/null
+++ b/chalk/colorspaces/wet/chalkwetplugin.desktop
@@ -0,0 +1,86 @@
+[Desktop Entry]
+Name=Watercolor Paint Plugin
+Name[bg]=Приставка акварелни бои
+Name[ca]=Connector de pintura aquarel·la
+Name[cy]=Ategyn Paent Dyfrlliw
+Name[da]=Plugin for vandfarvemaling
+Name[de]=Modul für Wasserfarben-Effekte
+Name[el]=Πρόσθετο υδατογραφίας
+Name[eo]=Akvokolorpentrada kromaĵo
+Name[es]=Complemento de pintura de acuarela
+Name[et]=Vesivärvijoonistuse plugin
+Name[eu]=Akuarelazko margoen plugina
+Name[fa]=وصلۀ رنگ‌آمیزی آبرنگ
+Name[fi]=Vesivärikuvaliitännäinen
+Name[fr]=Module de dessin à l'aquarelle
+Name[fy]=Wetter skilderplugin
+Name[gl]=Plugin de Pintura con Cores de Auga
+Name[he]=תוסף צביעה בצבעי מים
+Name[hu]=Vízfesték modul
+Name[is]=Vatnslita íforrit
+Name[it]=Plugin per la pittura ad acquerello
+Name[ja]=水彩プラグイン
+Name[km]=កម្មវិធី​ជំនួយ​សម្រាប់​គូរ​គំនូរ​ពណ៌​ទឹក
+Name[lv]=Zīmēšanas ar ūdenskrāsām spraudnis
+Name[ms]=Plugin Warna Cat Air 
+Name[nb]=Paint-programtillegg for vannfarger
+Name[nds]=Waterklöör-Effektmoduul
+Name[ne]=पानी रङ पेन्ट प्लगइन
+Name[nl]=Waterkleur schilderplugin
+Name[nn]=Programtillegg for vassfargar
+Name[pl]=Wtyczka malowania akwarelami
+Name[pt]='Plugin' de Pintura a Água
+Name[pt_BR]=Plug-in de Marca D'água
+Name[ru]=Акварель
+Name[sk]=Modul pre vodové farby
+Name[sl]=Vstavek za slikanje z vodnimi barvami
+Name[sr]=Прикључак за сликање воденим бојама
+Name[sr@Latn]=Priključak za slikanje vodenim bojama
+Name[sv]=Insticksprogram för vattenfärgsmålning
+Name[uk]=Втулок малювання акварельними фарбами
+Name[zh_CN]=水彩绘画插件
+Name[zh_TW]=水色繪畫外掛程式
+Comment=Color model and tools for painting with simulated watercolors
+Comment[bg]=Цветови модел и инструменти за рисуване със симулирани акварелни бои
+Comment[ca]=Model de color i eines per a pintar amb aquarel·les simulades
+Comment[cy]=Model lliw ac offer ar gyfer paentio efo dyfrliwiau wedi'u hefelychu
+Comment[da]=Farvemodel og værktøjer til at male med simulerede vandfarver
+Comment[de]=Farbmodell und Werkzeuge zum Malen mit simulierten Wasserfarben
+Comment[el]=Χρωματικό μοντέλο και εργαλεία για τη ζωγραφική με εξομοίωση χρωμάτων υδατογραφίας
+Comment[en_GB]=Colour model and tools for painting with simulated watercolours
+Comment[es]=Modelo de color y herramientas para pintar con acuarelas simuladas
+Comment[et]=Vesivärvijoonistuse simulatsiooni värvimudel ja tööriistad
+Comment[eu]=Akuarelen itxuraz margotzeko tresnak eta kolore-eredua
+Comment[fa]=مدل رنگ و ابزارها برای رنگ‌آمیزی با آبرنگهای شبیه‌سازی شده
+Comment[fi]=Värimalli ja työkalut simuloiduille vesiväreille
+Comment[fr]=Modèle de couleurs et outils pour dessiner avec des couleurs simulées d'aquarelle
+Comment[fy]=Kleurmodel en -ark foar it skilderjen mei simulearre wetterkleuren
+Comment[gl]=Modelo de cores e ferramentas para pintar con cores de auga simulados
+Comment[he]=מודל צבעים וכלים לצביעה תוך הדמיה של צבעי מים
+Comment[hu]=Színmodell és eszközök szimulált vízfestékes képekhez
+Comment[is]=Litategundir og tól til að teikna með vatnslitum
+Comment[it]=Modello di colore e strumenti per il disegno con acquerelli simulati
+Comment[ja]=水彩画をシミュレートして描画するためのカラーモデルとツール
+Comment[km]=គំរូពណ៌ និង​ឧបករណ៍​សម្រាប់​គូរ​គំនូរ​ដែល​មាន​ពណ៌​ស្រដៀង​ទឹក
+Comment[ms]=Model warna dan alat lukisan dengan cat air tiruan
+Comment[nb]=Fargemodell og verktøy for maling med simulerte vannfarger
+Comment[nds]=Klöörmodell un Warktüüch för't Malen mit Waterklöreneffekten
+Comment[ne]=बनावटी पानीरङहरू सँग पेन्टीङ्गका लागि रङ मोडेल
+Comment[nl]=Kleurmodel en -gereedschappen voor het schilderen met gesimuleerde waterkleuren
+Comment[nn]=Fargemodell og verktøy for måling med simulerte vassfargar
+Comment[pl]=Przestrzeń barw oraz narzędzia do symulacji malowania farbami akwarelowymi
+Comment[pt]=Modelo de cor e ferramentas para pintar com cores aquosas simuladas
+Comment[pt_BR]=Modelo de cor e ferramentas para pintura  de cores simuladas de água
+Comment[ru]=Цветовое пространство и инструменты рисования акварелью
+Comment[sk]=Model farieb a nástroje na kreslenie vodovými farbami
+Comment[sl]=Barvni model in orodja za slikanje s similiranimi vodnimi barvami
+Comment[sr]=Модел боја и алати за сликање симулираним воденим бојама
+Comment[sr@Latn]=Model boja i alati za slikanje simuliranim vodenim bojama
+Comment[sv]=Färgmodell och verktyg för att måla med simulerade vattenfärger
+Comment[uk]=Модель кольорів та засобів для малювання з симулюванням акварелі
+Comment[zh_CN]=模拟水彩绘画的色彩模型和工具
+Comment[zh_TW]=以模擬水色繪製的色彩模型與工具
+ServiceTypes=Chalk/ColorSpace,Chalk/ViewPlugin
+Type=Service
+X-KDE-Library=chalkwetplugin
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/wet/kis_texture_filter.cc b/chalk/colorspaces/wet/kis_texture_filter.cc
new file mode 100644
index 000000000..6f58cd14a
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_texture_filter.cc
@@ -0,0 +1,43 @@
+/*
+ * kis_texture_filter.cc -- Part of Chalk
+ *
+ * Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kdebug.h>
+#include <kis_view.h>
+#include <kis_image.h>
+#include <kis_debug_areas.h>
+#include "kis_texture_painter.h"
+#include "kis_texture_filter.h"
+
+void WetPaintDevAction::act(KisPaintDeviceSP device,  TQ_INT32 w,  TQ_INT32 h) const {
+    KisColorSpace * cs = device->colorSpace();
+
+    if (cs->id() != KisID("WET","")) {
+        kdDebug(DBG_AREA_CMS) << "You set this kind of texture on non-wet layers!.\n";
+        return;
+    } else {
+        kdDebug(DBG_AREA_CMS) << "Wet Paint Action activated!\n";
+    }
+
+    // XXX if params of the painter get configurable, make them here configurable as well?
+    KisTexturePainter painter(device);
+    painter.createTexture(0, 0, w, h);
+    painter.end();
+}
+
diff --git a/chalk/colorspaces/wet/kis_texture_filter.h b/chalk/colorspaces/wet/kis_texture_filter.h
new file mode 100644
index 000000000..75f12e88e
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_texture_filter.h
@@ -0,0 +1,38 @@
+/* 
+ * kis_texture_filter.h -- Part of Chalk
+ *
+ * Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _TEXTURE_FILTER_H
+#define _TEXTURE_FILTER_H
+
+#include <tqstring.h>
+#include <klocale.h>
+#include <kis_paint_device_action.h>
+
+/// Initializes a wet paint device with a texture
+class WetPaintDevAction : public KisPaintDeviceAction {
+public:
+    virtual ~WetPaintDevAction() {}
+
+    virtual void act(KisPaintDeviceSP device,  TQ_INT32 w = 0,  TQ_INT32 h = 0) const;
+    virtual TQString name() const { return i18n("Wet Texture"); }
+    virtual TQString description() const { return i18n("Add a texture to the wet canvas"); }
+};
+
+#endif // _TEXTURE_FILTER_H
diff --git a/chalk/colorspaces/wet/kis_texture_painter.cc b/chalk/colorspaces/wet/kis_texture_painter.cc
new file mode 100644
index 000000000..4b11b9899
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_texture_painter.cc
@@ -0,0 +1,92 @@
+/*
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <math.h>
+
+#include <kdebug.h>
+
+#include <kis_global.h>
+#include <kis_image.h>
+#include <kis_iterators_pixel.h>
+#include <kis_layer.h>
+#include <kis_paint_device.h>
+#include <kis_painter.h>
+#include <kis_types.h>
+
+#include "kis_wet_colorspace.h"
+#include "kis_texture_painter.h"
+
+KisTexturePainter::KisTexturePainter()
+    : super()
+{
+    // XXX make at least one of these configurable, probably blurh
+    m_height = 1;
+    m_blurh = 0.7;
+}
+
+KisTexturePainter::KisTexturePainter(KisPaintDeviceSP device) : super(device)
+{
+    m_height = 1;
+    m_blurh = 0.7;
+}
+
+void KisTexturePainter::createTexture( TQ_INT32 x,  TQ_INT32 y,  TQ_INT32 w,  TQ_INT32 h)
+{
+    double hscale = 128 * m_height / RAND_MAX;
+
+    int ibh = (int) floor(256 * m_blurh + 0.5);
+
+    // initialize with random data
+    for (int y2 = 0; y2 < h; y2++) {
+        KisHLineIterator i = m_device->createHLineIterator(x, y + y2, w, true);
+        while (!i.isDone()) {
+            WetPack* pack = reinterpret_cast<WetPack*>(i.rawData());
+            WetPix* w = &(pack->adsorb);
+            w->h = ( TQ_UINT16)floor(128 + hscale * rand());
+            ++i;
+        }
+    }
+
+    int lh;
+
+    // Blur horizontally
+    for (int y2 = 0; y2 < h; y2++) {
+        KisHLineIterator i = m_device->createHLineIterator(x, y + y2, w, true);
+
+        WetPack* pack = reinterpret_cast<WetPack*>(i.rawData());
+        WetPix* w = &(pack->adsorb);
+        lh = w->h;
+        ++i;
+
+        while (!i.isDone()) {
+            pack = reinterpret_cast<WetPack*>(i.rawData());
+            w = &(pack->adsorb);
+            w->h += ((lh - w->h) * ibh + 128) >> 8;
+            lh = w->h;
+            // XXX to make it easier for us later on, we store the height data in paint
+            // as well!
+            w = &(pack->paint);
+            w->h = lh;
+            ++i;
+        }
+    }
+
+    //Qt::Vertical blurring was commented out in wetdreams, the effect seems to be achievable
+    // without this.
+    // I think this is because with blur in one direction, you get more the effect of
+    // having 'fibers' in your paper
+}
diff --git a/chalk/colorspaces/wet/kis_texture_painter.h b/chalk/colorspaces/wet/kis_texture_painter.h
new file mode 100644
index 000000000..00bcd135a
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_texture_painter.h
@@ -0,0 +1,40 @@
+/*
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_TEXTURE_PAINTER_H_
+#define KIS_TEXTURE_PAINTER_H_
+
+#include "kis_types.h"
+#include "kis_painter.h"
+
+class KisTexturePainter : public KisPainter
+{
+
+    typedef KisPainter super;
+
+public:
+
+    KisTexturePainter();
+    KisTexturePainter(KisPaintDeviceSP device);
+
+    void createTexture( TQ_INT32 x,  TQ_INT32 y,  TQ_INT32 w,  TQ_INT32 h);
+
+private:
+    double m_blurh, m_height;
+
+};
+#endif //KIS_TEXTURE_PAINTER_H_
diff --git a/chalk/colorspaces/wet/kis_wet_colorspace.cc b/chalk/colorspaces/wet/kis_wet_colorspace.cc
new file mode 100644
index 000000000..7d6f0d678
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_wet_colorspace.cc
@@ -0,0 +1,514 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <limits.h>
+#include <stdlib.h>
+
+#include <config.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+
+#include <klocale.h>
+#include <kdebug.h>
+#include <kis_debug_areas.h>
+#include "kis_abstract_colorspace.h"
+#include "kis_colorspace_factory_registry.h"
+#include "kis_image.h"
+#include "kis_wet_colorspace.h"
+#include "wetphysicsfilter.h"
+#include "kis_integer_maths.h"
+
+namespace {
+    static const WetPix m_paint = { 707, 0, 707, 0, 707, 0, 240, 0 };
+
+    /* colors from Curtis et al, Siggraph 97 */
+
+    static const WetPix m_paintbox[] = {
+        {496, 0, 16992, 0, 3808, 0, 0, 0},
+        {16992, 9744, 21712, 6400, 25024, 3296, 0, 0},
+        {6512, 6512, 6512, 4880, 11312, 0, 0, 0},
+        {16002, 0, 2848, 0, 16992, 0, 0, 0},
+        {22672, 0, 5328, 2272, 4288, 2640, 0, 0},
+        {8000, 0, 16992, 0, 28352, 0, 0, 0},
+        {5696, 5696, 12416, 2496, 28352, 0, 0, 0},
+        {0, 0, 5136, 0, 28352, 0, 0, 0},
+        {2320, 1760, 7344, 4656, 28352, 0, 0, 0},
+        {8000, 0, 3312, 0, 5504, 0, 0, 0},
+        {13680, 0, 16992, 0, 3312, 0, 0, 0},
+        {5264, 5136, 1056, 544, 6448, 6304, 0, 0},
+        {11440, 11440, 11440, 11440, 11440, 11440, 0, 0},
+        {11312, 0, 11312, 0, 11312, 0, 0, 0},
+        {0, 0, 0, 0, 0, 0, 0, 0} };
+
+    static const int m_nPaints = 15;
+}
+
+void wetPixToDouble(WetPixDbl * dst, WetPix *src)
+{
+    dst->rd = (1.0 / 8192.0) * src->rd;
+    dst->rw = (1.0 / 8192.0) * src->rw;
+    dst->gd = (1.0 / 8192.0) * src->gd;
+    dst->gw = (1.0 / 8192.0) * src->gw;
+    dst->bd = (1.0 / 8192.0) * src->bd;
+    dst->bw = (1.0 / 8192.0) * src->bw;
+    dst->w = (1.0 / 8192.0) * src->w;
+    dst->h = (1.0 / 8192.0) * src->h;
+}
+
+void wetPixFromDouble(WetPix * dst, WetPixDbl *src)
+{
+    int v;
+
+    v = (int)floor (8192.0 * src->rd + 0.5);
+    dst->rd = CLAMP(v, 0, 65535);
+
+    v = (int)floor (8192.0 * src->rw + 0.5);
+    dst->rw = CLAMP(v, 0, 65535);
+
+    v = (int)floor (8192.0 * src->gd + 0.5);
+    dst->gd = CLAMP(v, 0, 65535);
+
+    v = (int)floor (8192.0 * src->gw + 0.5);
+    dst->gw = CLAMP(v, 0, 65535);
+
+    v = (int)floor (8192.0 * src->bd + 0.5);
+    dst->bd = CLAMP(v, 0, 65535);
+
+    v = (int)floor (8192.0 * src->bw + 0.5);
+    dst->bw = CLAMP(v, 0, 65535);
+
+    v = (int)floor (8192.0 * src->w + 0.5);
+    dst->w = CLAMP(v, 0, 511);
+
+    v = (int)floor (8192.0 * src->h + 0.5);
+    dst->h = CLAMP(v, 0, 511);
+
+}
+
+int getH(int r, int g, int b)
+{
+    int h, s, v;
+    TQColor c(r,g, b);
+    c.getHsv(&h, &s, &v);
+    return h;
+}
+
+KisWetColorSpace::KisWetColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) :
+    KisAbstractColorSpace(KisID("WET", i18n("Watercolors")), 0, icMaxEnumData, tqparent, p)
+{
+    wet_init_render_tab();
+
+    m_paintNames << i18n("Quinacridone Rose")
+        << i18n("Indian Red")
+        << i18n("Cadmium Yellow")
+        << i18n("Hookers Green")
+        << i18n("Cerulean Blue")
+        << i18n("Burnt Umber")
+        << i18n("Cadmium Red")
+        << i18n("Brilliant Orange")
+        << i18n("Hansa Yellow")
+        << i18n("Phthalo Green")
+        << i18n("French Ultramarine")
+        << i18n("Interference Lilac")
+        << i18n("Titanium White")
+        << i18n("Ivory Black")
+        << i18n("Pure Water");
+
+    m_channels.push_back(new KisChannelInfo(i18n("Red Concentration"), "Rc", 0, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Myth Red"), "Rm", 1, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Green Concentration"), "Gc", 2, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Myth Green"), "Gm", 3, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Blue Concentration"), "Bc", 4, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Myth Blue"), "Bm", 5, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Water Volume"), "W", 6, KisChannelInfo::SUBSTANCE, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Paper Height"), "H", 7, KisChannelInfo::SUBSTANCE, KisChannelInfo::UINT16));
+
+    m_channels.push_back(new KisChannelInfo(i18n("Adsorbed Red Concentration"), "Rc", 8, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Adsorbed Myth Red"), "Rm", 9, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Adsorbed Green Concentration"), "Gc", 10, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Adsorbed Myth Green"), "Gm", 11, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Adsorbed Blue Concentration"), "Bc", 12, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Adsorbed Myth Blue"), "Bm", 13, KisChannelInfo::COLOR, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Adsorbed Water Volume"), "W", 14, KisChannelInfo::SUBSTANCE, KisChannelInfo::UINT16));
+    m_channels.push_back(new KisChannelInfo(i18n("Adsorbed Paper Height"), "H", 15, KisChannelInfo::SUBSTANCE, KisChannelInfo::UINT16));
+
+    // Store the hue; we'll pick the paintbox color that closest to the given TQColor's hue.
+    m_conversionMap[getH(240, 32, 160)] = m_paintbox[0]; // Quinacridone Rose
+    m_conversionMap[getH(159, 88, 43)] = m_paintbox[1]; // Indian Red
+    m_conversionMap[getH(254, 220, 64)] = m_paintbox[2]; // Cadmium Yellow
+    m_conversionMap[getH(36, 180, 32)] = m_paintbox[3]; // Hookers Green
+    m_conversionMap[getH(16, 185, 215)] = m_paintbox[4]; // Cerulean Blue
+    m_conversionMap[getH(96, 32, 8)] = m_paintbox[5]; // Burnt Umber
+    m_conversionMap[getH(254, 96, 8)] = m_paintbox[6]; // Cadmium Red
+    m_conversionMap[getH(255, 136, 8)] = m_paintbox[7]; // Brilliant Orange
+    m_conversionMap[getH(240, 199, 8)] = m_paintbox[8]; // Hansa Yellow
+    m_conversionMap[getH(96, 170, 130)] = m_paintbox[9]; // Phthalo Green
+    m_conversionMap[getH(48, 32, 170)] = m_paintbox[10]; // French Ultramarine
+    m_conversionMap[getH(118, 16, 135)] = m_paintbox[11]; // Interference Lilac
+    m_conversionMap[getH(254, 254, 254)] = m_paintbox[12]; // Titanium White
+    m_conversionMap[getH(64, 64, 74)] = m_paintbox[13]; // Ivory Black
+
+    m_paintwetness = false;
+    phasebig = 0;
+}
+
+
+KisWetColorSpace::~KisWetColorSpace()
+{
+}
+
+void KisWetColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile * /*profile*/)
+{
+    WetPack* p = reinterpret_cast<WetPack*>(dst);
+
+    int h = getH(c.red(), c.green(), c.blue());
+    int delta = 256;
+    int key = 0;
+    TQMap<int, WetPix>::Iterator it;
+    TQMap<int, WetPix>::Iterator end = m_conversionMap.end();
+    for (it = m_conversionMap.begin(); it != end; ++it) {
+        if (abs(it.key() - h) < delta) {
+            delta = abs(it.key() - h);
+            key = it.key();
+        }
+    }
+
+    // Translate the special TQCOlors from our paintbox to wetpaint paints.
+    if (m_conversionMap.tqcontains(key)) {
+        (*p).paint = m_conversionMap[key];
+        (*p).adsorb = m_conversionMap[key]; // or maybe best add water here?
+    } else {
+        // water
+        (*p).paint = m_paintbox[14];
+        (*p).adsorb = m_paintbox[14];
+    }
+}
+
+void KisWetColorSpace::fromTQColor(const TQColor& c, TQ_UINT8  /*opacity*/, TQ_UINT8 *dst, KisProfile * /*profile*/)
+{
+    fromTQColor(c, dst);
+}
+
+ TQ_UINT8 KisWetColorSpace::getAlpha(const TQ_UINT8 */*pixel*/) const
+{
+    return OPACITY_OPAQUE;
+}
+
+void KisWetColorSpace::setAlpha( TQ_UINT8 * /*pixels*/, TQ_UINT8 /*alpha*/, TQ_INT32 /*nPixels*/) const
+{
+}
+
+void KisWetColorSpace::multiplyAlpha( TQ_UINT8 * /*pixels*/, TQ_UINT8 /*alpha*/, TQ_INT32 /*nPixels*/)
+{
+}
+
+void KisWetColorSpace::applyAlphaU8Mask( TQ_UINT8 * /*pixels*/, TQ_UINT8 * /*alpha*/, TQ_INT32 /*nPixels*/)
+{
+}
+
+void KisWetColorSpace::applyInverseAlphaU8Mask( TQ_UINT8 * /*pixels*/, TQ_UINT8 * /*alpha*/, TQ_INT32 /*nPixels*/)
+{
+}
+
+ TQ_UINT8 KisWetColorSpace::scaleToU8(const TQ_UINT8 * /*srcPixel*/, TQ_INT32 /*channelPos*/)
+{
+    return 0;
+}
+
+TQ_UINT16 KisWetColorSpace::scaleToU16(const TQ_UINT8 * /*srcPixel*/, TQ_INT32 /*channelPos*/)
+{
+    return 0;
+}
+
+
+void KisWetColorSpace::toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * /*profile*/)
+{
+    TQ_UINT8 * rgb = new TQ_UINT8[3];
+    Q_CHECK_PTR(rgb);
+
+    memset(rgb, 255, 3);
+
+    // Composite the two layers in each pixelSize
+
+    WetPack * wp = (WetPack*)src;
+
+    // First the adsorption layer
+    wet_composite(RGB, rgb, &wp->adsorb);
+
+    // Then the paint layer (which comes first in our double-packed pixel)
+    wet_composite(RGB, rgb,  &wp->paint);
+
+    c->setRgb(rgb[0], rgb[1], rgb[2]);
+
+    delete[]rgb;
+}
+
+void KisWetColorSpace::toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 */*opacity*/, KisProfile * /*profile*/)
+{
+    toTQColor(src, c);
+}
+
+void KisWetColorSpace::mixColors(const TQ_UINT8 **/*colors*/, const TQ_UINT8 */*weights*/,  TQ_UINT32 /*nColors*/, TQ_UINT8 */*dst*/) const
+{
+}
+
+TQValueVector<KisChannelInfo *> KisWetColorSpace::channels() const
+{
+    return m_channels;
+}
+
+ TQ_UINT32 KisWetColorSpace::nChannels() const
+{
+    return 16;
+}
+
+ TQ_UINT32 KisWetColorSpace::nColorChannels() const
+{
+    return 12;
+}
+
+ TQ_UINT32 KisWetColorSpace::nSubstanceChannels() const
+{
+    return 4;
+}
+
+
+ TQ_UINT32 KisWetColorSpace::pixelSize() const
+{
+    return 32; // This color strategy wants an unsigned short for each
+           // channel, and every pixel consists of two wetpix structs
+           // -- even though for many purposes we need only one wetpix
+           // struct.
+}
+
+
+
+// XXX: use profiles to display correctly on calibrated displays.
+TQImage KisWetColorSpace::convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                         KisProfile *  /*dstProfile*/,
+                         TQ_INT32 /*renderingIntent*/, float /*exposure*/)
+{
+
+    TQImage img(width, height, 32);
+
+    TQ_UINT8 *rgb = (TQ_UINT8*) img.bits();
+    const WetPack* wetData = reinterpret_cast<const WetPack*>(data);
+
+    // Clear to white -- the following code actually composits the contents of the
+    // wet pixels with the contents of the image buffer, so they need to be
+    // prepared
+    memset(rgb, 255, width * height * 4);
+    // Composite the two layers in each pixelSize
+
+    TQ_INT32 i = 0;
+    while ( i < width * height) {
+        // First the adsorption layers
+        WetPack* wp = const_cast<WetPack*>(&wetData[i]); // XXX don't do these things!
+        // XXX Probably won't work on MSB archs!
+        wet_composite(BGR, rgb, &(wp->adsorb));
+        // Then the paint layer (which comes first in our double-packed pixel)
+        wet_composite(BGR, rgb, &(wp->paint));
+
+        // XXX pay attention to this comment!!
+        // Display the wet stripes -- this only works if we have at least three scanlines in height,
+        // because otherwise the phase trick won't work.
+
+        // Because we work in a stateless thing, and we can't just draw this wetness
+        // indication AFTER this (e.g. like the selection), we have to do un nice things:
+        // Because we (hopefully atm!) don't use the height of the paint wetpix, we abuse
+        // that to store a state. It's not perfect, but it works for now...
+        if (m_paintwetness) {
+            wet_render_wetness(rgb, wp);
+        }
+
+        i++;
+        rgb += sizeof( TQ_UINT32); // Because the TQImage is 4 bytes deep.
+
+    }
+
+    return img;
+}
+
+void KisWetColorSpace::bitBlt( TQ_UINT8 *dst,
+                  TQ_INT32 dstRowSize,
+                  const TQ_UINT8 *src,
+                  TQ_INT32 srcRowStride,
+                  const TQ_UINT8 */*srcAlphaMask*/,
+                  TQ_INT32 /*tqmaskRowStride*/,
+                  TQ_UINT8 /*opacity*/,
+                  TQ_INT32 rows,
+                  TQ_INT32 cols,
+                  const KisCompositeOp& op)
+{
+    if (rows <= 0 || cols <= 0)
+        return;
+
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+
+    TQ_INT32 linesize = pixelSize() * cols;
+    d = dst;
+    s = src;
+
+    // Do as if we 'stack' them atop of each other
+    if (op == COMPOSITE_OVER) {
+        while (rows-- > 0) {
+            for (int i = 0; i < cols; i++) {
+                WetPack* dstPack = &(reinterpret_cast<WetPack*>(d))[i];
+                const WetPack* srcPack = &(reinterpret_cast<const WetPack*>(s))[i];
+                combinePixels(&(dstPack->paint), &(dstPack->paint), &(srcPack->paint));
+                combinePixels(&(dstPack->adsorb), &(dstPack->adsorb), &(srcPack->adsorb));
+            }
+            d += dstRowSize; // size??
+            s += srcRowStride;
+        }
+
+        return;
+    }
+
+    // Just copy the src onto the dst, we don't do fancy things here,
+    // we do those in the paint op, because we need pressure to determine
+    // paint deposition.
+
+    while (rows-- > 0) {
+        memcpy(d, s, linesize);
+        d += dstRowSize; // size??
+        s += srcRowStride;
+    }
+}
+
+void KisWetColorSpace::wet_init_render_tab()
+{
+    int i;
+
+    double d;
+    int a, b;
+
+    wet_render_tab = new  TQ_UINT32[4096];
+    Q_CHECK_PTR(wet_render_tab);
+
+    for (i = 0; i < 4096; i++)
+    {
+        d = i * (1.0 / 512.0);
+
+        if (i == 0)
+            a = 0;
+        else
+            a = (int) floor (0xff00 / i + 0.5);
+
+        b = (int) floor (0x8000 * exp (-d) + 0.5);
+        wet_render_tab[i] = (a << 16) | b;
+    }
+
+}
+
+void KisWetColorSpace::wet_composite(RGBMode m, TQ_UINT8 *rgb, WetPix * wet)
+{
+    int r, g, b;
+    int d, w;
+    int ab;
+    int wa;
+
+    if (m == RGB)
+        r = rgb[0];
+    else
+        r = rgb[2];
+    w = wet[0].rw >> 4;
+    d = wet[0].rd >> 4;
+
+    ab = wet_render_tab[d];
+
+    wa = (w * (ab >> 16) + 0x80) >> 8;
+    r = wa + (((r - wa) * (ab & 0xffff) + 0x4000) >> 15);
+    if (m == RGB)
+        rgb[0] = r;
+    else
+        rgb[2] = r;
+
+    // Green is 1 both in RGB as BGR
+    g = rgb[1];
+    w = wet[0].gw >> 4;
+    d = wet[0].gd >> 4;
+    d = d >= 4096 ? 4095 : d;
+    ab = wet_render_tab[d];
+    wa = (w * (ab >> 16) + 0x80) >> 8;
+    g = wa + (((g - wa) * (ab & 0xffff) + 0x4000) >> 15);
+    rgb[1] = g;
+
+    if (m == RGB)
+        b = rgb[2];
+    else
+        b = rgb[0];
+    w = wet[0].bw >> 4;
+    d = wet[0].bd >> 4;
+    d = d >= 4096 ? 4095 : d;
+    ab = wet_render_tab[d];
+    wa = (w * (ab >> 16) + 0x80) >> 8;
+    b = wa + (((b - wa) * (ab & 0xffff) + 0x4000) >> 15);
+    if (m == RGB)
+        rgb[2] = b;
+    else
+        rgb[0] = b;
+}
+
+void KisWetColorSpace::wet_render_wetness( TQ_UINT8 * rgb, WetPack * pack)
+{
+    int highlight = 255 - (pack->paint.w >> 1);
+
+    if (highlight < 255 && ((phase++) % 3 == 0)) {
+        for (int i = 0; i < 3; i++)
+            rgb[i] = 255 - (((255 - rgb[i]) * highlight) >> 8);
+    }
+    phase &= 3;
+}
+
+KisCompositeOpList KisWetColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+
+    return list;
+}
+
+TQString KisWetColorSpace::channelValueText(const TQ_UINT8 *U8_pixel,  TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < nChannels());
+    const TQ_UINT16 *pixel = reinterpret_cast<const TQ_UINT16 *>(U8_pixel);
+     TQ_UINT32 channelPosition = m_channels[channelIndex]->pos();
+
+    return TQString().setNum(pixel[channelPosition]);
+}
+
+TQString KisWetColorSpace::normalisedChannelValueText(const TQ_UINT8 *U8_pixel,  TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < nChannels());
+    const TQ_UINT16 *pixel = reinterpret_cast<const TQ_UINT16 *>(U8_pixel);
+     TQ_UINT32 channelPosition = m_channels[channelIndex]->pos();
+
+    return TQString().setNum(static_cast<float>(pixel[channelPosition]) / UINT16_MAX);
+}
+
+TQValueList<KisFilter *> KisWetColorSpace::createBackgroundFilters()
+{
+    TQValueList<KisFilter *> filterList;
+    KisFilter * f = new WetPhysicsFilter();
+    filterList << f;
+    return filterList;
+}
diff --git a/chalk/colorspaces/wet/kis_wet_colorspace.h b/chalk/colorspaces/wet/kis_wet_colorspace.h
new file mode 100644
index 000000000..0523bf970
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_wet_colorspace.h
@@ -0,0 +1,219 @@
+/*
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_STRATEGY_COLORSPACE_WET_H_
+#define KIS_STRATEGY_COLORSPACE_WET_H_
+
+#include <tqcolor.h>
+#include <tqstringlist.h>
+#include <tqvaluelist.h>
+#include <tqmap.h>
+
+#include "kis_global.h"
+#include "kis_abstract_colorspace.h"
+
+class KisFilter;
+
+/**
+ * The wet colourspace is one of the more complicated colour spaces. Every
+ * pixel actually consists of two pixels: the paint pixel and the adsorbtion
+ * pixel. This corresponds to the two layers of the wetpack structure in the
+ * original wetdreams code by Raph Levien.
+ */
+
+// XXX: This should really be in a namespace.
+
+typedef struct _WetPix WetPix;
+typedef struct _WetPixDbl WetPixDbl;
+typedef struct _WetPack WetPack;
+
+/*
+    * White is made up of myth-red, myth-green, and myth-blue. Myth-red
+    * looks red when viewed reflectively, but cyan when viewed
+    * transmissively (thus, it vaguely resembles a dichroic
+    * filter). Myth-red over black is red, and myth-red over white is
+    * white.
+    *
+    * Total red channel concentration is myth-red concentration plus
+    * cyan concentration.
+    */
+
+struct _WetPix {
+    TQ_UINT16 rd;  /*  Total red channel concentration */
+    TQ_UINT16 rw;  /*  Myth-red concentration */
+
+    TQ_UINT16 gd;  /*  Total green channel concentration */
+    TQ_UINT16 gw;  /*  Myth-green concentration */
+
+    TQ_UINT16 bd;  /*  Total blue channel concentration */
+    TQ_UINT16 bw;  /*  Myth-blue concentration */
+
+    TQ_UINT16 w;   /*  Water volume */
+    TQ_UINT16 h;   /*  Height of paper surface XXX: This might just as well be a single
+                      channel in our colour model that has two of
+                      these wetpix structs for every paint device pixels*/
+};
+
+struct _WetPack {
+    WetPix paint;  /* Paint layer */
+    WetPix adsorb; /* Adsorbtion layer */
+};
+
+struct _WetPixDbl {
+    double rd;  /*  Total red channel concentration */
+    double rw;  /*  Myth-red concentration */
+    double gd;  /*  Total green channel concentration */
+    double gw;  /*  Myth-green concentration */
+    double bd;  /*  Total blue channel concentration */
+    double bw;  /*  Myth-blue concentration */
+    double w;   /*  Water volume */
+    double h;   /*  Height of paper surface */
+};
+
+
+
+void wetPixToDouble(WetPixDbl * dst, WetPix *src);
+void wetPixFromDouble(WetPix * dst, WetPixDbl *src);
+
+
+class KisWetColorSpace : public KisAbstractColorSpace {
+public:
+    KisWetColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p);
+    virtual ~KisWetColorSpace();
+
+
+    virtual bool willDegrade(ColorSpaceIndependence independence)
+        {
+            if (independence == TO_RGBA8 || independence == TO_LAB16)
+                return true;
+            else
+                return false;
+        };
+
+
+
+
+public:
+
+    // Semi-clever: we have only fifteen wet paint colors that are mapped to the
+    // qcolors that are put in the painter by the special wet paint palette. Other
+    // TQColors are mapped to plain water...
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile * profile = 0);
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * profile = 0);
+
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * profile = 0);
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile = 0);
+
+    virtual TQ_UINT8 getAlpha(const TQ_UINT8 * pixel) const;
+    virtual void setAlpha( TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const;
+    virtual void multiplyAlpha( TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels);
+
+    virtual void applyAlphaU8Mask( TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+    virtual void applyInverseAlphaU8Mask( TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+
+    virtual TQ_UINT8 scaleToU8(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+    virtual TQ_UINT16 scaleToU16(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights,  TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual  TQ_UINT32 nChannels() const;
+    virtual  TQ_UINT32 nColorChannels() const;
+    virtual  TQ_UINT32 nSubstanceChannels() const;
+    virtual  TQ_UINT32 pixelSize() const;
+
+    virtual TQString channelValueText(const TQ_UINT8 *pixel,  TQ_UINT32 channelIndex) const;
+    virtual TQString normalisedChannelValueText(const TQ_UINT8 *pixel,  TQ_UINT32 channelIndex) const;
+
+    virtual TQImage convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                       KisProfile *  dstProfile,
+                       TQ_INT32 renderingIntent = INTENT_PERCEPTUAL,
+                       float exposure = 0.0f);
+
+    virtual TQValueList<KisFilter*> createBackgroundFilters();
+    
+    virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+    void setPaintWetness(bool b) { m_paintwetness = b; } // XXX this needs better design!
+    bool paintWetness() { return m_paintwetness; }
+    void resetPhase() { phase = phasebig++; phasebig &= 3; }
+
+    void combinePixels(WetPix* dst, WetPix const* src1, WetPix const* src2) const {
+        dst->rd = src1->rd + src2->rd;
+        dst->rw = src1->rw + src2->rw;
+        dst->gd = src1->gd + src2->gd;
+        dst->gw = src1->gw + src2->gw;
+        dst->bd = src1->bd + src2->bd;
+        dst->bw = src1->bw + src2->bw;
+        dst->w = src1->w + src2->w;
+    }
+protected:
+    virtual void bitBlt( TQ_UINT8 *dst,
+            TQ_INT32 dstRowSize,
+            const TQ_UINT8 *src,
+            TQ_INT32 srcRowStride,
+            const TQ_UINT8 *srcAlphaMask,
+            TQ_INT32 tqmaskRowStride,
+            TQ_UINT8 opacity,
+            TQ_INT32 rows,
+            TQ_INT32 cols,
+            const KisCompositeOp& op);
+private:
+
+    // This was static, but since we have only one instance of the color strategy,
+    // it can be just as well a private member variable.
+    void wet_init_render_tab();
+
+    /// Convert a single pixel from its wet representation to rgb: internal rgb: rgb[0] = R, etc
+    typedef enum { RGB, BGR } RGBMode;
+    void wet_composite(RGBMode m, TQ_UINT8 *rgb, WetPix * wet);
+
+    void wet_render_wetness( TQ_UINT8 * rgb, WetPack * pack);
+
+private:
+     TQ_UINT32 * wet_render_tab;
+
+    TQStringList m_paintNames;
+    TQMap<int, WetPix> m_conversionMap;
+
+    bool m_paintwetness;
+    int phase, phasebig;
+
+};
+
+class KisWetColorSpaceFactory : public KisColorSpaceFactory
+{
+public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+    virtual KisID id() const { return KisID("WET", i18n("Watercolors")); };
+
+    /**
+     * lcms colorspace type definition.
+     */
+    virtual  TQ_UINT32 colorSpaceType() { return 0; };
+
+    virtual icColorSpaceSignature colorSpaceSignature() { return icMaxEnumData; };
+
+    virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisWetColorSpace(tqparent, p); };
+
+    virtual TQString defaultProfile() { return ""; };
+};
+
+#endif // KIS_STRATEGY_COLORSPACE_WET_H_
diff --git a/chalk/colorspaces/wet/kis_wet_palette_widget.cc b/chalk/colorspaces/wet/kis_wet_palette_widget.cc
new file mode 100644
index 000000000..eb6556d27
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_wet_palette_widget.cc
@@ -0,0 +1,245 @@
+/*
+ * This file is part of Chalk
+ *
+ * Copyright (c) 1999 Matthias Elter (me@kde.org)
+ * Copyright (c) 2001-2002 Igor Jansen (rm@kde.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include <tqpushbutton.h>
+#include <tqapplication.h>
+#include <tqclipboard.h>
+#include <tqcolor.h>
+#include <tqdrawutil.h>
+#include <tqhbox.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqpainter.h>
+#include <tqspinbox.h>
+#include <tqstyle.h>
+#include <tqtooltip.h>
+
+#include <klocale.h>
+#include <knuminput.h>
+#include <koFrameButton.h>
+
+#include <kis_meta_registry.h>
+#include <kis_factory.h>
+#include <kis_canvas_subject.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_color.h>
+#include <kis_color_cup.h>
+
+#include "kis_wet_colorspace.h"
+#include "kis_wet_palette_widget.h"
+
+KisWetPaletteWidget::KisWetPaletteWidget(TQWidget *tqparent, const char *name) : super(tqparent, name)
+{
+    m_subject = 0;
+
+    TQVBoxLayout * vl = new TQVBoxLayout(this, 0, -1, "main tqlayout");
+
+    TQGridLayout * l = new TQGridLayout(vl, 2, 8, 2, "color wells grid");
+
+    KisColorCup * b;
+    int WIDTH = 24;
+    int HEIGHT = 24;
+
+    b = new KisColorCup(this);
+    b->setColor( TQColor(240, 32, 160) );
+    l->addWidget(b, 0, 0);
+    TQToolTip::add(b, i18n("Quinacridone Rose"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(159, 88, 43));
+    l->addWidget(b, 0, 1);
+    TQToolTip::add(b,i18n("Indian Red"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor( TQColor(254, 220, 64) );
+    l->addWidget(b, 0, 2);
+    TQToolTip::add(b,i18n("Cadmium Yellow"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(36, 180, 32));
+    l->addWidget(b, 0, 3);
+    TQToolTip::add(b,i18n("Hookers Green"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(16, 185, 215));
+    l->addWidget(b, 0, 4);
+    TQToolTip::add(b,i18n("Cerulean Blue"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(96, 32, 8));
+    l->addWidget(b, 0, 5);
+    TQToolTip::add(b,i18n("Burnt Umber"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(254, 96, 8));
+    l->addWidget(b, 0, 6);
+    TQToolTip::add(b,i18n("Cadmium Red"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(255, 136, 8));
+    l->addWidget(b, 0, 7);
+    TQToolTip::add(b,i18n("Brilliant Orange"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(240, 199, 8));
+    l->addWidget(b, 1, 0);
+    TQToolTip::add(b,i18n("Hansa Yellow"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(96, 170, 130));
+    l->addWidget(b, 1, 1);
+    TQToolTip::add(b,i18n("Phthalo Green"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(48, 32, 170));
+    l->addWidget(b, 1, 2);
+    TQToolTip::add(b,i18n("French Ultramarine"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(118, 16, 135));
+    l->addWidget(b, 1, 3);
+    TQToolTip::add(b,i18n("Interference Lilac"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(254, 254, 254));
+    l->addWidget(b, 1, 4);
+    TQToolTip::add(b,i18n("Titanium White"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(64, 64, 74));
+    l->addWidget(b, 1, 5);
+    TQToolTip::add(b,i18n("Ivory Black"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    b = new KisColorCup(this);
+    b->setColor(TQColor(255, 255, 255));
+    l->addWidget(b, 1, 6);
+    TQToolTip::add(b,i18n("Pure Water"));
+    b->setFixedSize(WIDTH, HEIGHT);
+    connect(b, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotFGColorSelected(const TQColor &)));
+
+    TQGridLayout * g2 = new TQGridLayout(vl, 2, 2);
+    
+    TQLabel * label = new TQLabel(i18n("Paint strength:"), this);
+    g2->addWidget(label, 0, 0);
+    m_strength = new KDoubleNumInput(0.0, 2.0, 1.0, 0.1, 1, this);
+    m_strength->setRange(0.0, 2.0, 0.1, true);
+    connect(m_strength, TQT_SIGNAL(valueChanged(double)), this,  TQT_SLOT(slotStrengthChanged(double)));
+    g2->addWidget(m_strength, 0, 1);
+
+    label = new TQLabel(i18n("Wetness:"), this);
+    g2->addWidget(label, 1, 0);
+    m_wetness = new KIntNumInput(16, this);
+    connect(m_wetness, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotWetnessChanged(int)));
+    m_wetness->setRange(0, 16, true);
+    g2->addWidget(m_wetness, 1, 1);
+
+    g2->addItem(new TQSpacerItem(1, 1, TQSizePolicy::Expanding, TQSizePolicy::Minimum));
+
+}
+
+void KisWetPaletteWidget::update(KisCanvasSubject *subject)
+{
+    m_subject = subject;
+
+}
+
+void KisWetPaletteWidget::slotFGColorSelected(const TQColor& c)
+{
+    KisWetColorSpace* cs = dynamic_cast<KisWetColorSpace*>(KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("WET", ""), ""));
+     Q_ASSERT(cs);
+
+    WetPack pack;
+    TQ_UINT8* data = reinterpret_cast< TQ_UINT8*>(&pack);
+    cs->fromTQColor(c, data);
+    pack.paint.w = 15 * m_wetness->value();
+    // upscale from double to uint16:
+    pack.paint.h = static_cast< TQ_UINT16>(m_strength->value() * (double)(0xffff/2));
+    KisColor color(data, cs);
+
+    if(m_subject)
+        m_subject->setFGColor(color);
+}
+
+void KisWetPaletteWidget::slotWetnessChanged(int n)
+{
+    if (!m_subject)
+        return;
+
+    KisWetColorSpace* cs = dynamic_cast<KisWetColorSpace*>(KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("WET", ""), ""));
+     Q_ASSERT(cs);
+
+    KisColor color = m_subject->fgColor();
+    color.convertTo(cs);
+    WetPack pack = *(reinterpret_cast<WetPack*>(color.data()));
+    pack.paint.w = 15 * n;
+
+    color.setColor(reinterpret_cast<  TQ_UINT8*>(&pack), cs);
+    m_subject->setFGColor(color);
+}
+
+void KisWetPaletteWidget::slotStrengthChanged(double n)
+{
+    if (!m_subject)
+        return;
+
+    KisWetColorSpace* cs = dynamic_cast<KisWetColorSpace*>(
+            KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("WET", ""), ""));
+     Q_ASSERT(cs);
+
+    KisColor color = m_subject->fgColor();
+    color.convertTo(cs);
+    WetPack pack = *(reinterpret_cast<WetPack*>(color.data()));
+    pack.paint.h = static_cast< TQ_UINT16>(n * (double)(0xffff/2)); // upscale from double to uint16
+
+    color.setColor(reinterpret_cast<  TQ_UINT8*>(&pack), cs);
+    m_subject->setFGColor(color);
+}
+
+
+#include "kis_wet_palette_widget.moc"
diff --git a/chalk/colorspaces/wet/kis_wet_palette_widget.h b/chalk/colorspaces/wet/kis_wet_palette_widget.h
new file mode 100644
index 000000000..10c177e6a
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_wet_palette_widget.h
@@ -0,0 +1,68 @@
+/* This file is part of the KDE project
+ *
+ * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_WET_PALETTE_WIDGET_H
+#define KIS_WET_PALETTE_WIDGET_H
+
+#include "tqwidget.h"
+#include "tqpushbutton.h"
+
+#include "kis_canvas_subject.h"
+#include "kis_canvas_observer.h"
+
+#include <koffice_export.h>
+
+class KoFrameButton;
+class TQGridLayout;
+class TQColor;
+class TQLabel;
+class TQSpinBox;
+class TQColor;
+class KIntNumInput;
+class KDoubleNumInput;
+
+class KRITAUI_EXPORT KisWetPaletteWidget
+     : public TQWidget,
+       public KisCanvasObserver
+{
+     Q_OBJECT
+  TQ_OBJECT
+    typedef TQWidget super;
+
+public:
+    KisWetPaletteWidget(TQWidget *tqparent = 0L, const char *name = 0);
+    virtual ~KisWetPaletteWidget() {}
+
+protected slots:
+
+    void slotFGColorSelected(const TQColor& c);
+    void slotWetnessChanged(int);
+    void slotStrengthChanged(double);
+
+private:
+    void update(KisCanvasSubject*);
+
+private:
+    KisCanvasSubject *m_subject;
+    KDoubleNumInput* m_strength;
+    KIntNumInput* m_wetness;
+
+
+};
+
+#endif
diff --git a/chalk/colorspaces/wet/kis_wetness_visualisation_filter.cc b/chalk/colorspaces/wet/kis_wetness_visualisation_filter.cc
new file mode 100644
index 000000000..853b11a25
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_wetness_visualisation_filter.cc
@@ -0,0 +1,77 @@
+/*
+ * kis_wetness_visualisation_filter.cc -- Part of Chalk
+ *
+ * Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kdebug.h>
+
+#include <klocale.h>
+#include "kis_meta_registry.h"
+#include <kis_view.h>
+#include <kis_image.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_factory.h>
+#include "kis_wet_colorspace.h"
+#include <kis_debug_areas.h>
+#include "kis_wetness_visualisation_filter.h"
+
+WetnessVisualisationFilter::WetnessVisualisationFilter(KisView* view)
+    : m_view(view), m_action(0) {
+    connect(&m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotTimeout()));
+}
+
+// XXX this needs to work on a per-layer basis!
+
+void WetnessVisualisationFilter::setAction(KToggleAction* action) {
+    m_action = action;
+    if (!m_action)
+        return;
+    KisWetColorSpace* cs = dynamic_cast<KisWetColorSpace*>(
+            KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("WET", ""),"") );
+     Q_ASSERT(cs);
+    m_action->setChecked(cs->paintWetness());
+}
+
+void WetnessVisualisationFilter::slotActivated() {
+    kdDebug(DBG_AREA_CMS) << "activated" << endl;
+    if (!m_action) {
+        kdDebug(DBG_AREA_CMS) << "no action" << endl;
+        return;
+    }
+    KisWetColorSpace* cs = dynamic_cast<KisWetColorSpace*>(
+            KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("WET", ""),"") );
+     Q_ASSERT(cs);
+    if (!m_action->isChecked()) {
+        m_timer.stop();
+        cs->setPaintWetness(false);
+    } else {
+        m_timer.start(500);
+        cs->setPaintWetness(true);
+    }
+}
+
+void WetnessVisualisationFilter::slotTimeout() {
+    KisWetColorSpace* cs = dynamic_cast<KisWetColorSpace*>(
+            KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("WET", ""),"") );
+     Q_ASSERT(cs);
+    if (!cs) return;
+    cs->resetPhase();
+
+}
+
+#include "kis_wetness_visualisation_filter.moc"
diff --git a/chalk/colorspaces/wet/kis_wetness_visualisation_filter.h b/chalk/colorspaces/wet/kis_wetness_visualisation_filter.h
new file mode 100644
index 000000000..979d580ce
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_wetness_visualisation_filter.h
@@ -0,0 +1,51 @@
+/* 
+ * kis_wetness_visualisation_filter.h -- Part of Chalk
+ *
+ * Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _WETNESS_VISUALISATION_FILTER_H
+#define _WETNESS_VISUALISATION_FILTER_H
+
+#include <tqobject.h>
+#include <tqtimer.h>
+#include <kactionclasses.h>
+
+class KisView;
+
+class WetnessVisualisationFilter : public TQObject
+{
+ Q_OBJECT
+  TQ_OBJECT
+public:
+    WetnessVisualisationFilter(KisView* view);
+    virtual ~WetnessVisualisationFilter() {}
+    void setAction(KToggleAction* action);
+    // XXX: Figure out a way to match a filter exactly to a colorspace
+    virtual ColorSpaceIndependence colorSpaceIndependence() { return FULLY_INDEPENDENT; };
+    virtual bool workWith(KisColorSpace* cs) { return (cs->id() == KisID("WET")); };
+private slots:
+    void slotActivated();
+    void slotTimeout();
+
+private:
+    KisView * m_view;
+    KToggleAction * m_action;
+    TQTimer m_timer;
+};
+
+#endif // _WETNESS_VISUALISATION_FILTER_H
diff --git a/chalk/colorspaces/wet/kis_wetop.cc b/chalk/colorspaces/wet/kis_wetop.cc
new file mode 100644
index 000000000..70e072809
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_wetop.cc
@@ -0,0 +1,230 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <tqrect.h>
+#include <tqcheckbox.h>
+
+#include <kdebug.h>
+
+#include <kis_brush.h>
+#include <kis_debug_areas.h>
+#include <kis_paint_device.h>
+#include <kis_painter.h>
+#include <kis_types.h>
+#include <kis_paintop.h>
+#include <kis_iterators_pixel.h>
+#include <kis_layer.h>
+#include <kis_meta_registry.h>
+#include <kis_colorspace_factory_registry.h>
+#include "kis_input_device.h"
+
+#include "kis_wetop.h"
+#include "kis_wet_colorspace.h"
+
+KisWetOpSettings::KisWetOpSettings(TQWidget *tqparent)
+    : super(tqparent)
+{
+    m_options = new WetPaintOptions(tqparent, "wet option widget");
+}
+
+bool KisWetOpSettings::varySize() const
+{
+    return m_options->checkSize->isChecked();
+}
+
+bool KisWetOpSettings::varyWetness() const
+{
+    return m_options->checkWetness->isChecked();
+}
+
+bool KisWetOpSettings::varyStrength() const
+{
+    return m_options->checkStrength->isChecked();
+}
+
+KisPaintOp * KisWetOpFactory::createOp(const KisPaintOpSettings *settings, KisPainter * painter)
+{
+    const KisWetOpSettings *wetopSettings = dynamic_cast<const KisWetOpSettings *>(settings);
+     Q_ASSERT(settings == 0 || wetopSettings != 0);
+
+    KisPaintOp * op = new KisWetOp(wetopSettings, painter);
+     Q_CHECK_PTR(op);
+    return op;
+}
+
+KisPaintOpSettings* KisWetOpFactory::settings(TQWidget * tqparent, const KisInputDevice& inputDevice)
+{
+    if (inputDevice == KisInputDevice::mouse()) {
+        // No options for mouse, only tablet devices
+        return 0;
+    } else {
+        return new KisWetOpSettings(tqparent);
+    }
+}
+
+KisWetOp::KisWetOp(const KisWetOpSettings * settings, KisPainter * painter)
+    : super(painter)
+{
+    if (settings) {
+        m_size = settings->varySize();
+        m_wetness = settings->varyWetness();
+        m_strength = settings->varyStrength();
+    } else {
+        m_size = false;
+        m_wetness = false;
+        m_strength = false;
+    }
+}
+
+KisWetOp::~KisWetOp()
+{
+}
+
+void KisWetOp::paintAt(const KisPoint &pos, const KisPaintInformation& info)
+{
+    if (!m_painter) return;
+
+    if (!m_painter->device()) return;
+    KisPaintDeviceSP device = m_painter->device();
+    if (!m_painter->device()) return;
+
+    KisBrush *brush = m_painter->brush();
+     Q_ASSERT(brush);
+
+    if (! brush->canPaintFor(info) )
+        return;
+
+    KisPaintInformation inf(info);
+
+    if (!m_size)
+        inf.pressure = PRESSURE_DEFAULT;
+
+    KisPaintDeviceSP dab = 0;
+
+    if (brush->brushType() == IMAGE || brush->brushType() == PIPE_IMAGE) {
+        dab = brush->image(KisMetaRegistry::instance()->csRegistry()->getAlpha8(), inf);
+    }
+    else {
+        KisAlphaMaskSP tqmask = brush->tqmask(inf);
+        dab = computeDab(tqmask, KisMetaRegistry::instance()->csRegistry()->getAlpha8());
+    }
+
+    KisColorSpace * cs = device->colorSpace();
+
+    if (cs->id() != KisID("WET","")) {
+        kdDebug(DBG_AREA_CMS) << "You cannot paint wet paint on dry pixels.\n";
+        return;
+    }
+
+    KisColor paintColor = m_painter->paintColor();
+    paintColor.convertTo(cs);
+    // hopefully this does
+    // nothing, conversions are bad ( wet->rgb->wet gives horrible mismatches, due to
+    // the conversion to rgb actually rendering the paint above white
+
+    WetPack* paintPack = reinterpret_cast<WetPack*>(paintColor.data());
+    WetPix paint = paintPack->paint;
+
+    // Get the paint info (we store the strength in the otherwise unused (?) height field of
+    // the paint
+    // double wetness = paint.w; // XXX: Was unused
+    // strength is a double in the 0 - 2 range, but upscaled to TQ_UINT16:
+    //kdDebug() << "Original strength as in paint.h: " << paint.h << endl;
+
+    double strength = 2.0 * static_cast<double>(paint.h) / (double)(0xffff);
+
+    //kdDebug() << "Before strength: " << strength << endl;
+
+    if (m_strength)
+        strength = strength * (strength + info.pressure) * 0.5;
+    else
+        strength = strength * (strength + PRESSURE_DEFAULT) * 0.5;
+
+    double pressure = 0.75 + 0.25 * info.pressure;
+
+    //kdDebug() << "info.pressure " << info.pressure << ", local pressure: " << pressure << ", strength: " << strength << endl;
+
+    WetPack currentPack;
+    WetPix currentPix;
+    double eff_height;
+    double press, contact;
+
+    int tqmaskW = brush->tqmaskWidth(inf);
+    int tqmaskH = brush->tqmaskHeight(inf);
+    KoPoint dest = (pos - (brush->hotSpot(inf)));
+    int xStart = (int)dest.x();
+    int yStart = (int)dest.y();
+
+    for (int y = 0; y < tqmaskH; y++) {
+        KisHLineIteratorPixel dabIt = dab->createHLineIterator(0, y, tqmaskW, false);
+        KisHLineIteratorPixel it = device->createHLineIterator(xStart, yStart+y, tqmaskW, true);
+
+        while (!dabIt.isDone()) {
+            // This only does something with .paint, and not with adsorb.
+            currentPack = *(reinterpret_cast<WetPack*>(it.rawData()));
+            WetPix currentData = currentPack.adsorb;
+            currentPix = currentPack.paint;
+
+            // Hardcoded threshold for the dab 'strength': above it, it will get painted
+            if (*dabIt.rawData() > 125)
+                press = pressure * 0.25;
+            else
+                press = -1;
+            //kdDebug() << "After mysterious line, press becomes: " << press << ", this is the same as in the orignal. Good" << endl;
+            // XXX - 192 is probably only useful for paper with a texture...
+            eff_height = (currentData.h + currentData.w - 192.0) * (1.0 / 255.0);
+            contact = (press + eff_height) * 0.2;
+            double old_contact = contact;
+            if (contact > 0.5)
+                contact = 1.0 - 0.5 * exp(-2.0 * contact - 1.0);
+
+            //kdDebug() << "Contact was " << old_contact << " and has become: " << contact << endl;
+            if (contact > 0.0001) {
+                int v;
+                double rnd = rand() * (1.0 / RAND_MAX);
+
+                v = currentPix.rd;
+                currentPix.rd = floor(v + (paint.rd * strength - v) * contact + rnd);
+                //kdDebug() << "Rd was " << v << " and has become " << currentPix.rd << endl;
+                v = currentPix.rw;
+                currentPix.rw = floor(v + (paint.rw * strength - v) * contact + rnd);
+                v = currentPix.gd;
+                currentPix.gd = floor(v + (paint.gd * strength - v) * contact + rnd);
+                v = currentPix.gw;
+                currentPix.gw = floor(v + (paint.gw * strength - v) * contact + rnd);
+                v = currentPix.bd;
+                currentPix.bd = floor(v + (paint.bd * strength - v) * contact + rnd);
+                v = currentPix.bw;
+                currentPix.bw = floor(v + (paint.bw * strength - v) * contact + rnd);
+                v = currentPix.w;
+                if (m_wetness)
+                    currentPix.w = (CLAMP(floor(
+                          v + (paint.w * (0.5 + pressure) - v) * contact + rnd), 0, 512));
+                else
+                    currentPix.w = floor(v + (paint.w - v) * contact + rnd);
+
+                currentPack.paint = currentPix;
+                *(reinterpret_cast<WetPack*>(it.rawData())) = currentPack;
+            }
+            ++dabIt;
+            ++it;
+        }
+    }
+
+    m_painter->addDirtyRect(TQRect(xStart, yStart, tqmaskW, tqmaskH));
+}
diff --git a/chalk/colorspaces/wet/kis_wetop.h b/chalk/colorspaces/wet/kis_wetop.h
new file mode 100644
index 000000000..37cd594aa
--- /dev/null
+++ b/chalk/colorspaces/wet/kis_wetop.h
@@ -0,0 +1,73 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_WETOP_H_
+#define KIS_WETOP_H_
+
+#include "kis_paintop.h"
+#include "kis_types.h"
+#include "kis_colorspace.h"
+#include "wdgpressure.h"
+
+class KisPoint;
+class KisPainter;
+class KisInputDevice;
+
+class KisWetOpFactory : public KisPaintOpFactory  {
+public:
+    KisWetOpFactory() {}
+    virtual ~KisWetOpFactory() {}
+
+    virtual KisPaintOp * createOp(const KisPaintOpSettings *settings, KisPainter * painter);
+    virtual KisID id() { return KisID("wetbrush", i18n("Watercolor Brush")); }
+    virtual bool userVisible(KisColorSpace* cs) { return cs->id() == KisID("WET", ""); }
+    virtual KisPaintOpSettings *settings(TQWidget * tqparent, const KisInputDevice& inputDevice);
+};
+
+class KisWetOpSettings : public KisPaintOpSettings {
+    typedef KisPaintOpSettings super;
+public:
+    KisWetOpSettings(TQWidget *tqparent);
+
+    bool varySize() const;
+    bool varyWetness() const;
+    bool varyStrength() const;
+
+    virtual TQWidget *widget() const { return m_options; }
+
+private:
+    WetPaintOptions *m_options;
+};
+
+class KisWetOp : public KisPaintOp {
+
+    typedef KisPaintOp super;
+    bool m_size;
+    bool m_wetness;
+    bool m_strength;
+
+public:
+
+    KisWetOp(const KisWetOpSettings *settings, KisPainter * painter);
+    virtual ~KisWetOp();
+
+    void paintAt(const KisPoint &pos, const KisPaintInformation& info);
+
+};
+
+#endif // KIS_WETOP_H_
diff --git a/chalk/colorspaces/wet/todo b/chalk/colorspaces/wet/todo
new file mode 100644
index 000000000..2f6d358b7
--- /dev/null
+++ b/chalk/colorspaces/wet/todo
@@ -0,0 +1,24 @@
+* Implement wet model
+* Implement wet paintop
+* Implement dry filter
+* Enable/disable all relevant gui bits on switching to/from a wet layer
+* Create something that can periodically call the dry filter
+* A palette with the special colour for wet painting: a docker tab for the colour docker.
+
+Perhaps: a special layer type or paint device, with an extensible option widget.
+
+When to create the height field? Ideally, the height field should be visualized in subtle shades
+of grey before painting.
+
+How to hack into the creation of paint devices? We need initializers, extra options, status
+widgets and thread or timer based continuous running filters.
+
+-> Maybe add an initializePaintDevice(rect) method to the color strategy that is called with the image
+rect on creation. Then, for uninitialized rects (because of autolayers extension) call the method again.
+
+A wet layer is equivalent to the wetpack; two layers, i.e., stacked pixels, per pixel.
+
+The filter will contain the physics model: paint flow, drying and adsorbing onto the lower "layer"
+
+
+
diff --git a/chalk/colorspaces/wet/wdgpressure.ui b/chalk/colorspaces/wet/wdgpressure.ui
new file mode 100644
index 000000000..96727ff19
--- /dev/null
+++ b/chalk/colorspaces/wet/wdgpressure.ui
@@ -0,0 +1,60 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>WetPaintOptions</class>
+<widget class="TQWidget">
+    <property name="name">
+        <cstring>WetPaintOptions</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>382</width>
+            <height>31</height>
+        </rect>
+    </property>
+    <hbox>
+        <property name="name">
+            <cstring>unnamed</cstring>
+        </property>
+        <property name="margin">
+            <number>0</number>
+        </property>
+        <widget class="TQLabel">
+            <property name="name">
+                <cstring>textLabel1</cstring>
+            </property>
+            <property name="text">
+                <string>Pressure effects:</string>
+            </property>
+        </widget>
+        <widget class="TQCheckBox">
+            <property name="name">
+                <cstring>checkSize</cstring>
+            </property>
+            <property name="text">
+                <string>Size</string>
+            </property>
+            <property name="checked">
+                <bool>true</bool>
+            </property>
+        </widget>
+        <widget class="TQCheckBox">
+            <property name="name">
+                <cstring>checkWetness</cstring>
+            </property>
+            <property name="text">
+                <string>Wetness</string>
+            </property>
+        </widget>
+        <widget class="TQCheckBox">
+            <property name="name">
+                <cstring>checkStrength</cstring>
+            </property>
+            <property name="text">
+                <string>Strength</string>
+            </property>
+        </widget>
+    </hbox>
+</widget>
+<tqlayoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/chalk/colorspaces/wet/wet_plugin.cc b/chalk/colorspaces/wet/wet_plugin.cc
new file mode 100644
index 000000000..1f65b83c9
--- /dev/null
+++ b/chalk/colorspaces/wet/wet_plugin.cc
@@ -0,0 +1,128 @@
+/*
+ * wet_plugin.cc -- Part of Chalk
+ *
+ * Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <stdlib.h>
+#include <vector>
+
+#include <tqobject.h>
+#include <tqapplication.h>
+#include <tqclipboard.h>
+#include <tqdockwindow.h>
+#include <tqpoint.h>
+#include <tqlabel.h>
+#include <tqwidget.h>
+
+#include <kactionclasses.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kinstance.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <ktempfile.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+
+#include <kopalettemanager.h>
+#include <KoMainWindow.h>
+
+#include <kis_debug_areas.h>
+#include "kis_meta_registry.h"
+#include <kis_factory.h>
+#include <kis_image.h>
+#include <kis_debug_areas.h>
+#include <kis_types.h>
+#include <kis_view.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_tool_registry.h>
+#include <kis_paintop_registry.h>
+#include <kis_canvas_subject.h>
+#include <kis_basic_histogram_producers.h>
+
+#include "wet_plugin.h"
+#include "kis_wet_palette_widget.h"
+#include "kis_wet_colorspace.h"
+#include "kis_wetop.h"
+#include "kis_wetness_visualisation_filter.h"
+#include "kis_texture_filter.h"
+#include "wetphysicsfilter.h"
+
+typedef KGenericFactory<WetPlugin> WetPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalkwetplugin, WetPluginFactory( "chalkcore" ) )
+
+
+WetPlugin::WetPlugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(WetPluginFactory::instance());
+
+    // This is not a gui plugin; only load it when the doc is created.
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") ) {
+        KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>(tqparent);
+
+        KisColorSpace* colorSpaceWet = new KisWetColorSpace(f, 0);
+
+        KisColorSpaceFactory * csf = new KisWetColorSpaceFactory();
+         Q_CHECK_PTR(colorSpaceWet);
+
+        // colorspace
+        f->add(csf);
+
+        // histogram producer
+        KisHistogramProducerFactoryRegistry::instance()->add(
+                new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
+                (KisID("WETHISTO", i18n("Wet")), colorSpaceWet) );
+
+        // wet brush op
+        KisPaintOpRegistry::instance()->add(new KisWetOpFactory);
+
+        // Dry filter
+        KisFilterRegistry::instance()->add( new WetPhysicsFilter() );
+
+        // Texture Action:
+        f->addPaintDeviceAction(colorSpaceWet, new WetPaintDevAction);
+    }
+    else if (tqparent->inherits("KisView"))
+    {
+        setInstance(WetPluginFactory::instance());
+        setXMLFile(locate("data","chalkplugins/wetplugin.rc"), true);
+
+        m_view = dynamic_cast<KisView*>(tqparent);
+        // Wetness visualisation
+        WetnessVisualisationFilter * wf = new WetnessVisualisationFilter(m_view);
+        wf->setAction(new KToggleAction(i18n("Wetness Visualisation"), 0, 0, wf,
+                        TQT_SLOT(slotActivated()), actionCollection(), "wetnessvisualisation"));
+
+        // Create the wet palette
+        KisWetPaletteWidget * w = new KisWetPaletteWidget(m_view);
+         Q_CHECK_PTR(w);
+
+        w->setCaption(i18n("Watercolors"));
+
+        m_view->canvasSubject()->paletteManager()->addWidget(w, "watercolor docker", chalk::COLORBOX, INT_MAX, PALETTE_DOCKER,  false);
+        m_view->canvasSubject()->attach(w);
+    }
+
+
+}
+
+WetPlugin::~WetPlugin()
+{
+}
+
+#include "wet_plugin.moc"
diff --git a/chalk/colorspaces/wet/wet_plugin.h b/chalk/colorspaces/wet/wet_plugin.h
new file mode 100644
index 000000000..d2fdc0837
--- /dev/null
+++ b/chalk/colorspaces/wet/wet_plugin.h
@@ -0,0 +1,46 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WET_PLUGIN_H_
+#define WET_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+#include "kis_types.h"
+
+class KisView;
+class KisWetColorSpace;
+
+/**
+ * A plugin wrapper around the WET colour space strategy.
+ */
+class WetPlugin : public KParts::Plugin
+{
+     Q_OBJECT
+  TQ_OBJECT
+public:
+    WetPlugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~WetPlugin();
+
+private:
+
+    KisView* m_view;
+
+};
+
+#endif // WET_PLUGIN_H_
diff --git a/chalk/colorspaces/wet/wetdreams/Makefile b/chalk/colorspaces/wet/wetdreams/Makefile
new file mode 100644
index 000000000..3daf4d767
--- /dev/null
+++ b/chalk/colorspaces/wet/wetdreams/Makefile
@@ -0,0 +1,6 @@
+CFLAGS = -O3 `gtk-config --cflags` -Wall -ansi -pedantic
+LDFLAGS = -O3 `gtk-config --libs` -Wall -ansi -pedantic
+
+all:	wetmain
+
+wetmain:	wetmain.o wetpix.o wetpaint.o wettexture.o wetphysics.o
diff --git a/chalk/colorspaces/wet/wetdreams/wetmain.c b/chalk/colorspaces/wet/wetdreams/wetmain.c
new file mode 100644
index 000000000..151385f5f
--- /dev/null
+++ b/chalk/colorspaces/wet/wetdreams/wetmain.c
@@ -0,0 +1,517 @@
+#include <gtk/gtk.h>
+#include <stdlib.h>
+#include <math.h>
+#include "wetpix.h"
+#include "wetpaint.h"
+#include "wettexture.h"
+#include "wetphysics.h"
+WetPack *pack;			/* The global wet pack */
+
+double lastx, lasty;
+double dist;
+double spacing = 2;
+
+WetPix paint = { 707, 0, 707, 0, 707, 0, 240, 0 };
+
+/* colors from Curtis et al, Siggraph 97 */
+
+WetPix paintbox[] = {
+	{496, 0, 16992, 0, 3808, 0, 0, 0},
+	{16992, 9744, 21712, 6400, 25024, 3296, 0, 0},
+	{6512, 6512, 6512, 4880, 11312, 0, 0, 0},
+	{16002, 0, 2848, 0, 16992, 0, 0, 0},
+	{22672, 0, 5328, 2272, 4288, 2640, 0, 0},
+	{8000, 0, 16992, 0, 28352, 0, 0, 0},
+	{5696, 5696, 12416, 2496, 28352, 0, 0, 0},
+	{0, 0, 5136, 0, 28352, 0, 0, 0},
+	{2320, 1760, 7344, 4656, 28352, 0, 0, 0},
+	{8000, 0, 3312, 0, 5504, 0, 0, 0},
+	{13680, 0, 16992, 0, 3312, 0, 0, 0},
+	{5264, 5136, 1056, 544, 6448, 6304, 0, 0},
+	{11440, 11440, 11440, 11440, 11440, 11440, 0, 0},
+	{11312, 0, 11312, 0, 11312, 0, 0, 0},
+	{0, 0, 0, 0, 0, 0, 0, 0}
+};
+
+int n_paints = 15;
+
+char *paintstr = "select paint";
+
+GtkWidget *paintname;
+
+char *paintnames[] = {
+	"Quinacridone Rose",
+	"Indian Red",
+	"Cadmium Yellow",
+	"Hookers Green",
+	"Cerulean Blue",
+	"Burnt Umber",
+	"Cadmium Red",
+	"Brilliant Orange",
+	"Hansa Yellow",
+	"Phthalo Green",
+	"French Ultramarine",
+	"Interference Lilac",
+	"Titanium White",
+	"Ivory Black",
+	"Pure Water"
+};
+
+GtkWidget *autodryb;
+int timo = 0;
+int adsorb_cnt;
+
+GtkObject *brushsize_adjust;
+
+GtkObject *wetness_adjust;
+
+GtkObject *strength_adjust;
+
+static void stop_drying(void)
+{
+	timo = 0;
+	gtk_label_set_text(GTK_LABEL(paintname), paintstr);
+}
+
+static double strength_func(double strength, double pressure)
+{
+	return strength * (strength + pressure) * 0.5;
+}
+
+static gint wet_button_press(GtkWidget * widget, GdkEventButton * event)
+{
+#define noVERBOSE
+#ifdef VERBOSE
+	g_print("button press %f %f %f\n", event->x, event->y,
+		event->pressure);
+
+#endif
+	wet_dab(pack->layers[1],
+		&paint,
+		event->x,
+		event->y,
+		((GtkAdjustment *) brushsize_adjust)->value *
+		event->pressure, 0.75 + 0.25 * event->pressure,
+		strength_func(((GtkAdjustment *) strength_adjust)->value,
+			      event->pressure));
+
+	lastx = event->x;
+	lasty = event->y;
+	dist = 0;
+
+	stop_drying();
+
+	gtk_widget_queue_draw(widget);
+	return TRUE;
+}
+
+static gint wet_motion(GtkWidget * widget, GdkEventMotion * event)
+{
+	double delta;
+#ifdef VERBOSE
+	g_print("motion %f %f %f %d\n", event->x, event->y,
+		event->pressure, event->state);
+
+#endif
+	stop_drying();
+
+	if (!(event->state & 256))
+		return TRUE;
+
+	delta = sqrt((event->x - lastx) * (event->x - lastx) +
+		     (event->y - lasty) * (event->y - lasty));
+
+	dist += delta;
+
+	if (dist >= spacing) {
+		/* todo: interpolate position and pressure of the dab */
+		wet_dab(pack->layers[1],
+			&paint,
+			event->x,
+			event->y,
+			((GtkAdjustment *) brushsize_adjust)->value *
+			event->pressure, 0.75 + 0.25 * event->pressure,
+			strength_func(((GtkAdjustment *) strength_adjust)->
+				      value, event->pressure));
+		gtk_widget_queue_draw(widget);
+		dist -= spacing;
+	}
+
+	lastx = event->x;
+	lasty = event->y;
+
+	return TRUE;
+}
+
+static void dry(GtkWidget * da)
+{
+	g_print("drying...");
+	gtk_label_set_text(GTK_LABEL(paintname), "drying...");
+	gtk_widget_draw(paintname, NULL);
+	gdk_flush();
+	wet_flow(pack->layers[1]);
+	adsorb_cnt++;
+	if (adsorb_cnt == 2) {
+		wet_adsorb(pack->layers[1], pack->layers[0]);
+		wet_dry(pack->layers[1]);
+		adsorb_cnt = 0;
+	}
+
+	gtk_widget_draw(da, NULL);
+#if 0
+	gtk_label_set_text(GTK_LABEL(paintname), paintstr);
+#endif
+	g_print("done\n");
+}
+
+static gint wet_dry_button_press(GtkWidget * widget, GtkWidget * da)
+{
+	dry(da);
+
+	timo = 0;
+
+	return TRUE;
+}
+
+static gint clear_button_press(GtkWidget * widget, GtkWidget * da)
+{
+	wet_layer_clear(pack->layers[0]);
+	wet_layer_clone_texture(pack->layers[0], pack->layers[1]);
+	wet_layer_clear(pack->layers[1]);
+	wet_layer_clone_texture(pack->layers[1], pack->layers[0]);
+
+	gtk_widget_draw(da, NULL);
+
+	stop_drying();
+
+	return TRUE;
+}
+
+static gint dry_timer(gpointer * dummy)
+{
+	GtkWidget *da = (GtkWidget *) dummy;
+
+	timo++;
+	if (timo >= 10) {
+		if (gtk_toggle_button_get_active
+		    (GTK_TOGGLE_BUTTON(autodryb))) {
+			dry(da);
+		}
+
+		timo -= 2;
+	}
+	return TRUE;
+}
+
+static gint
+wet_expose(GtkWidget * widget, GdkEventExpose * event, WetPack * pack)
+{
+	byte *rgb;
+	int rowstride;
+
+#ifdef VERBOSE
+	g_print("expose: %d layers\n", pack->n_layers);
+#endif
+
+	rowstride = event->area.width * 3;
+	rowstride = (rowstride + 3) & -4;	/* align to 4-byte boundary */
+	rgb = g_new(byte, event->area.height * rowstride);
+
+	wet_pack_render(rgb, rowstride,
+			pack,
+			event->area.x, event->area.y,
+			event->area.width, event->area.height);
+
+	gdk_draw_rgb_image(widget->window,
+			   widget->style->black_gc,
+			   event->area.x, event->area.y,
+			   event->area.width, event->area.height,
+			   GDK_RGB_DITHER_MAX, rgb, rowstride);
+
+	g_free(rgb);
+	return FALSE;
+}
+
+
+static void init_input(void)
+{
+	GList *tmp_list;
+	GdkDeviceInfo *info;
+
+	tmp_list = gdk_input_list_devices();
+
+	info = NULL;
+	while (tmp_list) {
+		info = (GdkDeviceInfo *) tmp_list->data;
+#ifdef VERBOSE
+		g_print("device: %s\n", info->name);
+#endif
+		if (!g_strcasecmp(info->name, "wacom") ||
+		    !g_strcasecmp(info->name, "stylus") ||
+		    !g_strcasecmp(info->name, "eraser")) {
+			gdk_input_set_mode(info->deviceid,
+					   GDK_MODE_SCREEN);
+		}
+		tmp_list = tmp_list->next;
+	}
+	if (!info)
+		return;
+}
+
+static gint
+pselect_expose(GtkWidget * widget, GdkEventExpose * event, WetPack * pack)
+{
+	byte *rgb;
+	int x;
+	int paint_quad, paint_num;
+	int last_pn;
+	int bg;
+
+#ifdef VERBOSE
+	g_print("expose: %d layers\n", pack->n_layers);
+#endif
+
+	rgb = g_new(byte, pack->layers[0]->width * 3);
+
+	last_pn = 0;
+	for (x = 0; x < pack->layers[0]->width; x++) {
+		paint_quad =
+		    floor(4 * x * n_paints / pack->layers[0]->width + 0.5);
+		paint_num = paint_quad >> 2;
+		if (last_pn != paint_num) {
+			rgb[x * 3] = 255;
+			rgb[x * 3 + 1] = 255;
+			rgb[x * 3 + 2] = 255;
+			last_pn = paint_num;
+		} else {
+			if ((paint_quad & 3) > 0 && (paint_quad & 3) < 3)
+				bg = 0;
+			else
+				bg = 255;
+			rgb[x * 3] = bg;
+			rgb[x * 3 + 1] = bg;
+			rgb[x * 3 + 2] = bg;
+			wet_composite(&rgb[x * 3], 0, &paintbox[paint_num],
+				      0, 1, 1);
+		}
+	}
+
+	gdk_draw_rgb_image(widget->window,
+			   widget->style->black_gc,
+			   event->area.x, event->area.y,
+			   event->area.width, event->area.height,
+			   GDK_RGB_DITHER_MAX,
+			   rgb + (event->area.x) * 3, 0);
+
+	g_free(rgb);
+	return FALSE;
+}
+
+static gint
+pselect_button_press(GtkWidget * widget, GdkEventButton * event)
+{
+	int paint_num;
+	int wet;
+
+#ifdef VERBOSE
+	g_print("pselect button press %f %f %f\n", event->x, event->y,
+		event->pressure);
+
+#endif
+	paint_num = floor((event->x * n_paints) / pack->layers[0]->width);
+
+	/* preserve wetness */
+	wet = paint.w;
+	paint = paintbox[paint_num];
+	paint.w = wet;
+	paintstr = paintnames[paint_num];
+	/*
+	   gtk_adjustment_set_value (GTK_ADJUSTMENT (wetness_adjust), paint.w);
+	 */
+	gtk_label_set_text(GTK_LABEL(paintname), paintstr);
+
+	stop_drying();
+
+	return TRUE;
+}
+
+static void wetness_update(GtkAdjustment * adj, gpointer data)
+{
+	paint.w = floor(15 * adj->value + 0.5);
+}
+
+int main(int argc, char **argv)
+{
+	GtkWidget *w;
+	GtkWidget *v;
+	GtkWidget *eb;
+	GtkWidget *da;
+	GtkWidget *peb;
+	GtkWidget *pda;
+	GtkWidget *h;
+	GtkWidget *b;
+	GtkWidget *db;
+	GtkWidget *h2;
+	GtkWidget *l;
+	GtkWidget *brushsize;
+	GtkWidget *wetness;
+	GtkWidget *strength;
+	int xs = 512;
+	int ys = 512;
+
+	gtk_init(&argc, &argv);
+
+	if (argc >= 3) {
+		xs = atoi(argv[1]);
+		ys = atoi(argv[2]);
+		if (xs == 0)
+			xs = 512;
+		if (ys == 0)
+			ys = 512;
+	}
+
+
+	init_input();
+
+	gdk_rgb_init();
+
+	gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
+	gtk_widget_set_default_visual(gdk_rgb_get_visual());
+
+	pack = wet_pack_new(xs, ys);
+
+	wet_pack_maketexture(pack, 1, 0.7, 0.5);
+
+	w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+	gtk_signal_connect(GTK_OBJECT(w), "destroy",
+			   (GtkSignalFunc) gtk_main_quit, NULL);
+
+	v = gtk_vbox_new(FALSE, 2);
+	gtk_container_add(GTK_CONTAINER(w), v);
+	gtk_widget_show(v);
+
+	eb = gtk_event_box_new();
+	gtk_container_add(GTK_CONTAINER(v), eb);
+	gtk_widget_show(eb);
+
+	gtk_widget_set_extension_events(eb, GDK_EXTENSION_EVENTS_ALL);
+
+	gtk_widget_set_events(eb, GDK_EXPOSURE_MASK
+			      | GDK_LEAVE_NOTIFY_MASK
+			      | GDK_BUTTON_PRESS_MASK
+			      | GDK_KEY_PRESS_MASK
+			      | GDK_POINTER_MOTION_MASK
+			      | GDK_PROXIMITY_OUT_MASK);
+
+	gtk_signal_connect(GTK_OBJECT(eb), "button_press_event",
+			   (GtkSignalFunc) wet_button_press, NULL);
+	gtk_signal_connect(GTK_OBJECT(eb), "motion_notify_event",
+			   (GtkSignalFunc) wet_motion, NULL);
+
+	da = gtk_drawing_area_new();
+	gtk_drawing_area_size(GTK_DRAWING_AREA(da), xs, ys);
+	gtk_container_add(GTK_CONTAINER(eb), da);
+	gtk_widget_show(da);
+
+	gtk_signal_connect(GTK_OBJECT(da), "expose_event",
+			   (GtkSignalFunc) wet_expose, pack);
+
+	peb = gtk_event_box_new();
+	gtk_container_add(GTK_CONTAINER(v), peb);
+	gtk_widget_show(peb);
+
+	gtk_widget_set_extension_events(peb, GDK_EXTENSION_EVENTS_ALL);
+
+	gtk_widget_set_events(peb, GDK_EXPOSURE_MASK
+			      | GDK_LEAVE_NOTIFY_MASK
+			      | GDK_BUTTON_PRESS_MASK
+			      | GDK_KEY_PRESS_MASK
+			      | GDK_PROXIMITY_OUT_MASK);
+
+	gtk_signal_connect(GTK_OBJECT(peb), "button_press_event",
+			   (GtkSignalFunc) pselect_button_press, NULL);
+
+	pda = gtk_drawing_area_new();
+	gtk_drawing_area_size(GTK_DRAWING_AREA(pda), xs, 16);
+	gtk_container_add(GTK_CONTAINER(peb), pda);
+	gtk_widget_show(pda);
+
+	gtk_signal_connect(GTK_OBJECT(pda), "expose_event",
+			   (GtkSignalFunc) pselect_expose, pack);
+
+	paintname = gtk_label_new(paintstr);
+	gtk_container_add(GTK_CONTAINER(v), paintname);
+	gtk_widget_show(paintname);
+
+	h = gtk_hbox_new(TRUE, 5);
+	gtk_container_add(GTK_CONTAINER(v), h);
+	gtk_widget_show(h);
+
+	b = gtk_button_new_with_label("Dry");
+	gtk_container_add(GTK_CONTAINER(h), b);
+	gtk_widget_show(b);
+
+	gtk_signal_connect(GTK_OBJECT(b), "clicked",
+			   (GtkSignalFunc) wet_dry_button_press, da);
+
+	autodryb = gtk_toggle_button_new_with_label("Auto Dry");
+	gtk_container_add(GTK_CONTAINER(h), autodryb);
+	gtk_widget_show(autodryb);
+
+	db = gtk_button_new_with_label("Clear");
+	gtk_container_add(GTK_CONTAINER(h), db);
+	gtk_widget_show(db);
+
+	gtk_signal_connect(GTK_OBJECT(db), "clicked",
+			   (GtkSignalFunc) clear_button_press, da);
+
+	h2 = gtk_hbox_new(FALSE, 5);
+	gtk_container_add(GTK_CONTAINER(v), h2);
+	gtk_widget_show(h2);
+
+	l = gtk_label_new("Brush size: ");
+	gtk_container_add(GTK_CONTAINER(h2), l);
+	gtk_widget_show(l);
+
+	brushsize_adjust = gtk_adjustment_new(10, 0, 32, 0.1, 0.1, 0);
+	brushsize = gtk_hscale_new(GTK_ADJUSTMENT(brushsize_adjust));
+	gtk_container_add(GTK_CONTAINER(h2), brushsize);
+	gtk_widget_show(brushsize);
+
+	h2 = gtk_hbox_new(FALSE, 5);
+	gtk_container_add(GTK_CONTAINER(v), h2);
+	gtk_widget_show(h2);
+
+	l = gtk_label_new("Wetness: ");
+	gtk_container_add(GTK_CONTAINER(h2), l);
+	gtk_widget_show(l);
+
+	wetness_adjust = gtk_adjustment_new(16, 0, 16, 1.0, 1.0, 0);
+	wetness = gtk_hscale_new(GTK_ADJUSTMENT(wetness_adjust));
+	gtk_container_add(GTK_CONTAINER(h2), wetness);
+	gtk_widget_show(wetness);
+	gtk_signal_connect(GTK_OBJECT(wetness_adjust), "value_changed",
+			   (GtkSignalFunc) wetness_update, NULL);
+
+	h2 = gtk_hbox_new(FALSE, 5);
+	gtk_container_add(GTK_CONTAINER(v), h2);
+	gtk_widget_show(h2);
+
+	l = gtk_label_new("Strength: ");
+	gtk_container_add(GTK_CONTAINER(h2), l);
+	gtk_widget_show(l);
+
+	strength_adjust = gtk_adjustment_new(1, 0, 2, 0.1, 0.1, 0);
+	strength = gtk_hscale_new(GTK_ADJUSTMENT(strength_adjust));
+	gtk_scale_set_digits(GTK_SCALE(strength), 2);
+	gtk_container_add(GTK_CONTAINER(h2), strength);
+	gtk_widget_show(strength);
+
+	gtk_widget_show(w);
+
+	gtk_timeout_add(50, (GtkFunction) dry_timer, da);
+
+	gtk_main();
+
+	return 0;
+}
diff --git a/chalk/colorspaces/wet/wetdreams/wetpaint.c b/chalk/colorspaces/wet/wetdreams/wetpaint.c
new file mode 100644
index 000000000..c1ac0d0c2
--- /dev/null
+++ b/chalk/colorspaces/wet/wetdreams/wetpaint.c
@@ -0,0 +1,101 @@
+
+#include <stdlib.h>
+#include <math.h>
+#include "wetpix.h"
+#include "wetphysics.h"
+#include "wetpaint.h"
+
+/* This function is not entirely satisfactory - the compositing is basically
+   opaque, and it really should do wet compositing. */
+void
+wet_dab(WetLayer * layer,
+	WetPix * paint,
+	double x, double y, double r, double pressure, double strength)
+{
+	double r_fringe;
+	int x0, y0;
+	int x1, y1;
+	WetPix *wet_line;
+	int xp, yp;
+	double xx, yy, rr;
+	double eff_height;
+	double press, contact;
+	WetPixDbl wet_tmp, wet_tmp2;
+
+	r_fringe = r + 1;
+	x0 = floor(x - r_fringe);
+	y0 = floor(y - r_fringe);
+	x1 = ceil(x + r_fringe);
+	y1 = ceil(y + r_fringe);
+	if (x0 < 0)
+		x0 = 0;
+	if (y0 < 0)
+		y0 = 0;
+	if (x1 >= layer->width)
+		x1 = layer->width;
+	if (y1 >= layer->height)
+		y1 = layer->height;
+
+	wet_line = layer->buf + y0 * layer->rowstride;
+	for (yp = y0; yp < y1; yp++) {
+		yy = (yp + 0.5 - y);
+		yy *= yy;
+		for (xp = x0; xp < x1; xp++) {
+			xx = (xp + 0.5 - x);
+			xx *= xx;
+			rr = yy + xx;
+			if (rr < r * r)
+				press = pressure * 0.25;
+			else
+				press = -1;
+			eff_height =
+			    (wet_line[xp].h + wet_line[xp].w -
+			     192) * (1.0 / 255);
+			contact = (press + eff_height) * 0.2;
+			if (contact > 0.5)
+				contact =
+				    1 - 0.5 * exp(-2.0 * contact - 1);
+			if (contact > 0.0001) {
+				int v;
+				double rnd = rand() * (1.0 / RAND_MAX);
+
+				v = wet_line[xp].rd;
+				wet_line[xp].rd =
+				    floor(v +
+					  (paint->rd * strength -
+					   v) * contact + rnd);
+				v = wet_line[xp].rw;
+				wet_line[xp].rw =
+				    floor(v +
+					  (paint->rw * strength -
+					   v) * contact + rnd);
+				v = wet_line[xp].gd;
+				wet_line[xp].gd =
+				    floor(v +
+					  (paint->gd * strength -
+					   v) * contact + rnd);
+				v = wet_line[xp].gw;
+				wet_line[xp].gw =
+				    floor(v +
+					  (paint->gw * strength -
+					   v) * contact + rnd);
+				v = wet_line[xp].bd;
+				wet_line[xp].bd =
+				    floor(v +
+					  (paint->bd * strength -
+					   v) * contact + rnd);
+				v = wet_line[xp].bw;
+				wet_line[xp].bw =
+				    floor(v +
+					  (paint->bw * strength -
+					   v) * contact + rnd);
+				v = wet_line[xp].w;
+				wet_line[xp].w =
+				    floor(v + (paint->w - v) * contact +
+					  rnd);
+
+			}
+		}
+		wet_line += layer->rowstride;
+	}
+}
diff --git a/chalk/colorspaces/wet/wetdreams/wetpaint.h b/chalk/colorspaces/wet/wetdreams/wetpaint.h
new file mode 100644
index 000000000..5cec2659e
--- /dev/null
+++ b/chalk/colorspaces/wet/wetdreams/wetpaint.h
@@ -0,0 +1,4 @@
+void wet_dab(WetLayer * layer,
+         WetPix * paint,
+         double x, double y,
+         double r, double pressure, double strength);
diff --git a/chalk/colorspaces/wet/wetdreams/wetphysics.c b/chalk/colorspaces/wet/wetdreams/wetphysics.c
new file mode 100644
index 000000000..d8b321a8c
--- /dev/null
+++ b/chalk/colorspaces/wet/wetdreams/wetphysics.c
@@ -0,0 +1,334 @@
+/* Cool physics functions for wet paint */
+
+#include <gtk/gtk.h>
+#include <math.h>
+#include "wetpix.h"
+#include "wetphysics.h"
+
+/* symmetric combine, i.e. wet mixing.
+
+   This does not set the dst h field.
+*/
+void wet_pix_combine(WetPixDbl * dst, WetPixDbl * src1, WetPixDbl * src2)
+{
+	dst->rd = src1->rd + src2->rd;
+	dst->rw = src1->rw + src2->rw;
+#if 0
+	g_print("rd %f rw %f\n", dst->rd, dst->rw);
+#endif
+	dst->gd = src1->gd + src2->gd;
+	dst->gw = src1->gw + src2->gw;
+	dst->bd = src1->bd + src2->bd;
+	dst->bw = src1->bw + src2->bw;
+	dst->w = src1->w + src2->w;
+#if 0
+	g_print("%f + %f -> %f\n", src1->w, src2->w, dst->w);
+#endif
+}
+
+void wet_pix_dilute(WetPixDbl * dst, WetPix * src, double dilution)
+{
+	double scale = dilution * (1.0 / 8192.0);
+
+
+	dst->rd = src->rd * scale;
+#if 0
+	g_print("dilution %f scale %f rd %f\n", dilution, scale, dst->rd);
+#endif
+	dst->rw = src->rw * scale;
+	dst->gd = src->gd * scale;
+	dst->gw = src->gw * scale;
+	dst->bd = src->bd * scale;
+	dst->bw = src->bw * scale;
+	dst->w = src->w * (1.0 / 8192.0);
+	dst->h = src->h * (1.0 / 8192.0);
+}
+
+void wet_pix_reduce(WetPixDbl * dst, WetPix * src, double dilution)
+{
+	wet_pix_dilute(dst, src, dilution);
+	dst->w *= dilution;
+}
+
+/* allows visualization of adsorption by rotating the hue 120 degrees */
+/* layer-merge combining. src1 is the top layer
+
+   This does not set the dst h or w fields.
+*/
+void
+wet_pix_merge(WetPixDbl * dst, WetPixDbl * src1, double dilution1,
+	      WetPixDbl * src2)
+{
+	double d1, w1, d2, w2;
+	double ed1, ed2;
+
+	if (src1->rd < 1e-4) {
+		dst->rd = src2->rd;
+		dst->rw = src2->rw;
+	} else if (src2->rd < 1e-4) {
+		dst->rd = src1->rd * dilution1;
+		dst->rw = src1->rw * dilution1;
+	} else {
+		d1 = src1->rd;
+		w1 = src1->rw;
+		d2 = src2->rd;
+		w2 = src2->rw;
+		dst->rd = d1 * dilution1 + d2;
+		ed1 = exp(-d1 * dilution1);
+		ed2 = exp(-d2);
+		dst->rw = dst->rd * ((1 - ed1) * w1 / d1 +
+				     ed1 * (1 - ed2) * w2 / d2) /
+		    (1 - ed1 * ed2);
+	}
+
+	if (src1->gd < 1e-4) {
+		dst->gd = src2->gd;
+		dst->gw = src2->gw;
+	} else if (src2->gd < 1e-4) {
+		dst->gd = src1->gd * dilution1;
+		dst->gw = src1->gw * dilution1;
+	} else {
+		d1 = src1->gd;
+		w1 = src1->gw;
+		d2 = src2->gd;
+		w2 = src2->gw;
+		dst->gd = d1 * dilution1 + d2;
+		ed1 = exp(-d1 * dilution1);
+		ed2 = exp(-d2);
+		dst->gw = dst->gd * ((1 - ed1) * w1 / d1 +
+				     ed1 * (1 - ed2) * w2 / d2) /
+		    (1 - ed1 * ed2);
+	}
+
+	if (src1->bd < 1e-4) {
+		dst->bd = src2->bd;
+		dst->bw = src2->bw;
+	} else if (src2->bd < 1e-4) {
+		dst->bd = src1->bd * dilution1;
+		dst->bw = src1->bw * dilution1;
+	} else {
+		d1 = src1->bd;
+		w1 = src1->bw;
+		d2 = src2->bd;
+		w2 = src2->bw;
+		dst->bd = d1 * dilution1 + d2;
+		ed1 = exp(-d1 * dilution1);
+		ed2 = exp(-d2);
+		dst->bw = dst->bd * ((1 - ed1) * w1 / d1 +
+				     ed1 * (1 - ed2) * w2 / d2) /
+		    (1 - ed1 * ed2);
+	}
+
+}
+
+void wet_flow(WetLayer * layer)
+{
+	/* XXX: Is this like a convolution operation? BSAR */
+	int x, y;
+	int width = layer->width;
+	int height = layer->height;
+	int rs = layer->rowstride;
+	double *flow_t, *flow_b, *flow_l, *flow_r;
+	double *fluid, *outflow;
+	WetPix *wet_line = layer->buf;
+	WetPix *wet_old;
+	int my_height;
+	int ix;
+	double ft, fb, fl, fr; /* top, bottom, left, right */
+	WetPixDbl wet_mix, wet_tmp;
+	
+	flow_t = g_new(double, width * height);
+	flow_b = g_new(double, width * height);
+	flow_l = g_new(double, width * height);
+	flow_r = g_new(double, width * height);
+	fluid = g_new(double, width * height);
+	outflow = g_new(double, width * height);
+	wet_old = g_new(WetPix, width * height);
+
+	/* assumes rowstride == width */
+	memcpy(wet_old, layer->buf, sizeof(WetPix) * width * height);
+
+	ix = width + 1;
+	for (y = 1; y < height - 1; y++) {
+		wet_line += rs;
+		for (x = 1; x < width - 1; x++) {
+			if (wet_line[x].w > 0) {
+				my_height = wet_line[x].h + wet_line[x].w;
+				ft = (wet_line[x - rs].h +
+				      wet_line[x - rs].w) - my_height;
+				fb = (wet_line[x + rs].h +
+				      wet_line[x + rs].w) - my_height;
+				fl = (wet_line[x - 1].h +
+				      wet_line[x - 1].w) - my_height;
+				fr = (wet_line[x + 1].h +
+				      wet_line[x + 1].w) - my_height;
+
+				fluid[ix] =
+				    0.4 * sqrt(wet_line[x].w * 1.0 /
+					       255.0);
+
+				/* smooth out the flow a bit */
+				flow_t[ix] =
+				    0.1 * (10 + ft * 0.75 - fb * 0.25);
+				if (flow_t[ix] > 1)
+					flow_t[ix] = 1;
+				if (flow_t[ix] < 0)
+					flow_t[ix] = 0;
+				flow_b[ix] =
+				    0.1 * (10 + fb * 0.75 - ft * 0.25);
+				if (flow_b[ix] > 1)
+					flow_b[ix] = 1;
+				if (flow_b[ix] < 0)
+					flow_b[ix] = 0;
+				flow_l[ix] =
+				    0.1 * (10 + fl * 0.75 - fr * 0.25);
+				if (flow_l[ix] > 1)
+					flow_l[ix] = 1;
+				if (flow_l[ix] < 0)
+					flow_l[ix] = 0;
+				flow_r[ix] =
+				    0.1 * (10 + fr * 0.75 - fl * 0.25);
+				if (flow_r[ix] > 1)
+					flow_r[ix] = 1;
+				if (flow_r[ix] < 0)
+					flow_r[ix] = 0;
+
+				outflow[ix] = 0;
+			}
+			ix++;
+		}
+		ix += 2;
+	}
+
+	ix = width + 1;
+	wet_line = layer->buf;
+	for (y = 1; y < height - 1; y++) {
+		wet_line += rs;
+		for (x = 1; x < width - 1; x++) {
+			if (wet_line[x].w > 0) {
+				/* reduce flow in dry areas */
+				flow_t[ix] *= fluid[ix] * fluid[ix - rs];
+				outflow[ix - rs] += flow_t[ix];
+				flow_b[ix] *= fluid[ix] * fluid[ix + rs];
+				outflow[ix + rs] += flow_b[ix];
+				flow_l[ix] *= fluid[ix] * fluid[ix - 1];
+				outflow[ix - 1] += flow_l[ix];
+				flow_r[ix] *= fluid[ix] * fluid[ix + 1];
+				outflow[ix + 1] += flow_r[ix];
+			}
+			ix++;
+		}
+		ix += 2;
+	}
+
+	wet_line = layer->buf;
+	ix = width + 1;
+	for (y = 1; y < height - 1; y++) {
+		wet_line += rs;
+		for (x = 1; x < width - 1; x++) {
+			if (wet_line[x].w > 0) {
+				wet_pix_reduce(&wet_mix, &wet_old[ix],
+					       1 - outflow[ix]);
+
+				wet_pix_reduce(&wet_tmp, &wet_old[ix - rs],
+					       flow_t[ix]);
+				wet_pix_combine(&wet_mix, &wet_mix,
+						&wet_tmp);
+				wet_pix_reduce(&wet_tmp, &wet_old[ix + rs],
+					       flow_b[ix]);
+				wet_pix_combine(&wet_mix, &wet_mix,
+						&wet_tmp);
+				wet_pix_reduce(&wet_tmp, &wet_old[ix - 1],
+					       flow_l[ix]);
+				wet_pix_combine(&wet_mix, &wet_mix,
+						&wet_tmp);
+				wet_pix_reduce(&wet_tmp, &wet_old[ix + 1],
+					       flow_r[ix]);
+				wet_pix_combine(&wet_mix, &wet_mix,
+						&wet_tmp);
+
+				wet_pix_from_double(&wet_line[x],
+						    &wet_mix);
+
+#if 0
+				if (ix % 3201 == 0)
+					g_print("%f %f %f %f %f %f\n",
+						outflow[ix],
+						flow_t[ix],
+						flow_b[ix],
+						flow_l[ix],
+						flow_r[ix], fluid[ix]);
+#endif
+			}
+			ix++;
+		}
+		ix += 2;
+	}
+
+	g_free(flow_t);
+	g_free(flow_b);
+	g_free(flow_l);
+	g_free(flow_r);
+	g_free(fluid);
+	g_free(outflow);
+	g_free(wet_old);
+}
+
+void wet_dry(WetLayer * layer)
+{
+	int x, y;
+	WetPix *wet_line = layer->buf;
+	int width = layer->width;
+	int height = layer->height;
+	int rs = layer->rowstride;
+	int w;
+
+	for (y = 0; y < height; y++) {
+		for (x = 0; x < width; x++) {
+			w = wet_line[x].w;
+			w -= 1;
+			if (w > 0)
+				wet_line[x].w = w;
+			else
+				wet_line[x].w = 0;
+
+		}
+		wet_line += rs;
+	}
+}
+
+/* Move stuff from the upperlayer to the lower layer. This is filter-level stuff*/
+void wet_adsorb(WetLayer * layer, WetLayer * adsorb)
+{
+	int x, y;
+	WetPix *wet_line = layer->buf;
+	WetPix *ads_line = adsorb->buf;
+	int width = layer->width;
+	int height = layer->height;
+	int rs = layer->rowstride;
+	double ads;
+	WetPixDbl wet_top;
+	WetPixDbl wet_bot;
+
+	for (y = 0; y < height; y++) {
+		for (x = 0; x < width; x++) {
+			/* do adsorption */
+			if (wet_line[x].w == 0)
+				continue;
+			ads = 0.5 / MAX(wet_line[x].w, 1);
+
+			wet_pix_to_double(&wet_top, &wet_line[x]);
+			wet_pix_to_double(&wet_bot, &ads_line[x]);
+			wet_pix_merge(&wet_bot, &wet_top, ads, &wet_bot);
+			wet_pix_from_double(&ads_line[x], &wet_bot);
+			wet_line[x].rd = wet_line[x].rd * (1 - ads);
+			wet_line[x].rw = wet_line[x].rw * (1 - ads);
+			wet_line[x].gd = wet_line[x].gd * (1 - ads);
+			wet_line[x].gw = wet_line[x].gw * (1 - ads);
+			wet_line[x].bd = wet_line[x].bd * (1 - ads);
+			wet_line[x].bw = wet_line[x].bw * (1 - ads);
+		}
+		wet_line += rs;
+		ads_line += rs;
+	}
+}
diff --git a/chalk/colorspaces/wet/wetdreams/wetphysics.h b/chalk/colorspaces/wet/wetdreams/wetphysics.h
new file mode 100644
index 000000000..25140956b
--- /dev/null
+++ b/chalk/colorspaces/wet/wetdreams/wetphysics.h
@@ -0,0 +1,9 @@
+void wet_pix_combine(WetPixDbl * dst, WetPixDbl * src1, WetPixDbl * src2);
+
+void wet_pix_dilute(WetPixDbl * dst, WetPix * src, double dilution);
+
+void wet_flow(WetLayer * layer);
+
+void wet_dry(WetLayer * layer);
+
+void wet_adsorb(WetLayer * layer, WetLayer * adsorb);
diff --git a/chalk/colorspaces/wet/wetdreams/wetpix.c b/chalk/colorspaces/wet/wetdreams/wetpix.c
new file mode 100644
index 000000000..812a038de
--- /dev/null
+++ b/chalk/colorspaces/wet/wetdreams/wetpix.c
@@ -0,0 +1,332 @@
+/* Routines for manipulating wet pixels.
+
+   Copyright 1999 Raph Levien <raph@gimp.org>
+
+   Released under GPL.
+
+   A wet pixel is a sequence of eight bytes, arranged as follows:
+
+   Red value when composited over black
+   Green value when composited over black
+   Blue value when composited over black
+   Volume of water
+   Red value when composited over white
+   Green value when composited over white
+   Blue value when composited over white
+   Height of paper surface
+
+*/
+
+#include <gtk/gtk.h>
+#include <string.h>
+#include <math.h>
+#include "wetpix.h"
+
+u32 *wet_render_tab = NULL;
+
+static void wet_init_render_tab(void)
+{
+	int i;
+	double d;
+	int a, b;
+
+	wet_render_tab = g_new(u32, 4096);
+	for (i = 0; i < 4096; i++) {
+		d = i * (1.0 / 512.0);
+		if (i == 0)
+			a = 0;
+		else
+			a = floor(0xff00 / i + 0.5);
+		b = floor(0x8000 * exp(-d) + 0.5);
+#if 0
+		g_print("%d: %x %x\n", i, a, b);
+#endif
+		wet_render_tab[i] = (a << 16) | b;
+	}
+}
+
+void
+wet_composite(byte * rgb, int rgb_rowstride,
+	      WetPix * wet, int wet_rowstride,
+	      int width, int height)
+{
+	int x, y;
+	byte *rgb_line = rgb;
+	WetPix *wet_line = wet;
+
+	if (wet_render_tab == NULL)
+		wet_init_render_tab();
+
+	for (y = 0; y < height; y++) {
+		byte *rgb_ptr = rgb_line;
+		WetPix *wet_ptr = wet_line;
+		for (x = 0; x < width; x++) {
+			int r, g, b;
+			int d, w;
+			int ab;
+			int wa;
+
+			r = rgb_ptr[0];
+			w = wet_ptr[0].rw >> 4;
+			d = wet_ptr[0].rd >> 4;
+			/*
+			   d = d >= 4096 ? 4095 : d;
+			 */
+			ab = wet_render_tab[d];
+			wa = (w * (ab >> 16) + 0x80) >> 8;
+			r = wa +
+			    (((r - wa) * (ab & 0xffff) + 0x4000) >> 15);
+			rgb_ptr[0] = r;
+
+#if 0
+			if (x == 128 && y == 128) {
+				g_print("w %d d %d r %d\n", w, d, r);
+			}
+#endif
+
+			g = rgb_ptr[1];
+			w = wet_ptr[0].gw >> 4;
+			d = wet_ptr[0].gd >> 4;
+			d = d >= 4096 ? 4095 : d;
+			ab = wet_render_tab[d];
+			wa = (w * (ab >> 16) + 0x80) >> 8;
+			g = wa +
+			    (((g - wa) * (ab & 0xffff) + 0x4000) >> 15);
+			rgb_ptr[1] = g;
+
+			b = rgb_ptr[2];
+			w = wet_ptr[0].bw >> 4;
+			d = wet_ptr[0].bd >> 4;
+			d = d >= 4096 ? 4095 : d;
+			ab = wet_render_tab[d];
+			wa = (w * (ab >> 16) + 0x80) >> 8;
+			b = wa +
+			    (((b - wa) * (ab & 0xffff) + 0x4000) >> 15);
+			rgb_ptr[2] = b;
+
+			rgb_ptr += 3;
+			wet_ptr++;
+		}
+		rgb_line += rgb_rowstride;
+		wet_line += wet_rowstride;
+	}
+}
+
+void
+wet_render_wetness(byte * rgb, int rgb_rowstride,
+		   WetLayer * layer, int x0, int y0, int width, int height)
+{
+	static int wet_phase = 0;
+	int x, y;
+	byte *rgb_line = rgb;
+	WetPix *wet_line = layer->buf + (y0 * layer->rowstride) + x0;
+	int highlight;
+
+	for (y = 0; y < height; y++) {
+		byte *rgb_ptr = rgb_line;
+		WetPix *wet_ptr = wet_line;
+		for (x = 0; x < width; x++) {
+			if (((x + y) & 3) == wet_phase) {
+				highlight = 255 - (wet_ptr[0].w >> 1);
+				if (highlight < 255) {
+					rgb_ptr[0] =
+					    255 -
+					    (((255 -
+					       rgb_ptr[0]) *
+					      highlight) >> 8);
+					rgb_ptr[1] =
+					    255 -
+					    (((255 -
+					       rgb_ptr[1]) *
+					      highlight) >> 8);
+					rgb_ptr[2] =
+					    255 -
+					    (((255 -
+					       rgb_ptr[2]) *
+					      highlight) >> 8);
+				}
+			}
+			rgb_ptr += 3;
+			wet_ptr++;
+		}
+		rgb_line += rgb_rowstride;
+		wet_line += layer->rowstride;
+	}
+	wet_phase += 1;
+	wet_phase &= 3;
+}
+
+void
+wet_composite_layer(byte * rgb, int rgb_rowstride,
+		    WetLayer * layer,
+		    int x0, int y0, int width, int height)
+{
+	/* todo: sanitycheck bounds */
+	wet_composite(rgb, rgb_rowstride,
+		      layer->buf + (y0 * layer->rowstride) + x0,
+		      layer->rowstride, width, height);
+}
+
+void
+wet_pack_render(byte * rgb, int rgb_rowstride,
+		WetPack * pack, int x0, int y0, int width, int height)
+{
+	int y;
+	byte *rgb_line = rgb;
+	int i;
+
+	/* clear rgb buffer to white */
+	for (y = 0; y < height; y++) {
+		memset(rgb_line, 255, width * 3);
+		rgb_line += rgb_rowstride;
+	}
+
+	/* black stripe */
+/*  rgb_line = rgb;
+  for (y = y0; y < 8 && y < y0 + height; y++)
+    {
+      memset (rgb_line, 0, width * 3);
+      rgb_line += rgb_rowstride;
+    }
+*/
+
+	for (i = 0; i < pack->n_layers; i++)
+		wet_composite_layer(rgb, rgb_rowstride,
+				    pack->layers[i],
+				    x0, y0, width, height);
+
+	wet_render_wetness(rgb, rgb_rowstride,
+			   pack->layers[pack->n_layers - 1],
+			   x0, y0, width, height);
+}
+
+WetLayer *wet_layer_new(int width, int height)
+{
+	WetLayer *layer;
+
+	layer = g_new(WetLayer, 1);
+
+	layer->buf = g_new(WetPix, width * height);
+	layer->width = width;
+	layer->height = height;
+	layer->rowstride = width;
+
+	return layer;
+}
+
+void wet_layer_clear(WetLayer * layer)
+{
+	int x, y;
+	WetPix *wet_line = layer->buf;
+	int width = layer->width;
+
+	for (y = 0; y < layer->height; y++) {
+		for (x = 0; x < width; x++) {
+			/* transparent, dry, smooth */
+			wet_line[x].rd = 0;
+			wet_line[x].rw = 0;
+			wet_line[x].gd = 0;
+			wet_line[x].gw = 0;
+			wet_line[x].bd = 0;
+			wet_line[x].bw = 0;
+			wet_line[x].w = 0;
+			wet_line[x].h = 128;
+		}
+		wet_line += layer->rowstride;
+	}
+}
+
+WetPack *wet_pack_new(int width, int height)
+{
+	WetPack *pack;
+
+	pack = g_new(WetPack, 1);
+
+	pack->n_layers = 2;
+	pack->layers = g_new(WetLayer *, pack->n_layers);
+	pack->layers[0] = wet_layer_new(width, height);
+	wet_layer_clear(pack->layers[0]);
+	pack->layers[1] = wet_layer_new(width, height);
+	wet_layer_clear(pack->layers[1]);
+
+	return pack;
+}
+
+void wet_pix_to_double(WetPixDbl * dst, WetPix * src)
+{
+	dst->rd = (1.0 / 8192.0) * src->rd;
+	dst->rw = (1.0 / 8192.0) * src->rw;
+	dst->gd = (1.0 / 8192.0) * src->gd;
+	dst->gw = (1.0 / 8192.0) * src->gw;
+	dst->bd = (1.0 / 8192.0) * src->bd;
+	dst->bw = (1.0 / 8192.0) * src->bw;
+	dst->w = (1.0 / 8192.0) * src->w;
+	dst->h = (1.0 / 8192.0) * src->h;
+}
+
+void wet_pix_from_double(WetPix * dst, WetPixDbl * src)
+{
+	int v;
+
+	v = floor(8192.0 * src->rd + 0.5);
+	if (v < 0)
+		v = 0;
+	if (v > 65535)
+		v = 65535;
+	dst->rd = v;
+
+	g_print("src->rd = %f, dst->rd = %d\n", src->rd, dst->rd);
+
+	v = floor(8192.0 * src->rw + 0.5);
+	if (v < 0)
+		v = 0;
+	if (v > 65535)
+		v = 65535;
+	dst->rw = v;
+
+	v = floor(8192.0 * src->gd + 0.5);
+	if (v < 0)
+		v = 0;
+	if (v > 65535)
+		v = 65535;
+	dst->gd = v;
+
+	v = floor(8192.0 * src->gw + 0.5);
+	if (v < 0)
+		v = 0;
+	if (v > 65535)
+		v = 65535;
+	dst->gw = v;
+
+	v = floor(8192.0 * src->bd + 0.5);
+	if (v < 0)
+		v = 0;
+	if (v > 65535)
+		v = 65535;
+	dst->bd = v;
+
+	v = floor(8192.0 * src->bw + 0.5);
+	if (v < 0)
+		v = 0;
+	if (v > 65535)
+		v = 65535;
+	dst->bw = v;
+
+	v = floor(8192.0 * src->w + 0.5);
+	if (v < 0)
+		v = 0;
+	if (v > 511)
+		v = 511;
+	dst->w = v;
+#if 0
+	g_print("src->w = %f, dst->w = %d\n", src->w, dst->w);
+#endif
+
+	v = floor(8192.0 * src->h + 0.5);
+	if (v < 0)
+		v = 0;
+	if (v > 511)
+		v = 511;
+	dst->h = v;
+
+}
diff --git a/chalk/colorspaces/wet/wetdreams/wetpix.h b/chalk/colorspaces/wet/wetdreams/wetpix.h
new file mode 100644
index 000000000..3dc7913f1
--- /dev/null
+++ b/chalk/colorspaces/wet/wetdreams/wetpix.h
@@ -0,0 +1,87 @@
+/* Routines for manipulating wet pixels.
+
+   Copyright 1999 Raph Levien <raph@gimp.org>
+
+   Released under GPL.
+
+   A wet pixel is an eight word sequence, representing partially
+   transparent wet paint on a paper surface.
+
+*/
+
+typedef unsigned char byte;
+typedef unsigned short u16;
+typedef unsigned int u32;
+
+typedef struct _WetPix WetPix;
+typedef struct _WetLayer WetLayer;
+typedef struct _WetPack WetPack;
+
+typedef struct _WetPixDbl WetPixDbl;
+
+/* White is made up of myth-red, myth-green, and myth-blue. Myth-red
+   looks red when viewed reflectively, but cyan when viewed
+   transmissively (thus, it vaguely resembles a dichroic
+   filter). Myth-red over black is red, and myth-red over white is
+   white.
+
+   Total red channel concentration is myth-red concentration plus
+   cyan concentration.
+
+*/
+
+struct _WetPix {
+    u16 rd;            /*  Total red channel concentration */
+    u16 rw;            /*  Myth-red concentration */
+    u16 gd;            /*  Total green channel concentration */
+    u16 gw;            /*  Myth-green concentration */
+    u16 bd;            /*  Total blue channel concentration */
+    u16 bw;            /*  Myth-blue concentration */
+    u16 w;            /*  Water volume */
+    u16 h;            /*  Height of paper surface */
+};
+
+struct _WetLayer {
+    WetPix *buf;
+    int width;
+    int height;
+    int rowstride;
+};
+
+struct _WetPack {
+    int n_layers;
+    WetLayer **layers;
+};
+
+struct _WetPixDbl {
+    double rd;        /*  Total red channel concentration */
+    double rw;        /*  Myth-red concentration */
+    double gd;        /*  Total green channel concentration */
+    double gw;        /*  Myth-green concentration */
+    double bd;        /*  Total blue channel concentration */
+    double bw;        /*  Myth-blue concentration */
+    double w;        /*  Water volume */
+    double h;        /*  Height of paper surface */
+};
+
+void wet_composite(byte * rgb, int rgb_rowstride,
+           WetPix * wet, int wet_rowstride,
+           int width, int height);
+
+void wet_composite_layer(byte * rgb, int rgb_rowstride,
+             WetLayer * layer,
+             int x0, int y0, int width, int height);
+
+void wet_pack_render(byte * rgb, int rgb_rowstride,
+             WetPack * pack,
+             int x0, int y0, int width, int height);
+
+WetLayer *wet_layer_new(int width, int height);
+
+void wet_layer_clear(WetLayer * layer);
+
+WetPack *wet_pack_new(int width, int height);
+
+void wet_pix_to_double(WetPixDbl * dst, WetPix * src);
+
+void wet_pix_from_double(WetPix * dst, WetPixDbl * src);
diff --git a/chalk/colorspaces/wet/wetdreams/wettexture.c b/chalk/colorspaces/wet/wetdreams/wettexture.c
new file mode 100644
index 000000000..620ad8b55
--- /dev/null
+++ b/chalk/colorspaces/wet/wetdreams/wettexture.c
@@ -0,0 +1,84 @@
+/* synthesize a surface texture */
+
+#include <stdlib.h>
+#include <math.h>
+#include "wetpix.h"
+
+void
+wet_layer_maketexture(WetLayer * layer,
+		      double height, double blurh, double blurv)
+{
+	int x, y;
+	int width = layer->width;
+	int lheight = layer->height;
+	int rowstride = layer->rowstride;
+	WetPix *wet_line = layer->buf;
+	double hscale = 128 * height / RAND_MAX;
+	int lh;
+	int ibh, ibv;
+
+	ibh = floor(256 * blurh + 0.5);
+#ifdef VERBOSE
+	g_print("ibh = %d\n", ibh);
+#endif
+	ibv = floor(256 * blurv + 0.5);
+
+	for (y = 0; y < lheight; y++) {
+		for (x = 0; x < width; x++) {
+			wet_line[x].h = floor(128 + hscale * rand());
+		}
+		/*      g_print ("%d\n", wet_line[0].h); */
+		wet_line += rowstride;
+	}
+
+	wet_line = layer->buf;
+	for (y = 0; y < lheight; y++) {
+		lh = wet_line[0].h;
+		for (x = 1; x < width; x++) {
+			wet_line[x].h +=
+			    ((lh - wet_line[x].h) * ibh + 128) >> 8;
+			lh = wet_line[x].h;
+		}
+		wet_line += rowstride;
+	}
+
+#if 0
+	for (x = 0; x < width; x++) {
+		wet_line = layer->buf + x;
+		lh = wet_line[0].h;
+		for (y = 1; y < lheight; y++) {
+			wet_line += rowstride;
+			wet_line[0].h +=
+			    ((lh - wet_line[0].h) * ibv + 128) >> 8;
+			lh = wet_line[0].h;
+		}
+	}
+#endif
+}
+
+void wet_layer_clone_texture(WetLayer * dst, WetLayer * src)
+{
+	int x, y;
+	int width = src->width;
+	WetPix *dst_line = dst->buf;
+	WetPix *src_line = src->buf;
+
+	for (y = 0; y < src->height; y++) {
+		for (x = 0; x < width; x++) {
+			dst_line[x].h = src_line[x].h;
+		}
+		dst_line += dst->rowstride;
+		src_line += src->rowstride;
+	}
+}
+
+void
+wet_pack_maketexture(WetPack * pack,
+		     double height, double blurh, double blurv)
+{
+	int i;
+
+	wet_layer_maketexture(pack->layers[0], height, blurh, blurv);
+	for (i = 1; i < pack->n_layers; i++)
+		wet_layer_clone_texture(pack->layers[i], pack->layers[0]);
+}
diff --git a/chalk/colorspaces/wet/wetdreams/wettexture.h b/chalk/colorspaces/wet/wetdreams/wettexture.h
new file mode 100644
index 000000000..c3cbc0d2a
--- /dev/null
+++ b/chalk/colorspaces/wet/wetdreams/wettexture.h
@@ -0,0 +1,9 @@
+/* synthesize a surface texture */
+
+void wet_layer_maketexture(WetLayer * layer,
+               double height, double blurh, double blurv);
+
+void wet_layer_clone_texture(WetLayer * dst, WetLayer * src);
+
+void wet_pack_maketexture(WetPack * pack,
+              double height, double blurh, double blurv);
diff --git a/chalk/colorspaces/wet/wetphysicsfilter.cc b/chalk/colorspaces/wet/wetphysicsfilter.cc
new file mode 100644
index 000000000..d63574fda
--- /dev/null
+++ b/chalk/colorspaces/wet/wetphysicsfilter.cc
@@ -0,0 +1,424 @@
+/*
+ * This file is part of the KDE project
+ *
+ * Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <stdlib.h>
+#include <vector>
+
+#include <klocale.h>
+#include <kdebug.h>
+
+#include <kis_iterators_pixel.h>
+#include <kis_filter_registry.h>
+#include <kis_debug_areas.h>
+#include <kis_types.h>
+#include <kis_paint_device.h>
+#include <kis_debug_areas.h>
+#include "wetphysicsfilter.h"
+
+/*
+ * [11:14] <boud> CyrilleB: I think I know why watercolor drying creates that funny pattern (you can see it if you have a very wet canvas with lots of paint and leave it drying for a while): our dry filter must have an off-by-one error to the right and bottom, which is also why the buggy drying didn't remove all of previously applied paint but left a fringe.
+ * [11:14] <pippin> does the drying behave kind of like an error diffusion?
+ * [11:14] <pippin> (it sounds like error diffusion artifacts,.)
+ * [11:15] <boud> pippin: not sure what error diffusion is...
+ * [11:15] <pippin> used for digital halftoning
+ * [11:15] <pippin> take a greyscale image,.. you want to end up with binary (could be less, but let's use 1bit result)
+ * [11:15] <CyrilleB> boud: the funny pattern is also in wetdreams when you disable wetness visualisation
+ * [11:15] <boud> CyrilleB: I don't mean the checkerboard pattern
+ * [11:16] <pippin> then for each pixel you calculate the difference between the current value and the desired value (0 or 255)
+ * [11:16] <CyrilleB> boud: which one then ?
+ * [11:16] <pippin> the error is distributed to the neighbour pixels (to the right, down and down to the left in pixels which have not yet been processed
+ * [11:16] <pippin> )
+ * [11:16] <boud> CyrilleB: it's only aptqparent when you let something dry for some time, it looks like meandering snakes (like the old game "snake")
+ * [11:16] <CyrilleB> pippin: somehow yes
+ * [11:16] <boud> pippin: that is possible
+ * [11:17] <pippin> boud: this leads to "bleeding" of data to the right and down,..
+ * [11:17] <boud> pippin: but on the other hand, when the filter worked on the old tiles (empty ones)  it also left a fringe of color.
+ * [11:17] <pippin> having the "error" spread in different directions on each iteration might fix something like this,.
+ * [11:18] <boud> Which leads me to think it's an off-by one.
+ * [11:25] <boud> No, it isn't off by one. Then pippin must be right.
+ * [11:26] <pippin> if I am, this is a fun debug session, not even having the code or the visual results available,. just hanging around on irc :)
+ * [11:27] <boud> Well, I don't have time to investigate right now, but it sounds very plausible.
+ * [11:27] <CyrilleB> pippin: :)
+ * [11:28] <boud> of course, the code _is_ available :-)
+ * [11:28] <pippin> if there is some form of diffusion matrix that is directional around the current pixel,. having that tqmask rotate depending on the modulus of the current iteration # should cancel such an effect out
+ */
+WetPhysicsFilter::WetPhysicsFilter()
+    : KisFilter(id(), "artistic", i18n("Dry the Paint"))
+{
+    m_adsorbCount = 0;
+}
+
+void WetPhysicsFilter::process(KisPaintDeviceSP src, KisPaintDeviceSP dst, KisFilterConfiguration* /*config*/, const TQRect& rect)
+{
+    kdDebug() << "Physics processing " << src->name() << m_adsorbCount << endl;
+    // XXX: It would be nice be able to interleave this, instead of
+    // having the same loop over  our pixels three times.
+    flow(src, dst, rect);
+    if (m_adsorbCount++ == 2) {
+//         XXX I think we could combine dry and adsorb, yes
+        adsorb(src, dst, rect);
+        dry(src, dst, rect);
+        m_adsorbCount = 0;
+    }
+    setProgressDone(); // Must be called even if you don't really support progression
+}
+
+
+void WetPhysicsFilter::flow(KisPaintDeviceSP src, KisPaintDeviceSP /*dst*/, const TQRect & r)
+{
+    /* XXX: Is this like a convolution operation? BSAR */
+    int width = r.width();
+    int height = r.height();
+
+    kdDebug() << "Flowing: " << r << endl;
+
+    /* width of a line in a layer in pixel units, not in bytes -- used to move to the next
+       line in the fluid tqmasks below */
+    int rs = width; // rowstride
+
+    double * flow_t  = new double[width * height];
+    Q_CHECK_PTR(flow_t);
+
+    double * flow_b  = new double[width * height];
+    Q_CHECK_PTR(flow_b);
+
+    double * flow_l  = new double[width * height];
+    Q_CHECK_PTR(flow_l);
+
+    double * flow_r  = new double[width * height];
+    Q_CHECK_PTR(flow_r);
+
+    double * fluid   = new double[width * height];
+    Q_CHECK_PTR(fluid);
+
+    double * outflow = new double[width * height];
+    Q_CHECK_PTR(outflow);
+
+    // Height of the paper surface. Do we also increase height because of paint deposits?
+    int my_height;
+
+    // Flow to the top, bottom, left, right of the currentpixel
+    double ft, fb, fl, fr;
+
+    // Temporary pixel constructs
+    WetPixDbl wet_mix, wet_tmp;
+
+    // XXX If the flow touches areas that have not been initialized with a height field yet,
+    // create a heigth field.
+
+    // We need three iterators, because we're working on a five-point convolution kernel (no corner pixels are being used)
+
+    // First iteration: compute fluid deposits around the paper.
+    TQ_INT32 dx, dy;
+    dx = r.x();
+    dy = r.y();
+
+    int ix = width + 1; // keeps track where we are in the one-dimensional arrays
+
+    for (TQ_INT32 y2 = 1; y2 < height - 1; ++y2) {
+        KisHLineIteratorPixel srcIt = src->createHLineIterator(dx, dy + y2, width, false);
+        KisHLineIteratorPixel upIt = src->createHLineIterator(dx + 1, dy + y2 - 1, width - 2, false);
+        KisHLineIteratorPixel downIt = src->createHLineIterator(dx + 1, dy + y2 + 1, width - 2, false);
+
+        // .paint is the first field in our wetpack, so this is ok (even though not nice)
+        WetPix left = *(reinterpret_cast<WetPix*>(srcIt.rawData()));
+        ++srcIt;
+        WetPix current = *(reinterpret_cast<WetPix*>(srcIt.rawData()));
+        ++srcIt;
+        WetPix right = *(reinterpret_cast<WetPix*>(srcIt.rawData()));
+        WetPix up, down;
+
+        while (!srcIt.isDone()) {
+            up = *(reinterpret_cast<WetPix*>(upIt.rawData()));
+            down = *(reinterpret_cast<WetPix*>(downIt.rawData()));
+
+            if (current.w > 0) {
+                my_height = current.h + current.w;
+                ft = (up.h + up.w) - my_height;
+                fb = (down.h + down.w) - my_height;
+                fl = (left.h + left.w) - my_height;
+                fr = (right.h + right.w) - my_height;
+
+                fluid[ix] = 0.4 * sqrt(current.w * 1.0 / 255.0);
+
+                /* smooth out the flow a bit */
+                flow_t[ix] = CLAMP(0.1 * (10 + ft * 0.75 - fb * 0.25), 0, 1);
+
+                flow_b[ix] = CLAMP(0.1 * (10 + fb * 0.75 - ft * 0.25), 0, 1);
+
+                flow_l[ix] = CLAMP(0.1 * (10 + fl * 0.75 - fr * 0.25), 0, 1);
+
+                flow_r[ix] = CLAMP(0.1 * (10 + fr * 0.75 - fl * 0.25), 0, 1);
+
+                outflow[ix] = 0;
+            }
+
+            ++srcIt;
+            ++upIt;
+            ++downIt;
+            ix++;
+            left = current;
+            current = right;
+            right = *(reinterpret_cast<WetPix*>(srcIt.rawData()));
+        }
+        ix+=2; // one for the last pixel on the line, and one for the first of the next line
+    }
+    // Second iteration: Reduce flow in dry areas
+    ix = width + 1;
+
+    for (TQ_INT32 y2 = 1; y2 < height - 1; ++y2) {
+        KisHLineIteratorPixel srcIt = src->createHLineIterator(dx + 1, dy + y2, width - 2, false);
+        while (!srcIt.isDone()) {
+            if ((reinterpret_cast<WetPix*>(srcIt.rawData()))->w > 0) {
+                /* reduce flow in dry areas */
+                flow_t[ix] *= fluid[ix] * fluid[ix - rs];
+                outflow[ix - rs] += flow_t[ix];
+                flow_b[ix] *= fluid[ix] * fluid[ix + rs];
+                outflow[ix + rs] += flow_b[ix];
+                flow_l[ix] *= fluid[ix] * fluid[ix - 1];
+                outflow[ix - 1] += flow_l[ix];
+                flow_r[ix] *= fluid[ix] * fluid[ix + 1];
+                outflow[ix + 1] += flow_r[ix];
+            }
+            ++srcIt;
+            ix++;
+        }
+        ix += 2;
+    }
+
+    // Third iteration: Combine the paint from the flow areas.
+    ix = width + 1;
+    for (TQ_INT32 y2 = 1; y2 < height - 1; ++y2) {
+        KisHLineIteratorPixel srcIt = src->createHLineIterator(dx, dy + y2, width, false);
+        KisHLineIteratorPixel upIt = src->createHLineIterator(dx + 1, dy + y2 - 1, width - 2, false);
+        KisHLineIteratorPixel downIt = src->createHLineIterator(dx + 1, dy + y2 + 1, width - 2, false);
+
+        KisHLineIteratorPixel dstIt = src->createHLineIterator(dx + 1, dy + y2, width - 2, true);
+
+        WetPix left = *(reinterpret_cast<const WetPix*>(srcIt.oldRawData()));
+        ++srcIt;
+        WetPix current = *(reinterpret_cast<const WetPix*>(srcIt.oldRawData()));
+        ++srcIt;
+        WetPix right = *(reinterpret_cast<const WetPix*>(srcIt.oldRawData()));
+        WetPix up, down;
+
+        while (!srcIt.isDone()) {
+            up = *(reinterpret_cast<const WetPix*>(upIt.oldRawData()));
+            down = *(reinterpret_cast<const WetPix*>(downIt.oldRawData()));
+
+            if ((reinterpret_cast<WetPix*>(srcIt.rawData()))->w > 0) {
+                reducePixel(&wet_mix, &current, 1 - outflow[ix]);
+                reducePixel(&wet_tmp, &up, flow_t[ix]);
+                combinePixels(&wet_mix, &wet_mix, &wet_tmp);
+                reducePixel(&wet_tmp, &down, flow_b[ix]);
+                combinePixels(&wet_mix, &wet_mix, &wet_tmp);
+                reducePixel(&wet_tmp, &left, flow_l[ix]);
+                combinePixels(&wet_mix, &wet_mix, &wet_tmp);
+                reducePixel(&wet_tmp, &right, flow_r[ix]);
+                combinePixels(&wet_mix, &wet_mix, &wet_tmp);
+                WetPix* target = reinterpret_cast<WetPix*>(dstIt.rawData());
+                wetPixFromDouble(target, &wet_mix);
+            }
+            ++srcIt;
+            ++dstIt;
+            ++upIt;
+            ++downIt;
+            ix++;
+
+            left = current;
+            current = right;
+            right = *(reinterpret_cast<const WetPix*>(srcIt.oldRawData()));
+        }
+        ix += 2;
+    }
+
+    delete[] flow_t;
+    delete[] flow_b;
+    delete[] flow_l;
+    delete[] flow_r;
+    delete[] fluid;
+    delete[] outflow;
+}
+
+void WetPhysicsFilter::dry(KisPaintDeviceSP src, KisPaintDeviceSP dst, const TQRect & r)
+{
+    kdDebug () << "Drying " << r << endl;
+    for (TQ_INT32 y = 0; y < r.height(); y++) {
+        KisHLineIteratorPixel srcIt = src->createHLineIterator(r.x(), r.y() + y, r.width(), false);
+        KisHLineIteratorPixel dstIt = dst->createHLineIterator(r.x(), r.y() + y, r.width(), true);
+
+        TQ_UINT16 w;
+        while (!srcIt.isDone()) {
+            // Two wet pixels in one KisWetColorSpace pixels.
+
+            WetPack pack = *(reinterpret_cast<WetPack*>(srcIt.rawData()));
+            WetPix* p = &(pack.paint);
+
+            w = p->w; // no -1 here because we work on unsigned ints!
+
+            if (w > 0)
+                p->w = w - 1;
+            else
+                p->w = 0;
+
+            *(reinterpret_cast<WetPack*>(dstIt.rawData())) = pack;
+
+            ++dstIt;
+            ++srcIt;
+        }
+    }
+}
+
+void WetPhysicsFilter::adsorb(KisPaintDeviceSP src, KisPaintDeviceSP /*dst*/, const TQRect & r)
+{
+    kdDebug() << "Adsorbing " << r << endl;
+    for (TQ_INT32 y = 0; y < r.height(); y++) {
+        KisHLineIteratorPixel srcIt = src->createHLineIterator(r.x(), r.y() + y, r.width(), true);
+
+        double ads;
+
+        WetPixDbl wet_top;
+        WetPixDbl wet_bot;
+
+        WetPack * pack;
+        TQ_UINT16 w;
+
+        while (!srcIt.isDone()) {
+            // Two wet pixels in one KisWetColorSpace pixels.
+            pack = reinterpret_cast<WetPack*>(srcIt.rawData());
+            WetPix* paint = &pack->paint;
+            WetPix* adsorb = &pack->adsorb;
+
+            /* do adsorption */
+            w = paint->w;
+
+            if (w == 0) {
+                ++srcIt;
+            }
+            else {
+
+                ads = 0.5 / TQMAX(w, 1);
+
+                wetPixToDouble(&wet_top, paint);
+                wetPixToDouble(&wet_bot, adsorb);
+
+                mergePixel(&wet_bot, &wet_top, ads, &wet_bot);
+                wetPixFromDouble(adsorb, &wet_bot);
+
+                paint->rd = (TQ_UINT16) (paint->rd*(1 - ads));
+                paint->rw = (TQ_UINT16) (paint->rw*(1 - ads));
+                paint->gd = (TQ_UINT16) (paint->gd*(1 - ads));
+                paint->gw = (TQ_UINT16) (paint->gw*(1 - ads));
+                paint->bd = (TQ_UINT16) (paint->bd*(1 - ads));
+                paint->bw = (TQ_UINT16) (paint->bw*(1 - ads));
+
+                ++srcIt;
+            }
+        }
+    }
+}
+
+void WetPhysicsFilter::combinePixels (WetPixDbl *dst, WetPixDbl *src1, WetPixDbl *src2)
+{
+    dst->rd = src1->rd + src2->rd;
+    dst->rw = src1->rw + src2->rw;
+    dst->gd = src1->gd + src2->gd;
+    dst->gw = src1->gw + src2->gw;
+    dst->bd = src1->bd + src2->bd;
+    dst->bw = src1->bw + src2->bw;
+    dst->w = src1->w + src2->w;
+}
+
+void WetPhysicsFilter::dilutePixel (WetPixDbl *dst, WetPix *src, double dilution)
+{
+    double scale = dilution * (1.0 / 8192.0);
+
+    dst->rd = src->rd * scale;
+    dst->rw = src->rw * scale;
+    dst->gd = src->gd * scale;
+    dst->gw = src->gw * scale;
+    dst->bd = src->bd * scale;
+    dst->bw = src->bw * scale;
+    dst->w = src->w * (1.0 / 8192.0);
+    dst->h = src->h * (1.0 / 8192.0);
+}
+
+
+void WetPhysicsFilter::reducePixel (WetPixDbl *dst, WetPix *src, double dilution)
+{
+    dilutePixel(dst, src, dilution);
+    dst->w *= dilution;
+}
+
+void WetPhysicsFilter::mergePixel (WetPixDbl *dst, WetPixDbl *src1, double dilution1,
+                                   WetPixDbl *src2)
+{
+    double d1, w1, d2, w2;
+    double ed1, ed2;
+
+    if (src1->rd < 1e-4) {
+        dst->rd = src2->rd;
+        dst->rw = src2->rw;
+    } else if (src2->rd < 1e-4) {
+        dst->rd = src1->rd * dilution1;
+        dst->rw = src1->rw * dilution1;
+    } else {
+        d1 = src1->rd;
+        w1 = src1->rw;
+        d2 = src2->rd;
+        w2 = src2->rw;
+        dst->rd = d1 * dilution1 + d2;
+        ed1 = exp(-d1 * dilution1);
+        ed2 = exp(-d2);
+        dst->rw = dst->rd * ((1 - ed1) * w1 / d1 + ed1 * (1 - ed2) * w2 / d2) /  (1 - ed1 * ed2);
+    }
+
+    if (src1->gd < 1e-4) {
+        dst->gd = src2->gd;
+        dst->gw = src2->gw;
+    } else if (src2->gd < 1e-4) {
+        dst->gd = src1->gd * dilution1;
+        dst->gw = src1->gw * dilution1;
+    } else {
+        d1 = src1->gd;
+        w1 = src1->gw;
+        d2 = src2->gd;
+        w2 = src2->gw;
+        dst->gd = d1 * dilution1 + d2;
+        ed1 = exp(-d1 * dilution1);
+        ed2 = exp(-d2);
+        dst->gw = dst->gd * ((1 - ed1) * w1 / d1 + ed1 * (1 - ed2) * w2 / d2) / (1 - ed1 * ed2);
+    }
+
+    if (src1->bd < 1e-4) {
+        dst->bd = src2->bd;
+        dst->bw = src2->bw;
+    } else if (src2->bd < 1e-4) {
+        dst->bd = src1->bd * dilution1;
+        dst->bw = src1->bw * dilution1;
+    } else {
+        d1 = src1->bd;
+        w1 = src1->bw;
+        d2 = src2->bd;
+        w2 = src2->bw;
+        dst->bd = d1 * dilution1 + d2;
+        ed1 = exp(-d1 * dilution1);
+        ed2 = exp(-d2);
+        dst->bw = dst->bd * ((1 - ed1) * w1 / d1 + ed1 * (1 - ed2) * w2 / d2) / (1 - ed1 * ed2);
+    }
+}
diff --git a/chalk/colorspaces/wet/wetphysicsfilter.h b/chalk/colorspaces/wet/wetphysicsfilter.h
new file mode 100644
index 000000000..eaae1a774
--- /dev/null
+++ b/chalk/colorspaces/wet/wetphysicsfilter.h
@@ -0,0 +1,87 @@
+/*
+ * This file is part of Chalk
+ *
+ * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WET_PHYSICS_FILTER_H
+#define WET_PHYSICS_FILTER_H
+
+#include <klocale.h>
+
+#include <kis_filter.h>
+#include <kis_types.h>
+
+#include "kis_wet_colorspace.h"
+
+class KisID;
+class TQRect;
+
+
+/**
+ * The wet physics filter must be run regularly from a timer
+ * or preferably from a thread. Every time the filter is processed
+ * the paint flows; every third time, the paint is adsorbed unto the
+ * lower pixel and dried.
+ *
+ * Note: this might also be implemented as three separate filters.
+ *       That might even be better.
+ */
+class WetPhysicsFilter: public KisFilter
+{
+public:
+    WetPhysicsFilter();
+public:
+    virtual void process(KisPaintDeviceSP src, KisPaintDeviceSP dst, KisFilterConfiguration*, const TQRect& r);
+
+    static inline KisID id() { return KisID("wetphysics", i18n("Watercolor Physics Simulation Filter")); };
+
+    virtual bool supportsPainting() { return false; }
+    virtual bool supportsPreview() { return false; }
+    virtual ColorSpaceIndependence colorSpaceIndependence() { return FULLY_INDEPENDENT; };
+    virtual bool workWith(KisColorSpace* cs) { return (cs->id() == KisID("WET")); };
+    
+private:
+
+    void flow(KisPaintDeviceSP src, KisPaintDeviceSP dst, const TQRect & r);
+    void dry(KisPaintDeviceSP src, KisPaintDeviceSP dst, const TQRect & r);
+
+    // Move stuff from the upperlayer to the lower layer. This is filter-level stuff.
+    void adsorb(KisPaintDeviceSP src, KisPaintDeviceSP dst, const TQRect & r);
+
+    // NOTE: this does not set the height fields
+    void combinePixels (WetPixDbl *dst, WetPixDbl *src1, WetPixDbl *src2);
+    void dilutePixel (WetPixDbl *dst, WetPix *src, double dilution);
+    void reducePixel (WetPixDbl *dst, WetPix *src, double dilution);
+
+    /*
+     * Allows visualization of adsorption by rotating the hue 120 degrees
+     * layer-merge combining. src1 is the top layer
+     *
+     * This does not set the dst h or w fields.
+     */
+    void mergePixel (WetPixDbl *dst, WetPixDbl *src1, double dilution1, WetPixDbl *src2);
+
+
+private:
+
+    TQ_INT32 m_adsorbCount;
+
+
+};
+
+#endif
diff --git a/chalk/colorspaces/wet/wetplugin.rc b/chalk/colorspaces/wet/wetplugin.rc
new file mode 100644
index 000000000..6e9334725
--- /dev/null
+++ b/chalk/colorspaces/wet/wetplugin.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui library="chalkwetplugin" version="1">
+<MenuBar>
+<Menu name="View"><text>&amp;View</text>
+	<Action name="wetnessvisualisation"/>
+</Menu>
+</MenuBar>
+</kpartgui>
diff --git a/chalk/colorspaces/wetsticky/Makefile.am b/chalk/colorspaces/wetsticky/Makefile.am
new file mode 100644
index 000000000..4ade368a8
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/Makefile.am
@@ -0,0 +1,25 @@
+kde_services_DATA = chalkwsplugin.desktop
+INCLUDES  =  -I$(srcdir)/../../sdk \
+	 -I$(srcdir)/../../core \
+	-I$(srcdir)/../../core/color_strategy \
+	-I$(srcdir)/../../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../../color_strategy/ \
+	-I$(srcdir)/../../ui \
+	$(KOFFICE_INCLUDES) \
+	-I$(interfacedir) \
+	$(KOPAINTER_INCLUDES) \
+	$(all_includes)
+
+kde_module_LTLIBRARIES = chalkwsplugin.la
+
+chalkwsplugin_la_SOURCES = wet_sticky_plugin.cc kis_wet_sticky_colorspace.cc kis_ws_engine_filter.cc
+noinst_HEADERS = wet_sticky_plugin.h kis_wet_sticky_colorspace.h kis_ws_engine_filter.h
+
+chalkwsplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+chalkwsplugin_la_LIBADD =  ../../chalkcolor/libchalkcolor.la
+
+chalkwsplugin_la_METASOURCES = AUTO
+
+SUBDIRS=brushop
+
+
diff --git a/chalk/colorspaces/wetsticky/README b/chalk/colorspaces/wetsticky/README
new file mode 100644
index 000000000..b1844466a
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/README
@@ -0,0 +1,42 @@
+Wet & Sticky
+
+The Chalk Wet & Sticky module is derived from the seminal dissertation
+"Wet & Stick: A Novel Model for Computer-Based Painting" by Malcom Tunde
+Cockshott, and the implementation of that model by Tunde Cockshott,
+David England and Kevin Waite. The complete source code to the first
+implementation is included in the module_ws/ws and is released under
+the terms of the GPL. 
+
+The W&S model is implemented in the following components:
+
+* A color strategy
+* A paint op
+* A filter
+
+The color strategy implements the canvas; the paint op implements the
+application of paint and the filter implements the paint simulation
+engine.
+
+This system adds the following interesting capabilities to Chalk:
+
+* Extending the tool options dialog with a widget describing the 
+  paint op.
+
+* Extending the paint op class with properties beyond opacity and
+  color to a more generic structure with can contain the many different
+  properties needed by more complex color models to calculate bitBlt's.
+
+  All the ordinary paint ops still work, but they act as if they are
+  applying dry, thin paint, conforming to Cockshott's analysis of the
+  Shoup model (which Chalk implemented in the first instance) as a subset
+  of the W&S model.
+
+* Adding continuously running filters (either in separate threads or 
+  called by a timer) to a particular paint device.
+
+* Adding a new way to mix colour; the older colour selection widgets
+  still work, but only give completely dry, infinitely thin paint.
+
+* Creating a layer with a fill of 'substrate' cells -- i.e, filling not just
+  with colour, but also with certain calculated amounts of height,
+  gravity and absorbency.
diff --git a/chalk/colorspaces/wetsticky/TODO b/chalk/colorspaces/wetsticky/TODO
new file mode 100644
index 000000000..513df2ffa
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/TODO
@@ -0,0 +1,7 @@
+* Add paintopbox to toolbox
+* Make all paint tools use the paintop from the paintop box
+* Add paintop properties palette
+* Add continuously running filters
+* Add filler objects that can fill a given area computationally
+* Add extensible properties for paint devices (to control things like drying)
+* Add default fill hook dependent on colorspace
diff --git a/chalk/colorspaces/wetsticky/brushop/Makefile.am b/chalk/colorspaces/wetsticky/brushop/Makefile.am
new file mode 100644
index 000000000..8df4d61e3
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/brushop/Makefile.am
@@ -0,0 +1,28 @@
+kde_services_DATA = chalkwsbrushpaintop.desktop
+
+chalkimagesdir = $(prefix)/share/apps/chalk/images
+chalkimages_DATA = wetpaintbrush.png
+
+# all_includes must remain last!
+INCLUDES =  -I$(srcdir)/../../../sdk \
+	-I$(srcdir)/../../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../../color_strategy/ \
+	-I$(srcdir)/../../../core/ \
+	-I$(srcdir)/../../../ui \
+	$(KOFFICE_INCLUDES) $(KOPAINTER_INCLUDES) $(all_includes)
+
+
+chalkwsbrushpaintop_la_SOURCES = \
+	wsbrushpaintop_plugin.cc \
+	kis_wsbrushop.cc
+
+noinst_HEADERS= \
+	wsbrushpaintop_plugin.h \
+	kis_wsbrushop.h
+
+kde_module_LTLIBRARIES = chalkwsbrushpaintop.la
+
+chalkwsbrushpaintop_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+chalkwsbrushpaintop_la_LIBADD =  ../../..//libchalkcommon.la $(LIB_KOPAINTER) $(LIB_KOFFICECORE)
+
+chalkwsbrushpaintop_la_METASOURCES = AUTO
diff --git a/chalk/colorspaces/wetsticky/brushop/README b/chalk/colorspaces/wetsticky/brushop/README
new file mode 100644
index 000000000..81156a89e
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/brushop/README
@@ -0,0 +1,2 @@
+Template for plugin paintops. Paint tools use the paintop to determine how
+to deposit their paint on the canvas, exactly.
diff --git a/chalk/colorspaces/wetsticky/brushop/chalkwsbrushpaintop.desktop b/chalk/colorspaces/wetsticky/brushop/chalkwsbrushpaintop.desktop
new file mode 100644
index 000000000..aa087bb91
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/brushop/chalkwsbrushpaintop.desktop
@@ -0,0 +1,73 @@
+[Desktop Entry]
+Name=Wet & Sticky Paintbrush Paintop
+Name[bg]=Мокра и лепкава четка
+Name[ca]=Pinzell humit i viscós de Paintop
+Name[cy]=Brws paent gwlyb gludiog
+Name[da]=Maleoperation med våd og klæbrig malerpensel
+Name[de]=Maloperation mit feuchtem & klebrigem Farbpinsel
+Name[el]=Βούρτσα υγρής και κολλώδους μπογιάς
+Name[eo]=KDED-testmodulo
+Name[es]=Pincel mojado y pegajoso para pintar
+Name[et]=Märja lõuendi joonistamistoiming
+Name[fa]=Paintop قلم‌موی چسبناک و مرطوب
+Name[fr]=Pinceau paintop mouillé et gluant
+Name[fy]=Kwasten foar wiete en kliemske ferfhannelings
+Name[gl]=Pintado Mollado e Pegoñento
+Name[hu]=Nedves és ragadós ecset
+Name[is]=Blautur & klístraður pensill
+Name[it]=Operazione con pennello bagnato e appiccicoso
+Name[km]=ជក់​ទឹក & ស្អិត Paintop
+Name[nb]=Fargemodell for våt og klissete pensel
+Name[nds]=Malen mit en natten backigen Pinsel
+Name[ne]=ओसिलो र टाँसिने पेन्टब्रस पेन्टप
+Name[nl]=Kwasten voor natte en kleverige verfverrichtingen
+Name[pl]=Mokre i lepkie włosie pędzla
+Name[pt]=Modelo de Cores Molhado e Pegajoso
+Name[pt_BR]=Modelo de Cores Molhado e Pegajoso
+Name[ru]=Кисть с параметрами влажности и прилипания
+Name[sk]=Mokrý a lepkavý štetec Paintop
+Name[sl]=Slikanje z mokrim in lepljivim čopičem
+Name[sr]=Модел боја мокре и лепљиве четкице
+Name[sr@Latn]=Model boja mokre i lepljive četkice
+Name[sv]=Målningsoperation med våt och klibbig målarpensel
+Name[uk]=Пензель з параметрами вогкості і клейкості
+Name[zh_CN]=湿性和粘性画布
+Name[zh_TW]=濕 & 黏的筆刷頭
+Comment=Wet & Sticky paintbrush
+Comment[bg]=Мокра и лепкава четка
+Comment[ca]=Pinzell humit i viscós
+Comment[cy]=Brws paent gwlyb gludiog
+Comment[da]=Våd og klæbrig malerpensel
+Comment[de]=Feuchter & klebriger Farbpinsel
+Comment[el]=Βούρτσα υγρής και κολλώδους μπογιάς
+Comment[eo]=Malseka & Glueca peniko
+Comment[es]=Pincel mojado y pegajoso
+Comment[et]=Märja lõuendi pintsel
+Comment[fa]=قلم‌موی چسبناک و مرطوب
+Comment[fr]=Pinceau mouillé et gluant
+Comment[fy]=Kwast foar wiete en kliemske ferfhannelings
+Comment[gl]=Un pincel mollado e pegaxoso
+Comment[hu]=Nedves és ragadós ecset
+Comment[is]=Blautur og klístraður pensill
+Comment[it]=Pennello bagnato e appiccicoso
+Comment[ja]=Wet & Sticky ペイントブラシ
+Comment[km]=ជក់​ទឹក & ស្អិត
+Comment[nb]=Våt og klissete pensel
+Comment[nds]=Natt un backig Pinsel
+Comment[ne]=ओसिलो र टाँसिने पेन्टब्रस
+Comment[nl]=Kwast voor nat en kleverige verfverichtingen
+Comment[pl]=Mokry i lepki pędzel
+Comment[pt]=Um pincel molhado e pegajoso
+Comment[pt_BR]=Modelo de cores de tela Molhada & Pegajosa
+Comment[ru]=Кисть с параметрами влажности и прилипания
+Comment[sk]=Mokrý a lepkavý štetec
+Comment[sl]=Moker in lepljiv čopič
+Comment[sr]=Мокра и лепљива четкица
+Comment[sr@Latn]=Mokra i lepljiva četkica
+Comment[sv]=Våt och klibbig målarpensel
+Comment[uk]=Пензель з параметрами вогкості і клейкості
+Comment[zh_TW]=濕 & 黏的筆刷
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-KDE-Library=chalkwsbrushpaintop
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/wetsticky/brushop/kis_wsbrushop.cc b/chalk/colorspaces/wetsticky/brushop/kis_wsbrushop.cc
new file mode 100644
index 000000000..8b182e08d
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/brushop/kis_wsbrushop.cc
@@ -0,0 +1,117 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <tqrect.h>
+
+#include <kdebug.h>
+
+#include "kis_brush.h"
+#include "kis_global.h"
+#include "kis_paint_device.h"
+#include "kis_painter.h"
+#include "kis_types.h"
+#include "kis_paintop.h"
+
+#include "kis_wsbrushop.h"
+
+KisPaintOp * KisWSBrushOpFactory::createOp(const KisPaintOpSettings */*settings*/, KisPainter * painter)
+{
+    KisPaintOp * op = new KisWSBrushOp(painter);
+    Q_CHECK_PTR(op);
+    return op;
+}
+
+KisWSBrushOp::KisWSBrushOp(KisPainter * painter)
+    : super(painter)
+{
+}
+
+KisWSBrushOp::~KisWSBrushOp()
+{
+}
+
+void KisWSBrushOp::paintAt(const KisPoint &pos,
+             const double pressure,
+             const double /*xTilt*/,
+             const double /*yTilt*/)
+{
+    // Painting should be implemented according to the following algorithm:
+    // retrieve brush
+    // if brush == tqmask
+    //          retrieve tqmask
+    // else if brush == image
+    //          retrieve image
+    // subsample (tqmask | image) for position -- pos should be double!
+    // apply filters to tqmask (colour | gradient | pattern | etc.
+    // composite filtered tqmask into temporary layer
+    // composite temporary layer into target layer
+    // @see: doc/brush.txt
+
+    if (!m_painter -> device()) return;
+
+    KisBrush *brush = m_painter -> brush();
+    
+    Q_ASSERT(brush);
+    if (!brush) return;
+    
+    KisPaintDeviceSP device = m_painter -> device();
+
+    KisPoint hotSpot = brush -> hotSpot(pressure);
+    KisPoint pt = pos - hotSpot;
+
+    // Split the coordinates into integer plus fractional parts. The integer
+    // is where the dab will be positioned and the fractional part determines
+    // the sub-pixel positioning.
+    TQ_INT32 x;
+    double xFraction;
+    TQ_INT32 y;
+    double yFraction;
+
+    splitCoordinate(pt.x(), &x, &xFraction);
+    splitCoordinate(pt.y(), &y, &yFraction);
+
+    KisLayerSP dab = 0;
+
+    if (brush -> brushType() == IMAGE || brush -> brushType() == PIPE_IMAGE) {
+        dab = brush -> image(device -> colorSpace(), pressure, xFraction, yFraction);
+    }
+    else {
+        KisAlphaMaskSP tqmask = brush -> tqmask(pressure, xFraction, yFraction);
+        dab = computeDab(tqmask);
+    }
+    m_painter -> setPressure(pressure);
+
+    TQRect dabRect = TQRect(0, 0, brush -> tqmaskWidth(pressure), brush -> tqmaskHeight(pressure));
+    TQRect dstRect = TQRect(x, y, dabRect.width(), dabRect.height());
+
+    KisImage * image = device -> image();
+    
+    if (image != 0) {
+        dstRect &= image -> bounds();
+    }
+    
+    if (dstRect.isNull() || dstRect.isEmpty() || !dstRect.isValid()) return;
+
+    TQ_INT32 sx = dstRect.x() - x;
+    TQ_INT32 sy = dstRect.y() - y;
+    TQ_INT32 sw = dstRect.width();
+    TQ_INT32 sh = dstRect.height();
+
+    m_painter -> bltSelection(dstRect.x(), dstRect.y(), m_painter -> compositeOp(), dab.data(), m_painter -> opacity(), sx, sy, sw, sh);
+    m_painter -> addDirtyRect(dstRect);
+}
diff --git a/chalk/colorspaces/wetsticky/brushop/kis_wsbrushop.h b/chalk/colorspaces/wetsticky/brushop/kis_wsbrushop.h
new file mode 100644
index 000000000..65f5fb6c0
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/brushop/kis_wsbrushop.h
@@ -0,0 +1,56 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_WSBRUSHOP_H_
+#define KIS_WSBRUSHOP_H_
+
+#include "kis_paintop.h"
+#include "kis_types.h"
+
+class KisPoint;
+class KisPainter;
+
+
+class KisWSBrushOpFactory : public KisPaintOpFactory  {
+
+public:
+    KisWSBrushOpFactory() {}
+    virtual ~KisWSBrushOpFactory() {}
+
+    virtual KisPaintOp * createOp(const KisPaintOpSettings *settings, KisPainter * painter);
+    virtual KisID id() { return KisID("wsbrush", i18n("Wet & Sticky Paintbrush")); }
+    virtual TQString pixmap() { return "wetpaintbrush.png"; }
+};
+
+class KisWSBrushOp : public KisPaintOp {
+
+    typedef KisPaintOp super;
+
+public:
+
+    KisWSBrushOp(KisPainter * painter);
+    virtual ~KisWSBrushOp();
+
+    void paintAt(const KisPoint &pos,
+             const double pressure,
+             const double /*xTilt*/,
+             const double /*yTilt*/);
+
+};
+
+#endif // KIS_WSBRUSHOP_H_
diff --git a/chalk/colorspaces/wetsticky/brushop/wetpaintbrush.png b/chalk/colorspaces/wetsticky/brushop/wetpaintbrush.png
new file mode 100644
index 000000000..8b681ec18
Binary files /dev/null and b/chalk/colorspaces/wetsticky/brushop/wetpaintbrush.png differ
diff --git a/chalk/colorspaces/wetsticky/brushop/wsbrushpaintop_plugin.cc b/chalk/colorspaces/wetsticky/brushop/wsbrushpaintop_plugin.cc
new file mode 100644
index 000000000..383bd9c54
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/brushop/wsbrushpaintop_plugin.cc
@@ -0,0 +1,56 @@
+/*
+ * wsbrushpaintop_plugin.cc -- Part of Chalk
+ *
+ * Copyright (c) 2005 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kinstance.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <ktempfile.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+
+#include <kis_paintop_registry.h>
+#include <kis_debug_areas.h>
+#include "kis_wsbrushop.h"
+
+#include "wsbrushpaintop_plugin.h"
+
+typedef KGenericFactory<WSBrushPaintOpPlugin> WSBrushPaintOpPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalkwsbrushpaintop, WSBrushPaintOpPluginFactory( "chalkcore" ) )
+
+
+WSBrushPaintOpPlugin::WSBrushPaintOpPlugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(WSBrushPaintOpPluginFactory::instance());
+
+    // This is not a gui plugin; only load it when the doc is created.
+    if ( tqparent->inherits("KisFactory") )
+    {
+        KisPaintOpRegistry::instance() -> add ( new KisWSBrushOpFactory );
+    }
+
+}
+
+WSBrushPaintOpPlugin::~WSBrushPaintOpPlugin()
+{
+}
+
+#include "wsbrushpaintop_plugin.moc"
diff --git a/chalk/colorspaces/wetsticky/brushop/wsbrushpaintop_plugin.h b/chalk/colorspaces/wetsticky/brushop/wsbrushpaintop_plugin.h
new file mode 100644
index 000000000..7e77afec1
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/brushop/wsbrushpaintop_plugin.h
@@ -0,0 +1,44 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WSBRUSH_PAINTOP_PLUGIN_H_
+#define WSBRUSH_PAINTOP_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+#include "kis_types.h"
+
+class KisView;
+
+/**
+ * A plugin wrapper that adds the paintop factories to the paintop registry.
+ */
+class WSBrushPaintOpPlugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    WSBrushPaintOpPlugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~WSBrushPaintOpPlugin();
+
+private:
+
+    KisView* m_view;
+};
+
+#endif // WSBRUSH_PAINTOP_PLUGIN_H_
diff --git a/chalk/colorspaces/wetsticky/chalkwsplugin.desktop b/chalk/colorspaces/wetsticky/chalkwsplugin.desktop
new file mode 100644
index 000000000..12fdc2862
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/chalkwsplugin.desktop
@@ -0,0 +1,46 @@
+[Desktop Entry]
+Name=Wet & Sticky Canvas Color Model
+Name[bg]=Цветови модел за мокро и лепкаво платно
+Name[ca]=Model de color de llenç humit i viscós
+Name[cy]=Model Lliw Cynfas Gwlyb a Gludiog
+Name[da]=Våd & klæbrig kanvasfarve-model
+Name[de]=Farbmodell feuchte & klebrige Leinwand
+Name[el]=Μοντέλο καμβά υγρής και κολλώδους μπογιάς
+Name[en_GB]=Wet & Sticky Canvas Colour Model
+Name[eo]=Kolormodelo por Malseka & Glueca Kanvaso
+Name[es]=Modelo de color de lienzo mojado y pegajoso
+Name[et]=Märja lõuendi värvimudel
+Name[eu]=Oihal heze eta itsaskorraren kolore-eredua
+Name[fa]=مدل رنگ صفحه مجازی چسبناک و مرطوب
+Name[fi]=Märkä ja tahmea kangasvärimalli
+Name[fr]=Modèle de couleurs gluantes et mouillées
+Name[fy]=wiete en kliemske canvasmodel
+Name[gl]=Modelo de Cores de Tea Mollado e Pegoñento
+Name[hu]=Nedves és ragadós vászon színmodell
+Name[is]=Blaut & klístruð litategund
+Name[it]=Modello di colore per tela bagnata
+Name[ja]=Wet & Sticky キャンバスカラーモデル
+Name[km]=ម៉ូដែល​ពណ៌​ទឹក & ស្អិត
+Name[ms]=Model Warna Kanvas Basah & Lekit
+Name[nb]=Fargemodell for vått og klissete lerret
+Name[nds]=Klöörmodell natt un backig Lienwand
+Name[ne]=ओसिलो र टाँसिने चित्रपट रङ मोडेल
+Name[nl]=Nat en kleverig canvasmodel
+Name[nn]=Fargemodell for vått lerret
+Name[pl]=Przestrzeń barw mokrego i lepkiego płótna
+Name[pt]=Modelo de Cores de Tela Molhado e Pegajoso
+Name[pt_BR]=Modelo de cores de tela Molhada & Pegajosa
+Name[ru]=Цветовое пространство с параметрами влажности и прилипания
+Name[sk]=Model farieb pre mokré a lepkavé plátno
+Name[sl]=Barvni model z mokrim in lepljivim platnom
+Name[sr]=Модел боја мокрог и лепљивог платна
+Name[sr@Latn]=Model boja mokrog i lepljivog platna
+Name[sv]=Våt och klibbig dukfärgmodell
+Name[uk]=Канва моделі кольорів з параметрами вогкості і клейкості
+Name[zh_CN]=湿性/粘性画布色彩模型
+Name[zh_TW]=濕 & 黏的畫布色彩模型
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-KDE-Library=chalkwsplugin
+X-Chalk-Version=2
+
diff --git a/chalk/colorspaces/wetsticky/kis_wet_sticky_colorspace.cc b/chalk/colorspaces/wetsticky/kis_wet_sticky_colorspace.cc
new file mode 100644
index 000000000..44426382e
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/kis_wet_sticky_colorspace.cc
@@ -0,0 +1,605 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <limits.h>
+#include <stdlib.h>
+
+#include <config.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+
+#include <klocale.h>
+#include <kdebug.h>
+
+#include "kis_color_conversions.h"
+#include "kis_abstract_colorspace.h"
+#include "kis_colorspace_registry.h"
+#include "kis_image.h"
+#include "kis_wet_sticky_colorspace.h"
+#include "kis_integer_maths.h"
+#include "kis_types.h"
+#include "kis_channelinfo.h"
+
+#define NOWSDEBUG
+
+using namespace WetAndSticky;
+
+enum WetStickyChannelIndex {
+    BLUE_CHANNEL_INDEX,
+    GREEN_CHANNEL_INDEX,
+    RED_CHANNEL_INDEX,
+    ALPHA_CHANNEL_INDEX,
+    HUE_CHANNEL_INDEX,
+    SATURATION_CHANNEL_INDEX,
+    LIGHTNESS_CHANNEL_INDEX,
+    LITQUID_CONTENT_CHANNEL_INDEX,
+    DRYING_RATE_CHANNEL_INDEX,
+    MISCIBILITY_CHANNEL_INDEX,
+    GRAVITATIONAL_DIRECTION_INDEX,
+    GRAVITATIONAL_STRENGTH_CHANNEL_INDEX,
+    ABSORBANCY_CHANNEL_INDEX,
+    PAINT_VOLUME_CHANNEL_INDEX
+};
+
+KisWetStickyColorSpace::KisWetStickyColorSpace() :
+    KisAbstractColorSpace(KisID("W&S", i18n("Wet & Sticky")), 0, icMaxEnumData)
+{
+    TQ_INT32 pos = 0;
+
+    // Basic representational definition
+    m_channels.push_back(new KisChannelInfo(i18n("Blue"), "B", pos, COLOR, 1));
+    m_channels.push_back(new KisChannelInfo(i18n("Green"), "G", ++pos, COLOR, 1));
+    m_channels.push_back(new KisChannelInfo(i18n("Red"), "R", ++pos, COLOR, 1));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), "A", ++pos, ALPHA, 1));
+
+    // Paint definition
+    m_channels.push_back(new KisChannelInfo(i18n("Hue"), "H", ++pos, COLOR, sizeof(float)));
+    m_channels.push_back(new KisChannelInfo(i18n("Saturation"), "S", pos+=sizeof(float) , COLOR, sizeof(float)));
+    m_channels.push_back(new KisChannelInfo(i18n("Lightness"), "L", pos+=sizeof(float), COLOR, sizeof(float)));
+
+    m_channels.push_back(new KisChannelInfo(i18n("Liquid Content"), "Q", pos+=sizeof(float), SUBSTANCE, 1));
+    m_channels.push_back(new KisChannelInfo(i18n("Drying Rate"), "D", ++pos, SUBSTANCE, 1));
+    m_channels.push_back(new KisChannelInfo(i18n("Miscibility"), "M", ++pos, SUBSTANCE, 1));
+
+    // Substrate definition
+    m_channels.push_back(new KisChannelInfo(i18n("Gravitational Direction"), "Gd", ++pos, SUBSTRATE, sizeof(enumDirection)));
+    m_channels.push_back(new KisChannelInfo(i18n("Gravitational Strength"), "Gs", pos+=sizeof(enumDirection), SUBSTRATE, 1));
+
+    m_channels.push_back(new KisChannelInfo(i18n("Absorbency"), "Ad", ++pos, SUBSTRATE, 1));
+    m_channels.push_back(new KisChannelInfo(i18n("Paint Volume"), "V", ++pos, SUBSTANCE, 1));
+
+    m_alphaPos = 3;
+    m_alphaSize = 1;
+    setDefaultProfile( 0 );
+
+#ifdef WSDEBUG
+    TQValueVector<KisChannelInfo *>_it it;
+    int i = 0;
+    for (it = m_channels.begin(); it != m_channels.end(); ++it)
+    {
+        KisChannelInfo * ch = (*it);
+        kdDebug(DBG_AREA_CMS) << "Channel: " << ch->name() << ", " << ch->pos() << ", " << i << "\n";
+        ++i;
+    }
+
+    kdDebug(DBG_AREA_CMS) << "Size of cell: " << sizeof(CELL) << "\n";
+#endif
+}
+
+
+KisWetStickyColorSpace::~KisWetStickyColorSpace()
+{
+}
+
+void KisWetStickyColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile *  profile)
+{
+    CELL_PTR p = (CELL_PTR) dst;
+    TQ_UINT8 r, g, b;
+
+    r = c.red();
+    g = c.green();
+    b = c.blue();
+
+    p -> red = r;
+    p -> green = g;
+    p -> blue = b;
+    p -> alpha = OPACITY_OPAQUE;
+
+    rgb_to_hls(r, g, b, &p->hue, &p->lightness, &p->saturation);
+
+    p -> liquid_content = 0;
+    p -> drying_rate = 0;
+    p -> miscibility = 0;
+
+    p -> direction = DOWN;
+    p -> strength = 10;
+
+    p -> absorbancy = 10;
+    p -> volume = 0;
+
+#ifdef WSDEBUG
+    kdDebug(DBG_AREA_CMS) << "qcolor: "
+        << " r: " << c.red() << " b: " << c.blue() << " g: " << c.red()
+        << " native color: (" << TQString().setNum(p->red) << ", "
+                              << TQString().setNum(p->green) << ", "
+                              << TQString().setNum(p->blue) << ", "
+                              << TQString().setNum(p->alpha) << ") "
+        << ", hls: (" << p->hue << ", "
+                      << p->lightness << ", "
+                      << p->saturation << ")\n";
+#endif
+}
+
+void KisWetStickyColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile *  profile)
+{
+    CELL_PTR p = (CELL_PTR) dst;
+    TQ_UINT8 r, g, b;
+
+    r = c.red();
+    g = c.green();
+    b = c.blue();
+
+    p -> red = r;
+    p -> green = g;
+    p -> blue = b;
+    p -> alpha = opacity;
+    rgb_to_hls(r, g, b, &p -> hue, &p -> lightness, &p -> saturation);
+
+    p ->liquid_content = 0;
+    p ->drying_rate = 0;
+    p ->miscibility = 0;
+
+    p -> direction = DOWN;
+    p -> strength = 10;
+
+    p -> absorbancy = 10;
+    p -> volume = 0;
+
+#ifdef WSDEBUG
+    kdDebug(DBG_AREA_CMS) << "qcolor: "
+        << " r: " << c.red() << " b: " << c.blue() << " g: " << c.red() << " opacity: " << opacity
+        << " native color: (" << TQString().setNum(p->red) << ", "
+                              << TQString().setNum(p->green) << ", "
+                              << TQString().setNum(p->blue) << ", "
+                              << TQString().setNum(p->alpha) << ") "
+        << ", hls: (" << p->hue << ", "
+                      << p->lightness << ", "
+                      << p->saturation << ")\n";
+#endif
+}
+
+void KisWetStickyColorSpace::toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile *  profile)
+{
+    CELL_PTR p = (CELL_PTR) src;
+
+    c -> setRgb(p -> red,
+            p -> green,
+            p -> blue);
+#ifdef WSDEBUG
+    kdDebug(DBG_AREA_CMS) << "Created qcolor from wet & sticky: " << " r: " << c->red() << " b: " << c->blue() << " g: " << c->red() << "\n";
+#endif
+}
+
+void KisWetStickyColorSpace::toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile *  profile)
+{
+
+    CELL_PTR p = (CELL_PTR) src;
+
+    c -> setRgb(p -> red,
+            p -> green,
+            p -> blue);
+
+    *opacity = p -> alpha;
+#ifdef WSDEBUG
+    kdDebug(DBG_AREA_CMS) << "Created qcolor from wet & sticky: " << " r: " << c->red() << " b: " << c->blue() << " g: " << c->red() << "\n";
+#endif
+}
+
+
+
+KisPixelRO KisWetStickyColorSpace::toKisPixelRO(const TQ_UINT8 *src, KisProfile *  profile)
+{
+    return KisPixelRO (src, src, this, profile);
+}
+
+KisPixel KisWetStickyColorSpace::toKisPixel(TQ_UINT8 *src, KisProfile *  profile)
+{
+    return KisPixel (src, src, this, profile);
+}
+
+void KisWetStickyColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+}
+
+TQ_UINT8 KisWetStickyColorSpace::getAlpha(const TQ_UINT8 *pixel) const
+{
+    return ((CELL_PTR)pixel)->alpha;
+}
+
+void KisWetStickyColorSpace::setAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const
+{
+    while (nPixels > 0) {
+        ((CELL_PTR)pixels)->alpha = alpha;
+        --nPixels;
+        pixels+=pixelSize();
+    }
+}
+
+void KisWetStickyColorSpace::applyAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels)
+{
+}
+
+void KisWetStickyColorSpace::applyInverseAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels)
+{
+}
+
+TQ_UINT8 KisWetStickyColorSpace::scaleToU8(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos)
+{
+    return 0;
+}
+
+TQ_UINT16 KisWetStickyColorSpace::scaleToU16(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos)
+{
+    return 0;
+}
+
+
+TQValueVector<KisChannelInfo *> KisWetStickyColorSpace::channels() const
+{
+    return m_channels;
+}
+
+bool KisWetStickyColorSpace::hasAlpha() const
+{
+    return true;
+}
+
+TQ_INT32 KisWetStickyColorSpace::nChannels() const
+{
+    return 14;
+}
+
+TQ_INT32 KisWetStickyColorSpace::nColorChannels() const
+{
+    return 3;
+}
+
+TQ_INT32 KisWetStickyColorSpace::nSubstanceChannels() const
+{
+    return 4;
+
+}
+
+TQ_INT32 KisWetStickyColorSpace::pixelSize() const
+{
+    return sizeof(CELL);
+}
+
+
+TQImage KisWetStickyColorSpace::convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                           KisProfile *  /*srcProfile*/, KisProfile *  /*dstProfile*/,
+                           TQ_INT32 /*renderingIntent*/, float /*exposure*/)
+{
+
+    TQImage img(width, height, 32, 0, TQImage::LittleEndian);
+
+    TQ_INT32 i = 0;
+    uchar *j = img.bits();
+
+    CELL_PTR p = (CELL_PTR) data;
+
+    while ( i < width * height) {
+
+        const TQ_UINT8 PIXEL_BLUE = 0;
+        const TQ_UINT8 PIXEL_GREEN = 1;
+        const TQ_UINT8 PIXEL_RED = 2;
+        const TQ_UINT8 PIXEL_ALPHA = 3;
+
+        *( j + PIXEL_ALPHA ) = p -> alpha;
+        *( j + PIXEL_RED )   = p -> red;
+        *( j + PIXEL_GREEN ) = p -> green;
+        *( j + PIXEL_BLUE )  = p -> blue;
+
+        p++;
+        i++;
+        j += 4; // Because we're hard-coded 32 bits deep, 4 bytes
+    }
+    return img;
+}
+
+bool KisWetStickyColorSpace::convertPixelsTo(const TQ_UINT8 * src, KisProfile *  /*srcProfile*/,
+                         TQ_UINT8 * dst, KisAbstractColorSpace * dstColorSpace, KisProfile *  dstProfile,
+                         TQ_UINT32 numPixels,
+                         TQ_INT32 /*renderingIntent*/)
+{
+    TQ_INT32 dSize = dstColorSpace -> pixelSize();
+    TQ_INT32 sSize = pixelSize();
+
+    TQ_UINT32 j = 0;
+    TQ_UINT32 i = 0;
+    TQColor c;
+    CELL_PTR cp;
+    while ( i < numPixels ) {
+        cp = (CELL_PTR) (src + i);
+
+        c.setRgb(cp -> red,
+             cp -> green,
+             cp -> blue);
+
+        dstColorSpace -> fromTQColor(c, cp -> alpha, (dst + j), dstProfile);
+
+        i += sSize;
+        j += dSize;
+
+    }
+    return true;
+
+}
+
+void KisWetStickyColorSpace::bitBlt(TQ_UINT8 *dst,
+                      TQ_INT32 dstRowStride,
+                      const TQ_UINT8 *src,
+                      TQ_INT32 srcRowStride,
+                      const TQ_UINT8 *tqmask,
+                      TQ_INT32 tqmaskRowStride,
+                      TQ_UINT8 opacity,
+                      TQ_INT32 rows,
+                      TQ_INT32 cols,
+                      const KisCompositeOp& op)
+{
+    switch (op.op()) {
+    case COMPOSITE_UNDEF:
+        // Undefined == no composition
+        break;
+    case COMPOSITE_OVER:
+        compositeOver(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    case COMPOSITE_COPY:
+    default:
+        compositeCopy(dst, dstRowStride, src, srcRowStride, tqmask, tqmaskRowStride, rows, cols, opacity);
+        break;
+    }
+
+}
+
+
+void KisWetStickyColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    // XXX: This is basically the same as with rgb and used to composite layers for  Composition for
+    //      painting works differently
+
+
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            CELL_PTR dstCell = (CELL_PTR) dst;
+            CELL_PTR srcCell = (CELL_PTR) src;
+
+#ifdef WSDEBUG
+            kdDebug(DBG_AREA_CMS) << "Source: " << rows << ", " << columns << " color: " <<
+                srcCell->red << ", " << srcCell->blue << ", " << srcCell->green << ", " << srcCell->alpha << ", " << srcCell->volume << "\n";
+
+
+            kdDebug(DBG_AREA_CMS) << "Destination: "  << rows << ", " << columns << " color: " <<
+                dstCell->red << ", " << dstCell->blue << ", " << dstCell->green << ", " << dstCell->alpha << ", " << dstCell->volume << "\n";
+
+#endif
+
+            TQ_UINT8 srcAlpha = srcCell->alpha;
+
+            // apply the alphatqmask
+            if(tqmask != 0)
+            {
+                if(*tqmask != OPACITY_OPAQUE)
+                    srcAlpha = UINT8_MULT(srcAlpha, *tqmask);
+                tqmask++;
+            }
+
+            if (srcAlpha != OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT8_MULT(srcCell->alpha, opacity);
+                }
+
+                if (srcAlpha == OPACITY_OPAQUE) {
+                    memcpy(dst, src, 3); // XXX: First three bytes for rgb?
+                } else {
+                    TQ_UINT8 dstAlpha = dstCell->alpha;
+
+                    TQ_UINT8 srcBlend;
+
+                    if (dstAlpha == OPACITY_OPAQUE) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        TQ_UINT8 newAlpha = dstAlpha + UINT8_MULT(OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                        dstCell->alpha = newAlpha;
+
+                        if (newAlpha != 0) {
+                            srcBlend = UINT8_DIVIDE(srcAlpha, newAlpha);
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend == OPACITY_OPAQUE) {
+                        memcpy(dst, src, 3); //XXX: First three bytes for rgb?
+                    } else {
+                        dstCell->red = UINT8_BLEND(srcCell->red, dstCell->red, srcBlend);
+                        dstCell->green = UINT8_BLEND(srcCell->green, dstCell->green, srcBlend);
+                        dstCell->blue = UINT8_BLEND(srcCell->blue, dstCell->blue, srcBlend);
+                    }
+                }
+            }
+            columns--;
+            src += sizeof(CELL);
+            dst += sizeof(CELL);
+        }
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+
+        if(tqmaskRowStart)
+            tqmaskRowStart += tqmaskRowStride;
+    }
+
+}
+
+void KisWetStickyColorSpace::compositeCopy(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity)
+{
+    TQ_INT32 linesize = sizeof(CELL) * columns;
+    TQ_UINT8 *d;
+    const TQ_UINT8 *s;
+    d = dst;
+    s = src;
+
+    while (rows-- > 0) {
+        memcpy(d, s, linesize);
+        d += dstRowStride;
+        s += srcRowStride;
+    }
+
+}
+
+
+KisCompositeOpList KisWetStickyColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+
+    return list;
+}
+
+TQString KisWetStickyColorSpace::channelValueText(const TQ_UINT8 *U8_pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < nChannels());
+    const CELL *pixel = reinterpret_cast<const CELL *>(U8_pixel);
+
+    switch (channelIndex) {
+    case BLUE_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> blue);
+    case GREEN_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> green);
+    case RED_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> red);
+    case ALPHA_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> alpha);
+    case HUE_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> hue);
+    case SATURATION_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> saturation);
+    case LIGHTNESS_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> lightness);
+    case LITQUID_CONTENT_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> liquid_content);
+    case DRYING_RATE_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> drying_rate);
+    case MISCIBILITY_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> miscibility);
+    case GRAVITATIONAL_DIRECTION_INDEX:
+        {
+            switch (pixel -> direction) {
+            case UP:
+                return i18n("Up");
+            case DOWN:
+                return i18n("Down");
+            case LEFT:
+                return i18n("Left");
+            case RIGHT:
+                return i18n("Right");
+            default:
+                Q_ASSERT(false);
+                return TQString();
+            }
+        }
+    case GRAVITATIONAL_STRENGTH_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> strength);
+    case ABSORBANCY_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> absorbancy);
+    case PAINT_VOLUME_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> volume);
+    default:
+        Q_ASSERT(false);
+        return TQString();
+    }
+}
+
+TQString KisWetStickyColorSpace::normalisedChannelValueText(const TQ_UINT8 *U8_pixel, TQ_UINT32 channelIndex) const
+{
+    Q_ASSERT(channelIndex < nChannels());
+    const CELL *pixel = reinterpret_cast<const CELL *>(U8_pixel);
+
+    //XXX: Are these right?
+
+    switch (channelIndex) {
+    case BLUE_CHANNEL_INDEX:
+        return TQString().setNum(static_cast<float>(pixel -> blue) / UINT8_MAX);
+    case GREEN_CHANNEL_INDEX:
+        return TQString().setNum(static_cast<float>(pixel -> green) / UINT8_MAX);
+    case RED_CHANNEL_INDEX:
+        return TQString().setNum(static_cast<float>(pixel -> red) / UINT8_MAX);
+    case ALPHA_CHANNEL_INDEX:
+        return TQString().setNum(static_cast<float>(pixel -> alpha) / UINT8_MAX);
+    case HUE_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> hue);
+    case SATURATION_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> saturation);
+    case LIGHTNESS_CHANNEL_INDEX:
+        return TQString().setNum(pixel -> lightness);
+    case LITQUID_CONTENT_CHANNEL_INDEX:
+        return TQString().setNum(static_cast<float>(pixel -> liquid_content) / UINT8_MAX);
+    case DRYING_RATE_CHANNEL_INDEX:
+        return TQString().setNum(static_cast<float>(pixel -> drying_rate) / UINT8_MAX);
+    case MISCIBILITY_CHANNEL_INDEX:
+        return TQString().setNum(static_cast<float>(pixel -> miscibility) / UINT8_MAX);
+    case GRAVITATIONAL_DIRECTION_INDEX:
+        {
+            switch (pixel -> direction) {
+            case UP:
+                return i18n("Up");
+            case DOWN:
+                return i18n("Down");
+            case LEFT:
+                return i18n("Left");
+            case RIGHT:
+                return i18n("Right");
+            default:
+                Q_ASSERT(false);
+                return TQString();
+            }
+        }
+    case GRAVITATIONAL_STRENGTH_CHANNEL_INDEX:
+        return TQString().setNum(static_cast<float>(pixel -> strength) / UINT8_MAX);
+    case ABSORBANCY_CHANNEL_INDEX:
+        return TQString().setNum(static_cast<float>(pixel -> absorbancy) / UINT8_MAX);
+    case PAINT_VOLUME_CHANNEL_INDEX:
+        return TQString().setNum(static_cast<float>(pixel -> volume) / UINT8_MAX);
+    default:
+        Q_ASSERT(false);
+        return TQString();
+    }
+}
+
diff --git a/chalk/colorspaces/wetsticky/kis_wet_sticky_colorspace.h b/chalk/colorspaces/wetsticky/kis_wet_sticky_colorspace.h
new file mode 100644
index 000000000..57f3ac70b
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/kis_wet_sticky_colorspace.h
@@ -0,0 +1,148 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.o>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_COLORSPACE_WET_STICKY_H_
+#define KIS_COLORSPACE_WET_STICKY_H_
+
+#include <tqcolor.h>
+
+#include "kis_global.h"
+#include "kis_abstract_colorspace.h"
+
+namespace WetAndSticky {
+
+    /**
+         * A color is specified as a vector in HLS space.  Hue is a value
+     * in the range 0..360 degrees with 0 degrees being red.  Saturation
+         * and Lightness are both in the range [0,1].  A lightness of 0 means
+     * black, with 1 being white.  A totally saturated color has saturation
+     * of 1.
+     */
+
+    enum enumDirection {
+        UP,
+        DOWN,
+        LEFT,
+        RIGHT
+    };
+
+    /**
+     * Defines the contents and attributes of a cell on the canvas.
+     */
+    typedef struct cell {
+        TQ_UINT8 blue;
+        TQ_UINT8 green;
+        TQ_UINT8 red;
+        TQ_UINT8 alpha;
+
+        float   hue;
+        float   saturation;
+        float   lightness;
+
+        TQ_UINT8 liquid_content;
+        TQ_UINT8 drying_rate;
+        TQ_UINT8 miscibility;
+
+        enumDirection direction;
+        TQ_UINT8 strength;
+
+        TQ_UINT8  absorbancy;  /* How much paint can this cell hold? */
+        TQ_UINT8  volume;      /* The volume of paint. */
+
+    } CELL, *CELL_PTR;
+
+
+}
+
+
+
+class KisWetStickyColorSpace : public KisAbstractColorSpace {
+public:
+    KisWetStickyColorSpace();
+    virtual ~KisWetStickyColorSpace();
+
+public:
+
+
+
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile *  profile = 0);
+    virtual void fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile *  profile = 0);
+
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile *  profile = 0);
+    virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile *  profile = 0);
+
+    virtual TQ_UINT8 getAlpha(const TQ_UINT8 *pixel) const;
+    virtual void setAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const;
+
+    virtual void applyAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+    virtual void applyInverseAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
+
+    virtual TQ_UINT8 scaleToU8(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+    virtual TQ_UINT16 scaleToU16(const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
+
+    virtual TQValueVector<KisChannelInfo *> channels() const;
+    virtual bool hasAlpha() const;
+    virtual TQ_INT32 nChannels() const;
+    virtual TQ_INT32 nColorChannels() const;
+    virtual TQ_INT32 nSubstanceChannels() const;
+    virtual TQ_INT32 pixelSize() const;
+
+    virtual TQString channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+    virtual TQString normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
+
+    virtual TQImage convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                       KisProfile *  srcProfile, KisProfile *  dstProfile,
+                       TQ_INT32 renderingIntent = INTENT_PERCEPTUAL,
+                       float exposure = 0.0f);
+
+
+    virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+    virtual void convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
+    virtual void invertColor(TQ_UINT8 * src, TQ_INT32 nPixels);
+    virtual void darken(const TQ_UINT8 * src, TQ_UINT8 * dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const;
+
+    virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+protected:
+
+    virtual void bitBlt(TQ_UINT8 *dst,
+                TQ_INT32 dstRowSize,
+                const TQ_UINT8 *src,
+                TQ_INT32 srcRowStride,
+                const TQ_UINT8 *srcAlphaMask,
+                TQ_INT32 tqmaskRowStride,
+                TQ_UINT8 opacity,
+                TQ_INT32 rows,
+                TQ_INT32 cols,
+                const KisCompositeOp& op);
+
+
+    virtual bool convertPixelsTo(const TQ_UINT8 * src, KisProfile *  srcProfile,
+                     TQ_UINT8 * dst, KisAbstractColorSpace * dstColorSpace, KisProfile *  dstProfile,
+                     TQ_UINT32 numPixels,
+                     TQ_INT32 renderingIntent = INTENT_PERCEPTUAL);
+
+
+private:
+
+    void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeClear(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+    void compositeCopy(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+
+};
+
+#endif // KIS_COLORSPACE_WET_STICKY_H_
diff --git a/chalk/colorspaces/wetsticky/kis_ws_engine_filter.cc b/chalk/colorspaces/wetsticky/kis_ws_engine_filter.cc
new file mode 100644
index 000000000..040d30023
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/kis_ws_engine_filter.cc
@@ -0,0 +1,180 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <stdlib.h>
+#include <vector>
+#include <math.h>
+
+#include <tqpoint.h>
+#include <tqspinbox.h>
+#include <tqrect.h>
+#include <tqcolor.h>
+
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kinstance.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <ktempfile.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <knuminput.h>
+
+#include <kis_debug_areas.h>
+#include <kis_image.h>
+#include <kis_iterators_pixel.h>
+#include <kis_layer.h>
+#include <kis_filter_registry.h>
+#include <kis_debug_areas.h>
+#include <kis_types.h>
+#include <kis_paint_device.h>
+#include <kis_colorspace_registry.h>
+
+#include "kis_ws_engine_filter.h"
+#include "kis_wet_sticky_colorspace.h"
+
+/**
+ * The Wet & Sticky Engine filter is based on the wet & sticky model
+ * for computer painting designed by Tunde Cockshott and implemented
+ * by David England and Kevin Waite.
+ *
+ * The filter implements the engine that moves the paint according to
+ * gravity, viscosity and absorbency.
+ *
+ */
+KisWSEngineFilter::KisWSEngineFilter() : KisFilter(id(), "", i18n("&Wet & Sticky paint engine..."))
+{
+}
+
+
+/**
+ * Sets the POINT giving the coordinate location of the next
+ * cell on the canvas to be visited.  There is an even probability
+ * of each cell being visited.
+ */
+TQPoint next_cell(TQ_UINT32 width, TQ_UINT32 height)
+{
+    return TQPoint(random() * width,  random() * height);
+}
+
+void single_step(KisColorSpace * cs, KisPaintDeviceSP src,  KisPaintDeviceSP dst, const TQRect & rect, bool native)
+{
+    using namespace WetAndSticky;
+
+
+    TQPoint p = next_cell( rect.width(),  rect.height() );
+
+    // XXX: We could optimize by randomly doing lines of 64 pixels
+    // -- maybe that would be enough to avoid the windscreen wiper
+    // effect.
+    KisHLineIterator iter = src -> createHLineIterator(p.x(), p.y(), 1,  false);
+
+    TQ_UINT8 *orig = iter.rawData();
+    TQ_UINT8 *pix = orig;
+
+     if (!orig) return;
+
+    if (!native ) {
+        TQColor c;
+        TQ_UINT8 opacity;
+
+        src -> colorSpace() -> toTQColor(pix, &c, &opacity);
+        TQ_UINT8 *pix = new TQ_UINT8[sizeof( cell )];
+        Q_CHECK_PTR(pix);
+
+        cs -> fromTQColor(c, opacity, pix);
+    }
+
+    // Process
+
+    CELL_PTR c = ( CELL_PTR )pix;
+
+
+    if ( !native ) {
+        // Set RGBA back
+    }
+
+}
+
+void KisWSEngineFilter::process(KisPaintDeviceSP src, KisPaintDeviceSP dst, KisFilterConfiguration* configuration, const TQRect& rect)
+{
+
+    m_src = src;
+    m_dst = dst;
+    m_cfg = ( KisWSEngineFilterConfiguration * )configuration;
+    m_rect = rect;
+
+
+    kdDebug(DBG_AREA_FILTERS) << "WSEnginefilter called!\n";
+    TQTime t;
+    t.restart();
+
+    // Two possibilities: we have our own, cool w&s pixel, and
+    // then we have real data to mess with, or we're filtering a
+    // boring shoup-model paint device and we can only work by
+    // synthesizing w&s pixels.
+    bool native = false;
+    // XXX: We need a better way to ID color strategies
+    if ( src -> colorSpace() -> id() == KisID("W&S","") ) native = true;
+
+    // XXX: We need a better way to ID color strategies
+    KisColorSpace * cs = KisColorSpaceRegistry::instance()->get("W&S");
+
+    TQ_UINT32 pixels = 400; //m_cfg -> pixels();
+
+    kdDebug(DBG_AREA_FILTERS) << "Going to singlestep " << pixels << " pixels.\n";
+
+    // Determine whether we want an infinite loop
+    if ( pixels == 0 ) {
+        while ( true )
+            single_step (cs, src, dst, rect, native);
+    }
+    // Or not.
+    else {
+        for ( TQ_UINT32 i = 0; i < pixels; ++i ) {
+            single_step (cs, src, dst, rect, native);
+        }
+    }
+    kdDebug(DBG_AREA_FILTERS) << "Done in " << t.elapsed() << " ms\n";
+
+}
+
+KisFilterConfigWidget * KisWSEngineFilter::createConfigurationWidget(TQWidget* tqparent, KisPaintDeviceSP dev)
+{
+//     KisWSEngineFilterConfigurationWidget* kefcw = new KisWSEngineFilterConfigurationWidget(this,tqparent, "");
+//     kdDebug(DBG_AREA_FILTERS) << kefcw << endl;
+//     return kefcw  ;
+    return 0;
+}
+
+KisFilterConfiguration* KisWSEngineFilter::configuration(TQWidget* nwidget, KisPaintDeviceSP dev)
+{
+//     KisWSEngineFilterConfigurationWidget* widget = (KisWSEngineFilterConfigurationWidget*) nwidget;
+
+//     if( widget == 0 )
+//     {
+//         return new KisWSEngineFilterConfiguration(30);
+//     } else {
+//                 TQ_UINT32 depth = widget -> baseWidget() -> depthSpinBox -> value();
+
+//                 return new KisWSEngineFilterConfiguration(depth);
+//         }
+
+
+    return new KisWSEngineFilterConfiguration( m_rect.height() * m_rect.width() );
+}
+
diff --git a/chalk/colorspaces/wetsticky/kis_ws_engine_filter.h b/chalk/colorspaces/wetsticky/kis_ws_engine_filter.h
new file mode 100644
index 000000000..d1c23810c
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/kis_ws_engine_filter.h
@@ -0,0 +1,77 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef _KIS_WS_ENGINE_FILTER_H_
+#define _KIS_WS_ENGINE_FILTER_H_
+
+#include <kdebug.h>
+
+#include <kis_view.h>
+#include <kis_filter.h>
+#include <kis_id.h>
+
+class KisWSEngineFilterConfiguration : public KisFilterConfiguration
+{
+
+public:
+
+    KisWSEngineFilterConfiguration() { m_pixels = 10000; }
+
+    KisWSEngineFilterConfiguration(TQ_UINT32 pixels = 0) { m_pixels = pixels; }
+
+    TQ_UINT32 pixels() { return m_pixels; }
+
+private:
+
+    TQ_UINT32 m_pixels; // The number of pixels the filter should
+               // move. 0 means keep running indefinitely
+
+
+
+};
+
+class KisWSEngineFilter : public KisFilter
+{
+
+public:
+
+    KisWSEngineFilter();
+
+    virtual void process(KisPaintDeviceSP src, KisPaintDeviceSP dst, KisFilterConfiguration* cfg, const TQRect& rc);
+
+    static inline KisID id() { return KisID("Wet & Sticky Engine", i18n("Wet & Sticky")); };
+    virtual bool supportsPainting() { return false; }
+    virtual bool supportsPreview() { return false; }
+    virtual bool supportsIncrementalPainting() { return false; }
+
+public:
+    virtual KisFilterConfigWidget * createConfigurationWidget(TQWidget* tqparent, KisPaintDeviceSP dev);
+    virtual KisFilterConfiguration* configuration(TQWidget*, KisPaintDeviceSP dev);
+
+
+private:
+
+private:
+
+    KisWSEngineFilterConfiguration * m_cfg;
+    KisPaintDeviceSP m_src;
+    KisPaintDeviceSP m_dst;
+    TQRect m_rect;
+
+};
+
+#endif // _KIS_WS_ENGINE_FILTER_H_
diff --git a/chalk/colorspaces/wetsticky/wet_sticky_plugin.cc b/chalk/colorspaces/wetsticky/wet_sticky_plugin.cc
new file mode 100644
index 000000000..525b18bb5
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/wet_sticky_plugin.cc
@@ -0,0 +1,60 @@
+/*
+ * wet_sticky_plugin.cc -- Part of Chalk
+ *
+ * Copyright (c) 2005 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kinstance.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <ktempfile.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+
+#include <kis_colorspace_registry.h>
+#include <kis_debug_areas.h>
+#include "wet_sticky_plugin.h"
+
+#include "kis_wet_sticky_colorspace.h"
+#include "kis_ws_engine_filter.h"
+
+typedef KGenericFactory<WetStickyPlugin> WetStickyPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalkwsplugin, WetStickyPluginFactory( "chalkcore" ) )
+
+
+WetStickyPlugin::WetStickyPlugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+           setInstance(WetStickyPluginFactory::instance());
+
+    // This is not a gui plugin; only load it when the doc is created.
+    if ( tqparent->inherits("KisFactory") )
+    {
+        KisColorSpace * colorSpaceWS = new KisWetStickyColorSpace();
+        Q_CHECK_PTR(colorSpaceWS);
+        KisColorSpaceRegistry::instance() -> add(colorSpaceWS);
+        KisFilterRegistry::instance()->add(new KisWSEngineFilter());
+    }
+
+}
+
+WetStickyPlugin::~WetStickyPlugin()
+{
+}
+
+#include "wet_sticky_plugin.moc"
diff --git a/chalk/colorspaces/wetsticky/wet_sticky_plugin.h b/chalk/colorspaces/wetsticky/wet_sticky_plugin.h
new file mode 100644
index 000000000..fe981a59b
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/wet_sticky_plugin.h
@@ -0,0 +1,42 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WET_STICKY_PLUGIN_H_
+#define WET_STICKY_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the Wet & Sticky colour space strategy.
+ *
+ * The Wet & Sticky paint system was first designed in 1991 by Tunde Cockshott
+ * and was further developed by David England and Kevin Waite. It was released
+ * under the GPL in 2005.
+ *
+ */
+class WetStickyPlugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    WetStickyPlugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~WetStickyPlugin();
+
+};
+
+#endif // WET_STICKY_PLUGIN_H_
diff --git a/chalk/colorspaces/wetsticky/ws/GNU b/chalk/colorspaces/wetsticky/ws/GNU
new file mode 100644
index 000000000..e69de29bb
diff --git a/chalk/colorspaces/wetsticky/ws/GNU Public Licence.txt b/chalk/colorspaces/wetsticky/ws/GNU Public Licence.txt
new file mode 100644
index 000000000..5e79907b0
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/GNU Public Licence.txt	
@@ -0,0 +1,341 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which tqcontains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it tqcontains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
diff --git a/chalk/colorspaces/wetsticky/ws/README b/chalk/colorspaces/wetsticky/ws/README
new file mode 100644
index 000000000..15f55e77d
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/README
@@ -0,0 +1,4 @@
+
+The gear example
+
+This example program demonstrates how to use OpenGL display lists.
diff --git a/chalk/colorspaces/wetsticky/ws/TODO b/chalk/colorspaces/wetsticky/ws/TODO
new file mode 100644
index 000000000..91c48a03b
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/TODO
@@ -0,0 +1,24 @@
+1/ Load in portable pixmaps (PPM). Set an arbitrary paint attribute
+map for each different colour. Otherwise load in a paint attribute
+map definition file.
+2/ Input from "brush". Incremental development of brush input.
+First simple mixing then
+empty brush moving paint
+paint on top of paint
+attribute application.
+3/ Animation 
+1000000 = 1 fps
+500000  = 2 fps
+250000  = 4 fps
+125000  = 8 fps
+62500   = 16 fps
+41660   = 24 fps
+
+4/ NK times    178.9 real        49.4 user        13.3 sys
+   Orig times  636.6 real       111.1 user        43.6 sys
+
+5/ Cross section through volume 
+
+6/ Separate Colour scale window
+
+7/ Transparency
diff --git a/chalk/colorspaces/wetsticky/ws/after.jpg b/chalk/colorspaces/wetsticky/ws/after.jpg
new file mode 100644
index 000000000..5116efdbd
Binary files /dev/null and b/chalk/colorspaces/wetsticky/ws/after.jpg differ
diff --git a/chalk/colorspaces/wetsticky/ws/anim.c b/chalk/colorspaces/wetsticky/ws/anim.c
new file mode 100644
index 000000000..995a3dffc
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/anim.c
@@ -0,0 +1,154 @@
+/*
+        FILE:           x_interface.c
+        PURPOSE:        Creation and access to an X windows interface
+                        to wet+sticky using Athena Widgets
+        AUTHOR:         David England
+        VERSION:        1.00  (13-May-91)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 
+
+*/
+
+#define FRAME_LIMIT  36
+
+#include <X11/Xos.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Intrinsic.h>
+
+#include <X11/cursorfont.h>
+#include <X11/StringDefs.h>
+
+#include <X11/Shell.h>
+#include <X11/Xaw/Box.h>
+#include <X11/Xaw/Label.h>
+#include <stdio.h>
+
+#include "constants.h"
+#include "types.h"
+
+#include "engine.h"
+#include "canvas.h"
+
+/* Window Heirarchy -
+        Three shell widgets, one for colour output, two for attributes
+output
+        plus a back_up pixmap for redrawing
+*/
+
+static Widget top_level;
+static Widget       colour_shell;
+static Widget            colour_box;
+static Widget                   colour_canvas;
+static Pixmap    colour_pm[FRAME_LIMIT];
+
+static GC gc;
+static GC tmp_gc;
+static long tqmask;
+static XGCValues values;
+
+Display *display;
+char pix_file[32];
+unsigned int delay;
+
+main(argc, argv)
+int argc;
+char *argv[];
+{
+    static Arg args[]={
+        {XtNwidth, (XtArgVal) 0},
+        {XtNheight, (XtArgVal)0} };
+
+	XEvent event;
+        int i, width, height;
+	int ret;
+	int c;
+
+	extern char *optarg;
+       extern int optind;
+
+	width = 300;
+	height = 300;
+
+        args[0].value = (XtArgVal)width;
+
+        args[1].value = (XtArgVal)height;
+
+        top_level =  XtInitialize("wet+sticky", "Wet+Sticky", NULL,
+                                                 0, &argc, argv);
+
+	delay = 100000; /*default delay in microseconds between frames */
+
+	 while ((c = getopt(argc, argv, "D:")) != -1)
+                    switch (c) {
+                    case 'D':
+			delay = atoi(optarg);
+			delay = delay * 1000000;
+			break;
+		   }
+
+
+        display = XtDisplay(top_level);
+
+        colour_shell = XtCreateApplicationShell("colour_frame",
+                        topLevelShellWidgetClass, NULL, 0);
+
+        colour_box = XtCreateManagedWidget("colour_box", boxWidgetClass,
+                                                colour_shell, NULL, 0);
+
+
+        colour_canvas = XtCreateManagedWidget("", labelWidgetClass,
+                                        colour_box, args, XtNumber(args));
+
+
+        /*XtAddEventHandler(colour_canvas, ExposureMask, False,
+	expose_event, 0);*/
+
+        XtRealizeWidget(colour_shell);
+
+	XSynchronize(display, True);
+
+	tqmask = GCBackground| GCForeground|  GCFunction;
+
+        values.function = GXcopy;
+        values.background = 0;
+        values.foreground = 1;
+
+
+        gc = XtGetGC(colour_canvas, tqmask, &values);
+
+	
+
+	fprintf(stderr,"Read files ...");
+	for (i=0; i < FRAME_LIMIT; i++) {
+		sprintf(pix_file,"pixmap.%d",i);
+		if ((XReadBitmapFile(display, XtWindow(colour_shell), pix_file,
+			&width, &height, &colour_pm[i], &ret, &ret)) != 
+			BitmapSuccess)
+		perror("bad bitmap");
+	}
+	fprintf(stderr,"done.\nBegin Animation\n");
+
+
+	for (;;) {
+		 for (i=0; i < FRAME_LIMIT; i++) {
+			XCopyPlane(display, colour_pm[i], 
+				XtWindow(colour_canvas),gc,
+				0, 0, 300, 300, 0, 0, 1);
+			fprintf(stderr,"pre sleep\n");
+			usleep(delay);
+		}
+		
+
+           } /* End for loop */
+}xk
+
diff --git a/chalk/colorspaces/wetsticky/ws/before.jpg b/chalk/colorspaces/wetsticky/ws/before.jpg
new file mode 100644
index 000000000..fc26b9898
Binary files /dev/null and b/chalk/colorspaces/wetsticky/ws/before.jpg differ
diff --git a/chalk/colorspaces/wetsticky/ws/canvas.c b/chalk/colorspaces/wetsticky/ws/canvas.c
new file mode 100644
index 000000000..77cfa17dc
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/canvas.c
@@ -0,0 +1,514 @@
+/*
+	FILE:		canvas.c
+	PURPOSE:	Hides the canvas and provides its access and 
+			manipuation routines.
+	AUTHOR:		Kevin Waite 
+	VERSION:	1.00  (10-May-91)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 
+
+*/
+
+#include "constants.h"
+#include "types.h"
+#include "canvas.h"
+#include <stdio.h>
+
+/*  Declare the canvas data structure local to this module.  It can
+    only be accessed via routines given in the header file for this module.  
+    The (0,0) location for the canvas is at the top-left.  */
+
+CELL canvas[CANVAS_WIDTH][CANVAS_HEIGHT];
+
+/*  This module maintains a list of the addresses of cells that have
+    been modified since the last redraw and therefore need updating.
+    Points are added to this list by the need_to_tqrepaint() routine
+    and are removed by the next_cell_for_tqrepaint() function.  The
+    pointer to the current tail of the list is updated by side-effect. */
+
+static POINT need_tqrepainting[REDRAW_LIMIT];
+static int   next_free = 0;
+static int   next_to_tqrepaint = 0;
+
+/* *********************************************************************** */
+
+int number_of_tqrepaints_needed()
+/*  Returns the number of cells that need to be tqrepainted. */
+
+{
+   return (next_free);
+}
+
+/* *********************************************************************** */
+
+void need_to_tqrepaint(point)
+/*  The cell at this location needs to be redrawn since it has
+    been altered.   Scan the list to see if it is already
+    scheduled for a tqrepainting operation and only add it if
+    it is not there.   */
+
+POINT point;
+
+{
+   int k;
+
+
+   /*  If the list is already full then simply ignore the tqrepaint
+       request - it will get done eventually anyway.  */
+
+   if (next_free == REDRAW_LIMIT) return;
+
+   /* Check whether this point is already on the list. */
+
+   for (k=0; k < next_free; k++) {
+      if ((need_tqrepainting[k].x == point.x) &&
+          (need_tqrepainting[k].y == point.y)) break;
+   }
+
+   if (k < next_free) return; /* Already in the list. */
+
+   /*  Add this new cell address to the end of the list. */
+
+   need_tqrepainting[next_free].x = point.x;
+   need_tqrepainting[next_free].y = point.y;
+   next_free++;
+}
+
+/* *********************************************************************** */
+
+void next_cell_for_tqrepaint(cell, locus)
+/*  This routine returns the next cell to be tqrepainted, together with its
+    location on the canvas.  This is determined by taking the next point 
+    from the need_tqrepainting list and accessing its cell.  If the list is 
+    empty then return NIL. 
+    Note that the tqrepainting operation will clear out the list before
+    any other new positions are added.  */ 
+
+   CELL_PTR *cell;
+   POINT_PTR locus;
+
+{
+   if (next_to_tqrepaint >= next_free) {
+      next_to_tqrepaint = next_free = 0;
+      *(cell) = NIL;
+      return;
+   }
+
+   *(cell) = get_cell(need_tqrepainting[next_to_tqrepaint]);
+   locus->x = need_tqrepainting[next_to_tqrepaint].x;
+   locus->y = need_tqrepainting[next_to_tqrepaint].y;
+   next_to_tqrepaint++;
+}
+
+/* *********************************************************************** */
+
+void next_cell_point (address)
+/*  Sets the POINT giving the coordinate location of the next
+    cell on the canvas to be visited.  There is an even probability
+    of each cell being visited.  */
+
+POINT_PTR address;
+{
+   extern long random();
+
+   address->x = random() % CANVAS_WIDTH;
+   address->y = random() % CANVAS_HEIGHT;
+}
+
+
+/* *********************************************************************** */
+
+CELL_PTR get_cell (point)
+/*  This function returns a pointer to the cell at the
+    given address on the canvas.  */
+
+POINT point;
+
+{
+   return (&canvas[point.x][point.y]);
+}
+
+/* *********************************************************************** */
+
+DIRECTION anti_clockwise_from (arrow)
+/*  Returns the direction found going anti-clockwise from the
+    given direction.  */
+
+DIRECTION arrow;
+
+{
+   switch (arrow) {
+  
+      case NORTH:  return(WEST);
+      case EAST:   return(NORTH);
+      case SOUTH:  return(EAST);
+      case WEST:   ;
+
+   }
+   return(SOUTH);
+}
+
+/* *********************************************************************** */
+
+DIRECTION clockwise_from (arrow)
+/*  Returns the direction found going clockwise from the
+    given direction.  */
+
+DIRECTION arrow;
+
+{
+   switch (arrow) {
+  
+      case NORTH:  return(EAST);
+      case EAST:   return(SOUTH);
+      case SOUTH:  return(WEST);
+      case WEST:   ;
+
+   }
+   return(NORTH);
+}
+
+/* *********************************************************************** */
+
+BOOLEAN neighbour (aPoint, direction, bPoint)
+/*  Set bPoint to the coordinate of the point that can
+    be found by going one place in the given direction 
+    from aPoint.  The direction can be NORTH, EAST, WEST
+    or SOUTH.  If bPoint will be off the canvas then the
+    function returns FALSE otherwise TRUE.  */
+
+POINT     aPoint;
+POINT_PTR bPoint;
+DIRECTION direction;
+
+{
+    int x, y;
+
+    switch (direction) {
+
+       case NORTH:  x = 0; y = -1; break;
+       case EAST:   x = 1; y = 0;  break;
+       case SOUTH:  x = 0; y = 1;  break;
+       case WEST:   x = -1; y = 0; break;
+    }
+
+    bPoint->x = aPoint.x + x;
+    bPoint->y = aPoint.y + y;
+
+    if ((bPoint->x >= CANVAS_WIDTH) || (bPoint->x < 0) ||
+       (bPoint->y >= CANVAS_HEIGHT) || (bPoint->y < 0)) return(FALSE);
+
+    return(TRUE);
+}
+
+/* *********************************************************************** */
+
+void initialise_paint (paint)
+/*  Set this paint to be a dry, unmixing white. */
+
+PAINT_PTR paint;
+
+{
+   paint->colour.hue = 255;
+   paint->colour.saturation = 0.0;
+   paint->colour.lightness = 1.0;
+   paint->liquid_content = 0;
+   paint->drying_rate = 0;
+   paint->miscibility = 0;
+}
+
+/* *********************************************************************** */
+
+void initialise_cell(cell)
+/*  Reset the given cell to a default value.  */
+
+CELL_PTR cell;
+
+{
+   initialise_paint (&cell->contents);
+
+   cell->volume = UNFILLED;  /* Indicates that no paint has yet been applied.  
+*/
+   cell->absorbancy = 10;
+   cell->gravity.direction = SOUTH;
+   cell->gravity.strength = DEFAULT_GRAVITY_STRENGTH;
+}
+
+
+/* *********************************************************************** */
+
+void split_gravity()
+/*  This routine is for test purposes only.  It causes the right
+    half of the canvas to have gravity going NORTH with the left
+    half having gravity going SOUTH.   */
+
+{
+   POINT p;
+   CELL_PTR cell;
+
+   /*for (p.x=CANVAS_WIDTH/2; p.x < CANVAS_WIDTH; p.x++) {*/
+   for (p.x=165; p.x < CANVAS_WIDTH; p.x++) {
+      for (p.y=0; p.y < CANVAS_HEIGHT; p.y++) {
+	 cell = get_cell (p);
+         cell->gravity.direction = NORTH;
+      }
+   }
+}
+
+/* *********************************************************************** */
+
+void initialise_canvas()
+/*  Before it can be used the canvas needs to be initialised to 
+    a default state.  This involves setting each of the cells to
+    have no paint and for gravity to be uniformly down.  Each cell
+    has the default absorbancy value.  */
+
+{
+   POINT p;
+   CELL_PTR cell;
+
+   for (p.x=0; p.x < CANVAS_WIDTH; p.x++) {
+      for (p.y=0; p.y < CANVAS_HEIGHT; p.y++) {
+	 cell = get_cell (p);
+         initialise_cell (cell);
+      }
+   }
+}
+
+/* *********************************************************************** */
+
+void print_cell_attributes(cell)
+CELL_PTR cell;
+{
+   printf("Volume         = %d\n", cell->volume);
+
+   printf("Liquid content = %d%%\n", cell->contents.liquid_content);
+   printf("Drying rate    = %d%%\n", cell->contents.drying_rate);
+   printf("Miscibility    = %d%%\n\n", cell->contents.miscibility);
+
+   printf("Saturation = %2f\n", cell->contents.colour.saturation);
+   printf("Lightness  = %2f\n", cell->contents.colour.lightness);
+   printf("Hue        = %d\n", cell->contents.colour.hue);
+   printf ("------------------------------\n\n");
+}
+
+/* *********************************************************************** */
+
+void blob_cell_alpha (cell)
+CELL_PTR cell;
+
+{
+   cell->contents.liquid_content = 100;
+   cell->contents.drying_rate = 10;
+   cell->contents.miscibility = 80;
+   
+   cell->contents.colour.hue = 20;
+   cell->contents.colour.saturation = 1.0;
+   cell->contents.colour.lightness = 0.0;
+
+   cell->volume = 50;
+
+}
+
+/* *********************************************************************** */
+
+void blob_cell_beta (cell)
+CELL_PTR cell;
+
+{
+   cell->contents.liquid_content = 80;
+   cell->contents.drying_rate = 20;
+   cell->contents.miscibility = 90;
+   
+   cell->contents.colour.hue = 70;
+   cell->contents.colour.saturation = 1.0;
+   cell->contents.colour.lightness = 0.7;
+
+   cell->volume = 30;
+
+}
+/* *********************************************************************** */
+
+void blob_cell_gamma (cell)
+CELL_PTR cell;
+
+{
+   cell->contents.liquid_content = 80;
+   cell->contents.drying_rate = 40;
+   cell->contents.miscibility = 80;
+   
+   cell->contents.colour.hue = 100;
+   cell->contents.colour.saturation = 0.5;
+   cell->contents.colour.lightness = 0.4;
+
+   cell->volume = 50;
+
+}
+
+/* *********************************************************************** */
+
+void old_blob(width)
+/* This routine puts a square blob of various paints
+   of the given side length centred on the canvas.
+   This is used for test purposes.  */
+
+int width;
+
+{
+   int count, lump, startx, starty, x, y;
+
+   width = (width > CANVAS_WIDTH) ? CANVAS_WIDTH : width;
+   width = (width > CANVAS_HEIGHT) ? CANVAS_HEIGHT : width;
+
+   printf("This run used a square blob of side %d pixels\n", width);
+   printf ("centred on the canvas.  The blob was split into three equal\n");
+   printf ("vertical strips with the following paint attributes:\n\n");
+
+   startx = (CANVAS_WIDTH - width) / 2;
+   starty = (CANVAS_HEIGHT - width) / 2;
+   lump = width / 3;
+
+   count=0;
+   for (x = startx; x < startx + width; x++) {
+      for (y = starty; y < starty + width; y++) {
+         switch (count / lump) {
+    
+             case 0:  blob_cell_alpha (&canvas[x][y]);  break;
+             case 1:  blob_cell_beta (&canvas[x][y]);   break;
+             default: blob_cell_gamma (&canvas[x][y]);  break;
+
+         }
+      }
+      count++;
+   }
+   split_gravity();
+
+   print_cell_attributes (&canvas[startx][starty]);
+   print_cell_attributes (&canvas[startx + lump][starty]);
+   print_cell_attributes (&canvas[startx + (2*lump)][starty]);
+}
+
+gravity_set(x,y,x1,y1,attr)
+int x;
+int y;
+int x1;
+int y1;
+int attr;
+{
+	/* set the canavs absorbancy and gravity to various test values
+		in the region (x,y),(x1,y1)
+	*/
+
+	int i,j;
+
+	for (i=x; i < x1; i++ )
+            for (j=y; j < y1; j++) {
+		canvas[i][j].absorbancy = 10; /* default 10 */
+		   canvas[i][j].gravity.direction = SOUTH;
+		   canvas[i][j].gravity.strength =  DEFAULT_GRAVITY_STRENGTH;
+					/*DEFAULT_GRAVITY_STRENGTH*/
+	    }
+}
+
+blob_set(x, y, x1, y1, attr)
+int x;
+int y;
+int x1;
+int y1;
+int attr;
+{
+	/* Set a blob of paint in the rectangle (x,y),(x1,y1) with
+		the attribute, attr (can be volume, liquidity or dryness*/
+	int i,j;
+	float colour;
+
+	colour = (3.6 * 122);
+	colour = 64;
+	fprintf(stderr, "attribute value %d %d\n", attr, (int)colour);
+
+
+	for (i=x; i < x1; i++ )
+	    for (j=y; j < y1; j++) {
+		canvas[i][j].contents.liquid_content = 80;
+		   canvas[i][j].contents.drying_rate = 50;
+		   canvas[i][j].contents.miscibility = 80;
+
+		   canvas[i][j].contents.colour.hue = (int)colour;
+		   canvas[i][j].contents.colour.saturation = 1.0;
+		   canvas[i][j].contents.colour.lightness = 0.7;
+
+		   canvas[i][j].volume = attr;
+	}
+		
+
+}
+
+void blob(type)
+int type;
+{
+
+	/* paint nine test blobs on the canvas */
+
+	/* X Example 1 All attributes at 80% except vol 0 - 100%*/
+
+	/* X Example 2 All attributes at 80% except liq 0 - 100% */
+
+        /* X Example 3 All attributes at 80% except dry 0 - 100% */
+
+	/* X Example 4 All attributes at 80% except absorp 100 - 0% */
+
+	/* X Example 5 All attributes at 80% except gravity 0 - 100% */
+
+	/* X Example 6 All attributes at 80% except direction N,S,E & W */
+
+	blob_set(20, 20, 80, 80, 0);
+	gravity_set(0, 0, 100, 100, SOUTH);
+
+	blob_set(120,20, 180, 80, 22);
+	gravity_set(150, 0, 300, 150, EAST);
+	
+	blob_set(220,20,280,80,33);
+	gravity_set(0, 150, 150, 300, NORTH);
+
+	blob_set(20,120,80,180,44);
+	gravity_set(150, 150, 300, 300, WEST);
+	
+	blob_set(120,120,180,180,55);
+	gravity_set(100, 100, 200, 200, 55);
+
+	blob_set(220,120, 280,180, 66);
+	gravity_set(200, 100, 300, 200, 66);
+	
+	blob_set(20,220,80,280,77);
+	gravity_set(0, 200, 100, 300, 77);
+
+	blob_set(120,220,180,280,88);
+	gravity_set(100, 200, 200, 300, 88);
+
+	blob_set(220,220,280,280, 100);
+	gravity_set(200, 200, 300, 300, 100);
+	
+}
+
+void
+load_file(filename, width, height)
+char *filename;
+int *width;
+int *height;
+{
+
+	/* Load in a file using the load_ppm_format() function
+	 This loads in a file in Portable Pixmap format 
+	*/
+
+	load_ppm_format(filename, canvas, width, height);
+}	
diff --git a/chalk/colorspaces/wetsticky/ws/canvas.h b/chalk/colorspaces/wetsticky/ws/canvas.h
new file mode 100644
index 000000000..c2f2bcbf6
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/canvas.h
@@ -0,0 +1,70 @@
+/*
+    FILE:        canvas.h
+    PURPOSE:    Defines the public routines for manipulating the canvas.
+    AUTHOR:        Kevin Waite 
+    VERSION:    1.00  (10-May-91)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA 
+
+*/
+
+
+extern int number_of_tqrepaints_needed();
+/*  Returns the number of cells needing to tqrepainted.  */
+
+extern void need_to_tqrepaint (/* POINT */);
+/*  Requests that the cell at the given point be tqrepainted
+    at the next update as it has been modified.  */
+
+extern void next_cell_for_tqrepaint (/* *CELL_PTR, POINT_PTR  */);
+/*  Returns a pointer to a cell that needs to be updated as well
+    as the location of that cell on the canvas.   If there are
+    no more cells to be redrawn then the pointer will be NIL.  */
+
+extern void next_cell_point (/* POINT_PTR */);
+/*  Sets the POINT giving the coordinate location of the next
+    cell on the canvas to be visited.  There is an even probability
+    of each cell being visited.  */
+
+extern CELL_PTR get_cell (/* POINT */);
+/*  This function returns a pointer to the cell at the
+    given address on the canvas.  */
+
+extern DIRECTION anti_clockwise_from (/*  DIRECTION  */);
+/*  Returns the direction found going clockwise from the
+    given direction.  */ 
+
+extern DIRECTION clockwise_from (/*  DIRECTION  */);
+/*  Returns the direction found going clockwise from the
+    given direction.  */ 
+
+extern BOOLEAN neighbour (/* POINT, DIRECTION, POINT_PTR */);
+/*  Set bPoint to the coordinate of the point that can
+    be found by going one place in the given direction 
+    from aPoint.  The direction can be NORTH, EAST, WEST
+    or SOUTH.  If bPoint will be off the canvas then the
+    function returns FALSE otherwise TRUE.  */
+
+extern void initialise_canvas();
+/*  Before it can be used the canvas needs to be initialised to 
+    a default state.  This involves setting each of the cells to
+    have no paint and for gravity to be uniformly down.  Each cell
+    has the default absorbancy value.  */
+
+extern void blob( /* int */);
+/* This routine puts a square blob of black paint
+   of the given side length centred on the canvas.
+   This is used for test purposes.  */
+
+extern void load_file(/*char *, int *, int * */);
+/* Load a file from a portable pixmap into the canvas */
diff --git a/chalk/colorspaces/wetsticky/ws/cmap.c b/chalk/colorspaces/wetsticky/ws/cmap.c
new file mode 100644
index 000000000..0f11eaf7a
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/cmap.c
@@ -0,0 +1,681 @@
+/*
+        FILE:           x_interface.c
+        PURPOSE:        Creation and access to an X windows interface
+			to wet+sticky using Athena Widgets
+        AUTHOR:         David England
+        VERSION:        1.00  (13-May-91)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 
+
+*/
+
+#include <X11/Xos.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Intrinsic.h>
+
+#include <X11/cursorfont.h>
+#include <X11/StringDefs.h>
+
+#include <X11/Shell.h>
+#include <X11/Xaw/Box.h>
+#include <X11/Xaw/Label.h>
+#include <stdio.h>
+
+#include "constants.h"
+#include "types.h"
+#include "engine.h"
+#include "canvas.h"
+
+/* Window Heirarchy - 
+	Three shell widgets, one for colour output, two for attributes output
+	plus a back_up pixmap for redrawing
+*/
+
+static Widget top_level;
+static Widget 	    colour_shell;
+static Widget            colour_box;
+static Widget		        colour_canvas;
+static Pixmap		        colour_pm;
+
+static Widget      volume_shell;
+static Widget            volume_box;
+static Widget                  volume_canvas;
+static Pixmap		        volume_pm;
+
+static Widget      dryness_shell;
+static Widget            dryness_box;
+static Widget                  dryness_canvas;
+static Pixmap		        dryness_pm;
+
+static GC gc;
+static GC tmp_gc;
+static long tqmask;
+static XGCValues values;
+
+static Colormap cmap;
+static XColor colours[256];
+void stroke();
+void stroke_motion();
+
+Display *display;
+int screen;
+Screen          *screen_ptr;
+Window root;
+
+static int count=0;
+static int frame_count=0;
+char pix_file[64];
+
+void StartWindow();
+void StartUpWindows();
+
+static XtEventHandler
+expose_event(w, event)
+Widget          w;
+XEvent          *event;
+{
+/* Re-display the colour window if an exposure event is received */
+int width, height;
+
+	width = height = 300;
+
+        XCopyArea(XtDisplay(colour_canvas), colour_pm, 
+		XtWindow(colour_canvas), gc, 0, 0, width, height, 0,0);
+
+}
+
+
+static void
+expose_volume(w, event)
+Widget          w;
+XEvent          *event;
+{
+/* Re-display the volume window if an exposure event is received */
+int width, height;
+
+	width = height = 300;
+
+      XCopyArea(XtDisplay(volume_canvas), volume_pm,
+	      XtWindow(volume_canvas), gc, 0, 0, width, height, 0,0);
+      
+
+}
+
+static void
+expose_dryness(w, event)
+Widget          w;
+XEvent          *event;
+{
+/* Re-display the dryness window if an exposure event is received */
+int width, height;
+
+        width = height = 300;
+
+      XCopyArea(XtDisplay(dryness_canvas), dryness_pm,
+              XtWindow(dryness_canvas), gc, 0, 0, width, height, 0,0);
+
+
+}
+
+int 
+GetHueValue(red, green, blue)
+int red;
+int green;
+int blue;
+{
+	XColor colour;
+
+	colour.red = red * 257;
+	colour.green = green * 257;
+	colour.blue = blue * 257;
+	colour.flags = DoRed | DoGreen | DoBlue;
+
+	if (XAllocColor(display, cmap, &colour) == 0)
+		fprintf(stderr,"colour allocation failed\n");
+
+	return (colour.pixel);	
+}
+
+
+void
+DrawPoint(x,y,colour)
+int x;
+int y;
+int colour;
+/* Draw a point on the window and the back-up Pixmap */
+{
+	XSetForeground(XtDisplay(top_level), gc, colours[colour].pixel);
+
+	XDrawPoint(XtDisplay(top_level), XtWindow(colour_canvas), gc, x, y);
+	XDrawPoint(XtDisplay(top_level), colour_pm, gc, x, y);
+}
+
+int
+DrawVolumePoint(x,y,attr)
+int x;
+int y;
+int attr;
+/* Draw a point on the window and the back-up Pixmap */
+{
+	/* later - use the range of the volume to affect the colour
+		value
+	*/
+
+	if (XtWindow(volume_canvas) == NULL)
+		return (-1);
+
+	XSetForeground(XtDisplay(top_level), gc, colours[attr].pixel);
+
+	XDrawPoint(XtDisplay(top_level), XtWindow(volume_canvas), gc, x, y);
+	XDrawPoint(XtDisplay(top_level), volume_pm, gc, x, y);
+
+	return(0);
+}
+
+int
+DrawDrynessPoint(x,y,attr)
+int x;
+int y;
+int attr;
+/* Draw a point on the window and the back-up Pixmap */
+{
+        /* later - use the range of the dryness to affect the colour
+                value
+        */
+
+        if (XtWindow(dryness_canvas) == NULL)
+                return (-1);
+
+        XSetForeground(XtDisplay(top_level), gc, colours[attr].pixel);
+
+        XDrawPoint(XtDisplay(top_level), XtWindow(dryness_canvas), gc, x, y);
+        XDrawPoint(XtDisplay(top_level), dryness_pm, gc, x, y);
+
+        return(0);
+}
+
+void
+ClearWindow()
+{
+	XClearWindow(XtDisplay(top_level), XtWindow(colour_canvas));
+}
+
+static void
+CleanWindow(win)
+Drawable win;
+/* Fill a window with a solid, white rectangle */
+{
+XGCValues values;
+long tqmask;
+
+	values.background = colours[0].pixel;
+        values.foreground = colours[255].pixel;;
+        values.fill_style = FillSolid;
+        values.function   = GXclear;
+
+
+         tqmask = GCBackground| GCForeground| GCFillStyle | GCFunction;
+
+         tmp_gc = XtGetGC(top_level,  tqmask, &values);
+
+        XFillRectangle(XtDisplay(top_level), win, tmp_gc, 0,  0, 300, 300);
+
+}
+
+void SetupCmap()
+{
+int i;
+
+        for (i=0;i<256;i++) {
+                colours[i].red = i*257;
+                colours[i].flags = DoRed | DoBlue | DoGreen;
+	}
+
+     /*   for (i=0;i<=127;i++)
+                colours[i].green = i*2*257;
+
+        for (i=128;i>0;i--)
+                colours[255-i].green = (i-1)*2*257;*/
+
+       for (i=0;i<64;i++)
+                colours[i].green = i*4*257;
+
+        for (i=64;i<128;i++)
+                colours[i].green = 65536-i*4*257;
+ 
+         for (i=128;i<192;i++)
+                colours[i].green = (i-128)*2*257;
+ 
+         for (i=192;i<255;i++)
+                colours[i].green = 65536-(i-128)*2*257;
+
+
+        for (i=0;i<256;i++)
+                colours[i].blue = 65536 - i*257;
+
+	colours[0].red = 65535;
+	colours[0].green = 65535;
+	colours[0].blue = 65535;
+}
+
+void
+SetupGreyMap()
+{
+int i;
+
+	 for (i=0;i<256;i++) {
+                colours[i].red = i*257;
+                colours[255 - i].flags = DoRed | DoBlue | DoGreen;
+	}
+
+
+         for (i=0;i<256;i++)
+                colours[i].green =  i*257;
+
+         for (i=0;i<256;i++)
+                colours[i].blue =  i*257;
+
+	colours[255].red = 255*257;
+	colours[255].green = 255*257;
+	colours[255].blue = 255*257;
+
+}
+
+
+main(argc, argv)
+int argc;
+char **argv;
+/* Create colour window heirarchy and add event handlers */
+{
+	
+    static Arg args[]={
+        {XtNwidth, (XtArgVal) 0},
+        {XtNheight, (XtArgVal)0} };	
+
+int width;
+int height;
+	int i;
+
+	
+	width = 300;
+	height = 300;
+
+	args[0].value = (XtArgVal)width;
+
+	args[1].value = (XtArgVal)height;
+
+	top_level =  XtInitialize("wet+sticky", "Wet+Sticky", NULL,
+                                                 0, &argc, argv);
+
+
+	display = XtDisplay(top_level);
+        screen = DefaultScreen(display);
+	screen_ptr = ScreenOfDisplay(display, DefaultScreen(display));
+
+	root = RootWindow(display, screen);
+
+	colour_shell = XtCreateApplicationShell("colour_frame", 
+			topLevelShellWidgetClass, NULL, 0);
+
+
+
+        colour_box = XtCreateManagedWidget("colour_box", boxWidgetClass,
+                                                colour_shell, NULL, 0);
+
+
+        colour_canvas = XtCreateManagedWidget("", labelWidgetClass,
+                                        colour_box, args, XtNumber(args));
+
+
+	XtAddEventHandler(colour_canvas, ExposureMask, False, expose_event, 0);
+
+	XtAddEventHandler(colour_canvas, ButtonPressMask, False, stroke, 0);
+
+	XtAddEventHandler(colour_canvas, Button1MotionMask, 
+		False, stroke_motion, 0);
+
+	XtRealizeWidget(colour_shell);
+
+	cmap = XCreateColormap( display, XtWindow(colour_shell),
+                        XDefaultVisualOfScreen(screen_ptr), AllocAll);
+
+        for (i=0; i <= 255; i++)
+                colours[i].pixel = i;
+
+        XQueryColors(display, DefaultColormapOfScreen(screen_ptr),colours, 256);
+
+        /*SetupCmap();*/
+
+	SetupGreyMap();
+
+        XStoreColors(display, cmap, colours, 256);
+
+        i=0;
+        while( XAllocColorCells( display, DefaultColormapOfScreen(screen_ptr),
+                 True, NULL, 0, &colours[i].pixel, 1 ) ) {
+                        colours[i].pixel = i;
+                        i++;
+          }
+
+	XSetWindowColormap(display, XtWindow(colour_shell), cmap);
+
+        XInstallColormap(display, cmap);
+
+	tqmask = GCBackground| GCForeground|  GCFunction; 
+
+	values.function = GXcopy;
+	values.background = colours[0].pixel;
+	values.foreground = colours[255].pixel;
+
+
+	gc = XtGetGC(colour_canvas, tqmask, &values);
+
+	colour_pm = XCreatePixmap(XtDisplay(top_level), 
+			XtWindow(colour_shell), width, height,
+                            XDefaultDepth(XtDisplay(top_level), 0));
+
+	CleanWindow(colour_pm);
+
+	StartWindow (CANVAS_WIDTH, CANVAS_HEIGHT);
+
+	StartUpWindows();
+}
+
+
+void StartWindow(width, height)
+int width;
+int height;
+/* Create Volume heirarchy and add event handlers */
+{
+	static Arg args[]={
+	{XtNwidth, (XtArgVal) 0},
+	{XtNheight, (XtArgVal)0} };
+
+	args[0].value = (XtArgVal)width;
+
+	args[1].value = (XtArgVal)height;
+
+	volume_shell = XtCreateApplicationShell("volume_frame",
+			topLevelShellWidgetClass, NULL, 0);
+
+	volume_box = XtCreateManagedWidget("volume_box", boxWidgetClass,
+				volume_shell, NULL, 0);
+											
+	volume_canvas = XtCreateManagedWidget("", labelWidgetClass,
+				volume_box, args, XtNumber(args));
+
+	XtAddEventHandler(volume_canvas, ExposureMask, False, 
+				expose_volume, 0);
+
+	XtRealizeWidget(volume_shell);
+
+	XSetWindowColormap(display, XtWindow(volume_shell), cmap);
+
+	volume_pm = XCreatePixmap(XtDisplay(top_level), 
+			XtWindow(colour_shell), width, height,
+                            XDefaultDepth(XtDisplay(top_level), 0));
+
+	CleanWindow(volume_pm);
+
+
+}
+
+void StartDrynessWindow(width, height)
+int width;
+int height;
+/* Create dryness heirarchy and add event handlers */
+{
+	static Arg args[]={
+	{XtNwidth, (XtArgVal) 0},
+	{XtNheight, (XtArgVal)0} };
+
+	args[0].value = (XtArgVal)width;
+
+	args[1].value = (XtArgVal)height;
+
+	dryness_shell = XtCreateApplicationShell("dryness_frame",
+			topLevelShellWidgetClass, NULL, 0);
+
+	dryness_box = XtCreateManagedWidget("dryness_box", boxWidgetClass,
+				dryness_shell, NULL, 0);
+											dryness_canvas 
+= XtCreateManagedWidget("", labelWidgetClass,
+				dryness_box, args, XtNumber(args));
+
+	XtAddEventHandler(dryness_canvas, ExposureMask, False, 
+				expose_dryness, 0);
+
+	XtRealizeWidget(dryness_shell);
+
+	XSetWindowColormap(display, XtWindow(dryness_shell), cmap);
+
+	dryness_pm = XCreatePixmap(XtDisplay(top_level), 
+			XtWindow(colour_shell), width, height,
+                            XDefaultDepth(XtDisplay(top_level), 0));
+
+	CleanWindow(dryness_pm);
+
+}
+
+static void
+draw_labels()
+{
+	XSetForeground(XtDisplay(colour_shell), gc, colours[1].pixel);
+
+	XDrawString(XtDisplay(colour_shell), XtWindow(colour_canvas), gc, 10, 10, 
+			"Colour", strlen("Colour"));
+	XDrawString(XtDisplay(colour_shell), colour_pm, gc, 10, 10, 
+			"Colour", strlen("Colour")); 
+
+	XSetForeground(XtDisplay(colour_shell), gc, colours[128].pixel);
+
+	XDrawString(XtDisplay(colour_shell), XtWindow(volume_canvas), gc, 10, 10, 
+			"Volume", strlen("Volume")); 
+	XDrawString(XtDisplay(colour_shell), volume_pm, gc, 10, 10, 
+			"Volume", strlen("Volume"));
+
+        XSetForeground(XtDisplay(colour_shell), gc, colours[255].pixel);
+
+	XDrawString(XtDisplay(colour_shell), XtWindow(dryness_canvas), gc, 10, 10, 
+			"Bump Map", strlen("Bump Map"));
+	XDrawString(XtDisplay(colour_shell), dryness_pm, gc, 10, 10, 
+			"Bump Map", strlen("Bump Map"));
+}
+
+void paint_cell(cell, x, y)
+CELL_PTR cell;
+int x, y;
+
+{
+    int colour, volColour, dryness;
+    POINT p;
+
+    p.x = x;
+    p.y = y;
+
+    /*  The current display simply maps hue onto the indices of the colour
+        table.  This involves some scaling since hues are in the range [0,360)
+        with the colour table being [0,256).  */
+
+    colour = (int) (cell->contents.colour.hue * 
+			((float) MAX_COLOUR_INDEX / 360.0));
+
+    /*DrawPoint(x,y,colour);   */
+
+    /*  volColour is an index into the colour table in the range [0,255].
+        It is used to give a false colour image of the canvas's volume.  */
+
+    /*if (x < SCALE_WIDTH) return;    Don't draw over colour scale.  */
+
+    volColour = MIN(cell->volume * 2, 255);
+    volColour = MAX(volColour, 0);        
+				/* Make unfilled cells have a zero vol.  */
+
+    /*DrawVolumePoint(x,y,volColour);*/
+
+    /*  Dryness will be in the range [0,255].  */
+    dryness = (cell->contents.liquid_content * 255) / 100;
+
+    /*DrawDrynessPoint(x,y,dryness);*/
+}
+
+
+
+void draw_false_colour_scale()
+/*  This routine places a scale along the top of the volume window
+    showing the colours being used.   Low is at the left edge. 
+    The colour palette has indices 0..255.    */
+{
+    int x, y;
+
+    /*for (x=0; x < 255; x++) 
+       for (y=0; y < SCALE_WIDTH; y++) DrawVolumePoint(x,y,MIN(x, 255));*/
+}
+
+
+void draw_full_canvas()
+{
+   int x, y;
+   CELL_PTR cell;
+   POINT p;
+ 
+  if (DEBUG) {
+     printf ("Starting to paint full canvas...");
+     fflush(stdout);
+   }
+
+   for (x=0; x < CANVAS_WIDTH; x++) {
+     for (y=0; y < CANVAS_HEIGHT; y++) {
+        p.x = x;
+        p.y = y;
+        /*cell = get_cell(p);*/
+        paint_cell(cell, x, y);
+     }
+  }
+  draw_false_colour_scale();
+  if (DEBUG) printf ("done.\n");
+}
+
+void
+bump_map()
+{
+	POINT p;
+	CELL_PTR cell;
+	register int x, y;
+	register int colour;
+
+
+   for (x=0; x < CANVAS_WIDTH; x++) {
+     for (y=0; y < CANVAS_HEIGHT; y++) {
+        p.x = x;
+        p.y = y;
+        /*cell = get_cell(p);*/
+	/*colour = (int) new_intensity_value(p);*/
+
+/*	colour = (int) (cell->contents.colour.hue *
+                        ((float) MAX_COLOUR_INDEX / 360.0));*/
+	DrawDrynessPoint(x,y,colour);
+     }
+  }
+
+}
+
+
+void evolve_paint()
+{
+      
+}
+
+
+
+void StartUpWindows()
+{
+/* Start the X windows event loop and paint processing */
+XEvent event;
+
+
+
+	for (;;) {
+	   if (XtPending()) {
+		XtNextEvent(&event);
+		XtDispatchEvent(&event);
+	   }
+	   else {
+		/* Evolve paint and re-display*/
+		evolve_paint();
+	        }
+		
+	   } /* End for loop */
+
+
+}
+
+void
+stroke(w, client_data, event)
+Widget w;
+caddr_t client_data;
+XEvent *event;
+{
+/*	brush_stroke(event->xbutton.x, event->xbutton.y);*/
+
+
+	/*if ((XEvent *)event != (XEvent *)NULL)
+	else
+		printf("Null event\n"); */
+
+/*	DrawPoint(event->xbutton.x, event->xbutton.y, 128);
+        DrawVolumePoint(event->xbutton.x, event->xbutton.y, 128);
+        DrawDrynessPoint(event->xbutton.x, event->xbutton.y, 128);*/
+
+	
+        XSetForeground(XtDisplay(top_level), gc, colours[128].pixel);
+
+        XFillRectangle(XtDisplay(top_level), XtWindow(colour_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);
+
+        XFillRectangle(XtDisplay(top_level), XtWindow(volume_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);
+
+        /*XFillRectangle(XtDisplay(top_level), XtWindow(dryness_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);*/
+
+	/*brush_stroke(event->xbutton.x, event->xbutton.y);*/
+}
+
+
+void
+stroke_motion(w, client_data, event)
+Widget w;
+caddr_t client_data;
+XEvent *event;
+{
+
+
+        /*if ((XEvent *)event != (XEvent *)NULL)
+        else
+                printf("Null event\n"); */
+
+
+        XSetForeground(XtDisplay(top_level), gc, colours[128].pixel);
+
+        XFillRectangle(XtDisplay(top_level), XtWindow(colour_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);
+        XFillRectangle(XtDisplay(top_level), XtWindow(volume_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);
+
+        XFillRectangle(XtDisplay(top_level), XtWindow(dryness_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);
+
+      /*brush_stroke(event->xbutton.x, event->xbutton.y);*/
+}
+
diff --git a/chalk/colorspaces/wetsticky/ws/constants.h b/chalk/colorspaces/wetsticky/ws/constants.h
new file mode 100644
index 000000000..fa72bc925
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/constants.h
@@ -0,0 +1,69 @@
+/*
+    FILE:        constants.h
+    PURPOSE:    Constains all the #DEFINES for Wet&Sticky.
+    AUTHORS:    Kevin Waite and David England
+    VERSION:    1.00  (10-May-91)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA 
+
+*/
+
+/*  Some utility constants.  */
+
+#define  TRUE    1
+#define  FALSE   0
+#define  YES     1
+#define  NO      0
+#define  NIL     0
+#define  DEBUG   1
+#define  VERSION "1.0" 
+
+/*  Define the constants for colours in the HLS space.  */
+
+#define  UNFILLED           -1
+#define  MAX_COLOUR_INDEX  255
+
+
+/*  Define the dimensions of the intelligent canvas. */
+
+#define  CANVAS_WIDTH  300
+#define  CANVAS_HEIGHT 300
+#define  SCALE_WIDTH    30
+
+
+/*  Define constants that control the evolution of the paint. */
+
+#define  STEP_LIMIT    200
+#define  REDRAW_LIMIT  500
+
+
+/*  Define some constants used in testing the system. */
+
+#define  DEFAULT_BLOB_SIZE (CANVAS_WIDTH / 3)
+#define  BLOB_NAME         "-blob"
+
+
+/*  Constants used in modelling gravity.  */
+
+#define NORTH 0
+#define EAST  1
+#define SOUTH 2
+#define WEST  3
+
+#define DEFAULT_GRAVITY_STRENGTH  10
+
+
+/*  Define some macros.  */
+
+#define MAX(A,B) ((A) > (B) ? (A) : (B))
+#define MIN(A,B) ((A) < (B) ? (A) : (B))
diff --git a/chalk/colorspaces/wetsticky/ws/engine.c b/chalk/colorspaces/wetsticky/ws/engine.c
new file mode 100644
index 000000000..2fb4917e3
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/engine.c
@@ -0,0 +1,802 @@
+/*
+	FILE:		engine.c
+	PURPOSE:	Defines the routines for the Paint Engine.
+	AUTHOR:		Kevin Waite 
+	VERSION:	1.00  (10-May-91)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 
+
+*/
+
+#include "constants.h"
+#include "types.h"
+#include "canvas.h"
+#include <math.h>
+
+extern double HEIGHT_SCALE;
+
+/* *********************************************************************** */
+
+int random_percent()
+/*  This function returns a random number in the range [0,100].  */
+{
+   extern long random();
+
+   return (random() % 101);
+}
+
+/* *********************************************************************** */
+
+BOOLEAN allow_event_based_on(value)
+/*  The given value is a percentage.  Compare this value
+    with a randomly generated percentage and if it is larger
+    then allow the event to happen (i.e. return TRUE) other-
+    wise return FALSE.  */
+
+int value;
+
+{
+   if (value > random_percent()) return(TRUE);
+   return(FALSE);
+}
+
+/* *********************************************************************** */
+
+BOOLEAN age_paint(cell)
+/*  Make the paint in the given cell older, i.e. let
+    if dry out a bit if it isn't already dry.  This
+    function returns TRUE if the paint was already
+    dry or becomes so, and FALSE otherwise.  */
+
+CELL_PTR cell;
+
+{
+  if (cell->volume == 0) return(TRUE);
+  if (cell->contents.liquid_content == 0) return(TRUE);
+  if (allow_event_based_on(cell->contents.drying_rate) == TRUE) 
+     cell->contents.liquid_content--;
+
+  if (cell->contents.liquid_content == 0) return(TRUE);
+  return(FALSE);
+}
+
+/* *********************************************************************** */
+
+BOOLEAN similar_paint(aPaint, bPaint)
+/* Determine whether the two paints are similar.  It is
+   assumed that aPaint has come from the host cell (and
+   so it is its miscibility value that is used).  The
+   function returns TRUE if the paints are similar and
+   FALSE otherwise.   */
+
+PAINT aPaint, bPaint;
+
+{
+   int delta;
+
+   delta = abs(aPaint.liquid_content - bPaint.liquid_content);
+   if (delta <= aPaint.miscibility) return(TRUE);
+   return(FALSE);
+}
+
+/* *********************************************************************** */
+
+int surplus_paint(cell)
+/*  Returns the amount of paint held by this cell greater than its
+    absorbancy value.  This is the amount of paint that can flow.  */
+
+CELL_PTR cell;
+
+{
+   return (MAX(cell->volume - cell->absorbancy, 0));
+}
+
+/* *********************************************************************** */
+
+BOOLEAN has_surplus_paint(cell)
+/*  Does the given cell have excess paint, i.e. can paint flow out
+    of this cell.  Return TRUE if it can and FALSE otherwise.  */
+
+CELL_PTR cell;
+
+{
+   if (surplus_paint(cell) > 0) return(TRUE);
+   return(FALSE);
+}
+
+/* *********************************************************************** */
+
+void stop() {  /*  Used for breakpointing.  */ }
+
+void donate_paint(source, srcLocus, amount, dest, destLocus)
+/* The source cell is donating the specified volume of its paint
+   to the destination cell.  The destination cell must mix this 
+   new paint with its existing paint to yield a new paint.
+   This routine is also responsible for recording which cells
+   have been updated and so need tqrepainting.
+   
+   A special case is recognised where the destination has not yet
+   had any paint applied.  This causes the donated paint to become
+   to new contents of this cell.   
+
+*/
+
+CELL_PTR source, dest;
+POINT    srcLocus, destLocus;
+int      amount;
+
+{
+   float delta, ratio;
+   int   iDelta;
+
+   source->volume -= amount;
+
+   if (dest->volume == UNFILLED) {
+
+      /*  The donated paint is going into an unfilled cell.  
+          Copy the source's attributes into the destination.  */
+
+      dest->volume = amount;
+      dest->contents.colour.hue = source->contents.colour.hue;
+      dest->contents.colour.lightness = source->contents.colour.lightness;
+      dest->contents.colour.saturation = source->contents.colour.saturation;
+      dest->contents.liquid_content = source->contents.liquid_content;
+      dest->contents.miscibility = source->contents.miscibility;
+      dest->contents.drying_rate = source->contents.drying_rate;
+
+   } else {
+
+   /*  Need to mix the existing paint in the dest with this amount
+       of new paint from the source.  This is done using a linear
+       interpolation mechanism using the relative amounts of the
+       paint as the control.  */
+
+	if (dest->volume != 0)
+	      ratio = amount / (float)(dest->volume);
+   
+      iDelta = source->contents.colour.hue - dest->contents.colour.hue;
+      if (iDelta != 0) {
+         dest->contents.colour.hue += (int)(ratio * iDelta); 
+         if (dest->contents.colour.hue >= 360)
+            dest->contents.colour.hue -= 360; 
+      }
+
+      iDelta = source->contents.drying_rate - dest->contents.drying_rate;
+      dest->contents.drying_rate += (int)((int)ratio * iDelta);
+      dest->contents.drying_rate %= 101;
+
+      iDelta = source->contents.liquid_content - dest->contents.liquid_content;
+      dest->contents.liquid_content += (int)(ratio * iDelta);
+      dest->contents.liquid_content %= 101;
+
+      iDelta = source->contents.miscibility - dest -> contents.miscibility;
+      dest->contents.miscibility += (int)(ratio * iDelta);
+      dest->contents.miscibility %= 101;
+
+      delta = source -> contents.colour.saturation - dest -> contents.colour.saturation;
+      dest -> contents.colour.saturation += ratio * delta;
+
+      delta = source->contents.colour.lightness - dest->contents.colour.lightness;
+      dest->contents.colour.lightness += ratio * delta;
+
+      dest->volume += amount;   /* The new volume of paint in dest. */
+
+   }
+
+   need_to_tqrepaint(destLocus);
+}
+
+/* *********************************************************************** */
+
+void handle_surface_tension(cell, locus)
+/*  This routine handles the surface tension around the given cell.
+*/
+
+CELL_PTR cell;
+POINT    locus;
+
+{
+   DIRECTION direction[3];
+   POINT     loci[3];
+   CELL_PTR  buddy[3];
+   BOOLEAN   ok, similar[3];
+   int       weakCount, weak[3], count[3], excess, chosen, side, start, finish, 
+k, lowest;
+
+   if (has_surplus_paint(cell) == FALSE) return;
+
+   direction[0] = cell->gravity.direction;
+   direction[1] = clockwise_from(direction[0]);
+   direction[2] = anti_clockwise_from(direction[0]);
+
+   for (k=0; k < 3; k++) {
+      ok = neighbour(locus, direction[k], &loci[k]);
+      if (ok == TRUE) {
+         buddy[k] = get_cell(loci[k]);
+         count[k] = 0;
+      } else count[k] = -1;
+   }
+
+   for (k=0; k < 3; k++) 
+      similar[k] = (count[k] == -1) 
+                      ? FALSE 
+                      : similar_paint(cell->contents, buddy[k]->contents); 
+
+   for (k=0; k < 3; k++) {
+      if ((count[k] != -1) && (similar[k] == FALSE)) {
+         count[k] = 0;
+         start = MAX(k-1, 0);
+         finish = MIN(k+1, 2);
+         for (side=start; side <= finish; side++) 
+            if ((count[side] != -1) && (similar[side] == FALSE)) count[k]++;
+          
+      }
+   }
+
+   lowest = 4;
+   for (k=0; k < 3; k++) if (count[k] >= 0) lowest = MIN(count[k], lowest);
+
+   weakCount = 0;
+   for (k=0; k < 3; k++) if (count[k] == lowest) weak[weakCount++] = k;
+
+   /*  The weak array now holds weakCount indices of those sides that have
+       the lowest surface tension and therefore where any paint would flow over.
+       Now it is necessary to see whether paint will actually flow based on
+       a probability level using the liquidity and volume of the paint in the
+       cell as parameters.   Paint will flow over only one of the weakest sides
+       with the side chosen at random.    */
+
+   if (random_percent() > cell->contents.liquid_content) return;  /*  Too 
+viscous.  */
+
+   excess = surplus_paint(cell);
+   if (random_percent() > excess * 3) return;   
+   /*  The '3' in the previous statement is an empirically-derived multiplier.  
+*/
+
+   /*  The paint will flow.  Pick one of the weakest sides at random.  */
+
+   chosen = weak[random_percent() % weakCount];
+   donate_paint(cell, locus, (excess / 2), buddy[chosen], loci[chosen]);
+}
+
+/* *********************************************************************** */
+
+BOOLEAN diffuse_paint(cell, locus)
+/* Diffuse paint among the neighbours of the given cell.
+   If this cell does not have surplus paint then return
+   TRUE otherwise return FALSE.  */
+
+CELL_PTR cell;
+POINT locus;
+
+{
+   extern long random();
+   DIRECTION down, direction;
+   CELL_PTR buddy;
+   POINT nlocus;
+   BOOLEAN ok;
+   int excess;
+
+   if (has_surplus_paint(cell) == FALSE) return(TRUE);
+
+   down = cell->gravity.direction;
+   direction = ((random() & 01) == 0) 
+               ? clockwise_from(down) 
+               : anti_clockwise_from(down);
+
+   ok = neighbour(locus, direction, &nlocus);
+   if (ok == FALSE) return(TRUE);
+
+   buddy = get_cell(nlocus);
+
+   if (similar_paint(cell->contents, buddy->contents) == FALSE) {
+      handle_surface_tension(cell, locus);
+      return(FALSE);
+   }
+
+   if (buddy->volume >= cell->volume) return(FALSE);
+
+   if (allow_event_based_on(cell->contents.liquid_content) == FALSE)
+      return(FALSE);
+
+   /* Transfer one particle of paint from cell to its buddy. */
+
+   excess = (cell->volume - buddy->volume) / 2;
+   donate_paint(cell, locus, excess, buddy, nlocus);
+   return(FALSE);
+}
+
+/* *********************************************************************** */
+
+BOOLEAN apply_gravity(cell, locus)
+/*  Subject the contents of the given cell to the effects
+    of gravity.  Note that the direction of gravity is local
+    to the given cell.   Locus is the address of this cell.
+    This function returns TRUE if the paint in this cell
+    cannot flow and FALSE otherwise.
+*/
+
+CELL_PTR cell;
+POINT    locus;
+
+{
+   extern long random();
+   POINT downhill;
+   CELL_PTR down;
+   BOOLEAN ok, can_flow;
+   int barrier, excess;
+
+   ok = neighbour(locus, cell->gravity.direction, &downhill);
+   if (ok == FALSE) return(TRUE);  /* At bottom of canvas. */
+
+   down = get_cell(downhill);
+
+   can_flow = down->volume < (cell->volume + cell->gravity.strength)
+	      ? TRUE : FALSE;
+
+   if (can_flow == FALSE) return(TRUE);
+
+   /*  Although this paint can flow introduce a random value that
+       uses the viscosity of the paint to determine whether it does
+       actually flow.  */
+
+   barrier = random() % 10;
+   if (cell->contents.liquid_content > barrier) { 
+     /* Paint is actually moving.  Move half of the excess downward. */
+
+     excess = (cell->volume - cell->absorbancy) / 2;
+     donate_paint(cell, locus, excess, down, downhill);
+   }
+
+   return(FALSE);
+}
+
+
+float  lx, ly, lz;
+
+void
+compute_shade_vectors()
+{
+	extern  float lx, ly, lz;
+	float D;
+	
+	lx = 1.0;  ly = -1.0;  lz = 3.0;
+
+	D = sqrt ( lx * lx + ly * ly + lz * lz );
+
+	lx = lx/D; ly = ly/D; lz = lz/D;
+
+}
+
+/* *********************************************************************** **	
+								**
+** 	new_intensity_value						**
+**									**
+**	calculates shade value for a pixel from surface characteristics ** **	
+								**
+**	Revision History						**
+**									**
+**	Rev	Date	By	Description				**
+**	1.0 1/12/91	DE Original				**
+**	1.1 1/04/92	DE Include Phong Shading			**
+**	1.2 11/08/92	 JWP Parameterized Specular Component 	** **		
+							**
+*********************************************************************** */ 
+
+float calc_d();
+float calc_g();
+float calc_f();
+float sqr();
+void printvector();
+void vectscale();
+void vectadd();
+float magnitude();
+
+float
+normalize (x, y, z)
+ float x, y, z; /*vector x, y, z components*/
+{
+	float result;
+
+        /* function calculates the amount to divide each vector component
+           to normalize it to a unit vector. The parameters are the x,y,z
+           components and the result is the amount to divide by */
+
+ result = sqrt (x*x + y*y + z*z);
+ return (result);
+
+ }
+
+
+
+float Newnormalize(V, W)
+float *V;
+float *W;
+{
+	float temp;
+
+	temp = normalize(V[0], V[1], V[2]);
+
+	W[0] = V[0]/temp;
+	W[1] = V[1]/temp;
+	W[2] = V[2]/temp;
+
+	return temp;
+}
+
+float dot(V, W)
+	float V[3];
+	float W[3];
+{	
+
+	return ( (V[0])*(W[0]) + (V[1])*(W[1]) + (V[2])*(W[2]) );
+
+}
+
+float Phong (Nv, Lv, Ev, shine)
+float Nv[3];
+float Lv[3];
+float Ev[3];
+float shine;
+{
+	float Hv[3];
+ 
+	Newnormalize(Ev, Ev);
+ 
+	Hv[0] = Ev[0] + Lv[0];
+	Hv[1] = Ev[1] + Lv[1];
+	Hv[2] = Ev[2] + Lv[2];
+ 
+	Newnormalize (Hv, Hv);
+ 
+	shine = abs(shine);
+	return( pow(dot(Nv, Hv), shine) );
+}
+
+
+/******************* Auxillary functions *****************************/ 
+
+/* Function : calc_c
+* Returns : the microfacet distribution function */
+
+float calc_d(cos_alpha,c3)
+float cos_alpha;
+float c3;
+{
+float d;
+d=sqr( sqr(c3) / ( sqr(cos_alpha)*(sqr(c3) -1) +1)); return d;
+}
+
+/*
+* Function : calc_g
+* Returns : the geometrical attenuation factor. *
+* This function should return values between 0.0 and 1.0, so if it's  * negative I will return 0.0 Anyway it does not seem to make any difference  * at all whether I return 0.0, the negative value or the minimum of the  * absolute values of (temp1,temp2,temp3) */
+
+float calc_g(N,H,L,V)
+float N[3];		/* Normal vector 	*/
+float H[3];		/* Half-way vector 	*/
+float L[3];		/* Light vector		*/
+float V[3];		/* View vector		*/
+{
+	float temp1,temp2,temp3,ret;
+	float NdotH,NdotV,NdotL,VdotH;
+	NdotH=dot(N,H);
+	NdotV=dot(N,V);
+	NdotL=dot(N,L);
+	VdotH=dot(V,H);
+	temp1=1.0;
+	temp2=(2*NdotH*NdotV)/VdotH;
+	temp3=(2*NdotH*NdotL)/VdotH;
+	/* Find minimum value */
+	if (temp1 < temp2)
+		if (temp1 < temp3)
+			ret=temp1;
+		else
+		ret=temp3;
+	else
+		if (temp2 < temp3)
+			ret=temp2;
+		else
+			ret=temp3;
+	if (ret < 0.0)
+		ret=0.0;
+	return ret;
+}
+
+/* Function : calc_f
+* Returns : the Fresnel term
+*/
+
+float calc_f(L,H,mu)
+float L[3];
+float H[3];
+float mu;
+{
+	float temp1,temp2;
+	float c,g;
+	c=dot(L,H);
+	g=sqrt(sqr(mu)+sqr(c) -1);
+	temp1 = (sqr(g-c)/sqr(g+c))*0.5;
+	temp2 = 1+(sqr( c*(g+c)-1 ) / sqr( c*(g-c)+1)); return (temp1*temp2);
+}
+
+/* Function : sqr
+* Returns : the square of its argument
+*/
+
+float sqr(x)
+float x;
+{
+	return (x*x);
+}
+
+/* Function : printvector
+* prints the contents of a vector with 3 elements */
+
+void printvector(v)
+float v[3];
+{
+	printf("[%f,%f,%f] ",v[0],v[1],v[2]);
+}
+
+void vectscale(v1, k, vout, n)
+float *v1;
+float k;
+float *vout;
+int n;
+{  	vout[0] = v1[0]*k;
+	vout[1] = v1[1]*k;
+	vout[2] = v1[2]*k;
+}
+
+void vectadd(v1, v2, vout, n)
+float *v1, *v2, *vout;
+int n;
+{  	vout[0] = v1[0] + v2[0];
+	vout[1] = v1[1] + v2[1];
+	vout[2] = v1[2] + v2[2];
+}
+
+float magnitude(v)
+float *v;
+{  		return( normalize(v[0], v[1], v[2]) );
+}
+
+float T_S(Nv, Lv, Ev, shine)
+float Nv[3];    /* Normalized Normal vector */
+float Lv[3];                    /* Normalized Light-source vector */
+float Ev[3];                    /* Un-normalized Eye vector */
+float shine;                    /* parameter to absorb Phong coeff */
+{
+	float Hv[3];                 /* Half-way vector H            */
+	float cos_alpha;
+	float t;
+	float mdf;                /* Micro facet distribtuion function */
+	float gaf;                     /* Geometrical attenuation factor*/  	float ft;                   /* The Fresnel term             */
+	float c3;
+	float mu;                      /* Refractive index             */
+
+        /*initialize appearance constants*/
+        c3 = shine;
+        mu = 200.0;
+ 
+        /*normalize eye vector*/
+ 
+        Newnormalize(Ev, Ev);
+ 
+/* Calculate the half-way vector H, between the light vector and the
+view vector */
+ 
+        vectadd(Ev,Lv,Hv,3);
+        t = magnitude(Hv,3);
+
+        vectscale(Hv,(1/t),Hv,3);
+ 
+        /* Calculate the micro-facet distribution function D */
+ 
+        cos_alpha=dot(Nv,Hv);
+        mdf=calc_d(cos_alpha,c3);
+ 
+ 
+        /* Calculate the geometrical attenuation factor */
+ 
+        gaf=calc_g(Nv,Hv,Lv,Ev);
+ 
+        /* Calculate the Fresnel Term */
+ 
+        ft=calc_f(Lv,Hv,mu);
+ 
+        /* Calculate specular component */
+ 
+        return( (mdf*gaf*ft) / dot(Nv,Lv) );
+}
+ 
+
+
+
+float
+new_intensity_value(a_pnt)
+POINT a_pnt;
+/* Calculate the new intensity value of a pixel 
+in order to construct a bump map of the paint surface
+*/
+{
+float h, h1, h2, h3, h4;
+	float shininess;
+float Ka, Kd, Ks;
+	float wetmax, degree, norm, distance;
+	float g;
+float Nv[3];
+	float Ev[3];
+	float Hv[3];
+	float Lv[3];
+	extern float lx, ly, lz;
+float intensity, light_intensity;
+int liquid;
+POINT b_pnt;
+CELL_PTR cell;
+CELL_PTR next_cell;
+	int x_cntr, y_cntr;
+
+	Ka = 0.0;
+	Kd = 0.5;
+	Ks = 0.5;
+
+	wetmax = 100.0;
+	distance = 2500.0;
+	light_intensity = 2.0;
+	shininess = 0.3;
+
+	cell = get_cell(a_pnt);
+
+	h = (float)cell->volume;
+
+	if (neighbour(a_pnt, NORTH, &b_pnt)) {
+		next_cell = get_cell(b_pnt);
+		h1 = (float)next_cell->volume;
+	} else
+		h1 = h;
+
+	if (neighbour(a_pnt, EAST, &b_pnt)) {
+		next_cell = get_cell(b_pnt);
+		h2 = (float)next_cell->volume;
+	} else
+		h2 = h;
+
+	if (neighbour(a_pnt, SOUTH, &b_pnt)) {
+		next_cell = get_cell(b_pnt);
+		h3 = (float)next_cell->volume;
+	} else
+		h3 = h;
+
+	if (neighbour(a_pnt, WEST, &b_pnt)) {
+		next_cell = get_cell(b_pnt);
+		h4 = (float)next_cell->volume;
+	} else
+		h4 = h;
+
+	h1 = h1/HEIGHT_SCALE;
+	h2 = h2/HEIGHT_SCALE;
+	h3 = h3/HEIGHT_SCALE;
+	h4 = h4/HEIGHT_SCALE;
+
+	/* test fix for "disappearing" paint */
+
+	if (cell->contents.liquid_content == 0) 
+		liquid = 1;
+	else
+		liquid = cell->contents.liquid_content;
+
+	degree = (float)abs(liquid)/wetmax; 
+
+	x_cntr= 150 - a_pnt.x;
+	y_cntr= 150 - a_pnt.y;
+
+	Ks = light_intensity * Ks /* * degree*/ ;
+
+	Kd = light_intensity * Kd;
+
+/*	shininess = shininess/degree; */
+
+
+	Nv[1] = h3 - h1;
+	Nv[0] = h4 - h2;
+	Nv[2] = 4.0;
+
+	Newnormalize (Nv, Nv);
+
+	Lv[0] = lx;
+	Lv[1] = ly;
+	Lv[2] = lz;
+
+	g = dot(Lv, Nv)*Kd + Ka;
+
+        g = g * (float)cell->contents.colour.hue;
+
+	Ev[0] = (float)x_cntr;
+	Ev[1] = (float)y_cntr;
+	Ev[2] = distance;
+
+        intensity = g + Ks*T_S(Nv, Lv, Ev, shininess);
+
+        if ( intensity > 255.0 ) {
+                intensity = 0.0;
+        } else {
+                if (intensity < 0.0)
+                        intensity = 255.0;
+                else
+                        intensity = 255.0 - intensity;
+        }
+        
+        
+        /*printf("wetness %d colour %d intensity %f guraud %f phong %f\n",
+                        cell->contents.liquid_content,
+                                cell->contents.colour.hue,
+                                intensity,
+                                g,
+                                intensity - g);*/
+ 
+ 
+return (intensity);
+}
+
+
+/* *********************************************************************** */
+
+void single_step()
+/*  This routine defines the paint steps involved in the
+    basic cycle of the painting engine.  */
+
+{
+   POINT     locus;
+   CELL_PTR  cell;
+   BOOLEAN   done;
+
+   next_cell_point(&locus);
+   cell = get_cell(locus);
+   
+   done = age_paint(cell);
+   if (done == TRUE) return;
+
+   done = diffuse_paint(cell, locus);
+   if (done == TRUE) return;
+
+   done = apply_gravity(cell, locus);
+}
+
+brush_stroke(x,y)
+int x;
+int y;
+{
+   POINT pnt;
+   CELL_PTR cell;
+
+
+	pnt.x = x;
+	pnt.y = y;
+
+	cell = get_cell(pnt);
+
+         cell->contents.liquid_content = 100;
+	   cell->contents.drying_rate = 10;
+	   cell->contents.miscibility = 80;
+
+	   cell->contents.colour.hue = 128;
+	   cell->contents.colour.saturation = 1.0;
+	   cell->contents.colour.lightness = 0.0;
+
+	   cell->volume = 50;
+	
+}
+
+
diff --git a/chalk/colorspaces/wetsticky/ws/engine.h b/chalk/colorspaces/wetsticky/ws/engine.h
new file mode 100644
index 000000000..b6072b0a4
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/engine.h
@@ -0,0 +1,33 @@
+/*
+    FILE:        engine.h
+    PURPOSE:    Defines the routines for the Paint Engine.
+    AUTHOR:        Kevin Waite 
+    VERSION:    1.00  (10-May-91)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA 
+
+*/
+
+extern void single_step();
+/*  This routine defines the paint steps involved in the
+    basic cycle of the painting engine.  */
+
+extern brush_stroke();
+
+extern float intensity_value( /* POINT */);
+
+extern float new_intensity_value( /* POINT */);
+
+extern void compute_shade_vectors();
+
+
diff --git a/chalk/colorspaces/wetsticky/ws/engine3.c b/chalk/colorspaces/wetsticky/ws/engine3.c
new file mode 100644
index 000000000..9fd274cdd
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/engine3.c
@@ -0,0 +1,617 @@
+/*
+	FILE:		engine.c
+	PURPOSE:	Defines the routines for the Paint Engine.
+	AUTHOR:		Kevin Waite 
+	VERSION:	1.00  (10-May-91)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 
+
+*/
+
+#include "constants.h"
+#include "types.h"
+#include "canvas.h"
+#include <math.h>
+
+#define HEIGHT_SCALE 1.0
+
+/* *********************************************************************** */
+
+int random_percent()
+/*  This function returns a random number in the range [0,100].  */
+{
+   extern long random();
+
+   return (random() % 101);
+}
+
+/* *********************************************************************** */
+
+BOOLEAN allow_event_based_on(value)
+/*  The given value is a percentage.  Compare this value
+    with a randomly generated percentage and if it is larger
+    then allow the event to happen (i.e. return TRUE) other-
+    wise return FALSE.  */
+
+int value;
+
+{
+   if (value > random_percent()) return(TRUE);
+   return(FALSE);
+}
+
+/* *********************************************************************** */
+
+BOOLEAN age_paint(cell)
+/*  Make the paint in the given cell older, i.e. let
+    if dry out a bit if it isn't already dry.  This
+    function returns TRUE if the paint was already
+    dry or becomes so, and FALSE otherwise.  */
+
+CELL_PTR cell;
+
+{
+  if (cell->volume == 0) return(TRUE);
+  if (cell->contents.liquid_content == 0) return(TRUE);
+  if (allow_event_based_on(cell->contents.drying_rate) == TRUE) 
+     cell->contents.liquid_content--;
+
+  if (cell->contents.liquid_content == 0) return(TRUE);
+  return(FALSE);
+}
+
+/* *********************************************************************** */
+
+BOOLEAN similar_paint(aPaint, bPaint)
+/* Determine whether the two paints are similar.  It is
+   assumed that aPaint has come from the host cell (and
+   so it is its miscibility value that is used).  The
+   function returns TRUE if the paints are similar and
+   FALSE otherwise.   */
+
+PAINT aPaint, bPaint;
+
+{
+   int delta;
+
+   delta = abs(aPaint.liquid_content - bPaint.liquid_content);
+   if (delta <= aPaint.miscibility) return(TRUE);
+   return(FALSE);
+}
+
+/* *********************************************************************** */
+
+int surplus_paint(cell)
+/*  Returns the amount of paint held by this cell greater than its
+    absorbancy value.  This is the amount of paint that can flow.  */
+
+CELL_PTR cell;
+
+{
+   return (MAX(cell->volume - cell->absorbancy, 0));
+}
+
+/* *********************************************************************** */
+
+BOOLEAN has_surplus_paint(cell)
+/*  Does the given cell have excess paint, i.e. can paint flow out
+    of this cell.  Return TRUE if it can and FALSE otherwise.  */
+
+CELL_PTR cell;
+
+{
+   if (surplus_paint(cell) > 0) return(TRUE);
+   return(FALSE);
+}
+
+/* *********************************************************************** */
+
+void stop() {  /*  Used for breakpointing.  */ }
+
+void donate_paint(source, srcLocus, amount, dest, destLocus)
+/* The source cell is donating the specified volume of its paint
+   to the destination cell.  The destination cell must mix this 
+   new paint with its existing paint to yield a new paint.
+   This routine is also responsible for recording which cells
+   have been updated and so need tqrepainting.
+   
+   A special case is recognised where the destination has not yet
+   had any paint applied.  This causes the donated paint to become
+   to new contents of this cell.   
+
+*/
+
+CELL_PTR source, dest;
+POINT    srcLocus, destLocus;
+int      amount;
+
+{
+   float delta, ratio;
+   int   iDelta;
+
+   source->volume -= amount;
+
+   if (dest->volume == UNFILLED) {
+
+      /*  The donated paint is going into an unfilled cell.  
+          Copy the source's attributes into the destination.  */
+
+      dest->volume = amount;
+      dest->contents.colour.hue = source->contents.colour.hue;
+      dest->contents.colour.lightness = source->contents.colour.lightness;
+      dest->contents.colour.saturation = source->contents.colour.saturation;
+      dest->contents.liquid_content = source->contents.liquid_content;
+      dest->contents.miscibility = source->contents.miscibility;
+      dest->contents.drying_rate = source->contents.drying_rate;
+
+   } else {
+
+   /*  Need to mix the existing paint in the dest with this amount
+       of new paint from the source.  This is done using a linear
+       interpolation mechanism using the relative amounts of the
+       paint as the control.  */
+
+      ratio = amount / (float)(dest->volume);
+   
+      iDelta = source->contents.colour.hue - dest->contents.colour.hue;
+      if (iDelta != 0) {
+         dest->contents.colour.hue += (int)(ratio * iDelta); 
+         if (dest->contents.colour.hue >= 360)
+            dest->contents.colour.hue -= 360; 
+      }
+
+      iDelta = source->contents.drying_rate - dest->contents.drying_rate;
+      dest->contents.drying_rate += (int)(ratio * iDelta);
+      dest->contents.drying_rate %= 101;
+
+      iDelta = source->contents.liquid_content - dest->contents.liquid_content;
+      dest->contents.liquid_content += (int)(ratio * iDelta);
+      dest->contents.liquid_content %= 101;
+
+      iDelta = source->contents.miscibility - dest->contents.miscibility;
+      dest->contents.miscibility += (int)(ratio * iDelta);
+      dest->contents.miscibility %= 101;
+
+      delta = source->contents.colour.saturation - dest->contents.colour.saturation;
+      dest->contents.colour.saturation += ratio * delta;
+
+      delta = source->contents.colour.lightness - dest->contents.colour.lightness;
+      dest->contents.colour.lightness += ratio * delta;
+
+      dest->volume += amount;   /* The new volume of paint in dest. */
+
+   }
+
+   need_to_tqrepaint(destLocus);
+}
+
+/* *********************************************************************** */
+
+void handle_surface_tension(cell, locus)
+/*  This routine handles the surface tension around the given cell.
+*/
+
+CELL_PTR cell;
+POINT    locus;
+
+{
+   DIRECTION direction[3];
+   POINT     loci[3];
+   CELL_PTR  buddy[3];
+   BOOLEAN   ok, similar[3];
+   int       weakCount, weak[3], count[3], excess, chosen, side, start, finish, k, lowest;
+
+   if (has_surplus_paint(cell) == FALSE) return;
+
+   direction[0] = cell->gravity.direction;
+   direction[1] = clockwise_from(direction[0]);
+   direction[2] = anti_clockwise_from(direction[0]);
+
+   for (k=0; k < 3; k++) {
+      ok = neighbour(locus, direction[k], &loci[k]);
+      if (ok == TRUE) {
+         buddy[k] = get_cell(loci[k]);
+         count[k] = 0;
+      } else count[k] = -1;
+   }
+
+   for (k=0; k < 3; k++) 
+      similar[k] = (count[k] == -1) 
+                      ? FALSE 
+                      : similar_paint(cell->contents, buddy[k]->contents); 
+
+   for (k=0; k < 3; k++) {
+      if ((count[k] != -1) && (similar[k] == FALSE)) {
+         count[k] = 0;
+         start = MAX(k-1, 0);
+         finish = MIN(k+1, 2);
+         for (side=start; side <= finish; side++) 
+            if ((count[side] != -1) && (similar[side] == FALSE)) count[k]++;
+          
+      }
+   }
+
+   lowest = 4;
+   for (k=0; k < 3; k++) if (count[k] >= 0) lowest = MIN(count[k], lowest);
+
+   weakCount = 0;
+   for (k=0; k < 3; k++) if (count[k] == lowest) weak[weakCount++] = k;
+
+   /*  The weak array now holds weakCount indices of those sides that have
+       the lowest surface tension and therefore where any paint would flow over.
+       Now it is necessary to see whether paint will actually flow based on
+       a probability level using the liquidity and volume of the paint in the
+       cell as parameters.   Paint will flow over only one of the weakest sides
+       with the side chosen at random.    */
+
+   if (random_percent() > cell->contents.liquid_content) return;  /*  Too viscous.  */
+
+   excess = surplus_paint(cell);
+   if (random_percent() > excess * 3) return;   
+   /*  The '3' in the previous statement is an empirically-derived multiplier.  */
+
+   /*  The paint will flow.  Pick one of the weakest sides at random.  */
+
+   chosen = weak[random_percent() % weakCount];
+   donate_paint(cell, locus, (excess / 2), buddy[chosen], loci[chosen]);
+}
+
+/* *********************************************************************** */
+
+BOOLEAN diffuse_paint(cell, locus)
+/* Diffuse paint among the neighbours of the given cell.
+   If this cell does not have surplus paint then return
+   TRUE otherwise return FALSE.  */
+
+CELL_PTR cell;
+POINT locus;
+
+{
+   extern long random();
+   DIRECTION down, direction;
+   CELL_PTR buddy;
+   POINT nlocus;
+   BOOLEAN ok;
+   int excess;
+
+   if (has_surplus_paint(cell) == FALSE) return(TRUE);
+
+   down = cell->gravity.direction;
+   direction = ((random() & 01) == 0) 
+               ? clockwise_from(down) 
+               : anti_clockwise_from(down);
+
+   ok = neighbour(locus, direction, &nlocus);
+   if (ok == FALSE) return(TRUE);
+
+   buddy = get_cell(nlocus);
+
+   if (similar_paint(cell->contents, buddy->contents) == FALSE) {
+      handle_surface_tension(cell, locus);
+      return(FALSE);
+   }
+
+   if (buddy->volume >= cell->volume) return(FALSE);
+
+   if (allow_event_based_on(cell->contents.liquid_content) == FALSE)
+      return(FALSE);
+
+   /* Transfer one particle of paint from cell to its buddy. */
+
+   excess = (cell->volume - buddy->volume) / 2;
+   donate_paint(cell, locus, excess, buddy, nlocus);
+   return(FALSE);
+}
+
+/* *********************************************************************** */
+
+BOOLEAN apply_gravity(cell, locus)
+/*  Subject the contents of the given cell to the effects
+    of gravity.  Note that the direction of gravity is local
+    to the given cell.   Locus is the address of this cell.
+    This function returns TRUE if the paint in this cell
+    cannot flow and FALSE otherwise.
+*/
+
+CELL_PTR cell;
+POINT    locus;
+
+{
+   extern long random();
+   POINT downhill;
+   CELL_PTR down;
+   BOOLEAN ok, can_flow;
+   int barrier, excess;
+
+   ok = neighbour(locus, cell->gravity.direction, &downhill);
+   if (ok == FALSE) return(TRUE);  /* At bottom of canvas. */
+
+   down = get_cell(downhill);
+
+   can_flow = down->volume < (cell->volume + cell->gravity.strength)
+	      ? TRUE : FALSE;
+
+   if (can_flow == FALSE) return(TRUE);
+
+   /*  Although this paint can flow introduce a random value that
+       uses the viscosity of the paint to determine whether it does
+       actually flow.  */
+
+   barrier = random() % 10;
+   if (cell->contents.liquid_content > barrier) { 
+     /* Paint is actually moving.  Move half of the excess downward. */
+
+     excess = (cell->volume - cell->absorbancy) / 2;
+     donate_paint(cell, locus, excess, down, downhill);
+   }
+
+   return(FALSE);
+}
+
+
+float  lx, ly, lz;
+
+void
+compute_shade_vectors()
+{
+	extern  float lx, ly, lz;
+	float D;
+	
+	lx = -1.0;  ly = 1.0;  lz = 2.0;
+
+	D = sqrt ( lx * lx + ly * ly + lz * lz );
+
+	lx = lx/D; ly = ly/D; lz = lz/D;
+
+}
+
+/* *********************************************************************** **									**
+** 	new_intensity_value						**
+**									**
+**	calculates shade value for a pixel from surface characteristics ** **									**
+**	Revision History						**
+**									**
+**	Rev	Date	By	Description				**
+**	1.0 1/12/91	DE Original				**
+**	1.1 1/04/92	DE Include Phong Shading			**
+**	1.2 11/08/92	 JWP Parameterized Specular Component 	** **									**
+*********************************************************************** */ 
+float
+normalize (x, y, z)
+ float x, y, z; /*vector x, y, z components*/
+{
+ float result;
+
+        /* function calculates the amount to divide each vector component
+           to normalize it to a unit vector. The parameters are the x, y,
+z
+           components and the result is the amount to divide by */
+
+ result = sqrt (x*x + y*y + z*z);
+ return (result);
+
+ }
+
+
+
+float Newnormalize(V, W)
+float *V;
+float *W;
+{
+float temp;
+
+temp = normalize(V[0], V[1], V[2]);
+
+W[0] = V[0]/temp;
+W[1] = V[1]/temp;
+W[2] = V[2]/temp;
+
+return temp;
+}
+
+float dot(V, W)
+float V[3];
+float W[3];
+{
+
+return ( (V[0])*(W[0]) + (V[1])*(W[1]) + (V[2])*(W[2]) );
+
+}
+
+float Phong (Nv, Lv, Ev, shine)
+float Nv[3];
+float Lv[3];
+float Ev[3];
+float shine;
+{
+float Hv[3];
+ 
+Newnormalize(Ev, Ev);
+ 
+Hv[0] = Ev[0] + Lv[0];
+Hv[1] = Ev[1] + Lv[1];
+Hv[2] = Ev[2] + Lv[2];
+ 
+Newnormalize (Hv, Hv);
+ 
+shine = abs(shine);
+return( pow(dot(Nv, Hv), shine) );
+}
+
+
+float
+new_intensity_value(a_pnt)
+POINT a_pnt;
+/* Calculate the new intensity value of a pixel 
+in order to construct a bump map of the paint surface
+*/
+{
+float h, h1, h2, h3, h4;
+	int shininess;
+float Ka, Kd, Ks;
+	float wetmax, degree, norm, distance;
+	float g;
+float Nv[3];
+	float Ev[3];
+	float Hv[3];
+	float Lv[3];
+	extern float lx, ly, lz;
+float intensity, light_intensity;
+POINT b_pnt;
+CELL_PTR cell;
+CELL_PTR next_cell;
+	int x_cntr, y_cntr;
+
+Ka = 0.1;
+Kd = 0.6;
+	Ks = 0.4;
+
+	wetmax = 100.0;
+	distance = 2500.0;
+	light_intensity = 2.0;
+	shininess = 200;
+
+cell = get_cell(a_pnt);
+
+h = (float)cell->volume;
+
+if (neighbour(a_pnt, NORTH, &b_pnt)) {
+next_cell = get_cell(b_pnt);
+h1 = (float)next_cell->volume;
+} else
+h1 = h;
+
+if (neighbour(a_pnt, EAST, &b_pnt)) {
+next_cell = get_cell(b_pnt);
+h2 = (float)next_cell->volume;
+} else
+h2 = h;
+
+if (neighbour(a_pnt, SOUTH, &b_pnt)) {
+next_cell = get_cell(b_pnt);
+h3 = (float)next_cell->volume;
+} else
+h3 = h;
+
+if (neighbour(a_pnt, WEST, &b_pnt)) {
+next_cell = get_cell(b_pnt);
+h4 = (float)next_cell->volume;
+} else
+h4 = h;
+
+h1 = h1/HEIGHT_SCALE;
+h2 = h2/HEIGHT_SCALE;
+h3 = h3/HEIGHT_SCALE;
+h4 = h4/HEIGHT_SCALE;
+
+	degree = (float)abs(cell->contents.liquid_content)/wetmax; 
+
+	x_cntr= 150 - a_pnt.x;
+	y_cntr= 150 - a_pnt.y;
+
+	Ks = light_intensity * Ks * degree;
+
+	Kd = light_intensity * Kd;
+
+	shininess = (int)degree * shininess + 1; 
+
+
+	Nv[1] = h3 - h1;
+	Nv[0] = h4 - h2;
+Nv[2] = 4.0;
+
+	Newnormalize (Nv, Nv);
+
+	Lv[0] = lx;
+Lv[1] = ly;
+	Lv[2] = lz;
+
+	g = dot(Lv, Nv)*Kd + Ka;
+
+        g = g * (float)cell->contents.colour.hue;
+
+Ev[0] = (float)x_cntr;
+Ev[1] = (float)y_cntr;
+Ev[2] = distance;
+
+        intensity = g + Ks*Phong(Nv, Lv, Ev, (float)shininess);
+
+        if ( intensity > 255.0 ) {
+                intensity = 0.0;
+        } else {
+                if (intensity < 0.0)
+                        intensity = 255.0;
+                else
+                        intensity = 255.0 - intensity;
+        }
+        
+        
+        /*printf("wetness %d colour %d intensity %f guraud %f phong %f\n",
+                        cell->contents.liquid_content,
+                                cell->contents.colour.hue,
+                                intensity,
+                                g,
+                                intensity - g);*/
+ 
+ 
+return (intensity);
+}
+
+
+/* *********************************************************************** */
+
+void single_step()
+/*  This routine defines the paint steps involved in the
+    basic cycle of the painting engine.  */
+
+{
+   POINT     locus;
+   CELL_PTR  cell;
+   BOOLEAN   done;
+
+   next_cell_point(&locus);
+   cell = get_cell(locus);
+   
+   done = age_paint(cell);
+   if (done == TRUE) return;
+
+   done = diffuse_paint(cell, locus);
+   if (done == TRUE) return;
+
+   done = apply_gravity(cell, locus);
+}
+
+brush_stroke(x,y)
+int x;
+int y;
+{
+   POINT pnt;
+   CELL_PTR cell;
+
+
+	pnt.x = x;
+	pnt.y = y;
+
+	cell = get_cell(pnt);
+
+         cell->contents.liquid_content = 100;
+	   cell->contents.drying_rate = 10;
+	   cell->contents.miscibility = 80;
+
+	   cell->contents.colour.hue = 128;
+	   cell->contents.colour.saturation = 1.0;
+	   cell->contents.colour.lightness = 0.0;
+
+	   cell->volume = 50;
+	
+}
+
diff --git a/chalk/colorspaces/wetsticky/ws/load_ppm.c b/chalk/colorspaces/wetsticky/ws/load_ppm.c
new file mode 100644
index 000000000..6368ee083
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/load_ppm.c
@@ -0,0 +1,244 @@
+/*
+	FILE:		load_ppm.c
+	PURPOSE:	Defines the routines to load a PPM portable pixmap image file.
+	AUTHOR:		David England
+	VERSION:	1.00  (10-May-91)
+
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 
+
+*/
+
+#include "constants.h"
+#include "types.h"
+#include "canvas.h"
+
+#include <ctype.h>
+#include <ppm.h>
+#include <ppmcmap.h>
+
+/* Max number of colors allowed in ppm input. */
+#define MAXCOLORS 256
+
+extern CELL canvas[CANVAS_WIDTH][CANVAS_HEIGHT];
+
+float
+max_rgb(r,g,b)
+float r;
+float g;
+float b;
+{
+	if ((r > g) && (r > b))
+		return (r);
+
+	if ((b > g) && (b > r))
+		return (b);
+
+	if ((g > b) && (g > r))
+		return (g);
+
+	return(0);
+}
+
+float 
+min_rgb(r,g,b) 
+float r; 
+float g; 
+float b;
+{ 
+        if ((r < g) && (b < g)) 
+                return (r); 
+ 
+        if ((b < g) && (b < r))
+                return (b); 
+
+        if ((g < b) && (g < r)) 
+                return (g); 
+
+	return(0);
+}
+
+
+int
+GetHue(red, green, blue) /* rgb to hls */
+int red;
+int green;
+int blue;
+{
+	float min_col, max_col;
+	float h,s,l;
+	float rc, gc, bc;
+	float r, g, b;
+
+	r =  (float)red/255.0;
+	b =  (float)green/255.0;
+	g =  (float)blue/255.0;
+
+	max_col = (float)max_rgb(r, g, b);
+	min_col = (float)min_rgb(r, g, b);
+
+	l = (max_col + min_col)/2.0 ;
+
+	if ( max_col == min_col) {
+		s = 0.0;
+		h = 0.0;
+	} else  {
+		if ( l < 0.5) {
+			s = (max_col - min_col)/(max_col + min_col);
+		} else  s = (max_col - min_col)/(2 - max_col - min_col);
+
+		rc = (max_col -r)/( max_col - min_col);
+		gc = (max_col -g)/(max_col - min_col);
+		bc = (max_col -b)/(max_col - min_col);
+
+		if (r == max_col)
+			h = bc - gc;
+		else if (g == max_col )
+			h = 2 + rc - bc;
+			else if (b == max_col)
+				h = 4  + gc -rc;
+		
+		h = h * 60;
+
+		if ( h < 0.0)
+			h = h + 360;
+	}
+
+	return ((int)h);
+
+
+}
+
+GetHuePaint(r,g,b)
+int r;
+int g;
+int b;
+{
+
+	/*if ((r == 0) && (g == 0) && (b ==0)) {
+		canvas[i][j].contents.liquid_content = 0;
+		   canvas[i][j].contents.drying_rate = 0;
+		   canvas[i][j].contents.miscibility = 0;
+
+		   canvas[i][j].contents.colour.hue = 0;
+		   canvas[i][j].contents.colour.saturation = 1.0;
+		   canvas[i][j].contents.colour.lightness = 0.0;
+		   canvas[i][j].volume = 80;
+		return (0);
+	}
+
+	if ((r == 255) && (g == 255) && ( b == 255)) {
+		canvas[i][j].contents.liquid_content = 0;
+                   canvas[i][j].contents.drying_rate = 0;
+                   canvas[i][j].contents.miscibility = 0;
+
+                   canvas[i][j].contents.colour.hue = 128;
+                   canvas[i][j].contents.colour.saturation = 1.0;
+                   canvas[i][j].contents.colour.lightness = 0.0;
+                   canvas[i][j].volume = 80;
+		return (128);
+	}*/
+}
+
+load_ppm_format(filename, width, height)
+char *filename;
+int *width;
+int *height;
+{
+
+    FILE* ifp;
+    pixel **pixels;
+    int rows, cols, i, j;
+    pixval maxval;
+	int red, green, blue;
+	int hue;
+
+    /*ppm_init( &argc, argv );*/
+
+
+
+   ifp = pm_openr( filename);
+
+    pixels = ppm_readppm( ifp, &cols, &rows, &maxval );
+
+	*(width) = cols;
+	*(height) = rows;
+
+	fprintf(stderr,"Loading file %s, %dx%d. Please wait ", filename, rows, 
+cols);
+
+	if (rows > CANVAS_HEIGHT)
+		rows = CANVAS_HEIGHT;
+
+	if (cols > CANVAS_WIDTH)
+		cols = CANVAS_WIDTH;
+
+	for (i=0; i< rows; i++)  {
+		for (j=0; j< cols; j++) {
+			red = PPM_GETR(pixels[i][j]);
+			green = PPM_GETG(pixels[i][j]);
+			blue = PPM_GETB(pixels[i][j]);
+			
+			/*hue = GetHue(red, green, blue);*/
+
+			/* For gray scale only */
+
+			hue = 255 - red;
+
+
+			/*fprintf(stderr,"hue %d ", hue);*/
+			/*GetHuePaint(red, green, blue, i, j);*/
+
+			canvas[i][j].contents.liquid_content = 80;
+			   canvas[i][j].contents.drying_rate = 80;
+			   canvas[i][j].contents.miscibility = 80;
+
+			   canvas[i][j].contents.colour.hue = hue;
+			   canvas[i][j].contents.colour.saturation = 1.0;
+			   canvas[i][j].contents.colour.lightness = 0.0;
+			   canvas[i][j].volume = (float)hue/2.5;
+
+			if (red == 0) 
+			  if  (green == 0) 
+			   if  ( blue == 0) {
+				canvas[i][j].contents.liquid_content = 0;
+				canvas[i][j].contents.drying_rate = 0;
+                           canvas[i][j].contents.miscibility = 0;
+				canvas[i][j].contents.colour.hue = 0;
+				   canvas[i][j].volume = 0;
+			}
+
+			if (red == 255) 
+			   if (green == 255) 
+			      if ( blue == 255) {
+                                canvas[i][j].contents.liquid_content = 0;
+				canvas[i][j].contents.drying_rate = 0;
+                                canvas[i][j].contents.miscibility = 0;
+                                canvas[i][j].contents.colour.hue = 360;
+				   canvas[i][j].volume = 0;
+                        }
+
+
+		}		
+		if (( i %10) == 0){
+			fprintf(stderr,".");
+			fflush(stderr);
+		}
+	}
+
+	printf(" done\n");
+
+    pm_close( ifp );
+
+    /*exit(0);*/
+
+}
diff --git a/chalk/colorspaces/wetsticky/ws/main.c b/chalk/colorspaces/wetsticky/ws/main.c
new file mode 100644
index 000000000..8185557aa
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/main.c
@@ -0,0 +1,105 @@
+/*
+	FILE:		main.c
+	PURPOSE:	The top-level program for Wet&Sticky
+	AUTHOR:		Kevin Waite and David England
+	VERSION:	1.00  (10-May-91)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 
+
+*/
+
+#include "constants.h"
+#include "types.h"
+#include "canvas.h"
+#include "win_interface.h"
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+double HEIGHT_SCALE;
+
+void main(argc, argv) 
+int argc;
+char *argv[];
+
+/*
+   The Wet&Sticky program can be executed with optional parameters.
+   Those parameters used by the X graphics system are stripped out.
+   If no parameters are given then the program runs as a purely
+   interactive system.  This requires input handling which is not
+   yet implemented.  If the argument is the string '-blob' then the
+   program uses a square blob as the starting image.  Otherwise the
+   program assumes the argument is a filename containing a previously
+   stored canvas.  This is then loaded into the canvas as a starting
+   point.
+*/
+
+{
+   char *filename;
+   extern void exit();
+   int width;
+   int height;
+   extern int optind, opterr;
+   extern char *optarg;
+   int c,i;
+   int blob_flag;
+
+
+   fprintf(stdout, "Wet&Sticky Version %s\n", VERSION);
+   fprintf(stdout, "Implemented by K.Waite and D.England, 1991\n");
+   fprintf(stdout, "Based on ideas by Tunde Cockshott\n\n");
+
+
+   initialise_canvas();
+   if (DEBUG) fprintf (stdout, "Finished initialising the canvas\n");
+
+   CreateWindows (&argc, argv, CANVAS_WIDTH , CANVAS_HEIGHT);
+
+   filename = argv[1];
+
+   blob_flag = 1;
+   HEIGHT_SCALE = 20.0;
+
+  opterr = 0;
+    fprintf(stderr, "HEIGHT %g\n", HEIGHT_SCALE);
+
+  while ((c = getopt(argc, argv, "f:s:")) != EOF)
+                    switch (c) {
+                case 'f':
+                        filename = optarg;
+			load_file(filename, &width, &height);
+			blob_flag = 0;
+                        break;
+                case 's':
+                        fprintf(stderr, "HEIGHT string %s \n",optarg);
+                        HEIGHT_SCALE = atof(optarg);
+                        break;
+		case '?':
+                        break;
+                }
+
+   if (blob_flag)
+	blob (DEFAULT_BLOB_SIZE);
+
+    fprintf(stderr, "HEIGHT %g\n", HEIGHT_SCALE);
+
+   StartVolumeWindow (CANVAS_WIDTH, CANVAS_HEIGHT);
+   StartDrynessWindow (CANVAS_WIDTH, CANVAS_HEIGHT);
+
+   if (DEBUG) fprintf (stdout, "Finished preparing X\n");
+
+   if (DEBUG) fprintf (stdout, "Passing control to window manager\n");
+   StartWindows();
+   exit(0);
+
+}
diff --git a/chalk/colorspaces/wetsticky/ws/makefile b/chalk/colorspaces/wetsticky/ws/makefile
new file mode 100644
index 000000000..a14beb9a3
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/makefile
@@ -0,0 +1,55 @@
+CFLAGS = -O3
+#CFLAGS =  -g #-std
+LINT_FLAGS = -bchxu
+
+SOURCES = load_ppm.c canvas.c engine.c x_interface.c main.c 
+OBJECTS = x_interface.o load_ppm.o engine.o canvas.o
+OBJECTS2= ogl_interface.o load_ppm.o engine.o canvas.o
+
+GFX_LIB=-L/usr/X11R6/lib \
+	-lXaw -lXmu -lXt -lX11 -lm  -lppm -lpgm -lpbm
+
+#PPM_LIBS = ppm/libppm.a  ppm/libpgm.a  ppm/libpbm.a
+
+OGL_LIBS=-L/usr/X11R6/lib \
+	 -laux -lGLU -lGL -lXext -lX11 -limp -lm -lppm -lpgm -lpbm
+
+OGL_INCS=-I/usr2/share/src/OpenGL/libaux
+
+CC=cc
+
+wet+sticky:  constants.h canvas.h engine.h $(OBJECTS) main.c
+	${CC} -o wet+sticky  $(CFLAGS) main.c $(OBJECTS) $(GFX_LIB)
+
+wet+sticky2: constants.h canvas.h engine.h $(OBJECTS2) main.c
+	${CC} -o wet+sticky2  $(CFLAGS) main.c $(OBJECTS2) $(OGL_LIBS) 
+
+cmap: cmap.o
+	${CC} -g -o cmap  cmap.o $(GFX_LIB)
+
+anim:  constants.h canvas.h engine.h anim.c
+	${CC} -o anim $(CFLAGS) anim.c $(GFX_LIB)
+
+engine.o:  types.h constants.h canvas.h engine.h
+	${CC} -c  $(CFLAGS)  engine3.c
+
+canvas.o:  types.h constants.h canvas.h
+	${CC} -c  $(CFLAGS)  canvas.c
+
+x_interface.o: constants.h types.h canvas.h engine.h x_interface.c
+	${CC} -c $(CFLAGS)  x_interface.c
+
+ogl_interface.o:  constants.h types.h canvas.h engine.h ogl_interface.c
+	${CC} -c $(CFLAGS) ${OGL_INCS} ogl_interface.c
+
+load_ppm.o: constants.h types.h canvas.h engine.h load_ppm.c
+	${CC} -c $(CFLAGS) load_ppm.c
+
+cmap.o: cmap.c
+	${CC} -c -g cmap.c
+
+clean:
+	/bin/rm -f core
+	/bin/rm -f *.o
+
+lint:	alint $(LINT_FLAGS) $(SOURCES)
diff --git a/chalk/colorspaces/wetsticky/ws/mona.pgm b/chalk/colorspaces/wetsticky/ws/mona.pgm
new file mode 100644
index 000000000..2060ee909
Binary files /dev/null and b/chalk/colorspaces/wetsticky/ws/mona.pgm differ
diff --git a/chalk/colorspaces/wetsticky/ws/ogl_interface.c b/chalk/colorspaces/wetsticky/ws/ogl_interface.c
new file mode 100644
index 000000000..953b10c8a
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/ogl_interface.c
@@ -0,0 +1,302 @@
+/*
+        FILE:           xgl_interface.c
+        PURPOSE:        Creation and access to a OpenGL window
+			to wet+sticky using OpenGL
+        AUTHOR:         David England
+        VERSION:        1.00  (21-June-96)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 
+
+*/
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+/*#include <imp.h>*/
+/*#include "aux.h"*/
+
+#include <stdio.h>
+
+#include "constants.h"
+#include "types.h"
+#include "engine.h"
+#include "canvas.h"
+
+static int count=0;
+
+
+void nullProc()
+{
+}
+
+void SetupCmap()
+{
+}
+
+float Value(n1, n2, hue)
+float n1, n2, hue;
+{
+	if (hue > 360 )
+		hue = hue -360;
+	else if (hue < 0 )
+		hue = hue +360;
+	if (hue < 60  )
+		return n1+(n2-n1)*hue/60;
+	else if (hue < 180 )
+		return n2;
+	else if (hue < 240 )
+		return n1+(n2-n1)*(240-hue)/60;
+	else return n1;
+}
+
+
+RGB_COLOUR hls_to_rgb(h, l, s)
+int h;
+float l;
+float s;
+{
+RGB_COLOUR rgb_colour;
+float m1, m2;
+
+if (l <= 0.5 )
+	m2 = l*(1+s);
+else 
+	m2 = l+s -  l*s;
+m1 = 2*l-m2;
+
+rgb_colour.r = Value(m1, m2, h+120);
+rgb_colour.g = Value(m1,m2, h);
+rgb_colour.b = Value(m1,m2, h-120);
+
+return (rgb_colour);
+}
+
+void
+DrawPoint(x,y,hls_col)
+int x;
+int y;
+HLS_COLOUR hls_col;
+/* Draw a point on the window and the back-up Pixmap */
+{
+RGB_COLOUR rgb_colour;
+
+	rgb_colour = hls_to_rgb(hls_col.hue,
+				hls_col.lightness,
+				hls_col.saturation);
+
+
+	printf("h %.2f l %.2f s %.2f\n", hls_col.hue, hls_col.lightness,
+				hls_col.saturation);
+
+	printf( "r %.2f g %.2f b %.2f\n", rgb_colour.r, rgb_colour.g,
+                                rgb_colour.b);
+
+	glColor3f(rgb_colour.r, rgb_colour.g, rgb_colour.b);
+
+	glBegin(GL_POINTS);
+		glVertex2s(x,y);
+		glVertex2s(x+1,y+1);
+	glEnd();
+
+}
+
+void
+DrawVolumePoint(x,y,attr)
+int x;
+int y;
+int attr;
+{
+/*set colour, draw point at offset */	
+}
+
+void
+DrawDrynessPoint(x,y,attr)
+int x;
+int y;
+int attr;
+/* Draw a point on the window and the back-up Pixmap */
+{
+
+}
+
+void
+ClearWindow()
+{
+
+}
+
+static void
+CleanWindow()
+/* Fill a window with a solid, white rectangle */
+{
+}
+
+
+void CreateWindows(argc, argv, width, height)
+int *argc;
+char **argv;
+int width;
+int height;
+
+{
+
+	auxInitDisplayMode( AUX_RGBA);
+
+	auxInitPosition(50,50, width*3, height);
+
+	auxInitWindow(argv[0]);
+
+	glClearColor(1.0, 1.0, 1.0, 0.0);
+
+	glClear(GL_COLOR_BUFFER_BIT);
+
+}
+
+
+static void
+draw_labels()
+{
+}
+
+void paint_cell(cell, x, y)
+CELL_PTR cell;
+int x, y;
+
+{
+    DrawPoint(x,y, cell->contents.colour);
+
+    /*  volColour is an index into the colour table in the range [0,255].
+        It is used to give a false colour image of the canvas's volume.  */
+
+    /*DrawVolumePoint(x,y,volColour);*/
+
+
+    /*DrawDrynessPoint(x,y,dryness);*/
+}
+
+
+
+
+void draw_full_canvas()
+{
+   int x, y;
+   CELL_PTR cell;
+   POINT p;
+ 
+          glClear(GL_COLOR_BUFFER_BIT);
+
+  if (DEBUG) {
+     printf ("Starting to paint full canvas...");
+     fflush(stdout);
+   }
+
+   for (y=0; y < CANVAS_HEIGHT; y++) 
+     for (x=0; x < CANVAS_WIDTH; x++) {
+        p.x = x;
+        p.y = y;
+        cell = get_cell(p);
+        paint_cell(cell, x, y);
+     }
+
+   glFlush();
+	sleep(10);
+  
+  if (DEBUG) printf ("done.\n");
+}
+
+void
+bump_map()
+{
+	POINT p;
+	CELL_PTR cell;
+	register int x, y;
+	register int colour;
+
+
+   for (y=0; y < CANVAS_HEIGHT; y++) {
+     for (x=0; x < CANVAS_WIDTH; x++) {
+        p.x = x;
+        p.y = y;
+        cell = get_cell(p);
+	colour = (int) new_intensity_value(p);
+
+/*	colour = (int) (cell->contents.colour.hue *
+                        ((float) MAX_COLOUR_INDEX / 360.0));*/
+	DrawDrynessPoint(x,y,colour);
+     }
+  }
+
+}
+
+
+void evolve_paint()
+{
+   int k;
+   POINT p;
+   CELL_PTR cell;
+   int  new_x, new_y;
+   extern int count;
+
+	/*count++;
+	if (count > 500) {
+		fprintf(stderr,".");
+		fflush(stderr);
+		bump_map();
+	}*/
+
+   for (k=0; k < STEP_LIMIT; k++) single_step();
+   while (TRUE) {
+      next_cell_for_tqrepaint(&cell, &p);
+      if (cell == NIL) return;
+      paint_cell(cell, p.x, p.y);     
+	   glFlush();
+   } 
+      
+
+}
+
+void StartVolumeWindow()
+{
+}
+
+void StartDrynessWindow()
+{
+}
+
+void StartWindows()
+{
+
+
+        draw_full_canvas();
+	compute_shade_vectors(); /* Set vectors for shading */
+	draw_labels();
+
+	/*auxIdleFunc(evolve_paint);
+	
+	auxMainLoop(draw_full_canvas);*/
+
+
+}
+
+void
+stroke()
+{
+	
+}
+
+
+void
+stroke_motion()
+{
+
+}
+
diff --git a/chalk/colorspaces/wetsticky/ws/test2.jpg b/chalk/colorspaces/wetsticky/ws/test2.jpg
new file mode 100644
index 000000000..4254264f2
Binary files /dev/null and b/chalk/colorspaces/wetsticky/ws/test2.jpg differ
diff --git a/chalk/colorspaces/wetsticky/ws/test3.jpg b/chalk/colorspaces/wetsticky/ws/test3.jpg
new file mode 100644
index 000000000..2b25a0d55
Binary files /dev/null and b/chalk/colorspaces/wetsticky/ws/test3.jpg differ
diff --git a/chalk/colorspaces/wetsticky/ws/types.h b/chalk/colorspaces/wetsticky/ws/types.h
new file mode 100644
index 000000000..af671f536
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/types.h
@@ -0,0 +1,72 @@
+/*
+    FILE:        types.h
+    PURPOSE:    Defines all the main types used in Wet&Sticky.
+    AUTHORS:    Kevin Waite and David England
+    VERSION:    1.00  (10-May-91)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA 
+
+
+*/
+
+
+/*  A colour is specified as a vector in HLS space.  Hue is a value
+    in the range 0..360 degrees with 0 degrees being red.  Saturation
+    and Lightness are both in the range [0,1].  A lightness of 0 means
+    black, with 1 being white.  A totally saturated colour has saturation
+    of 1.
+*/
+
+typedef struct hls_colour { short int hue; float saturation, lightness; }
+HLS_COLOUR;
+
+typedef struct rgb_colour {float r; float g; float b;}
+RGB_COLOUR;
+
+
+/* The address of a cell on the canvas. */
+
+typedef struct point { int x, y; } POINT, *POINT_PTR;  
+
+
+/*  A direction can be NORTH, EAST, SOUTH or WEST. */
+
+typedef short int DIRECTION;  
+
+typedef short int BOOLEAN;  /*  FALSE or TRUE  */
+
+
+typedef struct paint {
+   HLS_COLOUR colour;
+   int        liquid_content;  /*  [0,100].  */
+   int        drying_rate;     /*  [0,100].  */
+   int        miscibility;     /*  [0,inf].  */
+} PAINT, *PAINT_PTR;
+
+
+/*  Defines the strength and direction of gravity for a cell.  */
+
+typedef struct gravity {
+   DIRECTION  direction;    
+   int        strength;     /*  [0,Infinity). */
+} GRAVITY, *GRAVITY_PTR;
+
+
+/*  Defines the contents and attributes of a cell on the canvas. */
+
+typedef struct cell {
+   PAINT       contents;    /* The paint in this cell. */
+   GRAVITY     gravity;     /* This cell's gravity.  */
+   short int   absorbancy;  /* How much paint can this cell hold? */
+   short int   volume;      /* The volume of paint. */
+} CELL, *CELL_PTR;
diff --git a/chalk/colorspaces/wetsticky/ws/win_interface.h b/chalk/colorspaces/wetsticky/ws/win_interface.h
new file mode 100644
index 000000000..ee7a064b2
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/win_interface.h
@@ -0,0 +1,28 @@
+/*
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA 
+
+
+*/
+
+extern void DrawPoint(/* int x, int y; int colour*/);
+extern int DrawVolumePoint(/* int x, int y; int attr*/);
+extern int DrawDrynessPoint(/* int x, int y; int attr*/);
+extern void ClearWindow();
+extern void CreateWindows(/* int *argc, char *argv[], int width, int height*/);
+extern void StartWindows(); /* enter infinite loop */
+extern void StartVolumeWindow(/*int width, int height*/); 
+                    /* display attribute window */
+extern void StartDrynessWindow(/*int width, int height*/); 
+                    /* display attribute window */
+
+
diff --git a/chalk/colorspaces/wetsticky/ws/x_interface.c b/chalk/colorspaces/wetsticky/ws/x_interface.c
new file mode 100644
index 000000000..a8b54b3ea
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/ws/x_interface.c
@@ -0,0 +1,795 @@
+/*
+        FILE:           x_interface.c
+        PURPOSE:        Creation and access to an X windows interface
+			to wet+sticky using Athena Widgets
+        AUTHOR:         David England
+        VERSION:        1.00  (13-May-91)
+
+Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 
+Contact David England d.england@livjm.ac.uk
+School of Computing and Maths Sciences,
+Liverpool John Moores University 
+Liverpool L3 3AF
+United Kingdom
+Phone +44 151 231 2271
+
+
+Wet and Sticky is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version. Wet and Sticky is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details. You
+should have received a copy of the GNU General Public License along
+with Wet and Sticky; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+*/
+
+#include <X11/Xos.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Intrinsic.h>
+
+#include <X11/cursorfont.h>
+#include <X11/StringDefs.h>
+
+#include <X11/Shell.h>
+#include <X11/Xaw/Box.h>
+#include <X11/Xaw/Label.h>
+#include <stdio.h>
+
+#include "constants.h"
+#include "types.h"
+#include "engine.h"
+#include "canvas.h"
+
+/* Window Heirarchy - 
+	Three shell widgets, one for colour output, two for attributes output
+	plus a back_up pixmap for redrawing
+*/
+
+static Widget top_level;
+static Widget 	    colour_shell;
+static Widget            colour_box;
+static Widget		        colour_canvas;
+static Pixmap		        colour_pm;
+
+static Widget      volume_shell;
+static Widget            volume_box;
+static Widget                  volume_canvas;
+static Pixmap		        volume_pm;
+
+static Widget      dryness_shell;
+static Widget            dryness_box;
+static Widget                  dryness_canvas;
+static Pixmap		        dryness_pm;
+
+static GC gc;
+static GC tmp_gc;
+static long tqmask;
+static XGCValues values;
+
+static Colormap cmap;
+static XColor colours[256];
+void stroke();
+void stroke_motion();
+
+Display *display;
+int screen;
+Screen          *screen_ptr;
+Window root;
+
+static int count=0;
+static int frame_count=0;
+char pix_file[64];
+
+static void
+expose_event(w, event)
+Widget          w;
+XEvent          *event;
+{
+/* Re-display the colour window if an exposure event is received */
+int width, height;
+
+	width = height = 300;
+
+        XCopyArea(XtDisplay(colour_canvas), colour_pm, 
+		XtWindow(colour_canvas), gc, 0, 0, width, height, 0,0);
+
+}
+
+
+static void
+expose_volume(w, event)
+Widget          w;
+XEvent          *event;
+{
+/* Re-display the volume window if an exposure event is received */
+int width, height;
+
+	width = 300;
+	height = 300;
+
+      XCopyArea(XtDisplay(volume_canvas), volume_pm,
+	      XtWindow(volume_canvas), gc, 0, 0, width, height, 0,0);
+      
+
+}
+
+static void
+expose_dryness(w, event)
+Widget          w;
+XEvent          *event;
+{
+/* Re-display the dryness window if an exposure event is received */
+int width, height;
+
+        width = height = 300;
+
+      XCopyArea(XtDisplay(dryness_canvas), dryness_pm,
+              XtWindow(dryness_canvas), gc, 0, 0, width, height, 0,0);
+
+
+}
+
+void expose_canvases()
+{
+int width, height;
+
+width = height = 300;
+
+	XCopyArea(XtDisplay(colour_canvas), colour_pm,
+                XtWindow(colour_canvas), gc, 0, 0, width, height, 0,0);
+
+      XCopyArea(XtDisplay(dryness_canvas), dryness_pm,
+              XtWindow(dryness_canvas), gc, 0, 0, width, height, 0,0);
+
+	XCopyArea(XtDisplay(dryness_canvas), dryness_pm,
+                      XtWindow(dryness_canvas), gc, 0, 0, 300, 300, 0,0);
+
+}
+
+int 
+GetHueValue(red, green, blue)
+int red;
+int green;
+int blue;
+{
+	XColor colour;
+
+	colour.red = red * 257;
+	colour.green = green * 257;
+	colour.blue = blue * 257;
+	colour.flags = DoRed | DoGreen | DoBlue;
+
+	if (XAllocColor(display, cmap, &colour) == 0)
+		fprintf(stderr,"colour allocation failed\n");
+
+	return (colour.pixel);	
+}
+
+
+void
+DrawPoint(x,y,colour)
+int x;
+int y;
+int colour;
+/* Draw a point on the window and the back-up Pixmap */
+{
+	/* PROBS ? */
+
+	XSetForeground(XtDisplay(top_level), gc, colours[colour].pixel);
+
+	XDrawPoint(XtDisplay(top_level), XtWindow(colour_canvas), gc, x, y);
+	XDrawPoint(XtDisplay(top_level), colour_pm, gc, x, y);
+}
+
+void
+DrawBackgroundPoint(x,y,colour)
+int x;
+int y;
+int colour;
+/* Draw a point on the window and the back-up Pixmap */
+{
+        /* PROBS ? */
+
+        XSetForeground(XtDisplay(top_level), gc, colours[colour].pixel);
+
+        XDrawPoint(XtDisplay(top_level), colour_pm, gc, x, y);
+}
+
+
+int
+DrawVolumePoint(x,y,attr)
+int x;
+int y;
+int attr;
+/* Draw a point on the window and the back-up Pixmap */
+{
+	if (XtWindow(volume_canvas) == NULL)
+		return (-1);
+
+	XSetForeground(XtDisplay(top_level), gc, colours[attr].pixel);
+
+	XDrawPoint(XtDisplay(top_level), XtWindow(volume_canvas), gc, x, y);
+	XDrawPoint(XtDisplay(top_level), volume_pm, gc, x, y);
+
+	return(0);
+}
+
+int
+DrawBackgroundVolumePoint(x,y,attr)
+int x;
+int y;
+int attr;
+/* Draw a point on the window and the back-up Pixmap */
+{
+        if (XtWindow(volume_canvas) == NULL)
+                return (-1);
+
+        XSetForeground(XtDisplay(top_level), gc, colours[attr].pixel);
+
+        XDrawPoint(XtDisplay(top_level), volume_pm, gc, x, y);
+
+        return(0);
+}
+
+
+int
+DrawDrynessPoint(x,y,attr)
+int x;
+int y;
+int attr;
+/* Draw a point on the window and the back-up Pixmap */
+{
+        /* later - use the range of the dryness to affect the colour
+                value
+        */
+
+        if (XtWindow(dryness_canvas) == NULL)
+                return (-1);
+
+        XSetForeground(XtDisplay(top_level), gc, colours[attr].pixel);
+
+/*        XDrawPoint(XtDisplay(top_level), XtWindow(dryness_canvas), gc, x, y);
+*/
+        XDrawPoint(XtDisplay(top_level), dryness_pm, gc, x, y);
+
+        return(0);
+}
+
+void
+ClearWindow()
+{
+	XClearWindow(XtDisplay(top_level), XtWindow(colour_canvas));
+}
+
+static void
+CleanWindow(win)
+Drawable win;
+/* Fill a window with a solid, white rectangle */
+{
+XGCValues values;
+long tqmask;
+
+	values.background = colours[0].pixel;
+        values.foreground = colours[255].pixel;;
+        values.fill_style = FillSolid;
+        values.function   = GXclear;
+
+
+         tqmask = GCBackground| GCForeground| GCFillStyle | GCFunction;
+
+         tmp_gc = XtGetGC(top_level,  tqmask, &values);
+
+        XFillRectangle(XtDisplay(top_level), win, tmp_gc, 0,  0, 300, 300);
+
+}
+
+void SetupCmap()
+{
+int i;
+
+        for (i=0;i<256;i++) {
+                colours[i].red = i*257;
+                colours[i].flags = DoRed | DoBlue | DoGreen;
+	}
+
+     /*   for (i=0;i<=127;i++)
+                colours[i].green = i*2*257;
+
+        for (i=128;i>0;i--)
+                colours[255-i].green = (i-1)*2*257;*/
+
+       for (i=0;i<64;i++)
+                colours[i].green = i*4*257;
+
+        for (i=64;i<128;i++)
+                colours[i].green = 65536-i*4*257;
+ 
+         for (i=128;i<192;i++)
+                colours[i].green = (i-128)*2*257;
+ 
+         for (i=192;i<255;i++)
+                colours[i].green = 65536-(i-128)*2*257;
+
+
+        for (i=0;i<256;i++)
+                colours[i].blue = 65536 - i*257;
+
+	colours[0].red = 65535;
+	colours[0].green = 65535;
+	colours[0].blue = 65535;
+}
+
+void
+SetupGreyMap()
+{
+int i;
+
+	 for (i=0;i<256;i++) {
+                colours[i].red = i*257;
+                colours[255 - i].flags = DoRed | DoBlue | DoGreen;
+	}
+
+
+         for (i=0;i<256;i++)
+                colours[i].green =  i*257;
+
+         for (i=0;i<256;i++)
+                colours[i].blue =  i*257;
+
+	colours[255].red = 255*257;
+	colours[255].green = 255*257;
+	colours[255].blue = 255*257;
+
+}
+
+
+void CreateWindows(argc, argv, width, height)
+int *argc;
+char **argv;
+int width;
+int height;
+/* Create colour window heirarchy and add event handlers */
+{
+	
+    static Arg args[]={
+        {XtNwidth, (XtArgVal) 0},
+        {XtNheight, (XtArgVal)0} };	
+
+	int i;
+
+	args[0].value = (XtArgVal)width;
+
+	args[1].value = (XtArgVal)height;
+
+	top_level =  XtInitialize("wet+sticky", "Wet+Sticky", NULL,
+                                                 0, argc, argv);
+
+
+	display = XtDisplay(top_level);
+        screen = DefaultScreen(display);
+	screen_ptr = ScreenOfDisplay(display, DefaultScreen(display));
+
+	root = RootWindow(display, screen);
+
+	colour_shell = XtCreateApplicationShell("colour_frame", 
+			topLevelShellWidgetClass, NULL, 0);
+
+
+
+        colour_box = XtCreateManagedWidget("colour_box", boxWidgetClass,
+                                                colour_shell, NULL, 0);
+
+
+        colour_canvas = XtCreateManagedWidget("", labelWidgetClass,
+                                        colour_box, args, XtNumber(args));
+
+
+	XtAddEventHandler(colour_canvas, ExposureMask, False, expose_event, 0);
+
+	XtAddEventHandler(colour_canvas, ButtonPressMask, False, stroke, 0);
+
+	XtAddEventHandler(colour_canvas, Button1MotionMask, 
+		False, stroke_motion, 0);
+
+	XtRealizeWidget(colour_shell);
+
+	cmap = XCreateColormap( display, XtWindow(colour_shell),
+                        XDefaultVisualOfScreen(screen_ptr), AllocAll);
+
+        for (i=0; i <= 255; i++)
+                colours[i].pixel = i;
+
+        XQueryColors(display, DefaultColormapOfScreen(screen_ptr),colours, 256);
+
+        SetupCmap();
+
+	/*SetupGreyMap();*/
+
+        XStoreColors(display, cmap, colours, 256);
+
+        i=0;
+        while( XAllocColorCells( display, DefaultColormapOfScreen(screen_ptr),
+                 True, NULL, 0, &colours[i].pixel, 1 ) ) {
+                        colours[i].pixel = i;
+                        i++;
+          }
+
+	XSetWindowColormap(display, XtWindow(colour_shell), cmap);
+
+        XInstallColormap(display, cmap);
+
+	tqmask = GCBackground| GCForeground|  GCFunction; 
+
+	values.function = GXcopy;
+	values.background = colours[0].pixel;
+	values.foreground = colours[255].pixel;
+
+
+	gc = XtGetGC(colour_canvas, tqmask, &values);
+
+	colour_pm = XCreatePixmap(XtDisplay(top_level), 
+			XtWindow(colour_shell), width, height,
+                            XDefaultDepth(XtDisplay(top_level), 0));
+
+	CleanWindow(colour_pm);
+
+}
+
+
+void StartVolumeWindow(width, height)
+int width;
+int height;
+/* Create Volume heirarchy and add event handlers */
+{
+	static Arg args[]={
+	{XtNwidth, (XtArgVal) 0},
+	{XtNheight, (XtArgVal)0} };
+
+	args[0].value = (XtArgVal)width;
+
+	args[1].value = (XtArgVal)height;
+
+	volume_shell = XtCreateApplicationShell("volume_frame",
+			topLevelShellWidgetClass, NULL, 0);
+
+	volume_box = XtCreateManagedWidget("volume_box", boxWidgetClass,
+				volume_shell, NULL, 0);
+											
+	volume_canvas = XtCreateManagedWidget("", labelWidgetClass,
+				volume_box, args, XtNumber(args));
+
+	XtAddEventHandler(volume_canvas, ExposureMask, False, 
+				expose_volume, 0);
+
+	XtRealizeWidget(volume_shell);
+
+	XSetWindowColormap(display, XtWindow(volume_shell), cmap);
+
+	volume_pm = XCreatePixmap(XtDisplay(top_level), 
+			XtWindow(colour_shell), width, height,
+                            XDefaultDepth(XtDisplay(top_level), 0));
+
+	CleanWindow(volume_pm);
+
+
+}
+
+void StartDrynessWindow(width, height)
+int width;
+int height;
+/* Create dryness heirarchy and add event handlers */
+{
+	static Arg args[]={
+	{XtNwidth, (XtArgVal) 0},
+	{XtNheight, (XtArgVal)0} };
+
+	char name[32];
+
+	args[0].value = (XtArgVal)width;
+
+	args[1].value = (XtArgVal)height;
+
+	dryness_shell = XtCreateApplicationShell("dryness_frame",
+			topLevelShellWidgetClass, NULL, 0);
+
+	dryness_box = XtCreateManagedWidget("dryness_box", boxWidgetClass,
+				dryness_shell, NULL, 0);
+	dryness_canvas = XtCreateManagedWidget("Name", labelWidgetClass,
+				dryness_box, args, XtNumber(args));
+
+	fprintf(stderr,"Bumps %d\n",(int)dryness_canvas);
+
+	XtAddEventHandler(dryness_canvas, ExposureMask, False, 
+				expose_dryness, 0);
+
+	XtRealizeWidget(dryness_shell);
+
+	XSetWindowColormap(display, XtWindow(dryness_shell), cmap);
+
+	dryness_pm = XCreatePixmap(XtDisplay(top_level), 
+			XtWindow(colour_shell), width, height,
+                            XDefaultDepth(XtDisplay(top_level), 0));
+
+	XStoreName(display, XtWindow(dryness_shell), "bumps");
+
+	CleanWindow(dryness_pm);
+
+}
+
+static void
+draw_labels()
+{
+	XSetForeground(XtDisplay(colour_shell), gc, colours[1].pixel);
+
+	XDrawString(XtDisplay(colour_shell), XtWindow(colour_canvas), gc, 10, 10, 
+			"Colour", strlen("Colour"));
+	XDrawString(XtDisplay(colour_shell), colour_pm, gc, 10, 10, 
+			"Colour", strlen("Colour")); 
+
+	XSetForeground(XtDisplay(colour_shell), gc, colours[128].pixel);
+
+	XDrawString(XtDisplay(colour_shell), XtWindow(volume_canvas), gc, 10, 10, 
+			"Volume", strlen("Volume")); 
+	XDrawString(XtDisplay(colour_shell), volume_pm, gc, 10, 10, 
+			"Volume", strlen("Volume"));
+
+        XSetForeground(XtDisplay(colour_shell), gc, colours[255].pixel);
+
+	XDrawString(XtDisplay(colour_shell), XtWindow(dryness_canvas), gc, 10, 10, 
+			"Bump Map", strlen("Bump Map"));
+	XDrawString(XtDisplay(colour_shell), dryness_pm, gc, 10, 10, 
+			"Bump Map", strlen("Bump Map"));
+}
+
+void paint_cell(cell, x, y)
+CELL_PTR cell;
+int x, y;
+
+{
+    int colour, volColour, dryness;
+    POINT p;
+
+    p.x = x;
+    p.y = y;
+
+    /*  The current display simply maps hue onto the indices of the colour
+        table.  This involves some scaling since hues are in the range [0,360)
+        with the colour table being [0,256).  */
+
+    colour = (int) (cell->contents.colour.hue * 
+			((float) MAX_COLOUR_INDEX / 360.0));
+
+    DrawBackgroundPoint(x,y,colour);   
+
+    /*  volColour is an index into the colour table in the range [0,255].
+        It is used to give a false colour image of the canvas's volume.  */
+
+    /*if (x < SCALE_WIDTH) return;    Don't draw over colour scale.  */
+
+    volColour = MIN(cell->volume * 2, 255);
+    volColour = MAX(volColour, 0);        
+				/* Make unfilled cells have a zero vol.  */
+
+    DrawBackgroundVolumePoint(x,y,volColour);
+
+    /*  Dryness will be in the range [0,255].  */
+    dryness = (cell->contents.liquid_content * 255) / 100;
+
+    /*DrawDrynessPoint(x,y,dryness);*/
+}
+
+
+
+void draw_false_colour_scale()
+/*  This routine places a scale along the top of the volume window
+    showing the colours being used.   Low is at the left edge. 
+    The colour palette has indices 0..255.    */
+{
+    int x, y;
+
+    /*for (x=0; x < 255; x++) 
+       for (y=0; y < SCALE_WIDTH; y++) DrawVolumePoint(x,y,MIN(x, 255));*/
+}
+
+
+void draw_full_canvas()
+{
+   int x, y;
+   CELL_PTR cell;
+   POINT p;
+ 
+  if (DEBUG) {
+     printf ("Starting to paint full canvas...");
+     fflush(stdout);
+   }
+
+   for (y=0; y < CANVAS_HEIGHT; y++) 
+     for (x=0; x < CANVAS_WIDTH; x++) {
+        p.x = x;
+        p.y = y;
+        cell = get_cell(p);
+        paint_cell(cell, x, y);
+     }
+
+  expose_canvases();
+  
+  draw_false_colour_scale();
+  if (DEBUG) printf ("done.\n");
+}
+
+void
+bump_map()
+{
+	POINT p;
+	CELL_PTR cell;
+	register int x, y;
+	register int colour;
+
+
+   for (y=0; y < CANVAS_HEIGHT; y++) {
+     for (x=0; x < CANVAS_WIDTH; x++) {
+        p.x = x;
+        p.y = y;
+        cell = get_cell(p);
+	colour = (int) new_intensity_value(p);
+
+/*	colour = (int) (cell->contents.colour.hue *
+                        ((float) MAX_COLOUR_INDEX / 360.0));*/
+	DrawDrynessPoint(x,y,colour);
+     }
+  }
+
+}
+
+draw_cmap_line()
+
+{
+
+int i;
+
+	for (i=0; i< 255; i++) {
+	  DrawDrynessPoint(0,i,i);
+	}
+}
+
+void evolve_paint()
+{
+   int k;
+   POINT p;
+   CELL_PTR cell;
+   int  new_x, new_y;
+   Window tempChild;
+   extern Window root;
+   extern int count;
+   extern int frame_count;
+
+	count++;
+	if (count > 5000) {
+		fprintf(stderr,".");
+		fflush(stderr);
+		bump_map();
+		expose_canvases();
+
+		/*XTranslateCoordinates(display,XtWindow(dryness_canvas), root,
+			0,0, &new_x, &new_y, &tempChild);*/
+	/*if (frame_count < 10) 
+	sprintf(pix_file,"xwd -name bumps -out pixmap0%d.xwd &" ,frame_count);
+	else
+	sprintf(pix_file,"xwd -name bumps -out pixmap%d.xwd &" ,frame_count);
+	*/
+	
+
+		/*system(pix_file);*/
+	/*XWriteBitmapFile(display, pix_file,dryness_pm, 300, 300,-1,-1 );*/
+		count = 0;
+		frame_count++;	
+		/*if (frame_count > 250) {
+			fprintf(stderr,"Done\n");
+			sleep(2); 
+			exit(0);
+		} */
+		/*exit(0)*/;
+	} 
+
+
+
+   for (k=0; k < STEP_LIMIT; k++) single_step();
+   while (TRUE) {
+      next_cell_for_tqrepaint(&cell, &p);
+      if (cell == NIL) return;
+      paint_cell(cell, p.x, p.y);     
+   } 
+      
+}
+
+
+
+void StartWindows()
+{
+/* Start the X windows event loop and paint processing */
+XEvent event;
+
+
+        draw_full_canvas();
+	compute_shade_vectors(); /* Set vectors for shading */
+	draw_labels();
+
+	for (;;) {
+	   if (XtPending()) {
+		XtNextEvent(&event);
+		XtDispatchEvent(&event);
+	   }
+	   else {
+		/* Evolve paint and re-display*/
+		evolve_paint();
+	        }
+		
+	   } /* End for loop */
+
+
+}
+
+void
+stroke(w, client_data, event)
+Widget w;
+caddr_t client_data;
+XEvent *event;
+{
+/*	brush_stroke(event->xbutton.x, event->xbutton.y);*/
+
+
+	/*if ((XEvent *)event != (XEvent *)NULL)
+	else
+		printf("Null event\n"); */
+
+/*	DrawPoint(event->xbutton.x, event->xbutton.y, 128);
+        DrawVolumePoint(event->xbutton.x, event->xbutton.y, 128);
+        DrawDrynessPoint(event->xbutton.x, event->xbutton.y, 128);*/
+
+	
+        XSetForeground(XtDisplay(top_level), gc, colours[128].pixel);
+
+        XFillRectangle(XtDisplay(top_level), XtWindow(colour_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);
+
+        XFillRectangle(XtDisplay(top_level), XtWindow(volume_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);
+
+        XFillRectangle(XtDisplay(top_level), XtWindow(dryness_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);
+
+	brush_stroke(event->xbutton.x, event->xbutton.y);
+}
+
+
+void
+stroke_motion(w, client_data, event)
+Widget w;
+caddr_t client_data;
+XEvent *event;
+{
+
+
+        /*if ((XEvent *)event != (XEvent *)NULL)
+        else
+                printf("Null event\n"); */
+
+
+        XSetForeground(XtDisplay(top_level), gc, colours[128].pixel);
+
+        XFillRectangle(XtDisplay(top_level), XtWindow(colour_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);
+        XFillRectangle(XtDisplay(top_level), XtWindow(volume_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);
+
+        XFillRectangle(XtDisplay(top_level), XtWindow(dryness_canvas), gc,
+			 event->xmotion.x, event->xmotion.y ,1, 1);
+
+      brush_stroke(event->xbutton.x, event->xbutton.y);
+}
+
diff --git a/chalk/colorspaces/wetsticky/wstool.ui b/chalk/colorspaces/wetsticky/wstool.ui
new file mode 100644
index 000000000..2f95d18b2
--- /dev/null
+++ b/chalk/colorspaces/wetsticky/wstool.ui
@@ -0,0 +1,262 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>WdgWSPaintOp</class>
+<widget class="TQWidget">
+    <property name="name">
+        <cstring>WdgWSPaintOp</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>582</width>
+            <height>359</height>
+        </rect>
+    </property>
+    <grid>
+        <property name="name">
+            <cstring>unnamed</cstring>
+        </property>
+        <widget class="TQGroupBox" row="0" column="0">
+            <property name="name">
+                <cstring>grpGravity</cstring>
+            </property>
+            <property name="title">
+                <string>&amp;Gravity</string>
+            </property>
+            <grid>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2">
+                    <property name="name">
+                        <cstring>chkGravity</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Paint &amp;gravity</string>
+                    </property>
+                </widget>
+                <widget class="TQLabel" row="1" column="0">
+                    <property name="name">
+                        <cstring>lblDirection</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Direction:</string>
+                    </property>
+                    <property name="buddy" stdset="0">
+                        <cstring>intDryingRate</cstring>
+                    </property>
+                </widget>
+                <widget class="TQComboBox" row="1" column="1">
+                    <item>
+                        <property name="text">
+                            <string>Up</string>
+                        </property>
+                    </item>
+                    <item>
+                        <property name="text">
+                            <string>Right</string>
+                        </property>
+                    </item>
+                    <item>
+                        <property name="text">
+                            <string>Down</string>
+                        </property>
+                    </item>
+                    <item>
+                        <property name="text">
+                            <string>Left</string>
+                        </property>
+                    </item>
+                    <property name="name">
+                        <cstring>cmbGravitationalDirection</cstring>
+                    </property>
+                </widget>
+                <widget class="TQLabel" row="2" column="0">
+                    <property name="name">
+                        <cstring>lblStrength</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Strength:</string>
+                    </property>
+                    <property name="buddy" stdset="0">
+                        <cstring>intGravitationalStrength</cstring>
+                    </property>
+                </widget>
+                <widget class="KIntNumInput" row="2" column="1">
+                    <property name="name">
+                        <cstring>intGravitationalStrength</cstring>
+                    </property>
+                    <property name="minValue">
+                        <number>0</number>
+                    </property>
+                </widget>
+            </grid>
+        </widget>
+        <widget class="TQGroupBox" row="1" column="0" rowspan="1" colspan="2">
+            <property name="name">
+                <cstring>grpPaint</cstring>
+            </property>
+            <property name="title">
+                <string>&amp;Paint</string>
+            </property>
+            <grid>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <widget class="TQLabel" row="0" column="0">
+                    <property name="name">
+                        <cstring>lblDryingRate</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Drying rate:</string>
+                    </property>
+                    <property name="buddy" stdset="0">
+                        <cstring>intDryingRate</cstring>
+                    </property>
+                </widget>
+                <widget class="TQCheckBox" row="1" column="0" rowspan="2" colspan="4">
+                    <property name="name">
+                        <cstring>chkLiquid</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Liquid content:</string>
+                    </property>
+                    <property name="checked">
+                        <bool>true</bool>
+                    </property>
+                </widget>
+                <widget class="KIntNumInput" row="0" column="1" rowspan="1" colspan="3">
+                    <property name="name">
+                        <cstring>intDryingRate</cstring>
+                    </property>
+                    <property name="minValue">
+                        <number>0</number>
+                    </property>
+                    <property name="maxValue">
+                        <number>100</number>
+                    </property>
+                </widget>
+                <widget class="KIntNumInput" row="2" column="2" rowspan="1" colspan="2">
+                    <property name="name">
+                        <cstring>intMiscibility</cstring>
+                    </property>
+                </widget>
+                <widget class="KIntNumInput" row="3" column="3">
+                    <property name="name">
+                        <cstring>intLiquidContent</cstring>
+                    </property>
+                    <property name="minValue">
+                        <number>0</number>
+                    </property>
+                    <property name="maxValue">
+                        <number>100</number>
+                    </property>
+                </widget>
+                <widget class="TQLabel" row="3" column="0" rowspan="1" colspan="3">
+                    <property name="name">
+                        <cstring>lblMiscibility</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Miscibility:</string>
+                    </property>
+                    <property name="buddy" stdset="0">
+                        <cstring>intMiscibility</cstring>
+                    </property>
+                </widget>
+            </grid>
+        </widget>
+        <widget class="TQGroupBox" row="0" column="1">
+            <property name="name">
+                <cstring>grpSubstrate</cstring>
+            </property>
+            <property name="title">
+                <string>&amp;Canvas</string>
+            </property>
+            <grid>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <widget class="KIntNumInput" row="3" column="1">
+                    <property name="name">
+                        <cstring>intHeight</cstring>
+                    </property>
+                </widget>
+                <widget class="TQLabel" row="3" column="0">
+                    <property name="name">
+                        <cstring>lblHeight</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Height:</string>
+                    </property>
+                    <property name="buddy" stdset="0">
+                        <cstring>intHeight</cstring>
+                    </property>
+                </widget>
+                <widget class="KIntNumInput" row="2" column="1">
+                    <property name="name">
+                        <cstring>intAbsorbency</cstring>
+                    </property>
+                    <property name="minValue">
+                        <number>0</number>
+                    </property>
+                    <property name="maxValue">
+                        <number>100</number>
+                    </property>
+                </widget>
+                <widget class="TQLabel" row="2" column="0">
+                    <property name="name">
+                        <cstring>lblAbsorbency</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Absorbency:</string>
+                    </property>
+                    <property name="buddy" stdset="0">
+                        <cstring>intAbsorbency</cstring>
+                    </property>
+                </widget>
+                <widget class="TQLabel" row="1" column="0">
+                    <property name="name">
+                        <cstring>lblColor</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Color:</string>
+                    </property>
+                    <property name="buddy" stdset="0">
+                        <cstring>bnCanvasColor</cstring>
+                    </property>
+                </widget>
+                <widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2">
+                    <property name="name">
+                        <cstring>chkCanvas</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Paint canvas attributes</string>
+                    </property>
+                    <property name="accel">
+                        <string></string>
+                    </property>
+                </widget>
+                <widget class="KColorButton" row="1" column="1">
+                    <property name="name">
+                        <cstring>bnCanvasColor</cstring>
+                    </property>
+                    <property name="text">
+                        <string></string>
+                    </property>
+                </widget>
+            </grid>
+        </widget>
+    </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<tqlayoutdefaults spacing="6" margin="11"/>
+<includehints>
+    <includehint>knuminput.h</includehint>
+    <includehint>knuminput.h</includehint>
+    <includehint>knuminput.h</includehint>
+    <includehint>knuminput.h</includehint>
+    <includehint>knuminput.h</includehint>
+    <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/chalk/colorspaces/ycbcr_u16/Makefile.am b/chalk/colorspaces/ycbcr_u16/Makefile.am
new file mode 100644
index 000000000..d2e0aca39
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u16/Makefile.am
@@ -0,0 +1,27 @@
+# Install the desktop file needed to detect the plugin
+kde_services_DATA = chalk_ycbcr_u16_plugin.desktop
+
+INCLUDES  =  -I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../chalkcolor/ \
+	$(KOFFICE_INCLUDES) \
+	$(all_includes)
+
+lib_LTLIBRARIES = libchalk_ycbcr_u16.la
+
+libchalk_ycbcr_u16_la_LDFLAGS = $(all_libraries)
+libchalk_ycbcr_u16_la_LIBADD =  ../../chalkcolor/libchalkcolor.la
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = chalk_ycbcr_u16_plugin.la
+
+# Srcs for the plugin
+chalk_ycbcr_u16_plugin_la_SOURCES = ycbcr_u16_plugin.cc
+noinst_HEADERS = ycbcr_u16_plugin.h kis_ycbcr_u16_colorspace.h
+
+chalk_ycbcr_u16_plugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms
+chalk_ycbcr_u16_plugin_la_LIBADD =  libchalk_ycbcr_u16.la ../../chalkcolor/libchalkcolor.la
+
+METASOURCES = AUTO
+
+libchalk_ycbcr_u16_la_SOURCES = kis_ycbcr_u16_colorspace.cc
diff --git a/chalk/colorspaces/ycbcr_u16/chalk_ycbcr_u16_plugin.desktop b/chalk/colorspaces/ycbcr_u16/chalk_ycbcr_u16_plugin.desktop
new file mode 100644
index 000000000..eaa0c2a11
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u16/chalk_ycbcr_u16_plugin.desktop
@@ -0,0 +1,71 @@
+[Desktop Entry]
+Name=YCbCr Color Model (16-bit integer)
+Name[bg]=Цветови модел YCbCr (16 бита)
+Name[ca]=Model de color YCbCr (enters de 16 bits)
+Name[da]=YCbCr-farvemodel (16-bit heltal)
+Name[de]=YCbCr-Farbmodell (16-bit Ganzzahl)
+Name[el]=Χρωματικό μοντέλο YCbCr (16-bit ακέραιοι)
+Name[eo]=YCbCr-Kolormodelo (16-bita entjero)
+Name[es]=Modelo de color YCbCr (entero de 16 bits)
+Name[et]=YCbCr värvimudel (16-bitine täisarv)
+Name[fa]=مدل رنگ YCbCr )عدد صحیح ۱۶ بیتی(
+Name[fr]=Modèle de couleurs YCbCr (entiers 16 bits)
+Name[fy]=YCbCr-kleurmodel (16-bit integer)
+Name[gl]=Modelo de Cores YCbCr (inteiro de 16-bit)
+Name[hu]=YCbCr színmodell (16 bites egész)
+Name[it]=Modello di colore YCbCr (intero a 16 bit)
+Name[ja]=YCbCr カラーモデル (16 ビット整数)
+Name[km]=គំរូ​ពណ៌ CMYK (ចំនួន​គត់ ១៦ ប៊ីត)
+Name[lt]=YCbCr spalvų modelis (16-bitų sveikasis)
+Name[nb]=YCbCr-fargemodell (16-bit heltall)
+Name[nds]=YCbCr-Klöörmodell (16-Bit Heeltall)
+Name[ne]=वाईसी ी ी आर रङ मोडेल (१६-बिट इन्टिजर)
+Name[nl]=YCbCr-kleurmodel (16-bit integer)
+Name[pl]=Przestrzeń barw YCbCr (16-bitowa liczbowa całkowita)
+Name[pt]=Modelo de Cor YCbCr (inteiros de 16 bits)
+Name[pt_BR]=Modelo de Cor YCbCr (inteiros de 16 bits)
+Name[ru]=YCbCr (целое 16-бит)
+Name[sk]=Model farieb YCbCr (16-biové čísla)
+Name[sl]=Barvni model YCbCr (16-bitno celo število)
+Name[sr]=YCbCr модел боја (16-битно целобројно)
+Name[sr@Latn]=YCbCr model boja (16-bitno celobrojno)
+Name[sv]=YCbCr-färgmodell (16-bitars heltal)
+Name[uk]=Модель кольорів YCbCr (16-бітне ціле)
+Name[uz]=YCbCr rang usuli (16-bit butun)
+Name[uz@cyrillic]=YCbCr ранг усули (16-бит бутун)
+Name[zh_TW]=YCbCr 色彩模型 (16-bit 整數)
+Comment=Color model for 16-bit integer per channel YCbCr images
+Comment[bg]=Цветови модел за 16 битови YCbCr изображения
+Comment[ca]=Model de color d'enters de 16 bits per a canal d'imatges YCbCr
+Comment[da]=Farvemodel for 16-bit heltal pr kanal YCbCr-billeder
+Comment[de]=Farbmodell für 16-bit pro Kanal YCbCr-Bilder
+Comment[el]=Χρωματικό μοντέλο για 16-bit ακεραίους ανά κανάλι YCbCr εικόνες
+Comment[es]=Modelo de color de entero de 16 bits por canal para imágenes YCbCr
+Comment[et]=16-bitiste täisarvuliste kanalitega YCbCr-piltide värvimudel
+Comment[fa]=مدل رنگ برای عدد صحیح ۱۶ بیتی برای هر تصویر YCbCr مجرا
+Comment[fr]=Modèle de couleurs pour des images YCbCr à 16 bits par canal
+Comment[fy]=Kleurmodel foar16-bit/kanaal fan YCbCr-ôfbyldings
+Comment[gl]=Modelo de Cores para imaxes YCbCr de inteiro de 16-bit por canal
+Comment[hu]=Színmodell 16 bit/csatorna YCbCr képekhez
+Comment[it]=Modello di colore per immagini YCbCr a canale di 16 bit interi
+Comment[ja]=16 ビット整数/チャンネル YCbCr 画像のためのカラーモデル
+Comment[km]=គំរូ​ពណ៌​សម្រាប់​រូបភាព CMYK ចំនួនគត់ ១៦ ប៊ីត​ក្នុង​មួយ​ឆានែល
+Comment[nb]=Fargemodell for YCbCr-bilder med 16-bit heltall per kanal
+Comment[nds]=Klöörmodell för YCbCr-Biller mit 16-Bit Heeltall pro Kanaal
+Comment[ne]=प्रति च्यानल वाईसीबीसीआर छविहरूको १६-बिट इन्टिजरका लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor 16-bit/kanaal van YCbCr-afbeeldingen
+Comment[pl]=Przestrzeń barw dla obrazków YCbCr z 16-bitowymi liczbami całkowitymi na kanał
+Comment[pt]=Modelo de cor para imagens YCbCr com 16 bits por canal
+Comment[pt_BR]=Modelo de cor para imagens YCbCr com 16 bits por canal
+Comment[ru]=Цветовое пространство YCbCr (целое 16-бит/канал)
+Comment[sk]=Model farieb pre YCbCr obrázky so 16 bitmi na kanál
+Comment[sl]=Barvni model za slike YCbCr s 16 biti/kanal
+Comment[sr]=Модел боја за YCbCr слике, 16-битно целобројно по каналу
+Comment[sr@Latn]=Model boja za YCbCr slike, 16-bitno celobrojno po kanalu
+Comment[sv]=Färgmodell för YCbCr-bilder med 16-bitars heltal per kanal
+Comment[uk]=Модель кольорів для зображень YCbCr з цілим 16-біт/канал
+Comment[zh_TW]=每色頻為 16-bit 的 YCbCr 圖片色彩模型
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-KDE-Library=chalk_ycbcr_u16_plugin
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/ycbcr_u16/kis_ycbcr_u16_colorspace.cc b/chalk/colorspaces/ycbcr_u16/kis_ycbcr_u16_colorspace.cc
new file mode 100644
index 000000000..d8ea896bc
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u16/kis_ycbcr_u16_colorspace.cc
@@ -0,0 +1,338 @@
+/*
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_ycbcr_u16_colorspace.h"
+
+#include <tqimage.h>
+
+#include <kis_integer_maths.h>
+
+const TQ_INT32 MAX_CHANNEL_YCbCr = 3;
+const TQ_INT32 MAX_CHANNEL_YCbCrA = 4;
+
+KisYCbCrU16ColorSpace::KisYCbCrU16ColorSpace(KisColorSpaceFactoryRegistry* tqparent, KisProfile* /*p*/)
+    : KisU16BaseColorSpace(KisID("YCbCrAU16", i18n("YCbCr (16-bit integer/channel)")), TYPE_YCbCr_16, icSigYCbCrData, tqparent, 0)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Y"), "Y", PIXEL_Y * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16)));
+    m_channels.push_back(new KisChannelInfo(i18n("Cb"), "Cb", PIXEL_Cb * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16)));
+    m_channels.push_back(new KisChannelInfo(i18n("Cr"), "Cr", PIXEL_Cr * sizeof(TQ_UINT16), KisChannelInfo::COLOR, KisChannelInfo::UINT16, sizeof(TQ_UINT16)));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), "A", PIXEL_ALPHA * sizeof(TQ_UINT16), KisChannelInfo::ALPHA, KisChannelInfo::UINT16, sizeof(TQ_UINT16)));
+
+    m_alphaPos = PIXEL_ALPHA * sizeof(TQ_UINT16);
+    KisAbstractColorSpace::init();
+}
+
+
+KisYCbCrU16ColorSpace::~KisYCbCrU16ColorSpace()
+{
+}
+
+void KisYCbCrU16ColorSpace::setPixel(TQ_UINT8 *dst, TQ_UINT16 Y, TQ_UINT16 Cb, TQ_UINT16 Cr, TQ_UINT16 alpha) const
+{
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->Y = Y;
+    dstPixel->Cb = Cb;
+    dstPixel->Cr = Cr;
+    dstPixel->alpha = alpha;
+}
+
+void KisYCbCrU16ColorSpace::getPixel(const TQ_UINT8 *src, TQ_UINT16 *Y, TQ_UINT16 *Cb, TQ_UINT16 *Cr, TQ_UINT16 *alpha) const
+{
+    const Pixel *srcPixel = reinterpret_cast<const Pixel *>(src);
+
+    *Y = srcPixel->Y;
+    *Cb = srcPixel->Cb;
+    *Cr = srcPixel->Cr;
+    *alpha = srcPixel->alpha;
+
+}
+
+void KisYCbCrU16ColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 *dstU8, KisProfile * profile )
+{
+    if(getProfile())
+    {
+        KisU16BaseColorSpace::fromTQColor(c, dstU8, profile);
+    } else {
+        Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
+        dst->Y = computeY( c.red(), c.green(), c.blue());
+        dst->Cb = computeCb( c.red(), c.green(), c.blue());
+        dst->Cr = computeCr( c.red(), c.green(), c.blue());
+    }
+}
+
+void KisYCbCrU16ColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dstU8, KisProfile * profile )
+{
+    if(getProfile())
+    {
+        KisU16BaseColorSpace::fromTQColor(c, opacity, dstU8, profile);
+    } else {
+        Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
+        dst->Y = computeY( c.red(), c.green(), c.blue());
+        dst->Cb = computeCb( c.red(), c.green(), c.blue());
+        dst->Cr = computeCr( c.red(), c.green(), c.blue());
+        dst->alpha = opacity;
+    }
+}
+
+void KisYCbCrU16ColorSpace::toTQColor(const TQ_UINT8 *srcU8, TQColor *c, KisProfile * profile)
+{
+    if(getProfile())
+    {
+        KisU16BaseColorSpace::toTQColor(srcU8, c, profile);
+        
+    } else {
+        const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
+        c->setRgb(computeRed(src->Y,src->Cb,src->Cr) >> 8, computeGreen(src->Y,src->Cb,src->Cr) >> 8, computeBlue(src->Y,src->Cb,src->Cr) >> 8);
+    }
+}
+
+void KisYCbCrU16ColorSpace::toTQColor(const TQ_UINT8 *srcU8, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile)
+{
+    if(getProfile())
+    {
+        KisU16BaseColorSpace::toTQColor(srcU8, c, opacity, profile);
+    } else {
+        const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
+        c->setRgb(computeRed(src->Y,src->Cb,src->Cr) >> 8, computeGreen(src->Y,src->Cb,src->Cr) >> 8, computeBlue(src->Y,src->Cb,src->Cr) >> 8);
+        *opacity = src->alpha;
+    }
+}
+
+TQ_UINT8 KisYCbCrU16ColorSpace::difference(const TQ_UINT8 *src1U8, const TQ_UINT8 *src2U8)
+{
+    if(getProfile())
+        return KisU16BaseColorSpace::difference(src1U8, src2U8);
+    const Pixel *src1 = reinterpret_cast<const Pixel *>(src1U8);
+    const Pixel *src2 = reinterpret_cast<const Pixel *>(src2U8);
+
+    return TQMAX(TQABS(src2->Y - src1->Y), TQMAX(TQABS(src2->Cb - src1->Cb), TQABS(src2->Cr - src1->Cr))) >> 8;
+
+}
+
+void KisYCbCrU16ColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    TQ_UINT16 totalY = 0, totalCb = 0, totalCr = 0, newAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel *pixel = reinterpret_cast<const Pixel *>(*colors);
+
+        TQ_UINT16 alpha = pixel->alpha;
+        float alphaTimesWeight = alpha * *weights;
+
+        totalY += (TQ_UINT16)(pixel->Y * alphaTimesWeight);
+        totalCb += (TQ_UINT16)(pixel->Cb * alphaTimesWeight);
+        totalCr += (TQ_UINT16)(pixel->Cr * alphaTimesWeight);
+        newAlpha += (TQ_UINT16)(alphaTimesWeight);
+
+        weights++;
+        colors++;
+    }
+
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->alpha = newAlpha;
+
+    if (newAlpha > 0) {
+        totalY = totalY / newAlpha;
+        totalCb = totalCb / newAlpha;
+        totalCr = totalCr / newAlpha;
+    }
+
+    dstPixel->Y = totalY;
+    dstPixel->Cb = totalCb;
+    dstPixel->Cr = totalCr;
+}
+
+TQValueVector<KisChannelInfo *> KisYCbCrU16ColorSpace::channels() const {
+    return m_channels;
+}
+
+TQ_UINT32 KisYCbCrU16ColorSpace::nChannels() const {
+    return MAX_CHANNEL_YCbCrA;
+}
+
+TQ_UINT32 KisYCbCrU16ColorSpace::nColorChannels() const {
+    return MAX_CHANNEL_YCbCr;
+}
+
+TQ_UINT32 KisYCbCrU16ColorSpace::pixelSize() const {
+    return MAX_CHANNEL_YCbCrA * sizeof(TQ_UINT16);
+}
+
+
+TQImage KisYCbCrU16ColorSpace::convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height, KisProfile *  dstProfile, TQ_INT32 renderingIntent, float exposure )
+{
+    if(getProfile())
+        return KisU16BaseColorSpace::convertToTQImage( data, width, height, dstProfile, renderingIntent, exposure);
+    
+    TQImage img = TQImage(width, height, 32, 0, TQImage::LittleEndian);
+    img.setAlphaBuffer(true);
+
+    TQ_INT32 i = 0;
+    uchar *j = img.bits();
+
+    while ( i < width * height * MAX_CHANNEL_YCbCrA) {
+        TQ_UINT16 Y = *( data + i + PIXEL_Y );
+        TQ_UINT16 Cb = *( data + i + PIXEL_Cb );
+        TQ_UINT16 Cr = *( data + i + PIXEL_Cr );
+        *( j + 3)  = *( data + i + PIXEL_ALPHA ) >> 8;
+        *( j + 2 ) = computeRed(Y,Cb,Cr) >> 8;
+        *( j + 1 ) = computeGreen(Y,Cb,Cr) >> 8;
+        *( j + 0 ) = computeBlue(Y,Cb,Cr) >> 8;
+        i += MAX_CHANNEL_YCbCrA;
+        j += 4;
+    }
+    return img;
+}
+
+
+void KisYCbCrU16ColorSpace::bitBlt(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *srcAlphaMask, TQ_INT32 tqmaskRowStride, TQ_UINT8 opacity, TQ_INT32 rows, TQ_INT32 cols, const KisCompositeOp& op)
+{
+    switch (op.op()) {
+        case COMPOSITE_UNDEF:
+        // Undefined == no composition
+            break;
+        case COMPOSITE_OVER:
+            compositeOver(dst, dstRowStride, src, srcRowStride, srcAlphaMask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_COPY:
+            compositeCopy(dst, dstRowStride, src, srcRowStride, srcAlphaMask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_ERASE:
+            compositeErase(dst, dstRowStride, src, srcRowStride, srcAlphaMask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        default:
+            break;
+    }
+}
+
+void KisYCbCrU16ColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT16 *src = reinterpret_cast<const TQ_UINT16 *>(srcRowStart);
+        TQ_UINT16 *dst = reinterpret_cast<TQ_UINT16 *>(dstRowStart);
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            TQ_UINT16 srcAlpha = src[PIXEL_ALPHA];
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, UINT8_TO_UINT16(U8_tqmask));
+                }
+                tqmask++;
+            }
+
+            if (srcAlpha != U16_OPACITY_TRANSPARENT) {
+
+                if (opacity != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_MULT(srcAlpha, opacity);
+                }
+
+                if (srcAlpha == U16_OPACITY_OPAQUE) {
+                    memcpy(dst, src, MAX_CHANNEL_YCbCrA * sizeof(TQ_UINT16));
+                } else {
+                    TQ_UINT16 dstAlpha = dst[PIXEL_ALPHA];
+
+                    TQ_UINT16 srcBlend;
+
+                    if (dstAlpha == U16_OPACITY_OPAQUE) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        TQ_UINT16 newAlpha = dstAlpha + UINT16_MULT(U16_OPACITY_OPAQUE - dstAlpha, srcAlpha);
+                        dst[PIXEL_ALPHA] = newAlpha;
+
+                        if (newAlpha != 0) {
+                            srcBlend = UINT16_DIVIDE(srcAlpha, newAlpha);
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend == U16_OPACITY_OPAQUE) {
+                        memcpy(dst, src, MAX_CHANNEL_YCbCr * sizeof(TQ_UINT16));
+                    } else {
+                        dst[PIXEL_Y] = UINT16_BLEND(src[PIXEL_Y], dst[PIXEL_Y], srcBlend);
+                        dst[PIXEL_Cb] = UINT16_BLEND(src[PIXEL_Cb], dst[PIXEL_Cb], srcBlend);
+                        dst[PIXEL_Cr] = UINT16_BLEND(src[PIXEL_Cr], dst[PIXEL_Cr], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_YCbCrA;
+            dst += MAX_CHANNEL_YCbCrA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart) {
+            tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+}
+
+void KisYCbCrU16ColorSpace::compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowSize, const TQ_UINT8 *src, TQ_INT32 srcRowSize, const TQ_UINT8 *srcAlphaMask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 cols, TQ_UINT8 /*opacity*/)
+{
+    while (rows-- > 0)
+    {
+        const Pixel *s = reinterpret_cast<const Pixel *>(src);
+        Pixel *d = reinterpret_cast<Pixel *>(dst);
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+    
+        for (TQ_INT32 i = cols; i > 0; i--, s++, d++)
+        {
+            TQ_UINT16 srcAlpha = s->alpha;
+    
+                // apply the alphatqmask
+            if (tqmask != 0) {
+                TQ_UINT8 U8_tqmask = *tqmask;
+    
+                if (U8_tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = UINT16_BLEND(srcAlpha, U16_OPACITY_OPAQUE, UINT8_TO_UINT16(U8_tqmask));
+                }
+                tqmask++;
+            }
+            d->alpha = UINT16_MULT(srcAlpha, d->alpha);
+        }
+    
+        dst += dstRowSize;
+        src += srcRowSize;
+        if(srcAlphaMask) {
+            srcAlphaMask += tqmaskRowStride;
+        }
+    }
+}
+
+KisCompositeOpList KisYCbCrU16ColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    return list;
+}
diff --git a/chalk/colorspaces/ycbcr_u16/kis_ycbcr_u16_colorspace.h b/chalk/colorspaces/ycbcr_u16/kis_ycbcr_u16_colorspace.h
new file mode 100644
index 000000000..69c499f25
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u16/kis_ycbcr_u16_colorspace.h
@@ -0,0 +1,144 @@
+/*
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_YCBCR_U16_COLORSPACE_H
+#define KIS_YCBCR_U16_COLORSPACE_H
+
+#include <kis_u16_base_colorspace.h>
+
+#include <klocale.h>
+
+#define LUMA_RED 0.2989
+#define LUMA_GREEN 0.587
+#define LUMA_BLUE 0.114
+
+class KisYCbCrU16ColorSpace : public KisU16BaseColorSpace
+{
+    public:
+        KisYCbCrU16ColorSpace(KisColorSpaceFactoryRegistry* tqparent, KisProfile* p);
+        ~KisYCbCrU16ColorSpace();
+        virtual bool willDegrade(ColorSpaceIndependence )
+        {
+            return false;
+        };
+    public:
+        void setPixel(TQ_UINT8 *pixel, TQ_UINT16 Y, TQ_UINT16 Cb, TQ_UINT16 Cr, TQ_UINT16 alpha) const;
+        void getPixel(const TQ_UINT8 *pixel, TQ_UINT16 *Y, TQ_UINT16 *Cb, TQ_UINT16 *Cr, TQ_UINT16 *alpha) const;
+
+        virtual void fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile * profile = 0);
+        virtual void fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * profile = 0);
+
+        virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * profile = 0);
+        virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile = 0);
+
+        virtual TQ_UINT8 difference(const TQ_UINT8 *src1, const TQ_UINT8 *src2);
+        virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+
+        virtual TQValueVector<KisChannelInfo *> channels() const;
+        virtual TQ_UINT32 nChannels() const;
+        virtual TQ_UINT32 nColorChannels() const;
+        virtual TQ_UINT32 pixelSize() const;
+
+        virtual TQImage convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                                       KisProfile *  dstProfile,
+                                       TQ_INT32 renderingIntent,
+                                       float exposure = 0.0f);
+
+        virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+    protected:
+
+        virtual void bitBlt(TQ_UINT8 *dst,
+                            TQ_INT32 dstRowStride,
+                            const TQ_UINT8 *src,
+                            TQ_INT32 srcRowStride,
+                            const TQ_UINT8 *srcAlphaMask,
+                            TQ_INT32 tqmaskRowStride,
+                            TQ_UINT8 opacity,
+                            TQ_INT32 rows,
+                            TQ_INT32 cols,
+                            const KisCompositeOp& op);
+
+        void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+        void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+
+    private:
+#define CLAMP_TO_16BITCHANNEL(a) CLAMP(a, 0, TQ_UINT16_MAX)
+        inline TQ_UINT16 computeRed(TQ_UINT16 Y, TQ_UINT16 /*Cb*/, TQ_UINT16 Cr)
+        {
+            return (TQ_UINT16)( CLAMP_TO_16BITCHANNEL( (Cr - 32768)* (2-2*LUMA_RED) + Y )  );
+        }
+        inline TQ_UINT16 computeGreen(TQ_UINT16 Y, TQ_UINT16 Cb, TQ_UINT16 Cr)
+        {
+            return (TQ_UINT16)( CLAMP_TO_16BITCHANNEL( (Y - LUMA_BLUE * computeBlue(Y,Cb,Cr) - LUMA_RED * computeRed(Y,Cb,Cr) ) / LUMA_GREEN ) );
+        }
+        inline TQ_UINT16 computeBlue(TQ_UINT16 Y, TQ_UINT16 Cb, TQ_UINT16 /*Cr*/)
+        {
+            return (TQ_UINT16)( CLAMP_TO_16BITCHANNEL( (Cb - 32768)*(2 - 2 * LUMA_BLUE) + Y) );
+        }
+        inline TQ_UINT16 computeY( TQ_UINT16 r, TQ_UINT16 b, TQ_UINT16 g)
+        {
+            return (TQ_UINT16)( CLAMP_TO_16BITCHANNEL( LUMA_RED*r + LUMA_GREEN*g + LUMA_BLUE*b ) );
+        }
+        inline TQ_UINT16 computeCb( TQ_UINT16 r, TQ_UINT16 b, TQ_UINT16 g)
+        {
+            return (TQ_UINT16)( CLAMP_TO_16BITCHANNEL( (b - computeY(r,g,b))/(2-2*LUMA_BLUE) + 32768) );
+        }
+        inline TQ_UINT16 computeCr( TQ_UINT16 r, TQ_UINT16 b, TQ_UINT16 g)
+        {
+            return (TQ_UINT8)( CLAMP_TO_16BITCHANNEL( (r - computeY(r,g,b))/(2-2*LUMA_RED) + 32768) );
+        }
+#undef CLAMP_TO_16BITCHANNEL
+        
+        static const TQ_UINT8 PIXEL_Y = 0;
+        static const TQ_UINT8 PIXEL_Cb = 1;
+        static const TQ_UINT8 PIXEL_Cr = 2;
+        static const TQ_UINT8 PIXEL_ALPHA = 3;
+
+        struct Pixel {
+            TQ_UINT16 Y;
+            TQ_UINT16 Cb;
+            TQ_UINT16 Cr;
+            TQ_UINT16 alpha;
+        };
+};
+
+class KisYCbCrU16ColorSpaceFactory : public KisColorSpaceFactory
+{
+    public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+        virtual KisID id() const { return KisID("YCbCrAU16", i18n("YCbCr (16-bit integer/channel)")); };
+
+    /**
+         * lcms colorspace type definition.
+     */
+        virtual TQ_UINT32 colorSpaceType() { return TYPE_YCbCr_16; };
+
+        virtual icColorSpaceSignature colorSpaceSignature() { return icSigYCbCrData; };
+
+        virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisYCbCrU16ColorSpace(tqparent, p); };
+
+        virtual TQString defaultProfile() { return ""; };
+};
+
+
+#endif
diff --git a/chalk/colorspaces/ycbcr_u16/ycbcr_u16_plugin.cc b/chalk/colorspaces/ycbcr_u16/ycbcr_u16_plugin.cc
new file mode 100644
index 000000000..d948097b7
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u16/ycbcr_u16_plugin.cc
@@ -0,0 +1,60 @@
+/*
+ * ycbcr_u16_plugin.cc -- Part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kinstance.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+
+#include <kis_debug_areas.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_basic_histogram_producers.h>
+#include <kis_debug_areas.h>
+#include "ycbcr_u16_plugin.h"
+#include "kis_ycbcr_u16_colorspace.h"
+
+typedef KGenericFactory<YCbCrU16Plugin> YCbCrU16PluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalk_ycbcr_u16_plugin, YCbCrU16PluginFactory( "chalk" ) )
+
+
+YCbCrU16Plugin::YCbCrU16Plugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(YCbCrU16PluginFactory::instance());
+
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") )
+    {
+        KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( tqparent );
+
+        KisColorSpace * colorSpaceYCbCrU16 = new KisYCbCrU16ColorSpace(f, 0);
+        KisColorSpaceFactory * csf = new KisYCbCrU16ColorSpaceFactory();
+        Q_CHECK_PTR(colorSpaceYCbCrU16);
+        f->add(csf);
+        KisHistogramProducerFactoryRegistry::instance()->add(
+                new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
+                (KisID("YCbCr16HISTO", i18n("YCbCr16")), colorSpaceYCbCrU16) );
+    }
+
+}
+
+YCbCrU16Plugin::~YCbCrU16Plugin()
+{
+}
+
+#include "ycbcr_u16_plugin.moc"
diff --git a/chalk/colorspaces/ycbcr_u16/ycbcr_u16_plugin.h b/chalk/colorspaces/ycbcr_u16/ycbcr_u16_plugin.h
new file mode 100644
index 000000000..ceb8ec6f4
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u16/ycbcr_u16_plugin.h
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef YCBCR_U16_PLUGIN_H_
+#define YCBCR_U16_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the YCbCr U16 colour space strategy.
+ */
+class YCbCrU16Plugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    YCbCrU16Plugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~YCbCrU16Plugin();
+
+};
+
+
+#endif // YCBCR_U16_PLUGIN_H_
diff --git a/chalk/colorspaces/ycbcr_u8/Makefile.am b/chalk/colorspaces/ycbcr_u8/Makefile.am
new file mode 100644
index 000000000..67f7933a8
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u8/Makefile.am
@@ -0,0 +1,29 @@
+# Install the desktop file needed to detect the plugin
+
+
+INCLUDES  =  -I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor/color_strategy/ \
+	-I$(srcdir)/../../chalkcolor/ \
+	$(KOFFICE_INCLUDES) \
+	$(all_includes)
+
+lib_LTLIBRARIES = libchalk_ycbcr_u8.la
+
+libchalk_ycbcr_u8_la_LDFLAGS = $(all_libraries)
+libchalk_ycbcr_u8_la_LIBADD =  ../../chalkcolor/libchalkcolor.la
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = chalk_ycbcr_u8_plugin.la
+
+# Srcs for the plugin
+chalk_ycbcr_u8_plugin_la_SOURCES = ycbcr_u8_plugin.cc
+noinst_HEADERS = ycbcr_u8_plugin.h kis_ycbcr_u8_colorspace.h
+
+chalk_ycbcr_u8_plugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -llcms
+chalk_ycbcr_u8_plugin_la_LIBADD =  libchalk_ycbcr_u8.la ../../chalkcolor/libchalkcolor.la
+
+METASOURCES = AUTO
+
+
+libchalk_ycbcr_u8_la_SOURCES = kis_ycbcr_u8_colorspace.cc
+kde_services_DATA = chalk_ycbcr_u8_plugin.desktop
diff --git a/chalk/colorspaces/ycbcr_u8/chalk_ycbcr_u8_plugin.desktop b/chalk/colorspaces/ycbcr_u8/chalk_ycbcr_u8_plugin.desktop
new file mode 100644
index 000000000..6eafad7b6
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u8/chalk_ycbcr_u8_plugin.desktop
@@ -0,0 +1,71 @@
+[Desktop Entry]
+Name=YCbCr Color Model (8-bit integer)
+Name[bg]=Цветови модел YCbCr (16 бита)
+Name[ca]=Model de color YCbCr (enters de 16 bits)
+Name[da]=YCbCr-farvemodel (8-bit heltal)
+Name[de]=YCbCr-Farbmodell (8-bit Ganzzahl)
+Name[el]=Χρωματικό μοντέλο YCbCr (16-bit ακέραιοι)
+Name[eo]=YCbCr-Kolormodelo (8-bita entjero)
+Name[es]=Modelo de color YCbCr (entero de 8 bits)
+Name[et]=YCbCr värvimudel (8-bitine täisarv)
+Name[fa]=مدل رنگ YCbCr )عدد صحیح ۸ بیتی(
+Name[fr]=Modèle de couleurs YCbCr (entiers 8 bits)
+Name[fy]=YCbCr-kleurmodel (8-bit integer)
+Name[gl]=Modelo de Cores YCbCr (inteiro de 8-bit)
+Name[hu]=YCbCr színmodell (8 bites egész)
+Name[it]=Modello di colore YCbCr (intero a 8 bit)
+Name[ja]=YCbCr カラーモデル (8 ビット整数)
+Name[km]=គំរូ​ពណ៌ CMYK (ចំនួនគត់ ១៦ ប៊ីត)
+Name[lt]=YCbCr spalvų modelis (8-bitų sveikasis)
+Name[nb]=YCbCr fargemodell (8-bit heltall)
+Name[nds]=YCbCr-Klöörmodell (8-Bit Heeltall)
+Name[ne]=वाईसीबीसीआर रङ मोडेल (८-बिट इन्टिजर)
+Name[nl]=YCbCr-kleurmodel (8-bit integer)
+Name[pl]=Przestrzeń barw YCbCr (8-bitowa liczbowa całkowita)
+Name[pt]=Modelo de Cor YCbCr (inteiros de 8 bits)
+Name[pt_BR]=Modelo de Cor YCbCr (inteiros de 8 bits)
+Name[ru]=YCbCr (целое 8-бит)
+Name[sk]=Model farieb YCbCr (8-biové čísla)
+Name[sl]=Barvni model YCbCr (8-bitno celo število)
+Name[sr]=YCbCr модел боја (8-битно целобројно)
+Name[sr@Latn]=YCbCr model boja (8-bitno celobrojno)
+Name[sv]=YCbCr-färgmodell (8-bitars heltal)
+Name[uk]=Модель кольорів YCbCr (ціле 8-біт)
+Name[uz]=YCbCr rang usuli (8-bit butun)
+Name[uz@cyrillic]=YCbCr ранг усули (8-бит бутун)
+Name[zh_TW]=YCbCr 色彩模型 (16-bit 整數)
+Comment=Color model for 8-bit integer per channel YCbCr images
+Comment[bg]=Цветови модел за 16 битови YCbCr изображения
+Comment[ca]=Model de color d'enters de 16 bits per a canal d'imatges YCbCr
+Comment[da]=Farvemodel for 8-bit heltal pr kanal YCbCr-billeder
+Comment[de]=Farbmodell für 8-bit pro Kanal YCbCr-Bilder
+Comment[el]=Χρωματικό μοντέλο για 8-bit ακεραίους ανά κανάλι YCbCr εικόνες
+Comment[es]=Modelo de color de entero de 16 bits por canal para imágenes YCbCr
+Comment[et]=8-bitiste täisarvuliste kanalitega YCbCr-piltide värvimudel
+Comment[fa]=مدل رنگ برای عدد صحیح ۸ بیتی برای هر تصویر YCbCr مجرا
+Comment[fr]=Modèle de couleurs pour des images YCbCr à 8 bits par canal
+Comment[fy]=Kleurmodel foar 8-bit/kanaal fan YCbCr-ôfbyldings
+Comment[gl]=Modelo de Cores para imaxes YCbCr de inteiro de 8-bit por canal
+Comment[hu]=Színmodell 8 bit/csatorna YCbCr képekhez
+Comment[it]=Modello di colore per immagini YCbCr a canale di 8 bit interi
+Comment[ja]=8 ビット整数/チャンネル YCbCr 画像のためのカラーモデル
+Comment[km]=ម៉ូដែល​ពណ៌​សម្រាប់​ចំនួន​គត់ 8-bit ក្នុង​ឆានែល​រូបភាព YCbCr
+Comment[nb]=Fargemodell for YCbCr-bilder med 8 bit heltall per kanal
+Comment[nds]=Klöörmodell för YCbCr-Biller mit 8-Bit Heeltall pro Kanaal
+Comment[ne]=प्रति वाईसीबीसीआर छविहरूको ८-बिट इन्टिजरका लागि रङ मोडेल
+Comment[nl]=Kleurmodel voor 8-bit/kanaal van YCbCr-afbeeldingen
+Comment[pl]=Przestrzeń barw dla obrazków YCbCr z 8-bitowymi liczbami całkowitymi na kanał
+Comment[pt]=Modelo de cor para imagens YCbCr com 8 bits por canal
+Comment[pt_BR]=Modelo de cor para imagens YCbCr com 8 bits por canal
+Comment[ru]=Цветовое пространство YCbCr (целое 8-бит/канал)
+Comment[sk]=Model farieb pre YCbCr obrázky s 8 bitmi na kanál
+Comment[sl]=Barvni model za slike YCbCr z 8 biti/kanal
+Comment[sr]=Модел боја за YCbCr слике, 8-битно целобројно по каналу
+Comment[sr@Latn]=Model boja za YCbCr slike, 8-bitno celobrojno po kanalu
+Comment[sv]=Färgmodell för YCbCr-bilder med 8-bitars heltal per kanal
+Comment[uk]=Модель кольорів для зображень YCbCr з цілим 8-біт/канал
+Comment[zh_TW]=每色頻為 16-bit 的 YCbCr 圖片色彩模型
+ServiceTypes=Chalk/ColorSpace
+Type=Service
+X-KDE-Library=chalk_ycbcr_u8_plugin
+X-Chalk-Version=2
diff --git a/chalk/colorspaces/ycbcr_u8/kis_ycbcr_u8_colorspace.cc b/chalk/colorspaces/ycbcr_u8/kis_ycbcr_u8_colorspace.cc
new file mode 100644
index 000000000..9c7548bfb
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u8/kis_ycbcr_u8_colorspace.cc
@@ -0,0 +1,344 @@
+/*
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_ycbcr_u8_colorspace.h"
+
+#include <tqimage.h>
+
+#include <kis_integer_maths.h>
+
+const TQ_INT32 MAX_CHANNEL_YCbCr = 3;
+const TQ_INT32 MAX_CHANNEL_YCbCrA = 4;
+
+KisYCbCrU8ColorSpace::KisYCbCrU8ColorSpace(KisColorSpaceFactoryRegistry* tqparent, KisProfile* /*p*/)
+    : KisU8BaseColorSpace(KisID("YCbCrAU8", i18n("YCbCr (8-bit integer/channel)")), TYPE_YCbCr_8, icSigYCbCrData, tqparent, 0)
+{
+    m_channels.push_back(new KisChannelInfo(i18n("Y"), "Y", PIXEL_Y * sizeof(TQ_UINT8), KisChannelInfo::COLOR, KisChannelInfo::UINT8, sizeof(TQ_UINT8)));
+    m_channels.push_back(new KisChannelInfo(i18n("Cb"), "Cb", PIXEL_Cb * sizeof(TQ_UINT8), KisChannelInfo::COLOR, KisChannelInfo::UINT8, sizeof(TQ_UINT8)));
+    m_channels.push_back(new KisChannelInfo(i18n("Cr"), "Cr", PIXEL_Cr * sizeof(TQ_UINT8), KisChannelInfo::COLOR, KisChannelInfo::UINT8, sizeof(TQ_UINT8)));
+    m_channels.push_back(new KisChannelInfo(i18n("Alpha"), "A", PIXEL_ALPHA * sizeof(TQ_UINT8), KisChannelInfo::ALPHA, KisChannelInfo::UINT8, sizeof(TQ_UINT8)));
+
+    m_alphaPos = PIXEL_ALPHA * sizeof(TQ_UINT8);
+    KisAbstractColorSpace::init();
+}
+
+
+KisYCbCrU8ColorSpace::~KisYCbCrU8ColorSpace()
+{
+}
+
+void KisYCbCrU8ColorSpace::setPixel(TQ_UINT8 *dst, TQ_UINT8 Y, TQ_UINT8 Cb, TQ_UINT8 Cr, TQ_UINT8 alpha) const
+{
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->Y = Y;
+    dstPixel->Cb = Cb;
+    dstPixel->Cr = Cr;
+    dstPixel->alpha = alpha;
+}
+
+void KisYCbCrU8ColorSpace::getPixel(const TQ_UINT8 *src, TQ_UINT8 *Y, TQ_UINT8 *Cb, TQ_UINT8 *Cr, TQ_UINT8 *alpha) const
+{
+    const Pixel *srcPixel = reinterpret_cast<const Pixel *>(src);
+
+    *Y = srcPixel->Y;
+    *Cb = srcPixel->Cb;
+    *Cr = srcPixel->Cr;
+    *alpha = srcPixel->alpha;
+
+}
+
+void KisYCbCrU8ColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 *dstU8, KisProfile * profile )
+{
+    if(getProfile())
+    {
+        KisU8BaseColorSpace::fromTQColor(c, dstU8, profile);
+    } else {
+        Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
+        dst->Y = computeY( c.red(), c.green(), c.blue());
+        dst->Cb = computeCb( c.red(), c.green(), c.blue());
+        dst->Cr = computeCr( c.red(), c.green(), c.blue());
+    }
+}
+
+void KisYCbCrU8ColorSpace::fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dstU8, KisProfile * profile )
+{
+    if(getProfile())
+    {
+        KisU8BaseColorSpace::fromTQColor(c, opacity, dstU8, profile);
+    } else {
+        Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
+        dst->Y = computeY( c.red(), c.green(), c.blue());
+        dst->Cb = computeCb( c.red(), c.green(), c.blue());
+        dst->Cr = computeCr( c.red(), c.green(), c.blue());
+        dst->alpha = opacity;
+    }
+}
+
+void KisYCbCrU8ColorSpace::toTQColor(const TQ_UINT8 *srcU8, TQColor *c, KisProfile * profile)
+{
+    if(getProfile())
+    {
+        KisU8BaseColorSpace::toTQColor(srcU8, c, profile);
+        
+    } else {
+        const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
+        c->setRgb(computeRed(src->Y,src->Cb,src->Cr), computeGreen(src->Y,src->Cb,src->Cr),     computeBlue(src->Y,src->Cb,src->Cr));
+    }
+}
+
+void KisYCbCrU8ColorSpace::toTQColor(const TQ_UINT8 *srcU8, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile)
+{
+    if(getProfile())
+    {
+        KisU8BaseColorSpace::toTQColor(srcU8, c, opacity, profile);
+    } else {
+        const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
+        c->setRgb(computeRed(src->Y,src->Cb,src->Cr), computeGreen(src->Y,src->Cb,src->Cr), computeBlue(src->Y,src->Cb,src->Cr));
+        *opacity = src->alpha;
+    }
+}
+
+TQ_UINT8 KisYCbCrU8ColorSpace::difference(const TQ_UINT8 *src1U8, const TQ_UINT8 *src2U8)
+{
+    if(getProfile())
+        return KisU8BaseColorSpace::difference(src1U8, src2U8);
+    const Pixel *src1 = reinterpret_cast<const Pixel *>(src1U8);
+    const Pixel *src2 = reinterpret_cast<const Pixel *>(src2U8);
+
+    return TQMAX(TQABS(src2->Y - src1->Y), TQMAX(TQABS(src2->Cb - src1->Cb), TQABS(src2->Cr - src1->Cr)));
+
+}
+
+void KisYCbCrU8ColorSpace::mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const
+{
+    TQ_UINT8 totalY = 0, totalCb = 0, totalCr = 0, newAlpha = 0;
+
+    while (nColors--)
+    {
+        const Pixel *pixel = reinterpret_cast<const Pixel *>(*colors);
+
+        TQ_UINT8 alpha = pixel->alpha;
+        float alphaTimesWeight = alpha * *weights;
+
+        totalY += (TQ_UINT8)(pixel->Y * alphaTimesWeight);
+        totalCb += (TQ_UINT8)(pixel->Cb * alphaTimesWeight);
+        totalCr += (TQ_UINT8)(pixel->Cr * alphaTimesWeight);
+        newAlpha += (TQ_UINT8)(alphaTimesWeight);
+
+        weights++;
+        colors++;
+    }
+
+    Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
+
+    dstPixel->alpha = newAlpha;
+
+    if (newAlpha > 0) {
+        totalY = totalY / newAlpha;
+        totalCb = totalCb / newAlpha;
+        totalCr = totalCr / newAlpha;
+    }
+
+    dstPixel->Y = totalY;
+    dstPixel->Cb = totalCb;
+    dstPixel->Cr = totalCr;
+}
+
+TQValueVector<KisChannelInfo *> KisYCbCrU8ColorSpace::channels() const {
+    return m_channels;
+}
+
+TQ_UINT32 KisYCbCrU8ColorSpace::nChannels() const {
+    return MAX_CHANNEL_YCbCrA;
+}
+
+TQ_UINT32 KisYCbCrU8ColorSpace::nColorChannels() const {
+    return MAX_CHANNEL_YCbCr;
+}
+
+TQ_UINT32 KisYCbCrU8ColorSpace::pixelSize() const {
+    return MAX_CHANNEL_YCbCrA*sizeof(TQ_UINT8);
+}
+
+
+TQImage KisYCbCrU8ColorSpace::convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height, KisProfile *  dstProfile, TQ_INT32 renderingIntent, float exposure )
+{
+    if(getProfile())
+        return KisU8BaseColorSpace::convertToTQImage( data, width, height, dstProfile, renderingIntent, exposure);
+    
+    TQImage img = TQImage(width, height, 32, 0, TQImage::LittleEndian);
+    img.setAlphaBuffer(true);
+
+    TQ_INT32 i = 0;
+    uchar *j = img.bits();
+
+    while ( i < width * height * MAX_CHANNEL_YCbCrA) {
+        TQ_UINT8 Y = *( data + i + PIXEL_Y );
+        TQ_UINT8 Cb = *( data + i + PIXEL_Cb );
+        TQ_UINT8 Cr = *( data + i + PIXEL_Cr );
+        *( j + 3)  = *( data + i + PIXEL_ALPHA );
+        *( j + 2 ) = computeRed(Y,Cb,Cr);
+        *( j + 1 ) = computeGreen(Y,Cb,Cr);
+        *( j + 0 ) = computeBlue(Y,Cb,Cr);
+        i += MAX_CHANNEL_YCbCrA;
+        j += 4;
+    }
+    return img;
+}
+
+
+void KisYCbCrU8ColorSpace::bitBlt(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *srcAlphaMask, TQ_INT32 tqmaskRowStride, TQ_UINT8 opacity, TQ_INT32 rows, TQ_INT32 cols, const KisCompositeOp& op)
+{
+    switch (op.op()) {
+        case COMPOSITE_UNDEF:
+        // Undefined == no composition
+            break;
+        case COMPOSITE_OVER:
+            compositeOver(dst, dstRowStride, src, srcRowStride, srcAlphaMask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_COPY:
+            compositeCopy(dst, dstRowStride, src, srcRowStride, srcAlphaMask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        case COMPOSITE_ERASE:
+            compositeErase(dst, dstRowStride, src, srcRowStride, srcAlphaMask, tqmaskRowStride, rows, cols, opacity);
+            break;
+        default:
+            break;
+    }
+}
+
+void KisYCbCrU8ColorSpace::compositeOver(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmaskRowStart, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 opacity)
+{
+    while (rows > 0) {
+
+        const TQ_UINT8 *src = srcRowStart;
+        TQ_UINT8 *dst = dstRowStart;
+        const TQ_UINT8 *tqmask = tqmaskRowStart;
+        TQ_INT32 columns = numColumns;
+
+        while (columns > 0) {
+
+            TQ_UINT8 srcAlpha = src[PIXEL_ALPHA];
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                if (*tqmask != OPACITY_OPAQUE) {
+                    srcAlpha *= *tqmask;
+                }
+                tqmask++;
+            }
+
+            if (srcAlpha > OPACITY_TRANSPARENT) {
+
+                if (opacity < OPACITY_OPAQUE) {
+                    srcAlpha *= opacity;
+                }
+
+                if (srcAlpha == OPACITY_OPAQUE) {
+                    memcpy(dst, src, MAX_CHANNEL_YCbCrA * sizeof(TQ_UINT8));
+                } else {
+                    TQ_UINT8 dstAlpha = dst[PIXEL_ALPHA];
+
+                    TQ_UINT8 srcBlend;
+
+                    if (dstAlpha == OPACITY_OPAQUE ) {
+                        srcBlend = srcAlpha;
+                    } else {
+                        TQ_UINT8 newAlpha = dstAlpha + (OPACITY_OPAQUE - dstAlpha) * srcAlpha;
+                        dst[PIXEL_ALPHA] = newAlpha;
+
+                        if (newAlpha > 0) {
+                            srcBlend = srcAlpha / newAlpha;
+                        } else {
+                            srcBlend = srcAlpha;
+                        }
+                    }
+
+                    if (srcBlend == OPACITY_OPAQUE) {
+                        memcpy(dst, src, MAX_CHANNEL_YCbCr * sizeof(TQ_UINT8));
+                    } else {
+                        dst[PIXEL_Y] = UINT8_BLEND(src[PIXEL_Y], dst[PIXEL_Y], srcBlend);
+                        dst[PIXEL_Cb] = UINT8_BLEND(src[PIXEL_Cb], dst[PIXEL_Cb], srcBlend);
+                        dst[PIXEL_Cr] = UINT8_BLEND(src[PIXEL_Cr], dst[PIXEL_Cr], srcBlend);
+                    }
+                }
+            }
+
+            columns--;
+            src += MAX_CHANNEL_YCbCrA;
+            dst += MAX_CHANNEL_YCbCrA;
+        }
+
+        rows--;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+        if(tqmaskRowStart) {
+            tqmaskRowStart += tqmaskRowStride;
+        }
+    }
+}
+
+void KisYCbCrU8ColorSpace::compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowSize, const TQ_UINT8 *src, TQ_INT32 srcRowSize, const TQ_UINT8 *srcAlphaMask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 cols, TQ_UINT8 /*opacity*/)
+{
+    while (rows-- > 0)
+    {
+        const Pixel *s = reinterpret_cast<const Pixel *>(src);
+        Pixel *d = reinterpret_cast<Pixel *>(dst);
+        const TQ_UINT8 *tqmask = srcAlphaMask;
+
+        for (TQ_INT32 i = cols; i > 0; i--, s++, d++)
+        {
+            TQ_UINT8 srcAlpha = s -> alpha;
+
+            // apply the alphatqmask
+            if (tqmask != 0) {
+                if (*tqmask != OPACITY_OPAQUE) {
+                    srcAlpha = *tqmask;
+                }
+                tqmask++;
+            }
+            d -> alpha = srcAlpha * d -> alpha;
+        }
+
+        dst += dstRowSize;
+        src += srcRowSize;
+        if(srcAlphaMask) {
+            srcAlphaMask += tqmaskRowStride;
+        }
+    }
+}
+
+void KisYCbCrU8ColorSpace::compositeCopy(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStride, const TQ_UINT8 *srcRowStart, TQ_INT32 srcRowStride, const TQ_UINT8 */*tqmask*/, TQ_INT32 /*tqmaskRowStride*/, TQ_INT32 rows, TQ_INT32 numColumns, TQ_UINT8 /*opacity*/)
+{
+    while (rows > 0) {
+        memcpy(dstRowStart, srcRowStart, numColumns * sizeof(Pixel));
+        --rows;
+        srcRowStart += srcRowStride;
+        dstRowStart += dstRowStride;
+    }
+}
+
+KisCompositeOpList KisYCbCrU8ColorSpace::userVisiblecompositeOps() const
+{
+    KisCompositeOpList list;
+
+    list.append(KisCompositeOp(COMPOSITE_OVER));
+    return list;
+}
diff --git a/chalk/colorspaces/ycbcr_u8/kis_ycbcr_u8_colorspace.h b/chalk/colorspaces/ycbcr_u8/kis_ycbcr_u8_colorspace.h
new file mode 100644
index 000000000..a03088816
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u8/kis_ycbcr_u8_colorspace.h
@@ -0,0 +1,144 @@
+/*
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_YCBCR_U8_COLORSPACE_H
+#define KIS_YCBCR_U8_COLORSPACE_H
+
+#include <kis_u8_base_colorspace.h>
+
+#include <klocale.h>
+
+#define LUMA_RED 0.2989
+#define LUMA_GREEN 0.587
+#define LUMA_BLUE 0.114
+
+class KisYCbCrU8ColorSpace : public KisU8BaseColorSpace
+{
+    public:
+        KisYCbCrU8ColorSpace(KisColorSpaceFactoryRegistry* tqparent, KisProfile* p);
+        ~KisYCbCrU8ColorSpace();
+        virtual bool willDegrade(ColorSpaceIndependence )
+        {
+            return false;
+        };
+    public:
+        void setPixel(TQ_UINT8 *pixel, TQ_UINT8 Y, TQ_UINT8 Cb, TQ_UINT8 Cr, TQ_UINT8 alpha) const;
+        void getPixel(const TQ_UINT8 *pixel, TQ_UINT8 *Y, TQ_UINT8 *Cb, TQ_UINT8 *Cr, TQ_UINT8 *alpha) const;
+
+        virtual void fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile * profile = 0);
+        virtual void fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * profile = 0);
+
+        virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * profile = 0);
+        virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile = 0);
+
+        virtual TQ_UINT8 difference(const TQ_UINT8 *src1, const TQ_UINT8 *src2);
+        virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
+
+        virtual TQValueVector<KisChannelInfo *> channels() const;
+        virtual TQ_UINT32 nChannels() const;
+        virtual TQ_UINT32 nColorChannels() const;
+        virtual TQ_UINT32 pixelSize() const;
+
+        virtual TQImage convertToTQImage(const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height,
+                                       KisProfile *  dstProfile,
+                                       TQ_INT32 renderingIntent,
+                                       float exposure = 0.0f);
+
+        virtual KisCompositeOpList userVisiblecompositeOps() const;
+
+    protected:
+
+        virtual void bitBlt(TQ_UINT8 *dst,
+                            TQ_INT32 dstRowStride,
+                            const TQ_UINT8 *src,
+                            TQ_INT32 srcRowStride,
+                            const TQ_UINT8 *srcAlphaMask,
+                            TQ_INT32 tqmaskRowStride,
+                            TQ_UINT8 opacity,
+                            TQ_INT32 rows,
+                            TQ_INT32 cols,
+                            const KisCompositeOp& op);
+
+        void compositeOver(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+        void compositeErase(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+        void compositeCopy(TQ_UINT8 *dst, TQ_INT32 dstRowStride, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *tqmask, TQ_INT32 tqmaskRowStride, TQ_INT32 rows, TQ_INT32 columns, TQ_UINT8 opacity);
+
+    private:
+#define CLAMP_TO_8BITCHANNEL(a) CLAMP(a, 0, TQ_UINT8_MAX)
+        inline TQ_UINT8 computeRed(TQ_UINT8 Y, TQ_UINT8 /*Cb*/, TQ_UINT8 Cr)
+        {
+            return (TQ_UINT8)( CLAMP_TO_8BITCHANNEL( (Cr - 128)* (2-2*LUMA_RED) + Y )  );
+        }
+        inline TQ_UINT8 computeGreen(TQ_UINT8 Y, TQ_UINT8 Cb, TQ_UINT8 Cr)
+        {
+            return (TQ_UINT8)( CLAMP_TO_8BITCHANNEL( (Y - LUMA_BLUE * computeBlue(Y,Cb,Cr) - LUMA_RED * computeRed(Y,Cb,Cr) ) / LUMA_GREEN ) );
+        }
+        inline TQ_UINT8 computeBlue(TQ_UINT8 Y, TQ_UINT8 Cb, TQ_UINT8 /*Cr*/)
+        {
+            return (TQ_UINT8)( CLAMP_TO_8BITCHANNEL( (Cb - 128)*(2 - 2 * LUMA_BLUE) + Y) );
+        }
+        inline TQ_UINT8 computeY( TQ_UINT8 r, TQ_UINT8 b, TQ_UINT8 g)
+        {
+            return (TQ_UINT8)( CLAMP_TO_8BITCHANNEL( LUMA_RED*r + LUMA_GREEN*g + LUMA_BLUE*b ) );
+        }
+        inline TQ_UINT8 computeCb( TQ_UINT8 r, TQ_UINT8 b, TQ_UINT8 g)
+        {
+            return (TQ_UINT8)( CLAMP_TO_8BITCHANNEL( (b - computeY(r,g,b))/(2-2*LUMA_BLUE) + 128) );
+        }
+        inline TQ_UINT8 computeCr( TQ_UINT8 r, TQ_UINT8 b, TQ_UINT8 g)
+        {
+            return (TQ_UINT8)( CLAMP_TO_8BITCHANNEL( (r - computeY(r,g,b))/(2-2*LUMA_RED) + 128) );
+        }
+#undef CLAMP_TO_8BITCHANNEL
+
+        static const TQ_UINT8 PIXEL_Y = 0;
+        static const TQ_UINT8 PIXEL_Cb = 1;
+        static const TQ_UINT8 PIXEL_Cr = 2;
+        static const TQ_UINT8 PIXEL_ALPHA = 3;
+
+        struct Pixel {
+            TQ_UINT8 Y;
+            TQ_UINT8 Cb;
+            TQ_UINT8 Cr;
+            TQ_UINT8 alpha;
+        };
+};
+
+class KisYCbCrU8ColorSpaceFactory : public KisColorSpaceFactory
+{
+    public:
+    /**
+     * Chalk definition for use in .kra files and internally: unchanging name +
+     * i18n'able description.
+     */
+        virtual KisID id() const { return KisID("YCbCrAU8", i18n("YCbCr (8-bit integer/channel)")); };
+
+    /**
+         * lcms colorspace type definition.
+     */
+        virtual TQ_UINT32 colorSpaceType() { return TYPE_YCbCr_8; };
+
+        virtual icColorSpaceSignature colorSpaceSignature() { return icSigYCbCrData; };
+
+        virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * tqparent, KisProfile *p) { return new KisYCbCrU8ColorSpace(tqparent, p); };
+
+        virtual TQString defaultProfile() { return ""; };
+};
+
+#endif
diff --git a/chalk/colorspaces/ycbcr_u8/ycbcr_u8_plugin.cc b/chalk/colorspaces/ycbcr_u8/ycbcr_u8_plugin.cc
new file mode 100644
index 000000000..d1d19c32a
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u8/ycbcr_u8_plugin.cc
@@ -0,0 +1,62 @@
+/*
+ * ycbcr_u8_plugin.cc -- Part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "ycbcr_u8_plugin.h"
+
+#include <kinstance.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+
+#include <kis_debug_areas.h>
+#include <kis_colorspace_factory_registry.h>
+#include <kis_basic_histogram_producers.h>
+#include <kis_debug_areas.h>
+
+#include "kis_ycbcr_u8_colorspace.h"
+
+typedef KGenericFactory<YCbCrU8Plugin> YCbCrU8PluginFactory;
+K_EXPORT_COMPONENT_FACTORY( chalk_ycbcr_u8_plugin, YCbCrU8PluginFactory( "chalk" ) )
+
+
+YCbCrU8Plugin::YCbCrU8Plugin(TQObject *tqparent, const char *name, const TQStringList &)
+    : KParts::Plugin(tqparent, name)
+{
+    setInstance(YCbCrU8PluginFactory::instance());
+
+    if ( tqparent->inherits("KisColorSpaceFactoryRegistry") )
+    {
+        KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>( tqparent );
+
+        KisColorSpace * colorSpaceYCbCrU8 = new KisYCbCrU8ColorSpace(f, 0);
+        KisColorSpaceFactory * csf = new KisYCbCrU8ColorSpaceFactory();
+        Q_CHECK_PTR(colorSpaceYCbCrU8);
+        f->add(csf);
+        KisHistogramProducerFactoryRegistry::instance()->add(
+                new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer>
+                (KisID("YCBR8HISTO", i18n("YCBR8")), colorSpaceYCbCrU8) );
+    }
+
+}
+
+YCbCrU8Plugin::~YCbCrU8Plugin()
+{
+}
+
+#include "ycbcr_u8_plugin.moc"
diff --git a/chalk/colorspaces/ycbcr_u8/ycbcr_u8_plugin.h b/chalk/colorspaces/ycbcr_u8/ycbcr_u8_plugin.h
new file mode 100644
index 000000000..982746144
--- /dev/null
+++ b/chalk/colorspaces/ycbcr_u8/ycbcr_u8_plugin.h
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef YCBCR_U8_PLUGIN_H_
+#define YCBCR_U8_PLUGIN_H_
+
+#include <kparts/plugin.h>
+
+/**
+ * A plugin wrapper around the YCbCr U8 colour space strategy.
+ */
+class YCbCrU8Plugin : public KParts::Plugin
+{
+    Q_OBJECT
+  TQ_OBJECT
+public:
+    YCbCrU8Plugin(TQObject *tqparent, const char *name, const TQStringList &);
+    virtual ~YCbCrU8Plugin();
+
+};
+
+
+#endif // YCBCR_U8_PLUGIN_H_
diff --git a/chalk/configure.in.bot b/chalk/configure.in.bot
new file mode 100644
index 000000000..1f070ba81
--- /dev/null
+++ b/chalk/configure.in.bot
@@ -0,0 +1,19 @@
+if test -z "$LCMS_LIBS"; then
+  echo ""
+  echo "LittleCMS is missing, Chalk will not be built."
+  echo ""
+  echo "If you want to compile Chalk you should install:"
+  echo "  * lcms 1.15 or newer (http://www.littlecms.com/)"
+  echo ""
+  all_tests=bad
+else
+  if test -z "$GLLIB"; then
+    echo ""
+    echo "You're missing OpenGL libraries. chalk will"
+    echo "not be able to use OpenGL for hardware"
+    echo "accelerated rendering."
+    echo ""
+  fi
+fi
+
+
diff --git a/chalk/configure.in.in b/chalk/configure.in.in
new file mode 100644
index 000000000..733abe215
--- /dev/null
+++ b/chalk/configure.in.in
@@ -0,0 +1,113 @@
+KDE_CHECK_LIB(Xi, XOpenDisplay, [
+	LIB_XINPUTEXT="-lXi"
+	AC_DEFINE(HAVE_XINPUTEXT, 1, [Define if you have the X11 Input Extension])
+	])
+AC_SUBST(LIB_XINPUTEXT)
+
+# Check for lcms
+AC_MSG_CHECKING([for lcms >= 1.15])
+
+have_lcms_header='no'
+KDE_CHECK_HEADER(lcms/lcms.h,have_lcms_header='yes',,)
+if test "$have_lcms_header" = 'yes'
+then
+        AC_DEFINE(LCMS_HEADER, <lcms/lcms.h>, [The correct header])
+
+	echo "#include <lcms/lcms.h>" > conftest.$ac_ext
+	echo "#if LCMS_VERSION < 115" >> conftest.$ac_ext
+	echo "#error Need lcms >= 1.15" >> conftest.$ac_ext
+	echo "#endif" >> conftest.$ac_ext
+	echo "int main() {}" >> conftest.$ac_ext
+
+else
+        # Alternative! Debian does it this way...
+	KDE_CHECK_HEADER(lcms.h,have_lcms_header='yes',,)
+
+    if test "$have_lcms_header" = 'yes'
+    then
+       	AC_DEFINE(LCMS_HEADER, <lcms.h>, [The correct header])
+
+	   echo "#include <lcms.h>" > conftest.$ac_ext
+	   echo "#if LCMS_VERSION < 115" >> conftest.$ac_ext
+	   echo "#error Need lcms >= 1.15" >> conftest.$ac_ext
+	   echo "#endif" >> conftest.$ac_ext
+	   echo "int main() {}" >> conftest.$ac_ext
+    else
+        KDE_CHECK_HEADER(lcms.h,have_lcms_header='yes',,)
+        # and now debian also does it this way... can't they decide for one way of doing stuff ?
+        
+       AC_DEFINE(LCMS_HEADER, <liblcms1/lcms.h>, [The correct header])
+
+       echo "#include <liblcms1/lcms.h>" > conftest.$ac_ext
+       echo "#if LCMS_VERSION < 115" >> conftest.$ac_ext
+       echo "#error Need lcms >= 1.15" >> conftest.$ac_ext
+       echo "#endif" >> conftest.$ac_ext
+       echo "int main() {}" >> conftest.$ac_ext
+
+   fi
+fi
+
+
+ac_link='$LIBTOOL_SHELL --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries -ltqt conftest.$ac_ext -llcms 1>&5'
+
+if AC_TRY_EVAL(ac_link) && test -s conftest; then
+    	AC_MSG_RESULT(yes)
+        HAVELCMS="yes"
+        LCMS_LIBS="-llcms"
+else
+	AC_MSG_RESULT(no)
+	HAVELCMS="no"
+	LCMS_LIBS=""
+        DO_NOT_COMPILE="$DO_NOT_COMPILE chalk"
+fi
+
+AC_SUBST(LCMS_LIBS)
+
+# IM 6.1.3 changed the number of arguments to GetMagickInfoList
+
+AC_MSG_CHECKING(if GetMagickInfoList has only 2 arguments)
+CPPFLAGS_TMP="$CPPFLAGS"   # Save preprocessor flags
+CPPFLAGS="$LIBMAGICK_CPPFLAGS"
+LDFLAGS_TMP="$LDFLAGS"
+LDFLAGS="$LDFLAGS -ltqt"
+
+AC_TRY_COMPILE(
+	[#include <stdio.h>
+	#if HAVE_SYS_TYPES_H
+	#include <sys/types.h>
+	#endif
+	#include "magick/api.h"],
+	[const char *pattern; unsigned long ncolors; (void)GetMagickInfoList(pattern, &ncolors)],
+	magick_info_list='yes',
+	magick_info_list='no')
+
+CPPFLAGS="$CPPFLAGS_TMP"  # Restore preprocessor flags
+LDFLAGS="$LDFLAGS_TMP"
+
+if test "$magick_info_list" = 'yes'; then
+	AC_MSG_RESULT(yes)
+  AC_DEFINE([HAVE_OLD_GETMAGICKINFOLIST], 1, [GetMagickInfoList has different number of arguments with versions >= 6.1.3])
+else
+	AC_MSG_RESULT(no)
+fi
+
+# Check for kunittest
+AC_MSG_CHECKING([for kunittest])
+
+have_kunittest_header="no"
+KDE_CHECK_HEADER(kunittest/tester.h, have_kunittest_header="yes", , )
+AM_CONDITIONAL(include_kunittest_tests, test "$have_kunittest_header" = "yes")
+
+# --- OpenGL check ---
+
+AC_HAVE_GL( [], [] )
+
+# --- End of OpenGL check ---
+
+# Check for powf.
+
+AC_CHECK_FUNC(powf, [have_powf="yes"], [AC_CHECK_LIB(m, powf, [have_powf="yes"], [have_powf="no"])])
+
+if test "$have_powf" = 'yes'; then
+  AC_DEFINE([HAVE_POWF], 1, [Define to 1 if your system has powf in <maths.h>])
+fi\
diff --git a/chalk/core/Makefile.am b/chalk/core/Makefile.am
new file mode 100644
index 000000000..30b1eb074
--- /dev/null
+++ b/chalk/core/Makefile.am
@@ -0,0 +1,59 @@
+# all_includes must remain last!
+INCLUDES  = \
+	-I$(srcdir)/../sdk \
+	-I$(srcdir)/tiles \
+	-I$(srcdir)/../chalkcolor \
+	$(KOFFICE_INCLUDES) \
+    $(KOPAINTER_INCLUDES) \
+    $(OPENEXR_CFLAGS) \
+	$(all_includes)
+
+#CXXFLAGS = -shared -fPIC
+
+lib_LTLIBRARIES = libchalkimage.la
+
+libchalkimage_la_SOURCES = kis_adjustment_layer.cc kis_alpha_mask.cc \
+				kis_autobrush_resource.cc kis_autogradient_resource.cc kis_background.cc kis_boundary.cc \
+				kis_brush.cc kis_command.cc kis_convolution_painter.cc kis_fill_painter.cc \
+				kis_filter.cc kis_filter_registry.cc kis_filter_strategy.cc \
+				kis_filter_configuration.cc kis_filter_config_widget.cc kis_gradient.cc kis_gradient_painter.cc \
+				kis_histogram.cc kis_image.cc kis_imagepipe_brush.cc kis_iterator.cc \
+				kis_iterators_pixel.cc kis_layer.cc kis_group_layer.cc kis_paint_layer.cc kis_meta_registry.cc \
+				kis_nameserver.cc kis_painter.cc kis_paintop.cc kis_paintop_registry.cc kis_palette.cc \
+				kis_pattern.cc kis_rect.cc kis_resource.cc kis_rotate_visitor.cc \
+				kis_selected_transaction.cc kis_selection.cc kis_strategy_move.cc kis_transaction.cc \
+				kis_transform_worker.cc kis_vec.cc kis_paint_device.cc kis_paint_device_iface.cc \
+				kis_paint_device_iface.skel kis_image_iface.cc kis_image_iface.skel kis_basic_math_toolbox.cpp \
+				kis_math_toolbox.cpp kis_exif_info.cc kis_thread_pool.cc kis_exif_value.cc \
+				kis_filter_strategy.h kis_random_accessor.cpp kis_random_sub_accessor.cpp \
+			kis_perspective_grid.cpp kis_perspectivetransform_worker.cpp kis_perspective_math.cpp kis_scale_visitor.cc
+
+noinst_HEADERS = kis_rotate_visitor.h kis_selected_transaction.h \
+			kis_strategy_move.h kis_transform_worker.h kis_datamanager.h kis_iteratorpixeltrait.h \
+			kis_merge_visitor.h kis_thread.h kis_thread_pool.h kis_change_profile_visitor.h \
+		kis_perspective_grid.h kis_perspectivetransform_worker.h
+
+include_HEADERS = kis_adjustment_layer.h kis_alpha_mask.h \
+		kis_autobrush_resource.h kis_autogradient_resource.h kis_background.h kis_boundary.h kis_brush.h \
+		kis_command.h kis_convolution_painter.h kis_fill_painter.h kis_filter.h \
+		kis_filter_registry.h kis_gradient.h kis_gradient_painter.h kis_histogram.h kis_image.h \
+		kis_image_iface.h kis_imagepipe_brush.h kis_iterator.h kis_iterators_pixel.h \
+		kis_iteratorpixeltrait.h kis_layer.h kis_meta_registry.h kis_nameserver.h \
+		kis_paint_device_iface.h kis_paint_device.h kis_painter.h kis_paintop.h kis_paintop_registry.h \
+		kis_palette.h kis_pattern.h kis_point.h kis_rect.h kis_resource.h kis_selection.h \
+		kis_transaction.h kis_types.h kis_vec.h kis_filter_config_widget.h \
+		kis_filter_configuration.h kis_exif_info.h kis_exif_value.h kis_substrate.h kis_perspective_math.h kis_scale_visitor.h kis_paint_layer.h kis_layer_visitor.h kis_filter_strategy.h kis_transform_worker.h
+
+libchalkimage_la_LDFLAGS = -version-info 1:0:0 -no-undefined $(all_libraries)
+libchalkimage_la_LIBADD = ../sdk/libchalksdk.la ../chalkcolor/libchalkcolor.la tiles/libchalktile.la $(OPENEXR_LIBS) $(LCMS_LIBS) $(LIB_KOFFICECORE) $(LIB_KOPAINTER) $(LIB_KDECORE) $(LIB_QT) $(OPENEXR_LIBS) 
+
+if include_kunittest_tests
+TESTSDIR = tests
+endif
+
+SUBDIRS = tiles . $(TESTSDIR)
+
+libchalkimage_la_METASOURCES = AUTO
+
+KDE_OPTIONS = nofinal
+
diff --git a/chalk/core/createdcop.py b/chalk/core/createdcop.py
new file mode 100755
index 000000000..bac48f333
--- /dev/null
+++ b/chalk/core/createdcop.py
@@ -0,0 +1,171 @@
+#!/usr/bin/env python
+
+import os, sys
+
+dcopiface_header = """/* This file is part of the KDE project
+ *  Copyright (C) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef %(classname_upper)sIFACE_H
+#define %(classname_upper)sIFACE_H
+
+#include <dcopref.h>
+#include <dcopobj.h>
+
+#include <qstring.h>
+
+class %(classname)s;
+
+class %(classname)sIface : virtual public DCOPObject
+{
+	K_DCOP
+public:
+	%(classname)sIface( %(classname)s * tqparent );
+k_dcop:
+
+private:
+
+	%(classname)s *m_parent;
+};
+
+#endif
+"""
+
+dcopiface_template = """/*
+ *  This file is part of the KDE project
+ *
+ *  Copyright (C) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#include <kapplication.h>
+
+
+#include "%(ifaceheader)s"
+
+#include "%(classheader)s"
+
+#include <dcopclient.h>
+
+%(classname)sIface::%(classname)sIface( %(classname)s * tqparent )
+	: DCOPObject()
+{
+	m_parent = tqparent;
+}
+
+"""
+
+def parseHeader(headerfile, classname):
+	# parse the source class header to get a list of functions we're going to wrap
+	functions = []
+	if (headerfile.tqfind("private:") > -1):
+		lines = headerfile[headerfile.tqfind(classname):headerfile.tqfind("private")].splitlines()
+	else:
+		lines = headerfile[headerfile.tqfind(classname):headerfile.tqfind("#endif")].splitlines()
+	i = 0
+	while i < len(lines):
+		line = lines[i].strip()
+		if (line.startswith("/") or 
+			line.startswith("public:") or 
+			line.startswith("*") or 
+			line.startswith(classname) or
+			line.startswith("class") or
+			line.startswith("Q_OBJECT") or
+			line.startswith("#") or
+			line.startswith("}") or
+			line.startswith("public Q_SLOTS:") or
+			line.tqfind("~")  != -1 or
+			len(line) == 0
+			):
+			i+=1	
+			continue
+		if (line.startswith("protected")):
+			return functions
+		# by now we are reasonable sure that this is a function. We need to find the end of the function definition, and then 
+		# if the return type is not primitive, replace it with dcopref.
+		function = line
+		complete = 0
+		# strip the inline implementation
+		if (line.tqfind("{") > -1):
+			function = line[:line.tqfind("{")]
+			if function.tqfind("}") > -1:
+				function += line[line.tqfind("}") + 1:]
+				complete = 1
+			else:
+				i += 1
+				# search for the missing } on the next lines
+				while i < len(lines):
+					if (lines[i].tqfind("}") > -1):
+						function += lines[i][lines[i].tqfind("}") + 1:]
+						complete = 1
+					i += 1
+		else:
+			complete = 1
+
+		if complete == 0:
+			i+=1
+			continue
+
+		if (function.endswith("= 0;")):
+			function = function[:-4] + ";"
+		print "\t", function
+		i+=1
+			
+
+def createDCOP(header):
+
+	# Determine filenames and classnames
+
+	implementation = header[:-1] + "cc"
+	classname = ""	
+	classname_upper ="_"
+	for part in header[:-2].split("_"):
+		classname = classname + part.capitalize()
+		classname_upper = classname_upper + part.upper() + "_"
+	ifaceheader = header[:-2] + "_iface.h"
+	ifaceimplementation = header[:-2] + "_iface.cc"
+	ifaceclass = classname + "Iface"
+
+	#print "with: ", implementation, classname, classname_upper, ifaceheader, ifaceimplementation, ifaceclass
+	file(ifaceheader, "w+").write(dcopiface_header % { "classname_upper" : classname_upper,
+							   "classname" : classname})
+	file(ifaceimplementation, "w+").write(dcopiface_template % {"ifaceheader" : ifaceheader,
+								    "classheader" : header,
+								    "classname" : classname })
+	functions = parseHeader(open(header).read(), classname)
+
+def main(args):
+	for line in args[1:]:
+		print "Going to create a dcop interface for:", line[:-1]
+		createDCOP(line.strip())
+
+if __name__=="__main__":
+    main(sys.argv)
+
+
diff --git a/chalk/core/kis_adjustment_layer.cc b/chalk/core/kis_adjustment_layer.cc
new file mode 100644
index 000000000..69e8b9398
--- /dev/null
+++ b/chalk/core/kis_adjustment_layer.cc
@@ -0,0 +1,252 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+
+#include <kdebug.h>
+#include <tqimage.h>
+
+#include "kis_debug_areas.h"
+#include "kis_group_layer.h"
+#include "kis_image.h"
+#include "kis_layer.h"
+#include "kis_adjustment_layer.h"
+#include "kis_painter.h"
+#include "kis_undo_adapter.h"
+#include "kis_selection.h"
+#include "kis_fill_painter.h"
+
+KisAdjustmentLayer::KisAdjustmentLayer(KisImageSP img, const TQString &name, KisFilterConfiguration * kfc, KisSelectionSP selection)
+    : KisLayer (img, name, OPACITY_OPAQUE)
+{
+    m_filterConfig = kfc;
+    setSelection( selection );
+    m_cachedPaintDev = new KisPaintDevice( img->colorSpace(), name.latin1());
+    m_showSelection = true;
+    Q_ASSERT(m_cachedPaintDev);
+    connect(img, TQT_SIGNAL(sigSelectionChanged(KisImageSP)),
+            this, TQT_SLOT(slotSelectionChanged(KisImageSP)));
+}
+
+KisAdjustmentLayer::KisAdjustmentLayer(const KisAdjustmentLayer& rhs)
+    : KisLayer(rhs), KisLayerSupportsIndirectPainting(rhs)
+{
+    m_filterConfig = new KisFilterConfiguration(*rhs.m_filterConfig);
+    if (rhs.m_selection) {
+        m_selection = new KisSelection( *rhs.m_selection.data() );
+        m_selection->setParentLayer(this);
+        m_selection->setInterestedInDirtyness(true);
+        connect(rhs.image(), TQT_SIGNAL(sigSelectionChanged(KisImageSP)),
+                this, TQT_SLOT(slotSelectionChanged(KisImageSP)));
+    }
+    m_cachedPaintDev = new KisPaintDevice( *rhs.m_cachedPaintDev.data() );
+    m_showSelection = false;
+}
+
+
+KisAdjustmentLayer::~KisAdjustmentLayer()
+{
+    delete m_filterConfig;
+}
+
+
+KisLayerSP KisAdjustmentLayer::clone() const
+{
+    return new KisAdjustmentLayer(*this);
+}
+
+
+void KisAdjustmentLayer::resetCache()
+{
+    m_cachedPaintDev = new KisPaintDevice(image()->colorSpace(), name().latin1());
+}
+
+KisFilterConfiguration * KisAdjustmentLayer::filter()
+{
+    Q_ASSERT(m_filterConfig);
+    return m_filterConfig;
+}
+
+
+void KisAdjustmentLayer::setFilter(KisFilterConfiguration * filterConfig)
+{
+    Q_ASSERT(filterConfig);
+    m_filterConfig = filterConfig;
+}
+
+
+KisSelectionSP KisAdjustmentLayer::selection()
+{
+    return m_selection;
+}
+
+void KisAdjustmentLayer::setSelection(KisSelectionSP selection)
+{
+    m_selection = new KisSelection();
+    KisFillPainter gc(m_selection.data());
+    KisColorSpace * cs = KisMetaRegistry::instance()->csRegistry()->getRGB8();
+
+    if (selection) {
+        gc.bitBlt(0, 0, COMPOSITE_COPY, selection.data(),
+                  0, 0, image()->bounds().width(), image()->bounds().height());
+    } else {
+        gc.fillRect(image()->bounds(), KisColor(TQt::white, cs), MAX_SELECTED);
+    }
+
+    gc.end();
+
+    m_selection->setParentLayer(this);
+    m_selection->setInterestedInDirtyness(true);
+}
+
+void KisAdjustmentLayer::clearSelection()
+{
+    KisFillPainter gc(m_selection.data());
+    KisColorSpace * cs = KisMetaRegistry::instance()->csRegistry()->getRGB8();
+
+    TQRect bounds = extent();
+    bounds |= image()->bounds();
+    gc.fillRect(bounds, KisColor(TQt::white, cs), MIN_SELECTED);
+    gc.end();
+}
+
+
+TQ_INT32 KisAdjustmentLayer::x() const
+{
+    if (m_selection)
+        return m_selection->getX();
+    else
+        return 0;
+}
+
+void KisAdjustmentLayer::setX(TQ_INT32 x)
+{
+    if (m_selection) {
+        m_selection->setX(x);
+        resetCache();
+    }
+
+}
+
+TQ_INT32 KisAdjustmentLayer::y() const
+{
+    if (m_selection)
+        return m_selection->getY();
+    else
+        return 0;
+}
+
+void KisAdjustmentLayer::setY(TQ_INT32 y)
+{
+    if (m_selection) {
+        m_selection->setY(y);
+        resetCache();
+    }
+}
+
+TQRect KisAdjustmentLayer::extent() const
+{
+    if (m_selection)
+        return m_selection->selectedRect();
+    else if (image())
+        return image()->bounds();
+    else
+        return TQRect();
+}
+
+TQRect KisAdjustmentLayer::exactBounds() const
+{
+    if (m_selection)
+        return m_selection->selectedRect();
+    else if (image())
+        return image()->bounds();
+    else
+        return TQRect();
+}
+
+bool KisAdjustmentLayer::accept(KisLayerVisitor & v)
+{
+    return v.visit( this );
+}
+
+void KisAdjustmentLayer::paintSelection(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h)
+{
+    if (showSelection() && selection())
+        selection()->paintSelection(img, x, y, w, h);
+}
+
+void KisAdjustmentLayer::paintSelection(TQImage &img, const TQRect& scaledImageRect, const TQSize& scaledImageSize, const TQSize& imageSize)
+{
+    if (showSelection() && selection())
+        selection()->paintSelection(img, scaledImageRect, scaledImageSize, imageSize);
+}
+
+TQImage KisAdjustmentLayer::createThumbnail(TQ_INT32 w, TQ_INT32 h)
+{
+    if (!selection())
+        return TQImage();
+
+    int srcw, srch;
+    if( image() )
+    {
+        srcw = image()->width();
+        srch = image()->height();
+    }
+    else
+    {
+        const TQRect e = extent();
+        srcw = e.width();
+        srch = e.height();
+    }
+
+    if (w > srcw)
+    {
+        w = srcw;
+        h = TQ_INT32(double(srcw) / w * h);
+    }
+    if (h > srch)
+    {
+        h = srch;
+        w = TQ_INT32(double(srch) / h * w);
+    }
+
+    if (srcw > srch)
+        h = TQ_INT32(double(srch) / srcw * w);
+    else if (srch > srcw)
+        w = TQ_INT32(double(srcw) / srch * h);
+
+    TQColor c;
+    TQ_UINT8 opacity;
+    TQImage img(w,h,32);
+
+    for (TQ_INT32 y=0; y < h; ++y) {
+        TQ_INT32 iY = (y * srch ) / h;
+        for (TQ_INT32 x=0; x < w; ++x) {
+            TQ_INT32 iX = (x * srcw ) / w;
+            m_selection->pixel(iX, iY, &c, &opacity);
+            img.setPixel(x, y, tqRgb(opacity, opacity, opacity));
+        }
+    }
+
+    return img;
+}
+
+void KisAdjustmentLayer::slotSelectionChanged(KisImageSP image) {
+    image->setModified();
+}
+
+#include "kis_adjustment_layer.moc"
diff --git a/chalk/core/kis_adjustment_layer.h b/chalk/core/kis_adjustment_layer.h
new file mode 100644
index 000000000..b8b76437f
--- /dev/null
+++ b/chalk/core/kis_adjustment_layer.h
@@ -0,0 +1,106 @@
+/*
+ *  Copyright (c) 2006 Boudewijn Rempt
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+#ifndef KIS_ADJUSTMENT_LAYER_H_
+#define KIS_ADJUSTMENT_LAYER_H_
+
+#include <tqobject.h>
+#include "kis_types.h"
+#include "kis_layer_visitor.h"
+#include "kis_composite_op.h"
+#include <koffice_export.h>
+
+class KNamedCommand;
+class TQPainter;
+class KisUndoAdapter;
+class KisGroupLayer;
+class KisFilterConfiguration;
+
+/**
+ * Class that contains a KisFilter and optionally a KisSelection. The combination
+ * is used by to influence the rendering of the layers under this layer in the
+ * layerstack
+ **/
+class KRITACORE_EXPORT KisAdjustmentLayer : public KisLayer, public KisLayerSupportsIndirectPainting
+{
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    /**
+     * Create a new adjustment layer with the given configuration and selection.
+     * Note that the selection will be _copied_. 
+     */
+    KisAdjustmentLayer(KisImageSP img, const TQString &name, KisFilterConfiguration * kfc, KisSelectionSP selection);
+    KisAdjustmentLayer(const KisAdjustmentLayer& rhs);
+    virtual ~KisAdjustmentLayer();
+
+    /// Return a copy of this layer
+    virtual KisLayerSP clone() const;
+
+public:
+    
+    KisFilterConfiguration * filter();
+    void setFilter(KisFilterConfiguration * filterConfig);
+
+    KisSelectionSP selection();
+    
+    /// Set the selction of this adjustment layer to a copy of selection.
+    void setSelection(KisSelectionSP selection);
+
+    /// Clears the selection (doesn't call any of the update or dirty methods)
+    void clearSelection();
+
+    virtual void paintSelection(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+    virtual void paintSelection(TQImage &img, const TQRect& scaledImageRect, const TQSize& scaledImageSize, const TQSize& imageSize);
+public:
+    
+    virtual TQ_INT32 x() const;
+    virtual void setX(TQ_INT32);
+
+    virtual TQ_INT32 y() const;
+    virtual void setY(TQ_INT32);
+
+    /// Returns an approximation of where the bounds on actual data are in this layer
+    virtual TQRect extent() const;
+    
+    /// Returns the exact bounds of where the actual data resides in this layer
+    virtual TQRect exactBounds() const;
+
+    virtual bool accept(KisLayerVisitor &);
+
+    virtual void resetCache();
+    virtual KisPaintDeviceSP cachedPaintDevice() { return m_cachedPaintDev; }
+
+    bool showSelection() const { return m_showSelection; }
+    void setSelection(bool b) { m_showSelection = b; }
+
+    virtual TQImage createThumbnail(TQ_INT32 w, TQ_INT32 h);
+
+    // KisLayerSupportsIndirectPainting
+    virtual KisLayer* layer() { return this; }
+private:
+    bool m_showSelection;
+    KisFilterConfiguration * m_filterConfig;
+    KisSelectionSP m_selection;
+    KisPaintDeviceSP m_cachedPaintDev;
+private slots:
+    void slotSelectionChanged(KisImageSP image);
+};
+
+#endif // KIS_ADJUSTMENT_LAYER_H_
+
diff --git a/chalk/core/kis_alpha_mask.cc b/chalk/core/kis_alpha_mask.cc
new file mode 100644
index 000000000..1b40e806b
--- /dev/null
+++ b/chalk/core/kis_alpha_mask.cc
@@ -0,0 +1,132 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <cfloat>
+#include <tqimage.h>
+#include <tqvaluevector.h>
+
+#include <kdebug.h>
+
+#include "kis_global.h"
+#include "kis_alpha_mask.h"
+
+KisAlphaMask::KisAlphaMask(const TQImage& img, bool hasColor)
+{
+    m_width = img.width();
+    m_height = img.height();
+
+    if (hasColor) {
+        copyAlpha(img);
+    }
+    else {
+        computeAlpha(img);
+    }
+}
+
+KisAlphaMask::KisAlphaMask(const TQImage& img)
+{
+    m_width = img.width();
+    m_height = img.height();
+
+    if (!img.allGray()) {
+        copyAlpha(img);
+    }
+    else {
+        computeAlpha(img);
+    }
+}
+
+KisAlphaMask::KisAlphaMask(TQ_INT32 width, TQ_INT32 height)
+{
+    m_width = width;
+    m_height = height;
+
+    m_data.resize(width * height, OPACITY_TRANSPARENT);
+}
+
+KisAlphaMask::~KisAlphaMask()
+{
+}
+
+TQ_INT32 KisAlphaMask::width() const
+{
+    return m_width;
+}
+
+TQ_INT32 KisAlphaMask::height() const
+{
+    return m_height;
+}
+
+void KisAlphaMask::setAlphaAt(TQ_INT32 x, TQ_INT32 y, TQ_UINT8 alpha)
+{
+    if (y >= 0 && y < m_height && x >= 0 && x < m_width) {
+        m_data[(y * m_width) + x] = alpha;
+    }
+}
+
+void KisAlphaMask::copyAlpha(const TQImage& img)
+{
+    for (int y = 0; y < img.height(); y++) {
+        for (int x = 0; x < img.width(); x++) {
+                        TQRgb c = img.pixel(x,y);
+                        TQ_UINT8 a = (tqGray(c) * tqAlpha(c)) / 255;
+            m_data.push_back(a);
+
+        }
+    }
+}
+
+void KisAlphaMask::computeAlpha(const TQImage& img)
+{
+    // The brushes are mostly grayscale on a white background,
+    // although some do have a colors. The alpha channel is seldom
+    // used, so we take the average gray value of this pixel of
+    // the brush as the setting for the opacitiy. We need to
+    // invert it, because 255, 255, 255 is white, which is
+    // completely transparent, but 255 corresponds to
+    // OPACITY_OPAQUE.
+
+    for (int y = 0; y < img.height(); y++) {
+        for (int x = 0; x < img.width(); x++) {
+            m_data.push_back(255 - tqRed(img.pixel(x, y)));
+        }
+    }
+}
+
+KisAlphaMaskSP KisAlphaMask::interpolate(KisAlphaMaskSP tqmask1, KisAlphaMaskSP tqmask2, double t)
+{
+    Q_ASSERT((tqmask1->width() == tqmask2->width()) && (tqmask1->height() == tqmask2->height()));
+    Q_ASSERT(t > -DBL_EPSILON && t < 1 + DBL_EPSILON);
+
+    int width = tqmask1->width();
+    int height = tqmask1->height();
+    KisAlphaMaskSP outputMask = new KisAlphaMask(width, height);
+    Q_CHECK_PTR(outputMask);
+
+    for (int x = 0; x < width; x++) {
+        for (int y = 0; y < height; y++) {
+            TQ_UINT8 d = static_cast<TQ_UINT8>((1 - t) * tqmask1->alphaAt(x, y) + t * tqmask2->alphaAt(x, y));
+            outputMask->setAlphaAt(x, y, d);
+        }
+    }
+
+    return outputMask;
+}
+
+
diff --git a/chalk/core/kis_alpha_mask.h b/chalk/core/kis_alpha_mask.h
new file mode 100644
index 000000000..4665857e3
--- /dev/null
+++ b/chalk/core/kis_alpha_mask.h
@@ -0,0 +1,106 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_ALPHA_MASK_
+#define KIS_ALPHA_MASK_
+
+#include <tqimage.h>
+#include <tqvaluevector.h>
+
+#include <ksharedptr.h>
+
+#include "kis_global.h"
+#include "kis_types.h"
+
+/**
+ * KisAlphaMask is intended to create alpha values from a TQImage for use
+ * in brush creation. It is not a generic alpha tqmask that can be used with
+ * KisPaintDevices: use a KisSelection for that.
+ */
+class KisAlphaMask : public KShared {
+    
+ public:
+    /**
+       Create an alpha tqmask based on the specified TQImage. If the image is
+       not a grayscale, the tqmask value is calculated from the effective grey
+       level and alpha value.
+    */
+    KisAlphaMask(const TQImage& img);
+
+    /**
+       As above except quicker as the image does not need to be scanned
+       to see if it has any colour pixels.
+    */
+    KisAlphaMask(const TQImage& img, bool hasColor);
+
+    /**
+       Create a transparent tqmask.
+    */
+    KisAlphaMask(TQ_INT32 width, TQ_INT32 height);
+
+    virtual ~KisAlphaMask();
+
+    /**
+       @return the number of alpha values in a scanline.
+    */
+    TQ_INT32 height() const;
+
+    /**
+       @return the number of lines in the tqmask.
+     */
+       TQ_INT32 width() const;
+
+    /**
+       @return the alpha value at the specified position.
+
+       Returns TQ_UINT8 OPACITY_TRANSPARENT if the value is
+       outside the bounds of the tqmask.
+
+       XXX: this is, of course, not the best way of tqmasking.
+       Better would be to let KisAlphaMask fill a chunk of memory
+       with the alpha values at the right position, something like
+       void applyMask(TQ_UINT8 *pixeldata, TQ_INT32 pixelWidth,
+       TQ_INT32 alphaPos). That would be fastest, or we could
+       provide an iterator over the tqmask, that would be nice, too.
+    */
+    inline TQ_UINT8 alphaAt(TQ_INT32 x, TQ_INT32 y) const
+    {
+	if (y >= 0 && y < m_height && x >= 0 && x < m_width) {
+	    return m_data[(y * m_width) + x];
+	}
+	else {
+	    return OPACITY_TRANSPARENT;
+	}
+    }
+
+    void setAlphaAt(TQ_INT32 x, TQ_INT32 y, TQ_UINT8 alpha);
+
+    // Create a new tqmask by interpolating between tqmask1 and tqmask2 as t
+    // goes from 0 to 1.
+    static KisAlphaMaskSP interpolate(KisAlphaMaskSP tqmask1, KisAlphaMaskSP tqmask2, double t);
+
+private:
+    void computeAlpha(const TQImage& img);
+    void copyAlpha(const TQImage& img);
+
+    TQValueVector<TQ_UINT8> m_data;
+    TQ_INT32 m_width;
+    TQ_INT32 m_height;
+};
+
+#endif // KIS_ALPHA_MASK_
+
diff --git a/chalk/core/kis_autobrush_resource.cc b/chalk/core/kis_autobrush_resource.cc
new file mode 100644
index 000000000..9a09fe788
--- /dev/null
+++ b/chalk/core/kis_autobrush_resource.cc
@@ -0,0 +1,106 @@
+/*
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+ 
+#include "kis_autobrush_resource.h"
+#include <kdebug.h>
+
+void KisAutobrushShape::createBrush( TQImage* img)
+{
+    img->create(m_w, m_h, 32);
+    for(int j = 0; j < m_h; j++)
+    {
+        for(int i = 0; i < m_w; i++)
+        {
+            TQ_INT8 v = valueAt(i,j);
+            img->setPixel( i, j, tqRgb(v,v,v));
+        }
+    }
+}
+
+KisAutobrushCircleShape::KisAutobrushCircleShape(TQ_INT32 w, TQ_INT32 h, double fh, double fv)
+    : KisAutobrushShape( w, h, w / 2.0 - fh, h / 2.0 - fv),
+        m_xcentre ( w / 2.0 ),
+        m_ycentre ( h / 2.0 ),
+        m_xcoef ( 2.0 / w ),
+        m_ycoef ( 2.0 / h ),
+        m_xfadecoef ( (m_fh == 0) ? 1 : ( 1.0 / m_fh)),
+        m_yfadecoef ( (m_fv == 0) ? 1 : ( 1.0 / m_fv))
+{
+}
+TQ_INT8 KisAutobrushCircleShape::valueAt(TQ_INT32 x, TQ_INT32 y)
+{
+    double xr = (x - m_xcentre) + 0.5;
+    double yr = (y - m_ycentre) + 0.5;
+    double n = norme( xr * m_xcoef, yr * m_ycoef);
+    if( n > 1 )
+    {
+        return 255;
+    }
+    else
+    {
+        double normeFade = norme( xr * m_xfadecoef, yr * m_yfadecoef );
+        if( normeFade > 1)
+        {
+            double xle, yle;
+            // xle stands for x-coordinate limit exterior
+            // yle stands for y-coordinate limit exterior
+            // we are computing the coordinate on the external ellipse in order to compute
+            // the fade value
+            if( xr == 0 )
+            {
+                xle = 0;
+                yle = yr > 0 ? 1/m_ycoef : -1/m_ycoef;
+            } else {
+                double c = yr / (double)xr;
+                xle = sqrt(1 / norme( m_xcoef, c * m_ycoef ));
+                xle = xr > 0 ? xle : -xle;
+                yle = xle * c;
+            }
+            // On the internal limit of the fade area, normeFade is equal to 1
+            double normeFadeLimitE = norme( xle * m_xfadecoef, yle * m_yfadecoef );
+            return (uchar)(255 * ( normeFade - 1 ) / ( normeFadeLimitE - 1 ));
+        } else {
+            return 0;
+        }
+    }
+}
+
+KisAutobrushRectShape::KisAutobrushRectShape(TQ_INT32 w, TQ_INT32 h, double fh, double fv)
+    : KisAutobrushShape( w, h, w / 2.0 - fh, h / 2.0 - fv),
+        m_xcentre ( w / 2.0 ),
+        m_ycentre ( h / 2.0 ),
+        m_c( fv/fh)
+{
+}
+TQ_INT8 KisAutobrushRectShape::valueAt(TQ_INT32 x, TQ_INT32 y)
+{
+    double xr = TQABS(x - m_xcentre);
+    double yr = TQABS(y - m_ycentre);
+    if( xr > m_fh || yr > m_fv )
+    {
+        if( yr <= ((xr - m_fh) * m_c + m_fv )  )
+        {
+            return (uchar)(255 * (xr - m_fh) / (m_w - m_fh));
+        } else {
+            return (uchar)(255 * (yr - m_fv) / (m_w - m_fv));
+        }
+    }
+    else {
+        return 0;
+    }
+}
diff --git a/chalk/core/kis_autobrush_resource.h b/chalk/core/kis_autobrush_resource.h
new file mode 100644
index 000000000..44708efa9
--- /dev/null
+++ b/chalk/core/kis_autobrush_resource.h
@@ -0,0 +1,71 @@
+/*
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _KIS_AUTOBRUSH_RESOURCE_H_
+#define _KIS_AUTOBRUSH_RESOURCE_H_
+
+#include "kis_brush.h"
+
+class KisAutobrushShape {
+    public:
+        KisAutobrushShape(TQ_INT32 w, TQ_INT32 h, double fh, double fv) : m_w(w), m_h(h), m_fh(fh), m_fv(fv)
+        { };
+        void createBrush( TQImage* img);
+    protected:
+        virtual TQ_INT8 valueAt(TQ_INT32 x, TQ_INT32 y) =0;
+        TQ_INT32 m_w, m_h;
+        double m_fh, m_fv;
+};
+
+class KisAutobrushCircleShape : public KisAutobrushShape {
+    public:
+        KisAutobrushCircleShape(TQ_INT32 w, TQ_INT32 h, double fh, double fv);
+    public:
+        virtual TQ_INT8 valueAt(TQ_INT32 x, TQ_INT32 y);
+    private:
+        double norme(double a, double b)
+        {
+            return a*a + b * b;
+        }
+    private:
+        double m_xcentre, m_ycentre;
+        double m_xcoef, m_ycoef;
+        double m_xfadecoef, m_yfadecoef;
+};
+
+class KisAutobrushRectShape : public KisAutobrushShape {
+    public:
+        KisAutobrushRectShape(TQ_INT32 w, TQ_INT32 h, double fh, double fv);
+    protected:
+        virtual TQ_INT8 valueAt(TQ_INT32 x, TQ_INT32 y);
+    private:
+        double m_xcentre, m_ycentre, m_c;
+};
+
+class KisAutobrushResource : public KisBrush
+{
+    public:
+        KisAutobrushResource(TQImage& img) : KisBrush("")
+        {
+            setImage(img);
+            setBrushType(MASK);
+        };
+    public:
+        virtual bool load() { return false; };
+};
+#endif // _KIS_AUTOBRUSH_RESOURCE_H_
diff --git a/chalk/core/kis_autogradient_resource.cc b/chalk/core/kis_autogradient_resource.cc
new file mode 100644
index 000000000..671e8fc2f
--- /dev/null
+++ b/chalk/core/kis_autogradient_resource.cc
@@ -0,0 +1,221 @@
+/*
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *                2004 Sven Langkamp <longamp@reallygood.de>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_gradient.h"
+#include "kis_autogradient_resource.h"
+
+// FIXME: use the same #define as in kis_gradient.cc, probably best customizable?
+#define PREVIEW_WIDTH 64
+#define PREVIEW_HEIGHT 64
+
+
+void KisAutogradientResource::createSegment( int interpolation, int colorInterpolation, double startOffset, double endOffset, double middleOffset, TQColor left, TQColor right )
+{
+    pushSegment(new KisGradientSegment(interpolation, colorInterpolation, startOffset, middleOffset, endOffset, Color( left, 1 ), Color( right, 1 )));
+
+}
+
+const TQValueVector<double> KisAutogradientResource::getHandlePositions() const
+{
+    TQValueVector<double> handlePositions;
+
+    handlePositions.push_back(m_segments[0]->startOffset());
+    for (uint i = 0; i < m_segments.count(); i++)
+    {
+        handlePositions.push_back(m_segments[i]->endOffset());
+    }
+    return handlePositions;
+}
+
+const TQValueVector<double> KisAutogradientResource::getMiddleHandlePositions() const
+{
+    TQValueVector<double> middleHandlePositions;
+
+    for (uint i = 0; i < m_segments.count(); i++)
+    {
+        middleHandlePositions.push_back(m_segments[i]->middleOffset());
+    }
+    return middleHandlePositions;
+}
+
+void KisAutogradientResource::moveSegmentStartOffset( KisGradientSegment* segment, double t)
+{
+    TQValueVector<KisGradientSegment*>::iterator it = tqFind( m_segments.begin(), m_segments.end(), segment );
+    if ( it != m_segments.end() )
+    {
+        if ( it == m_segments.begin() )
+        {
+            segment->setStartOffset( 0.0 );
+            return;
+        }
+        KisGradientSegment* previousSegment = (*(it-1));
+        if ( t > segment->startOffset()  )
+        {
+            if( t > segment->middleOffset() )
+                t = segment->middleOffset();
+        }
+        else {
+            if( t < previousSegment->middleOffset() )
+                t = previousSegment->middleOffset();
+        }
+        previousSegment->setEndOffset( t );
+        segment->setStartOffset( t );
+    }
+}
+
+void KisAutogradientResource::moveSegmentEndOffset( KisGradientSegment* segment, double t)
+{
+    TQValueVector<KisGradientSegment*>::iterator it = tqFind( m_segments.begin(), m_segments.end(), segment );
+    if ( it != m_segments.end() )
+    {
+        if ( it+1 == m_segments.end() )
+        {
+            segment->setEndOffset( 1.0 );
+            return;
+        }
+        KisGradientSegment* followingSegment = (*(it+1));
+        if ( t < segment->endOffset() )
+        {
+            if( t < segment->middleOffset() )
+                t = segment->middleOffset();
+        }
+        else {
+            if( t > followingSegment->middleOffset() )
+                t = followingSegment->middleOffset();
+        }
+        followingSegment->setStartOffset( t );
+        segment->setEndOffset( t );
+    }
+}
+
+void KisAutogradientResource::moveSegmentMiddleOffset( KisGradientSegment* segment, double t)
+{
+    if( segment )
+    {
+        if( t > segment->endOffset() )
+            segment->setMiddleOffset( segment->endOffset() );
+        else if( t < segment->startOffset() )
+            segment->setMiddleOffset( segment->startOffset() );
+        else
+            segment->setMiddleOffset( t );
+    }
+}
+
+void KisAutogradientResource::splitSegment( KisGradientSegment* segment )
+{
+    Q_ASSERT(segment != 0);
+    TQValueVector<KisGradientSegment*>::iterator it = tqFind( m_segments.begin(), m_segments.end(), segment );
+    if ( it != m_segments.end() )
+    {
+        KisGradientSegment* newSegment = new KisGradientSegment(
+                segment->interpolation(), segment->colorInterpolation(),
+                segment ->startOffset(),
+                ( segment->middleOffset() - segment->startOffset() ) / 2 + segment->startOffset(),
+                segment->middleOffset(),
+                segment->startColor(),
+                segment->colorAt( segment->middleOffset() ) );
+        m_segments.insert( it, newSegment );
+        segment->setStartColor( segment->colorAt( segment->middleOffset() ) );
+        segment->setStartOffset( segment->middleOffset() );
+        segment->setMiddleOffset( ( segment->endOffset() - segment->startOffset() ) / 2 + segment->startOffset() );
+    }
+}
+
+void KisAutogradientResource::duplicateSegment( KisGradientSegment* segment )
+{
+    Q_ASSERT(segment != 0);
+    TQValueVector<KisGradientSegment*>::iterator it = tqFind( m_segments.begin(), m_segments.end(), segment );
+    if ( it != m_segments.end() )
+    {
+        double middlePostionPercentage = ( segment->middleOffset() - segment->startOffset() ) / segment->length();
+        double center = segment->startOffset() + segment->length() / 2;
+        KisGradientSegment* newSegment = new KisGradientSegment(
+                segment->interpolation(), segment->colorInterpolation(),
+                segment ->startOffset(),
+                segment->length() / 2 * middlePostionPercentage + segment->startOffset(),
+                center, segment->startColor(),
+                segment->endColor() );
+        m_segments.insert( it, newSegment );
+        segment->setStartOffset( center );
+        segment->setMiddleOffset( segment->length() * middlePostionPercentage  + segment->startOffset() );
+    }
+}
+
+void KisAutogradientResource::mirrorSegment( KisGradientSegment* segment )
+{
+    Q_ASSERT(segment != 0);
+    Color tmpColor = segment->startColor();
+    segment->setStartColor( segment->endColor() );
+    segment->setEndColor( tmpColor );
+    segment->setMiddleOffset( segment->endOffset() - ( segment->middleOffset() - segment->startOffset() ) );
+
+    if( segment->interpolation() == INTERP_SPHERE_INCREASING )
+        segment->setInterpolation( INTERP_SPHERE_DECREASING );
+    else if( segment->interpolation() == INTERP_SPHERE_DECREASING )
+        segment->setInterpolation( INTERP_SPHERE_INCREASING );
+
+    if( segment->colorInterpolation() == COLOR_INTERP_HSV_CW )
+        segment->setColorInterpolation( COLOR_INTERP_HSV_CCW );
+    else if( segment->colorInterpolation() == COLOR_INTERP_HSV_CCW )
+        segment->setColorInterpolation( COLOR_INTERP_HSV_CW );
+}
+
+KisGradientSegment* KisAutogradientResource::removeSegment( KisGradientSegment* segment )
+{
+    Q_ASSERT(segment != 0);
+    if( m_segments.count() < 2 )
+        return 0;
+    TQValueVector<KisGradientSegment*>::iterator it = tqFind( m_segments.begin(), m_segments.end(), segment );
+    if ( it != m_segments.end() )
+    {
+        double middlePostionPercentage;
+        KisGradientSegment* nextSegment;
+        if( it == m_segments.begin() )
+        {
+            nextSegment = (*(it+1));
+            middlePostionPercentage = ( nextSegment->middleOffset() - nextSegment->startOffset() ) / nextSegment->length();
+            nextSegment->setStartOffset( segment->startOffset() );
+            nextSegment->setMiddleOffset( middlePostionPercentage * nextSegment->length() + nextSegment->startOffset() );
+        }
+        else
+        {
+            nextSegment = (*(it-1));
+            middlePostionPercentage = ( nextSegment->middleOffset() - nextSegment->startOffset() ) / nextSegment->length();
+            nextSegment->setEndOffset( segment->endOffset() );
+            nextSegment->setMiddleOffset( middlePostionPercentage * nextSegment->length() + nextSegment->startOffset() );
+        }
+
+        delete segment;
+        m_segments.erase( it );
+        return nextSegment;
+    }
+    return 0;
+}
+
+bool KisAutogradientResource::removeSegmentPossible() const
+{
+    if( m_segments.count() < 2 )
+        return false;
+    return true;
+}
+
+void KisAutogradientResource::updatePreview()
+{
+    setImage( generatePreview( PREVIEW_WIDTH, PREVIEW_HEIGHT ) );
+}
diff --git a/chalk/core/kis_autogradient_resource.h b/chalk/core/kis_autogradient_resource.h
new file mode 100644
index 000000000..37546a02d
--- /dev/null
+++ b/chalk/core/kis_autogradient_resource.h
@@ -0,0 +1,88 @@
+/*
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *                2004 Sven Langkamp <longamp@reallygood.de>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _KIS_AUTOGRADIENT_RESOURCE_H_ 
+#define _KIS_AUTOGRADIENT_RESOURCE_H_
+
+#include "kis_gradient.h"
+
+class KisAutogradientResource : public KisGradient
+{
+
+public:
+    KisAutogradientResource() : KisGradient("") {}
+
+public:
+
+    void createSegment( int interpolation, int colorInterpolation, double startOffset, double endOffset, double middleOffset, TQColor left, TQColor right );
+
+    const TQValueVector<double> getHandlePositions() const;
+    const TQValueVector<double> getMiddleHandlePositions() const;
+
+    /** 
+     * Moves the StartOffset of the specified segment to the specified value
+     * and corrects the endoffset of the previous segment.
+     * If the segment is the first Segment the startoffset will be set to 0.0 .
+     * The offset will maximally be moved till the middle of the current or the previous
+     * segment
+     */
+    void moveSegmentStartOffset( KisGradientSegment* segment, double t);
+
+    /** 
+     * Moves the endoffset of the specified segment to the specified value
+     * and corrects the startoffset of the following segment.
+     * If the segment is the last segment the endoffset will be set to 1.0 .
+     * The offset will maximally be moved till the middle of the current or the following
+     * segment
+     */
+    void moveSegmentEndOffset( KisGradientSegment* segment, double t);
+
+    /** 
+     * Moves the Middle of the specified segment to the specified value
+     * The offset will maximally be moved till the endoffset or startoffset of the segment
+     */
+    void moveSegmentMiddleOffset( KisGradientSegment* segment, double t);
+
+
+    void splitSegment( KisGradientSegment* segment );
+    void duplicateSegment( KisGradientSegment* segment );
+    void mirrorSegment( KisGradientSegment* segment );
+
+    /** 
+     * Removes the specific segment from the gradient.
+     * @return The segment which will be at the place of the old segment.
+     * 0 if the segment is not in the gradient or it is not possible to remove the segment.
+     */
+    KisGradientSegment* removeSegment( KisGradientSegment* segment );
+
+    /** 
+     * Checks if it's possible to remove an segment(at least two segments in the gradient)
+     * @return true if it's possible to remove an segment
+     */
+    bool removeSegmentPossible() const;
+        
+    /**
+     * Recreates the preview of the gradient
+     */
+    void updatePreview();
+public:
+    virtual bool load() { return false; };
+};
+
+#endif // _KIS_AUTOGRADIENT_RESOURCE_H_
diff --git a/chalk/core/kis_background.cc b/chalk/core/kis_background.cc
new file mode 100644
index 000000000..6f881d33f
--- /dev/null
+++ b/chalk/core/kis_background.cc
@@ -0,0 +1,155 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+#include "kis_global.h"
+#include "kis_background.h"
+#include "kis_integer_maths.h"
+
+KisBackground::KisBackground()
+    : KShared()
+{
+    m_patternTile = TQImage(PATTERN_WIDTH, PATTERN_HEIGHT, 32);
+    m_patternTile.setAlphaBuffer(false);
+
+    for (int y = 0; y < PATTERN_HEIGHT; y++)
+    {
+        for (int x = 0; x < PATTERN_WIDTH; x++)
+        {
+            TQ_UINT8 v = 128 + 63 * ((x / 16 + y / 16) % 2);
+            m_patternTile.setPixel(x, y, tqRgb(v, v, v));
+        }
+    }
+}
+
+KisBackground::~KisBackground()
+{
+}
+
+const TQImage& KisBackground::patternTile() const
+{
+    return m_patternTile;
+}
+
+void KisBackground::paintBackground(TQImage image, int imageLeftX, int imageTopY)
+{
+    int patternLeftX;
+
+    if (imageLeftX >= 0) {
+        patternLeftX = imageLeftX % PATTERN_WIDTH;
+    } else {
+        patternLeftX = (PATTERN_WIDTH - (-imageLeftX % PATTERN_WIDTH)) % PATTERN_WIDTH;
+    }
+
+    int patternTopY;
+
+    if (imageTopY >= 0) {
+        patternTopY = imageTopY % PATTERN_HEIGHT;
+    } else {
+        patternTopY = (PATTERN_HEIGHT - (-imageTopY % PATTERN_HEIGHT)) % PATTERN_HEIGHT;
+    }
+
+    int imageWidth = image.width();
+    int imageHeight = image.height();
+
+    int patternY = patternTopY;
+
+    for (int y = 0; y < imageHeight; y++)
+    {
+        TQRgb *imagePixelPtr = reinterpret_cast<TQRgb *>(image.scanLine(y));
+        const TQRgb *patternScanLine = reinterpret_cast<const TQRgb *>(m_patternTile.scanLine(patternY));
+        int patternX = patternLeftX;
+
+        for (int x = 0; x < imageWidth; x++)
+        {
+            TQRgb imagePixel = *imagePixelPtr;
+            TQ_UINT8 imagePixelAlpha = tqAlpha(imagePixel);
+
+            if (imagePixelAlpha != 255) {
+
+                TQRgb patternPixel = patternScanLine[patternX];
+                TQ_UINT8 imageRed = UINT8_BLEND(tqRed(imagePixel), tqRed(patternPixel), imagePixelAlpha);
+                TQ_UINT8 imageGreen = UINT8_BLEND(tqGreen(imagePixel), tqGreen(patternPixel), imagePixelAlpha);
+                TQ_UINT8 imageBlue = UINT8_BLEND(tqBlue(imagePixel), tqBlue(patternPixel), imagePixelAlpha);
+
+                *imagePixelPtr = tqRgba(imageRed, imageGreen, imageBlue, 255);
+            }
+
+            ++imagePixelPtr;
+            ++patternX;
+
+            if (patternX == PATTERN_WIDTH) {
+                patternX = 0;
+            }
+        }
+
+        ++patternY;
+
+        if (patternY == PATTERN_HEIGHT) {
+            patternY = 0;
+        }
+    }
+}
+
+void KisBackground::paintBackground(TQImage img, const TQRect& scaledImageRect, const TQSize& scaledImageSize, const TQSize& imageSize)
+{
+    if (scaledImageRect.isEmpty() || scaledImageSize.isEmpty() || imageSize.isEmpty()) {
+        return;
+    }
+
+    Q_ASSERT(img.size() == scaledImageRect.size());
+
+    if (img.size() != scaledImageRect.size()) {
+        return;
+    }
+
+    TQ_INT32 imageWidth = imageSize.width();
+    TQ_INT32 imageHeight = imageSize.height();
+
+    for (TQ_INT32 y = 0; y < scaledImageRect.height(); ++y) {
+
+        TQ_INT32 scaledY = scaledImageRect.y() + y;
+        TQ_INT32 srcY = (scaledY * imageHeight) / scaledImageSize.height();
+        TQ_INT32 patternY = srcY % PATTERN_HEIGHT;
+
+        TQRgb *imagePixelPtr = reinterpret_cast<TQRgb *>(img.scanLine(y));
+        const TQRgb *patternScanLine = reinterpret_cast<const TQRgb *>(m_patternTile.scanLine(patternY));
+
+        for (TQ_INT32 x = 0; x < scaledImageRect.width(); ++x) {
+
+            TQRgb imagePixel = *imagePixelPtr;
+            TQ_UINT8 imagePixelAlpha = tqAlpha(imagePixel);
+
+            if (imagePixelAlpha != 255) {
+
+                TQ_INT32 scaledX = scaledImageRect.x() + x;
+                TQ_INT32 srcX = (scaledX * imageWidth) / scaledImageSize.width();
+                TQ_INT32 patternX = srcX % PATTERN_WIDTH;
+
+                TQRgb patternPixel = patternScanLine[patternX];
+                TQ_UINT8 imageRed = UINT8_BLEND(tqRed(imagePixel), tqRed(patternPixel), imagePixelAlpha);
+                TQ_UINT8 imageGreen = UINT8_BLEND(tqGreen(imagePixel), tqGreen(patternPixel), imagePixelAlpha);
+                TQ_UINT8 imageBlue = UINT8_BLEND(tqBlue(imagePixel), tqBlue(patternPixel), imagePixelAlpha);
+
+                *imagePixelPtr = tqRgba(imageRed, imageGreen, imageBlue, 255);
+            }
+
+            ++imagePixelPtr;
+        }
+    }
+}
+
+
diff --git a/chalk/core/kis_background.h b/chalk/core/kis_background.h
new file mode 100644
index 000000000..f5b529031
--- /dev/null
+++ b/chalk/core/kis_background.h
@@ -0,0 +1,49 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+#ifndef KIS_BACKGROUND_H_
+#define KIS_BACKGROUND_H_
+
+#include <tqimage.h>
+
+#include <ksharedptr.h>
+
+class KisBackground : public KShared {
+
+public:
+    KisBackground();
+    virtual ~KisBackground();
+
+    // Paint the background pattern into the image, 'behind' the image
+    // contents. The coordinates are for the image's top-left corner
+    // in image space.
+    void paintBackground(TQImage image, int leftX, int topY);
+
+    void paintBackground(TQImage image, const TQRect& scaledImageRect, const TQSize& scaledImageSize, const TQSize& imageSize);
+
+    // Returns the pattern tile.
+    const TQImage& patternTile() const;
+
+protected:
+    static const int PATTERN_WIDTH = 32;
+    static const int PATTERN_HEIGHT = 32;
+
+    TQImage m_patternTile;
+};
+
+#endif // KIS_BACKGROUND_H_
+
diff --git a/chalk/core/kis_basic_math_toolbox.cpp b/chalk/core/kis_basic_math_toolbox.cpp
new file mode 100644
index 000000000..1b397ab56
--- /dev/null
+++ b/chalk/core/kis_basic_math_toolbox.cpp
@@ -0,0 +1,137 @@
+/*
+ *  This file is part of the KDE project
+ *
+ *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_basic_math_toolbox.h"
+
+KisBasicMathToolbox::KisBasicMathToolbox()
+    : KisMathToolbox(KisID("Basic"))
+{
+}
+
+
+KisBasicMathToolbox::~KisBasicMathToolbox()
+{
+}
+
+
+void KisBasicMathToolbox::wavetrans(KisMathToolbox::KisWavelet* wav, KisMathToolbox::KisWavelet* buff, uint halfsize)
+{
+    uint l = (2*halfsize)*wav->depth*sizeof(float);
+    for(uint i = 0; i < halfsize; i++)
+    {
+        float * itLL = buff->coeffs + i*buff->size*buff->depth;
+        float * itHL = buff->coeffs + (i*buff->size + halfsize)*buff->depth;
+        float * itLH = buff->coeffs + (halfsize+i)*buff->size*buff->depth;
+        float * itHH = buff->coeffs + ( (halfsize+i)*buff->size + halfsize)*buff->depth;
+        float * itS11 = wav->coeffs + 2*i*wav->size*wav->depth;
+        float * itS12 = wav->coeffs + (2*i*wav->size+1)*wav->depth;
+        float * itS21 = wav->coeffs + (2*i+1)*wav->size*wav->depth;
+        float * itS22 = wav->coeffs + ((2*i+1)*wav->size+1)*wav->depth;
+        for(uint j = 0; j < halfsize; j++)
+        {
+            for( uint k = 0; k < wav->depth; k++)
+            {
+                *(itLL++) = (*itS11 + *itS12 + *itS21 + *itS22) * M_SQRT1_2;
+                *(itHL++) = (*itS11 - *itS12 + *itS21 - *itS22) * M_SQRT1_2;
+                *(itLH++) = (*itS11 + *itS12 - *itS21 - *itS22) * M_SQRT1_2;
+                *(itHH++) = (*(itS11++) - *(itS12++) - *(itS21++) + *(itS22++)) * M_SQRT1_2;
+            }
+            itS11 += wav->depth; itS12 += wav->depth;
+            itS21 += wav->depth; itS22 += wav->depth;
+        }
+        emit nextStep();
+    }
+    for(uint i = 0; i < halfsize; i++)
+    {
+        uint p = i*wav->size*wav->depth;
+        memcpy(wav->coeffs + p, buff->coeffs + p, l);
+        p = (i + halfsize )*wav->size*wav->depth;
+        memcpy(wav->coeffs + p, buff->coeffs + p, l);
+    }
+    if(halfsize != 1)
+    {
+        wavetrans(wav, buff, halfsize/2);
+    }
+}
+
+void KisBasicMathToolbox::waveuntrans(KisMathToolbox::KisWavelet* wav, KisMathToolbox::KisWavelet* buff, uint halfsize)
+{
+    uint l = (2*halfsize)*wav->depth*sizeof(float);
+    for(uint i = 0; i < halfsize; i++)
+    {
+        float * itLL = wav->coeffs + i*buff->size*buff->depth;
+        float * itHL = wav->coeffs + (i*buff->size + halfsize)*buff->depth;
+        float * itLH = wav->coeffs + (halfsize+i)*buff->size*buff->depth;
+        float * itHH = wav->coeffs + ( (halfsize+i)*buff->size + halfsize)*buff->depth;
+        float * itS11 = buff->coeffs + 2*i*wav->size*wav->depth;
+        float * itS12 = buff->coeffs + (2*i*wav->size+1)*wav->depth;
+        float * itS21 = buff->coeffs + (2*i+1)*wav->size*wav->depth;
+        float * itS22 = buff->coeffs + ((2*i+1)*wav->size+1)*wav->depth;
+        for(uint j = 0; j < halfsize; j++)
+        {
+            for( uint k = 0; k < wav->depth; k++)
+            {
+                *(itS11++) = (*itLL + *itHL + *itLH + *itHH)*0.25*M_SQRT2;
+                *(itS12++) = (*itLL - *itHL + *itLH - *itHH)*0.25*M_SQRT2;
+                *(itS21++) = (*itLL + *itHL - *itLH - *itHH)*0.25*M_SQRT2;
+                *(itS22++) = (*(itLL++) - *(itHL++) - *(itLH++) + *(itHH++))*0.25*M_SQRT2;
+            }
+            itS11 += wav->depth; itS12 += wav->depth;
+            itS21 += wav->depth; itS22 += wav->depth;
+        }
+        emit nextStep();
+    }
+    for(uint i = 0; i < halfsize; i++)
+    {
+        uint p = i*wav->size*wav->depth;
+        memcpy(wav->coeffs + p, buff->coeffs + p, l);
+        p = (i + halfsize )*wav->size*wav->depth;
+        memcpy(wav->coeffs + p, buff->coeffs + p, l);
+    }
+    
+    if(halfsize != wav->size/2)
+    {
+        waveuntrans(wav, buff, halfsize*2);
+    }
+}
+
+KisMathToolbox::KisWavelet* KisBasicMathToolbox::fastWaveletTransformation(KisPaintDeviceSP src, const TQRect& rect,  KisWavelet* buff)
+{
+    if(buff == 0)
+    {
+        buff = initWavelet( src, rect );
+    }
+    KisWavelet* wav = initWavelet( src, rect );
+    transformToFR(src, wav, rect);
+    wavetrans(wav, buff, wav->size / 2);
+    
+    return wav;
+}
+
+void KisBasicMathToolbox::fastWaveletUntransformation(KisPaintDeviceSP dst, const TQRect& rect, KisWavelet* wav, KisWavelet* buff)
+{
+    if(buff == 0)
+    {
+        buff = initWavelet( dst, rect );
+    }
+    
+    waveuntrans(wav, buff, 1 );
+    transformFromFR(dst, wav, rect);
+}
diff --git a/chalk/core/kis_basic_math_toolbox.h b/chalk/core/kis_basic_math_toolbox.h
new file mode 100644
index 000000000..e5fa66cd5
--- /dev/null
+++ b/chalk/core/kis_basic_math_toolbox.h
@@ -0,0 +1,44 @@
+/*
+ *  This file is part of the KDE project
+ *
+ *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_BASIC_MATH_TOOLBOX_H
+#define KIS_BASIC_MATH_TOOLBOX_H
+
+#include "kis_math_toolbox.h"
+
+/**
+ * This class implement KisMathToolbox for most colorspaces, only colorspaces with "angular"
+ * channels need to reimplement the functions
+ */
+class KisBasicMathToolbox : public KisMathToolbox
+{
+    public:
+        KisBasicMathToolbox();
+        ~KisBasicMathToolbox();
+    public:
+        virtual KisWavelet* fastWaveletTransformation(KisPaintDeviceSP src, const TQRect&,  KisWavelet* buff = 0);
+        virtual void fastWaveletUntransformation(KisPaintDeviceSP dst, const TQRect&, KisWavelet* wav, KisWavelet* buff = 0);
+    private:
+        void wavetrans(KisWavelet* wav, KisWavelet* buff, uint halfsize);
+        void waveuntrans(KisWavelet* wav, KisWavelet* buff, uint halfsize);
+
+};
+
+#endif
diff --git a/chalk/core/kis_boundary.cc b/chalk/core/kis_boundary.cc
new file mode 100644
index 000000000..0c9681c25
--- /dev/null
+++ b/chalk/core/kis_boundary.cc
@@ -0,0 +1,83 @@
+/*
+ *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <tqpixmap.h>
+#include <tqpainter.h>
+
+#include "kis_colorspace.h"
+#include "kis_iterators_pixel.h"
+#include "kis_paint_device.h"
+#include "kis_boundary.h"
+
+KisBoundary::KisBoundary(KisPaintDevice* dev) {
+    m_device = dev;
+    m_fuzzyness = 255 / 2;
+}
+
+bool KisBoundary::isDark(TQ_UINT8 val) {
+    return val < m_fuzzyness;
+}
+
+void KisBoundary::generateBoundary(int w, int h) {
+    if (!m_device)
+        return;
+
+    KisColorSpace* cs = m_device->colorSpace();
+
+    //Qt::Horizontal
+    for (int currentY = - 1; currentY < h; currentY++) {
+        KisHLineIteratorPixel topIt = m_device->createHLineIterator(0, currentY, w, false);
+        KisHLineIteratorPixel botIt = m_device->createHLineIterator(0, currentY + 1, w, false);
+        bool darkTop;
+        bool darkBot;
+
+        m_horSegments.append(TQValueList<PointPair>());
+
+        while (!topIt.isDone()) {
+            darkTop = cs->getAlpha(topIt.rawData());
+            darkBot = cs->getAlpha(botIt.rawData());
+            if (darkTop != darkBot) {
+                // detected a change
+                m_horSegments.back().append(tqMakePair(KisPoint(botIt.x(), botIt.y()), 1));
+            }
+            ++topIt;
+            ++botIt;
+        }
+    }
+
+    //Qt::Vertical
+    for (int currentX = - 1; currentX < w; currentX++) {
+        KisVLineIteratorPixel leftIt = m_device->createVLineIterator(currentX, 0, h, false);
+        KisVLineIteratorPixel rightIt = m_device->createVLineIterator(currentX + 1, 0, h, false);
+        bool darkLeft;
+        bool darkRight;
+
+        m_vertSegments.append(TQValueList<PointPair>());
+
+        while (!leftIt.isDone()) {
+            darkLeft = cs->getAlpha(leftIt.rawData());
+            darkRight = cs->getAlpha(rightIt.rawData());
+            if (darkLeft != darkRight) {
+                // detected a change
+                m_vertSegments.back().append(tqMakePair(KisPoint(rightIt.x(), rightIt.y()), 1));
+            }
+            ++leftIt;
+            ++rightIt;
+        }
+    }
+}
+
diff --git a/chalk/core/kis_boundary.h b/chalk/core/kis_boundary.h
new file mode 100644
index 000000000..6c5ce8c6e
--- /dev/null
+++ b/chalk/core/kis_boundary.h
@@ -0,0 +1,57 @@
+/*
+ *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef _KIS_BOUNDARY_H_
+#define _KIS_BOUNDARY_H_
+
+#include <tqvaluelist.h>
+#include <tqpair.h>
+#include <koffice_export.h>
+
+#include "kis_point.h"
+
+class KisPaintDevice;
+
+/**
+ * Generates an 'outline' for a paint device. It should look a bit like the outline of a
+ * marching ants selection. You can use it to paint the outline of a KisBrush while painting.
+ * It's not really optimized, so it's not recommended to do big things with it and expect
+ * it to be fast.
+ * Usage: construct a KisBoundary, and then run a generateBoundary(w, h) on it. After that,
+ * you can use the KisBoundaryPainter::paint method to let it paint the outline, or get a pixmap.
+ **/
+class KRITACORE_EXPORT KisBoundary {
+public:
+    KisBoundary(KisPaintDevice* dev);
+    void generateBoundary(int w, int h);
+
+private:
+    typedef TQPair<KisPoint, int> PointPair; // int->length
+    bool isDark(TQ_UINT8 val);
+    KisPaintDevice* m_device;
+    int m_fuzzyness;
+
+    typedef TQValueList<PointPair> PointPairList;
+    typedef TQValueList< PointPairList > PointPairListList;
+
+    PointPairListList m_horSegments;
+    PointPairListList m_vertSegments;
+
+    friend class KisBoundaryPainter;
+};
+
+#endif // _KIS_BOUNDARY_H_
diff --git a/chalk/core/kis_brush.cc b/chalk/core/kis_brush.cc
new file mode 100644
index 000000000..9720a3e1d
--- /dev/null
+++ b/chalk/core/kis_brush.cc
@@ -0,0 +1,1333 @@
+/*
+ *  Copyright (c) 1999 Matthias Elter  <me@kde.org>
+ *  Copyright (c) 2003 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
+ *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <netinet/in.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <cfloat>
+
+#include <tqfile.h>
+#include <tqimage.h>
+#include <tqpoint.h>
+#include <tqvaluevector.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include <kis_meta_registry.h>
+#include "kis_paint_device.h"
+#include "kis_global.h"
+#include "kis_brush.h"
+#include "kis_alpha_mask.h"
+#include "kis_colorspace_factory_registry.h"
+#include "kis_iterators_pixel.h"
+#include "kis_image.h"
+
+
+namespace {
+    struct GimpBrushV1Header {
+        TQ_UINT32 header_size;  /*  header_size = sizeof (BrushHeader) + brush name  */
+        TQ_UINT32 version;      /*  brush file version #  */
+        TQ_UINT32 width;        /*  width of brush  */
+        TQ_UINT32 height;       /*  height of brush  */
+        TQ_UINT32 bytes;        /*  depth of brush in bytes */
+    };
+
+    /// All fields are in MSB on disk!
+    struct GimpBrushHeader {
+        TQ_UINT32 header_size;  /*  header_size = sizeof (BrushHeader) + brush name  */
+        TQ_UINT32 version;      /*  brush file version #  */
+        TQ_UINT32 width;        /*  width of brush  */
+        TQ_UINT32 height;       /*  height of brush  */
+        TQ_UINT32 bytes;        /*  depth of brush in bytes */
+
+                       /*  The following are only defined in version 2 */
+        TQ_UINT32 magic_number; /*  GIMP brush magic number  */
+        TQ_UINT32 spacing;      /*  brush spacing as % of width & height, 0 - 1000 */
+    };
+
+    // Needed, or the GIMP won't open it!
+    TQ_UINT32 const GimpV2BrushMagic = ('G' << 24) + ('I' << 16) + ('M' << 8) + ('P' << 0);
+}
+
+#define DEFAULT_SPACING 0.25
+#define MAXIMUM_SCALE 2
+
+KisBrush::KisBrush(const TQString& filename) : super(filename)
+{
+    m_brushType = INVALID;
+    m_ownData = true;
+    m_useColorAsMask = false;
+    m_hasColor = false;
+    m_spacing = DEFAULT_SPACING;
+    m_boundary = 0;
+}
+
+KisBrush::KisBrush(const TQString& filename,
+           const TQByteArray& data,
+           TQ_UINT32 & dataPos) : super(filename)
+{
+    m_brushType = INVALID;
+    m_ownData = false;
+    m_useColorAsMask = false;
+    m_hasColor = false;
+    m_spacing = DEFAULT_SPACING;
+    m_boundary = 0;
+
+    m_data.setRawData(data.data() + dataPos, data.size() - dataPos);
+    init();
+    m_data.resetRawData(data.data() + dataPos, data.size() - dataPos);
+    dataPos += m_header_size + (width() * height() * m_bytes);
+}
+
+KisBrush::KisBrush(KisPaintDevice* image, int x, int y, int w, int h)
+    : super(TQString(""))
+{
+    m_brushType = INVALID;
+    m_ownData = true;
+    m_useColorAsMask = false;
+    m_hasColor = true;
+    m_spacing = DEFAULT_SPACING;
+    m_boundary = 0;
+
+    initFromPaintDev(image, x, y, w, h);
+}
+
+KisBrush::KisBrush(const TQImage& image, const TQString& name)
+    : super(TQString(""))
+{
+    m_ownData = false;
+    m_useColorAsMask = false;
+    m_hasColor = true;
+    m_spacing = DEFAULT_SPACING;
+    m_boundary = 0;
+
+    setImage(image);
+    setName(name);
+    setBrushType(IMAGE);
+}
+
+
+KisBrush::~KisBrush()
+{
+    m_scaledBrushes.clear();
+    delete m_boundary;
+}
+
+bool KisBrush::load()
+{
+    if (m_ownData) {
+        TQFile file(filename());
+        file.open(IO_ReadOnly);
+        m_data = file.readAll();
+        file.close();
+    }
+    return init();
+}
+
+bool KisBrush::init()
+{
+    GimpBrushHeader bh;
+
+    if (sizeof(GimpBrushHeader) > m_data.size()) {
+        return false;
+    }
+
+    memcpy(&bh, &m_data[0], sizeof(GimpBrushHeader));
+    bh.header_size = ntohl(bh.header_size);
+    m_header_size = bh.header_size;
+
+    bh.version = ntohl(bh.version);
+    m_version = bh.version;
+
+    bh.width = ntohl(bh.width);
+    bh.height = ntohl(bh.height);
+
+    bh.bytes = ntohl(bh.bytes);
+    m_bytes = bh.bytes;
+
+    bh.magic_number = ntohl(bh.magic_number);
+    m_magic_number = bh.magic_number;
+
+    if (bh.version == 1) {
+        // No spacing in version 1 files so use Gimp default
+        bh.spacing = static_cast<int>(DEFAULT_SPACING * 100);
+    }
+    else {
+        bh.spacing = ntohl(bh.spacing);
+
+        if (bh.spacing > 1000) {
+            return false;
+        }
+    }
+
+    setSpacing(bh.spacing / 100.0);
+
+    if (bh.header_size > m_data.size() || bh.header_size == 0) {
+        return false;
+    }
+
+    TQString name;
+
+    if (bh.version == 1) {
+        // Version 1 has no magic number or spacing, so the name
+        // is at a different offset. Character encoding is undefined.
+        const char *text = &m_data[sizeof(GimpBrushV1Header)];
+        name = TQString::fromAscii(text, bh.header_size - sizeof(GimpBrushV1Header));
+    } else {
+        // ### Version = 3->cinepaint; may be float16 data!
+        // Version >=2: UTF-8 encoding is used
+        name = TQString::fromUtf8(&m_data[sizeof(GimpBrushHeader)],
+                                  bh.header_size - sizeof(GimpBrushHeader));
+    }
+
+    setName(i18n(name.ascii())); // Ascii? And what with real UTF-8 chars?
+
+    if (bh.width == 0 || bh.height == 0 || !m_img.create(bh.width, bh.height, 32)) {
+        return false;
+    }
+
+    TQ_INT32 k = bh.header_size;
+
+    if (bh.bytes == 1) {
+        // Grayscale
+
+        if (static_cast<TQ_UINT32>(k + bh.width * bh.height) > m_data.size()) {
+            return false;
+        }
+
+        m_brushType = MASK;
+        m_hasColor = false;
+
+        for (TQ_UINT32 y = 0; y < bh.height; y++) {
+            for (TQ_UINT32 x = 0; x < bh.width; x++, k++) {
+                TQ_INT32 val = 255 - static_cast<uchar>(m_data[k]);
+                m_img.setPixel(x, y, tqRgb(val, val, val));
+            }
+        }
+    } else if (bh.bytes == 4) {
+        // RGBA
+
+        if (static_cast<TQ_UINT32>(k + (bh.width * bh.height * 4)) > m_data.size()) {
+            return false;
+        }
+
+        m_brushType = IMAGE;
+        m_img.setAlphaBuffer(true);
+        m_hasColor = true;
+
+        for (TQ_UINT32 y = 0; y < bh.height; y++) {
+            for (TQ_UINT32 x = 0; x < bh.width; x++, k += 4) {
+                m_img.setPixel(x, y, tqRgba(m_data[k],
+                               m_data[k+1],
+                               m_data[k+2],
+                               m_data[k+3]));
+            }
+        }
+    } else {
+        return false;
+    }
+
+    setWidth(m_img.width());
+    setHeight(m_img.height());
+    //createScaledBrushes();
+    if (m_ownData) {
+        m_data.resize(0); // Save some memory, we're using enough of it as it is.
+    }
+
+
+    if (m_img.width() == 0 || m_img.height() == 0)
+        setValid(false);
+    else
+        setValid(true);
+
+    return true;
+}
+
+bool KisBrush::initFromPaintDev(KisPaintDevice* image, int x, int y, int w, int h) {
+    // Forcefully convert to RGBA8
+    // XXX profile and exposure?
+    setImage(image->convertToTQImage(0, x, y, w, h));
+    setName(image->name());
+
+    m_brushType = IMAGE;
+    m_hasColor = true;
+
+    return true;
+}
+
+bool KisBrush::save()
+{
+    TQFile file(filename());
+    file.open(IO_WriteOnly | IO_Truncate);
+    bool ok = saveToDevice(TQT_TQIODEVICE(&file));
+    file.close();
+    return ok;
+}
+
+bool KisBrush::saveToDevice(TQIODevice* dev) const
+{
+    GimpBrushHeader bh;
+    TQCString utf8Name = name().utf8(); // Names in v2 brushes are in UTF-8
+    char const* name = utf8Name.data();
+    int nameLength = tqstrlen(name);
+    int wrote;
+
+    bh.header_size = htonl(sizeof(GimpBrushHeader) + nameLength);
+    bh.version = htonl(2); // Only RGBA8 data needed atm, no cinepaint stuff
+    bh.width = htonl(width());
+    bh.height = htonl(height());
+    // Hardcoded, 4 bytes RGBA or 1 byte GREY
+    if (!hasColor())
+        bh.bytes = htonl(1);
+    else
+        bh.bytes = htonl(4);
+    bh.magic_number = htonl(GimpV2BrushMagic);
+    bh.spacing = htonl(static_cast<TQ_UINT32>(spacing() * 100.0));
+
+    // Write header: first bh, then the name
+    TQByteArray bytes;
+    bytes.setRawData(reinterpret_cast<char*>(&bh), sizeof(GimpBrushHeader));
+    wrote = dev->writeBlock(bytes);
+    bytes.resetRawData(reinterpret_cast<char*>(&bh), sizeof(GimpBrushHeader));
+
+    if (wrote == -1)
+        return false;
+
+    wrote = dev->writeBlock(name, nameLength); // No +1 for the trailing NULL it seems...
+    if (wrote == -1)
+        return false;
+
+    int k = 0;
+
+    if (!hasColor()) {
+        bytes.resize(width() * height());
+        for (TQ_INT32 y = 0; y < height(); y++) {
+            for (TQ_INT32 x = 0; x < width(); x++) {
+                TQRgb c = m_img.pixel(x, y);
+                bytes[k++] = static_cast<char>(255 - tqRed(c)); // red == blue == green
+            }
+        }
+    } else {
+        bytes.resize(width() * height() * 4);
+        for (TQ_INT32 y = 0; y < height(); y++) {
+            for (TQ_INT32 x = 0; x < width(); x++) {
+                // order for gimp brushes, v2 is: RGBA
+                TQRgb pixel = m_img.pixel(x,y);
+                bytes[k++] = static_cast<char>(tqRed(pixel));
+                bytes[k++] = static_cast<char>(tqGreen(pixel));
+                bytes[k++] = static_cast<char>(tqBlue(pixel));
+                bytes[k++] = static_cast<char>(tqAlpha(pixel));
+            }
+        }
+    }
+
+    wrote = dev->writeBlock(bytes);
+    if (wrote == -1)
+        return false;
+
+    return true;
+}
+
+TQImage KisBrush::img()
+{
+    TQImage image = m_img;
+
+    if (hasColor() && useColorAsMask()) {
+        image.detach();
+
+        for (int x = 0; x < image.width(); x++) {
+            for (int y = 0; y < image.height(); y++) {
+                TQRgb c = image.pixel(x, y);
+                int a = (tqGray(c) * tqAlpha(c)) / 255;
+                image.setPixel(x, y, tqRgba(a, 0, a, a));
+            }
+        }
+    }
+
+    return image;
+}
+
+KisAlphaMaskSP KisBrush::tqmask(const KisPaintInformation& info, double subPixelX, double subPixelY) const
+{
+    if (m_scaledBrushes.isEmpty()) {
+        createScaledBrushes();
+    }
+
+    double scale = scaleForPressure(info.pressure);
+
+    const ScaledBrush *aboveBrush = 0;
+    const ScaledBrush *belowBrush = 0;
+
+    findScaledBrushes(scale, &aboveBrush,  &belowBrush);
+    Q_ASSERT(aboveBrush != 0);
+
+    KisAlphaMaskSP outputMask = 0;
+
+    if (belowBrush != 0) {
+        // We're in between two tqmasks. Interpolate between them.
+
+        KisAlphaMaskSP scaledAboveMask = scaleMask(aboveBrush, scale, subPixelX, subPixelY);
+        KisAlphaMaskSP scaledBelowMask = scaleMask(belowBrush, scale, subPixelX, subPixelY);
+
+        double t = (scale - belowBrush->scale()) / (aboveBrush->scale() - belowBrush->scale());
+
+        outputMask = KisAlphaMask::interpolate(scaledBelowMask, scaledAboveMask, t);
+    } else {
+        if (fabs(scale - aboveBrush->scale()) < DBL_EPSILON) {
+            // Exact match.
+            outputMask = scaleMask(aboveBrush, scale, subPixelX, subPixelY);
+        } else {
+            // We are smaller than the smallest tqmask, which is always 1x1.
+            double s = scale / aboveBrush->scale();
+            outputMask = scaleSinglePixelMask(s, aboveBrush->tqmask()->alphaAt(0, 0), subPixelX, subPixelY);
+        }
+    }
+
+    return outputMask;
+}
+
+KisPaintDeviceSP KisBrush::image(KisColorSpace * /*colorSpace*/, const KisPaintInformation& info, double subPixelX, double subPixelY) const
+{
+    if (m_scaledBrushes.isEmpty()) {
+        createScaledBrushes();
+    }
+
+    double scale = scaleForPressure(info.pressure);
+
+    const ScaledBrush *aboveBrush = 0;
+    const ScaledBrush *belowBrush = 0;
+
+    findScaledBrushes(scale, &aboveBrush,  &belowBrush);
+    Q_ASSERT(aboveBrush != 0);
+
+    TQImage outputImage;
+
+    if (belowBrush != 0) {
+        // We're in between two brushes. Interpolate between them.
+
+        TQImage scaledAboveImage = scaleImage(aboveBrush, scale, subPixelX, subPixelY);
+        TQImage scaledBelowImage = scaleImage(belowBrush, scale, subPixelX, subPixelY);
+
+        double t = (scale - belowBrush->scale()) / (aboveBrush->scale() - belowBrush->scale());
+
+        outputImage = interpolate(scaledBelowImage, scaledAboveImage, t);
+    } else {
+        if (fabs(scale - aboveBrush->scale()) < DBL_EPSILON) {
+            // Exact match.
+            outputImage = scaleImage(aboveBrush, scale, subPixelX, subPixelY);
+        } else {
+            // We are smaller than the smallest brush, which is always 1x1.
+            double s = scale / aboveBrush->scale();
+            outputImage = scaleSinglePixelImage(s, aboveBrush->image().pixel(0, 0), subPixelX, subPixelY);
+        }
+    }
+
+    int outputWidth = outputImage.width();
+    int outputHeight = outputImage.height();
+
+    KisPaintDevice *layer = new KisPaintDevice(KisMetaRegistry::instance()->csRegistry()->getRGB8(), "brush");
+
+    Q_CHECK_PTR(layer);
+
+    for (int y = 0; y < outputHeight; y++) {
+        KisHLineIterator iter = layer->createHLineIterator( 0, y, outputWidth, true);
+        for (int x = 0; x < outputWidth; x++) {
+	    TQ_UINT8 * p = iter.rawData();
+
+            TQRgb pixel = outputImage.pixel(x, y);
+            int red = tqRed(pixel);
+            int green = tqGreen(pixel);
+            int blue = tqBlue(pixel);
+            int alpha = tqAlpha(pixel);
+
+            // Scaled images are in pre-multiplied alpha form so
+            // divide by alpha.
+	    // channel order is BGRA
+            if (alpha != 0) {
+                p[2] = (red * 255) / alpha;
+                p[1] = (green * 255) / alpha;
+		p[0] = (blue * 255) / alpha;
+		p[3] = alpha;
+            }
+
+            ++iter;
+        }
+    }
+
+    return layer;
+}
+
+void KisBrush::setHotSpot(KisPoint pt)
+{
+    double x = pt.x();
+    double y = pt.y();
+
+    if (x < 0)
+        x = 0;
+    else if (x >= width())
+        x = width() - 1;
+
+    if (y < 0)
+        y = 0;
+    else if (y >= height())
+        y = height() - 1;
+
+    m_hotSpot = KisPoint(x, y);
+}
+
+KisPoint KisBrush::hotSpot(const KisPaintInformation& info) const
+{
+    double scale = scaleForPressure(info.pressure);
+    double w = width() * scale;
+    double h = height() * scale;
+
+    // The smallest brush we can produce is a single pixel.
+    if (w < 1) {
+        w = 1;
+    }
+
+    if (h < 1) {
+        h = 1;
+    }
+
+    // XXX: This should take m_hotSpot into account, though it
+    // isn't specified by gimp brushes so it would default to the centre
+    // anyway.
+    KisPoint p(w / 2, h / 2);
+    return p;
+}
+
+enumBrushType KisBrush::brushType() const
+{
+    if (m_brushType == IMAGE && useColorAsMask()) {
+        return MASK;
+    }
+    else {
+        return m_brushType;
+    }
+}
+
+bool KisBrush::hasColor() const
+{
+    return m_hasColor;
+}
+
+void KisBrush::createScaledBrushes() const
+{
+    if (!m_scaledBrushes.isEmpty())
+        m_scaledBrushes.clear();
+
+    // Construct a series of brushes where each one's dimensions are
+    // half the size of the previous one.
+    int width = m_img.width() * MAXIMUM_SCALE;
+    int height = m_img.height() * MAXIMUM_SCALE;
+
+    TQImage scaledImage;
+
+    while (true) {
+
+        if (width >= m_img.width() && height >= m_img.height()) {
+            scaledImage = scaleImage(m_img, width, height);
+        }
+        else {
+            // Scale down the previous image once we're below 1:1.
+            scaledImage = scaleImage(scaledImage, width, height);
+        }
+
+        KisAlphaMaskSP scaledMask = new KisAlphaMask(scaledImage, hasColor());
+        Q_CHECK_PTR(scaledMask);
+
+        double xScale = static_cast<double>(width) / m_img.width();
+        double yScale = static_cast<double>(height) / m_img.height();
+        double scale = xScale;
+
+        m_scaledBrushes.append(ScaledBrush(scaledMask, hasColor() ? scaledImage : TQImage(), scale, xScale, yScale));
+
+        if (width == 1 && height == 1) {
+            break;
+        }
+
+        // Round up so that we never have to scale an image by less than 1/2.
+        width = (width + 1) / 2;
+        height = (height + 1) / 2;
+
+    }
+
+}
+
+double KisBrush::xSpacing(double pressure) const
+{
+    return width() * scaleForPressure(pressure) * m_spacing;
+}
+
+double KisBrush::ySpacing(double pressure) const
+{
+    return height() * scaleForPressure(pressure) * m_spacing;
+}
+
+double KisBrush::scaleForPressure(double pressure)
+{
+    double scale = pressure / PRESSURE_DEFAULT;
+
+    if (scale < 0) {
+        scale = 0;
+    }
+
+    if (scale > MAXIMUM_SCALE) {
+        scale = MAXIMUM_SCALE;
+    }
+
+    return scale;
+}
+
+TQ_INT32 KisBrush::tqmaskWidth(const KisPaintInformation& info) const
+{
+    // Add one for sub-pixel shift
+    return static_cast<TQ_INT32>(ceil(width() * scaleForPressure(info.pressure)) + 1);
+}
+
+TQ_INT32 KisBrush::tqmaskHeight(const KisPaintInformation& info) const
+{
+    // Add one for sub-pixel shift
+    return static_cast<TQ_INT32>(ceil(height() * scaleForPressure(info.pressure)) + 1);
+}
+
+KisAlphaMaskSP KisBrush::scaleMask(const ScaledBrush *srcBrush, double scale, double subPixelX, double subPixelY) const
+{
+    // Add one pixel for sub-pixel shifting
+    int dstWidth = static_cast<int>(ceil(scale * width())) + 1;
+    int dstHeight = static_cast<int>(ceil(scale * height())) + 1;
+
+    KisAlphaMaskSP dstMask = new KisAlphaMask(dstWidth, dstHeight);
+    Q_CHECK_PTR(dstMask);
+
+    KisAlphaMaskSP srcMask = srcBrush->tqmask();
+
+    // Compute scales to map the scaled brush onto the required scale.
+    double xScale = srcBrush->xScale() / scale;
+    double yScale = srcBrush->yScale() / scale;
+
+    int srcWidth = srcMask->width();
+    int srcHeight = srcMask->height();
+
+    for (int dstY = 0; dstY < dstHeight; dstY++) {
+        for (int dstX = 0; dstX < dstWidth; dstX++) {
+
+            double srcX = (dstX - subPixelX + 0.5) * xScale;
+            double srcY = (dstY - subPixelY + 0.5) * yScale;
+
+            srcX -= 0.5;
+            srcY -= 0.5;
+
+            int leftX = static_cast<int>(srcX);
+
+            if (srcX < 0) {
+                leftX--;
+            }
+
+            double xInterp = srcX - leftX;
+
+            int topY = static_cast<int>(srcY);
+
+            if (srcY < 0) {
+                topY--;
+            }
+
+            double yInterp = srcY - topY;
+
+            TQ_UINT8 topLeft = (leftX >= 0 && leftX < srcWidth && topY >= 0 && topY < srcHeight) ? srcMask->alphaAt(leftX, topY) : OPACITY_TRANSPARENT;
+            TQ_UINT8 bottomLeft = (leftX >= 0 && leftX < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcMask->alphaAt(leftX, topY + 1) : OPACITY_TRANSPARENT;
+            TQ_UINT8 topRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY >= 0 && topY < srcHeight) ? srcMask->alphaAt(leftX + 1, topY) : OPACITY_TRANSPARENT;
+            TQ_UINT8 bottomRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcMask->alphaAt(leftX + 1, topY + 1) : OPACITY_TRANSPARENT;
+
+            double a = 1 - xInterp;
+            double b = 1 - yInterp;
+
+            // Bi-linear interpolation
+            int d = static_cast<int>(a * b * topLeft
+                + a * (1 - b) * bottomLeft
+                + (1 - a) * b * topRight
+                + (1 - a) * (1 - b) * bottomRight + 0.5);
+
+            if (d < OPACITY_TRANSPARENT) {
+                d = OPACITY_TRANSPARENT;
+            }
+            else
+            if (d > OPACITY_OPAQUE) {
+                d = OPACITY_OPAQUE;
+            }
+
+            dstMask->setAlphaAt(dstX, dstY, static_cast<TQ_UINT8>(d));
+        }
+    }
+
+    return dstMask;
+}
+
+TQImage KisBrush::scaleImage(const ScaledBrush *srcBrush, double scale, double subPixelX, double subPixelY) const
+{
+    // Add one pixel for sub-pixel shifting
+    int dstWidth = static_cast<int>(ceil(scale * width())) + 1;
+    int dstHeight = static_cast<int>(ceil(scale * height())) + 1;
+
+    TQImage dstImage(dstWidth, dstHeight, 32);
+    dstImage.setAlphaBuffer(true);
+
+    const TQImage srcImage = srcBrush->image();
+
+    // Compute scales to map the scaled brush onto the required scale.
+    double xScale = srcBrush->xScale() / scale;
+    double yScale = srcBrush->yScale() / scale;
+
+    int srcWidth = srcImage.width();
+    int srcHeight = srcImage.height();
+
+    for (int dstY = 0; dstY < dstHeight; dstY++) {
+        for (int dstX = 0; dstX < dstWidth; dstX++) {
+
+            double srcX = (dstX - subPixelX + 0.5) * xScale;
+            double srcY = (dstY - subPixelY + 0.5) * yScale;
+
+            srcX -= 0.5;
+            srcY -= 0.5;
+
+            int leftX = static_cast<int>(srcX);
+
+            if (srcX < 0) {
+                leftX--;
+            }
+
+            double xInterp = srcX - leftX;
+
+            int topY = static_cast<int>(srcY);
+
+            if (srcY < 0) {
+                topY--;
+            }
+
+            double yInterp = srcY - topY;
+
+            TQRgb topLeft = (leftX >= 0 && leftX < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX, topY) : tqRgba(0, 0, 0, 0);
+            TQRgb bottomLeft = (leftX >= 0 && leftX < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX, topY + 1) : tqRgba(0, 0, 0, 0);
+            TQRgb topRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX + 1, topY) : tqRgba(0, 0, 0, 0);
+            TQRgb bottomRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX + 1, topY + 1) : tqRgba(0, 0, 0, 0);
+
+            double a = 1 - xInterp;
+            double b = 1 - yInterp;
+
+            // Bi-linear interpolation. Image is pre-multiplied by alpha.
+            int red = static_cast<int>(a * b * tqRed(topLeft)
+                + a * (1 - b) * tqRed(bottomLeft)
+                + (1 - a) * b * tqRed(topRight)
+                + (1 - a) * (1 - b) * tqRed(bottomRight) + 0.5);
+            int green = static_cast<int>(a * b * tqGreen(topLeft)
+                + a * (1 - b) * tqGreen(bottomLeft)
+                + (1 - a) * b * tqGreen(topRight)
+                + (1 - a) * (1 - b) * tqGreen(bottomRight) + 0.5);
+            int blue = static_cast<int>(a * b * tqBlue(topLeft)
+                + a * (1 - b) * tqBlue(bottomLeft)
+                + (1 - a) * b * tqBlue(topRight)
+                + (1 - a) * (1 - b) * tqBlue(bottomRight) + 0.5);
+            int alpha = static_cast<int>(a * b * tqAlpha(topLeft)
+                + a * (1 - b) * tqAlpha(bottomLeft)
+                + (1 - a) * b * tqAlpha(topRight)
+                + (1 - a) * (1 - b) * tqAlpha(bottomRight) + 0.5);
+
+            if (red < 0) {
+                red = 0;
+            }
+            else
+            if (red > 255) {
+                red = 255;
+            }
+
+            if (green < 0) {
+                green = 0;
+            }
+            else
+            if (green > 255) {
+                green = 255;
+            }
+
+            if (blue < 0) {
+                blue = 0;
+            }
+            else
+            if (blue > 255) {
+                blue = 255;
+            }
+
+            if (alpha < 0) {
+                alpha = 0;
+            }
+            else
+            if (alpha > 255) {
+                alpha = 255;
+            }
+
+            dstImage.setPixel(dstX, dstY, tqRgba(red, green, blue, alpha));
+        }
+    }
+
+    return dstImage;
+}
+
+TQImage KisBrush::scaleImage(const TQImage& srcImage, int width, int height)
+{
+    TQImage scaledImage;
+    //TQString filename;
+
+    int srcWidth = srcImage.width();
+    int srcHeight = srcImage.height();
+
+    double xScale = static_cast<double>(srcWidth) / width;
+    double yScale = static_cast<double>(srcHeight) / height;
+
+    if (xScale > 2 + DBL_EPSILON || yScale > 2 + DBL_EPSILON || xScale < 1 - DBL_EPSILON || yScale < 1 - DBL_EPSILON) {
+        // smoothScale gives better results when scaling an image up
+        // or scaling it to less than half size.
+        scaledImage = srcImage.smoothScale(width, height);
+
+        //filename = TQString("smoothScale_%1x%2.png").tqarg(width).tqarg(height);
+    }
+    else {
+        scaledImage.create(width, height, 32);
+        scaledImage.setAlphaBuffer(srcImage.hasAlphaBuffer());
+
+        for (int dstY = 0; dstY < height; dstY++) {
+            for (int dstX = 0; dstX < width; dstX++) {
+
+                double srcX = (dstX + 0.5) * xScale;
+                double srcY = (dstY + 0.5) * yScale;
+
+                srcX -= 0.5;
+                srcY -= 0.5;
+
+                int leftX = static_cast<int>(srcX);
+
+                if (srcX < 0) {
+                    leftX--;
+                }
+
+                double xInterp = srcX - leftX;
+
+                int topY = static_cast<int>(srcY);
+
+                if (srcY < 0) {
+                    topY--;
+                }
+
+                double yInterp = srcY - topY;
+
+                TQRgb topLeft = (leftX >= 0 && leftX < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX, topY) : tqRgba(0, 0, 0, 0);
+                TQRgb bottomLeft = (leftX >= 0 && leftX < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX, topY + 1) : tqRgba(0, 0, 0, 0);
+                TQRgb topRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY >= 0 && topY < srcHeight) ? srcImage.pixel(leftX + 1, topY) : tqRgba(0, 0, 0, 0);
+                TQRgb bottomRight = (leftX + 1 >= 0 && leftX + 1 < srcWidth && topY + 1 >= 0 && topY + 1 < srcHeight) ? srcImage.pixel(leftX + 1, topY + 1) : tqRgba(0, 0, 0, 0);
+
+                double a = 1 - xInterp;
+                double b = 1 - yInterp;
+
+                int red;
+                int green;
+                int blue;
+                int alpha;
+
+                if (srcImage.hasAlphaBuffer()) {
+                    red = static_cast<int>(a * b * tqRed(topLeft)         * tqAlpha(topLeft)
+                        + a * (1 - b) * tqRed(bottomLeft)             * tqAlpha(bottomLeft)
+                        + (1 - a) * b * tqRed(topRight)               * tqAlpha(topRight)
+                        + (1 - a) * (1 - b) * tqRed(bottomRight)      * tqAlpha(bottomRight) + 0.5);
+                    green = static_cast<int>(a * b * tqGreen(topLeft)     * tqAlpha(topLeft)
+                        + a * (1 - b) * tqGreen(bottomLeft)           * tqAlpha(bottomLeft)
+                        + (1 - a) * b * tqGreen(topRight)             * tqAlpha(topRight)
+                        + (1 - a) * (1 - b) * tqGreen(bottomRight)    * tqAlpha(bottomRight) + 0.5);
+                    blue = static_cast<int>(a * b * tqBlue(topLeft)       * tqAlpha(topLeft)
+                        + a * (1 - b) * tqBlue(bottomLeft)            * tqAlpha(bottomLeft)
+                        + (1 - a) * b * tqBlue(topRight)              * tqAlpha(topRight)
+                        + (1 - a) * (1 - b) * tqBlue(bottomRight)     * tqAlpha(bottomRight) + 0.5);
+                    alpha = static_cast<int>(a * b * tqAlpha(topLeft)
+                        + a * (1 - b) * tqAlpha(bottomLeft)
+                        + (1 - a) * b * tqAlpha(topRight)
+                        + (1 - a) * (1 - b) * tqAlpha(bottomRight) + 0.5);
+
+                    if (alpha != 0) {
+                        red /= alpha;
+                        green /= alpha;
+                        blue /= alpha;
+                    }
+                }
+                else {
+                    red = static_cast<int>(a * b * tqRed(topLeft)
+                        + a * (1 - b) * tqRed(bottomLeft)
+                        + (1 - a) * b * tqRed(topRight)
+                        + (1 - a) * (1 - b) * tqRed(bottomRight) + 0.5);
+                    green = static_cast<int>(a * b * tqGreen(topLeft)
+                        + a * (1 - b) * tqGreen(bottomLeft)
+                        + (1 - a) * b * tqGreen(topRight)
+                        + (1 - a) * (1 - b) * tqGreen(bottomRight) + 0.5);
+                    blue = static_cast<int>(a * b * tqBlue(topLeft)
+                        + a * (1 - b) * tqBlue(bottomLeft)
+                        + (1 - a) * b * tqBlue(topRight)
+                        + (1 - a) * (1 - b) * tqBlue(bottomRight) + 0.5);
+                    alpha = 255;
+                }
+
+                if (red < 0) {
+                    red = 0;
+                }
+                else
+                if (red > 255) {
+                    red = 255;
+                }
+
+                if (green < 0) {
+                    green = 0;
+                }
+                else
+                if (green > 255) {
+                    green = 255;
+                }
+
+                if (blue < 0) {
+                    blue = 0;
+                }
+                else
+                if (blue > 255) {
+                    blue = 255;
+                }
+
+                if (alpha < 0) {
+                    alpha = 0;
+                }
+                else
+                if (alpha > 255) {
+                    alpha = 255;
+                }
+
+                scaledImage.setPixel(dstX, dstY, tqRgba(red, green, blue, alpha));
+            }
+        }
+
+        //filename = TQString("bilinear_%1x%2.png").tqarg(width).tqarg(height);
+    }
+
+    //scaledImage.save(filename, "PNG");
+
+    return scaledImage;
+}
+
+void KisBrush::findScaledBrushes(double scale, const ScaledBrush **aboveBrush, const ScaledBrush **belowBrush) const
+{
+    uint current = 0;
+
+    while (true) {
+        *aboveBrush = &(m_scaledBrushes[current]);
+
+        if (fabs((*aboveBrush)->scale() - scale) < DBL_EPSILON) {
+            // Scale matches exactly
+            break;
+        }
+
+        if (current == m_scaledBrushes.count() - 1) {
+            // This is the last one
+            break;
+        }
+
+        if (scale > m_scaledBrushes[current + 1].scale() + DBL_EPSILON) {
+            // We fit in between the two.
+            *belowBrush = &(m_scaledBrushes[current + 1]);
+            break;
+        }
+
+        current++;
+    }
+}
+
+KisAlphaMaskSP KisBrush::scaleSinglePixelMask(double scale, TQ_UINT8 tqmaskValue, double subPixelX, double subPixelY)
+{
+    int srcWidth = 1;
+    int srcHeight = 1;
+    int dstWidth = 2;
+    int dstHeight = 2;
+    KisAlphaMaskSP outputMask = new KisAlphaMask(dstWidth, dstHeight);
+    Q_CHECK_PTR(outputMask);
+
+    double a = subPixelX;
+    double b = subPixelY;
+
+    for (int y = 0; y < dstHeight; y++) {
+        for (int x = 0; x < dstWidth; x++) {
+
+            TQ_UINT8 topLeft = (x > 0 && y > 0) ? tqmaskValue : OPACITY_TRANSPARENT;
+            TQ_UINT8 bottomLeft = (x > 0 && y < srcHeight) ? tqmaskValue : OPACITY_TRANSPARENT;
+            TQ_UINT8 topRight = (x < srcWidth && y > 0) ? tqmaskValue : OPACITY_TRANSPARENT;
+            TQ_UINT8 bottomRight = (x < srcWidth && y < srcHeight) ? tqmaskValue : OPACITY_TRANSPARENT;
+
+            // Bi-linear interpolation
+            int d = static_cast<int>(a * b * topLeft
+                + a * (1 - b) * bottomLeft
+                + (1 - a) * b * topRight
+                + (1 - a) * (1 - b) * bottomRight + 0.5);
+
+            // Multiply by the square of the scale because a 0.5x0.5 pixel
+            // has 0.25 the value of the 1x1.
+            d = static_cast<int>(d * scale * scale + 0.5);
+
+            if (d < OPACITY_TRANSPARENT) {
+                d = OPACITY_TRANSPARENT;
+            }
+            else
+            if (d > OPACITY_OPAQUE) {
+                d = OPACITY_OPAQUE;
+            }
+
+            outputMask->setAlphaAt(x, y, static_cast<TQ_UINT8>(d));
+        }
+    }
+
+    return outputMask;
+}
+
+TQImage KisBrush::scaleSinglePixelImage(double scale, TQRgb pixel, double subPixelX, double subPixelY)
+{
+    int srcWidth = 1;
+    int srcHeight = 1;
+    int dstWidth = 2;
+    int dstHeight = 2;
+
+    TQImage outputImage(dstWidth, dstHeight, 32);
+    outputImage.setAlphaBuffer(true);
+
+    double a = subPixelX;
+    double b = subPixelY;
+
+    for (int y = 0; y < dstHeight; y++) {
+        for (int x = 0; x < dstWidth; x++) {
+
+            TQRgb topLeft = (x > 0 && y > 0) ? pixel : tqRgba(0, 0, 0, 0);
+            TQRgb bottomLeft = (x > 0 && y < srcHeight) ? pixel : tqRgba(0, 0, 0, 0);
+            TQRgb topRight = (x < srcWidth && y > 0) ? pixel : tqRgba(0, 0, 0, 0);
+            TQRgb bottomRight = (x < srcWidth && y < srcHeight) ? pixel : tqRgba(0, 0, 0, 0);
+
+            // Bi-linear interpolation. Images are in pre-multiplied form.
+            int red = static_cast<int>(a * b * tqRed(topLeft)
+                + a * (1 - b) * tqRed(bottomLeft)
+                + (1 - a) * b * tqRed(topRight)
+                + (1 - a) * (1 - b) * tqRed(bottomRight) + 0.5);
+            int green = static_cast<int>(a * b * tqGreen(topLeft)
+                + a * (1 - b) * tqGreen(bottomLeft)
+                + (1 - a) * b * tqGreen(topRight)
+                + (1 - a) * (1 - b) * tqGreen(bottomRight) + 0.5);
+            int blue = static_cast<int>(a * b * tqBlue(topLeft)
+                + a * (1 - b) * tqBlue(bottomLeft)
+                + (1 - a) * b * tqBlue(topRight)
+                + (1 - a) * (1 - b) * tqBlue(bottomRight) + 0.5);
+            int alpha = static_cast<int>(a * b * tqAlpha(topLeft)
+                + a * (1 - b) * tqAlpha(bottomLeft)
+                + (1 - a) * b * tqAlpha(topRight)
+                + (1 - a) * (1 - b) * tqAlpha(bottomRight) + 0.5);
+
+            // Multiply by the square of the scale because a 0.5x0.5 pixel
+            // has 0.25 the value of the 1x1.
+            alpha = static_cast<int>(alpha * scale * scale + 0.5);
+
+            // Apply to the colour channels too since we are
+            // storing pre-multiplied by alpha.
+            red = static_cast<int>(red * scale * scale + 0.5);
+            green = static_cast<int>(green * scale * scale + 0.5);
+            blue = static_cast<int>(blue * scale * scale + 0.5);
+
+            if (red < 0) {
+                red = 0;
+            }
+            else
+            if (red > 255) {
+                red = 255;
+            }
+
+            if (green < 0) {
+                green = 0;
+            }
+            else
+            if (green > 255) {
+                green = 255;
+            }
+
+            if (blue < 0) {
+                blue = 0;
+            }
+            else
+            if (blue > 255) {
+                blue = 255;
+            }
+
+            if (alpha < 0) {
+                alpha = 0;
+            }
+            else
+            if (alpha > 255) {
+                alpha = 255;
+            }
+
+            outputImage.setPixel(x, y, tqRgba(red, green, blue, alpha));
+        }
+    }
+
+    return outputImage;
+}
+
+TQImage KisBrush::interpolate(const TQImage& image1, const TQImage& image2, double t)
+{
+    Q_ASSERT((image1.width() == image2.width()) && (image1.height() == image2.height()));
+    Q_ASSERT(t > -DBL_EPSILON && t < 1 + DBL_EPSILON);
+
+    int width = image1.width();
+    int height = image1.height();
+
+    TQImage outputImage(width, height, 32);
+    outputImage.setAlphaBuffer(true);
+
+    for (int x = 0; x < width; x++) {
+        for (int y = 0; y < height; y++) {
+            TQRgb image1pixel = image1.pixel(x, y);
+            TQRgb image2pixel = image2.pixel(x, y);
+
+            // Images are in pre-multiplied alpha format.
+            int red = static_cast<int>((1 - t) * tqRed(image1pixel) + t * tqRed(image2pixel) + 0.5);
+            int green = static_cast<int>((1 - t) * tqGreen(image1pixel) + t * tqGreen(image2pixel) + 0.5);
+            int blue = static_cast<int>((1 - t) * tqBlue(image1pixel) + t * tqBlue(image2pixel) + 0.5);
+            int alpha = static_cast<int>((1 - t) * tqAlpha(image1pixel) + t * tqAlpha(image2pixel) + 0.5);
+
+            if (red < 0) {
+                red = 0;
+            }
+            else
+            if (red > 255) {
+                red = 255;
+            }
+
+            if (green < 0) {
+                green = 0;
+            }
+            else
+            if (green > 255) {
+                green = 255;
+            }
+
+            if (blue < 0) {
+                blue = 0;
+            }
+            else
+            if (blue > 255) {
+                blue = 255;
+            }
+
+            if (alpha < 0) {
+                alpha = 0;
+            }
+            else
+            if (alpha > 255) {
+                alpha = 255;
+            }
+
+            outputImage.setPixel(x, y, tqRgba(red, green, blue, alpha));
+        }
+    }
+
+    return outputImage;
+}
+
+KisBrush::ScaledBrush::ScaledBrush()
+{
+    m_tqmask = 0;
+    m_image = TQImage();
+    m_scale = 1;
+    m_xScale = 1;
+    m_yScale = 1;
+}
+
+KisBrush::ScaledBrush::ScaledBrush(KisAlphaMaskSP scaledMask, const TQImage& scaledImage, double scale, double xScale, double yScale)
+{
+    m_tqmask = scaledMask;
+    m_image = scaledImage;
+    m_scale = scale;
+    m_xScale = xScale;
+    m_yScale = yScale;
+
+    if (!m_image.isNull()) {
+        // Convert image to pre-multiplied by alpha.
+
+        m_image.detach();
+
+        for (int y = 0; y < m_image.height(); y++) {
+            for (int x = 0; x < m_image.width(); x++) {
+
+                TQRgb pixel = m_image.pixel(x, y);
+
+                int red = tqRed(pixel);
+                int green = tqGreen(pixel);
+                int blue = tqBlue(pixel);
+                int alpha = tqAlpha(pixel);
+
+                red = (red * alpha) / 255;
+                green = (green * alpha) / 255;
+                blue = (blue * alpha) / 255;
+
+                m_image.setPixel(x, y, tqRgba(red, green, blue, alpha));
+            }
+        }
+    }
+}
+
+void KisBrush::setImage(const TQImage& img)
+{
+    m_img = img;
+    m_img.detach();
+
+    setWidth(img.width());
+    setHeight(img.height());
+
+    m_scaledBrushes.clear();
+
+    setValid(true);
+}
+
+TQ_INT32 KisBrush::width() const
+{
+    return m_width;
+}
+
+void KisBrush::setWidth(TQ_INT32 w)
+{
+    m_width = w;
+}
+
+TQ_INT32 KisBrush::height() const
+{
+    return m_height;
+}
+
+void KisBrush::setHeight(TQ_INT32 h)
+{
+    m_height = h;
+}
+
+/*TQImage KisBrush::outline(double pressure) {
+    KisLayerSP layer = image(KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("RGBA",""),""),
+                             KisPaintInformation(pressure));
+    KisBoundary bounds(layer.data());
+    int w = tqmaskWidth(pressure);
+    int h = tqmaskHeight(pressure);
+
+    bounds.generateBoundary(w, h);
+    TQPixmap pix(bounds.pixmap(w, h));
+    TQImage result;
+    result = pix;
+    return result;
+}*/
+
+void KisBrush::generateBoundary() {
+    KisPaintDeviceSP dev;
+    int w = tqmaskWidth(KisPaintInformation());
+    int h = tqmaskHeight(KisPaintInformation());
+
+    if (brushType() == IMAGE || brushType() == PIPE_IMAGE) {
+        dev = image(KisMetaRegistry::instance()->csRegistry() ->getColorSpace(KisID("RGBA",""),""), KisPaintInformation());
+    } else {
+        KisAlphaMaskSP atqmask = tqmask(KisPaintInformation());
+        KisColorSpace* cs = KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("RGBA",""),"");
+        dev = new KisPaintDevice(cs, "tmp for generateBoundary");
+        for (int y = 0; y < h; y++) {
+            KisHLineIteratorPixel it = dev->createHLineIterator(0, y, w, true);
+            int x = 0;
+
+            while(!it.isDone()) {
+                cs->setAlpha(it.rawData(), atqmask->alphaAt(x++, y), 1);
+                ++it;
+            }
+        }
+    }
+
+    m_boundary = new KisBoundary(dev);
+    m_boundary->generateBoundary(w, h);
+}
+
+KisBoundary KisBrush::boundary() {
+    if (!m_boundary)
+        generateBoundary();
+    return *m_boundary;
+}
+
+void KisBrush::makeMaskImage() {
+    if (!hasColor())
+        return;
+
+    TQImage img;
+    img.create(width(), height(), 32);
+
+    if (m_img.width() == img.width() && m_img.height() == img.height()) {
+        for (int x = 0; x < width(); x++) {
+            for (int y = 0; y < height(); y++) {
+                TQRgb c = m_img.pixel(x, y);
+                int a = (tqGray(c) * tqAlpha(c)) / 255; // tqGray(black) = 0
+                img.setPixel(x, y, tqRgba(a, a, a, 255));
+            }
+        }
+
+        m_img = img;
+    }
+
+    m_brushType = MASK;
+    m_hasColor = false;
+    m_useColorAsMask = false;
+    delete m_boundary;
+    m_boundary = 0;
+    m_scaledBrushes.clear();
+}
+
+KisBrush* KisBrush::clone() const {
+    KisBrush* c = new KisBrush("");
+    c->m_spacing = m_spacing;
+    c->m_useColorAsMask = m_useColorAsMask;
+    c->m_hasColor = m_useColorAsMask;
+    c->m_img = m_img;
+    c->m_width = m_width;
+    c->m_height = m_height;
+    c->m_ownData = false;
+    c->m_hotSpot = m_hotSpot;
+    c->m_brushType = m_brushType;
+    c->setValid(true);
+
+    return c;
+}
+
+#include "kis_brush.moc"
+
diff --git a/chalk/core/kis_brush.h b/chalk/core/kis_brush.h
new file mode 100644
index 000000000..091cebde6
--- /dev/null
+++ b/chalk/core/kis_brush.h
@@ -0,0 +1,192 @@
+/*
+ *  Copyright (c) 1999 Matthias Elter  <me@kde.org>
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_BRUSH_
+#define KIS_BRUSH_
+
+#include <tqcstring.h>
+#include <tqstring.h>
+#include <tqsize.h>
+#include <tqimage.h>
+#include <tqvaluevector.h>
+
+#include <kio/job.h>
+
+#include "kis_resource.h"
+#include "kis_types.h"
+#include "kis_point.h"
+#include "kis_alpha_mask.h"
+#include "koffice_export.h"
+#include "kis_boundary.h"
+#include "kis_paintop.h"
+
+class TQPoint;
+class TQPixmap;
+class KisBoundary;
+class KisColorSpace;
+class TQIODevice;
+
+enum enumBrushType {
+    INVALID,
+    MASK,
+    IMAGE,
+    PIPE_MASK,
+    PIPE_IMAGE,
+    AIRBRUSH
+};
+
+class KRITACORE_EXPORT KisBrush : public KisResource {
+    typedef KisResource super;
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    /// Construct brush to load filename later as brush
+    KisBrush(const TQString& filename);
+    /// Load brush from the specified data, at position dataPos, and set the filename
+    KisBrush(const TQString& filename,
+         const TQByteArray & data,
+         TQ_UINT32 & dataPos);
+    /// Load brush from the specified paint device, in the specified region
+    KisBrush(KisPaintDevice* image, int x, int y, int w, int h);
+    /// Load brush as a copy from the specified TQImage (handy when you need to copy a brush!)
+    KisBrush(const TQImage& image, const TQString& name = TQString(""));
+
+    virtual ~KisBrush();
+
+    virtual bool load();
+    /// synchronous, doesn't emit any signal (none defined!)
+    virtual bool save();
+    virtual TQImage img();
+    virtual bool saveToDevice(TQIODevice* dev) const;
+
+    /**
+       @return a tqmask computed from the grey-level values of the
+       pixels in the brush.
+    */
+    virtual KisAlphaMaskSP tqmask(const KisPaintInformation& info,
+                                double subPixelX = 0, double subPixelY = 0) const;
+    // XXX: return non-tiled simple buffer
+    virtual KisPaintDeviceSP image(KisColorSpace * colorSpace, const KisPaintInformation& info,
+                             double subPixelX = 0, double subPixelY = 0) const;
+
+    void setHotSpot(KisPoint);
+    KisPoint hotSpot(const KisPaintInformation& info = KisPaintInformation()) const;
+
+    void setSpacing(double s) { m_spacing = s; }
+    double spacing() const { return m_spacing; }
+    double xSpacing(double pressure = PRESSURE_DEFAULT) const;
+    double ySpacing(double pressure = PRESSURE_DEFAULT) const;
+
+    // Dimensions in pixels of the tqmask/image at a given pressure.
+    TQ_INT32 tqmaskWidth(const KisPaintInformation& info) const;
+    TQ_INT32 tqmaskHeight(const KisPaintInformation& info) const;
+
+    virtual void setUseColorAsMask(bool useColorAsMask) { m_useColorAsMask = useColorAsMask; }
+    virtual bool useColorAsMask() const { return m_useColorAsMask; }
+    virtual bool hasColor() const;
+
+    virtual void makeMaskImage();
+    TQ_INT32 width() const;
+    TQ_INT32 height() const;
+
+    virtual enumBrushType brushType() const;
+
+    //TQImage outline(double pressure = PRESSURE_DEFAULT);
+    virtual KisBoundary boundary();
+
+    /**
+     * Returns true if this brush can return something useful for the info. This is used
+     * by Pipe Brushes that can't paint sometimes
+     **/
+    virtual bool canPaintFor(const KisPaintInformation& /*info*/) { return true; }
+
+    virtual KisBrush* clone() const;
+
+protected:
+    void setWidth(TQ_INT32 w);
+    void setHeight(TQ_INT32 h);
+    void setImage(const TQImage& img);
+    void setBrushType(enumBrushType type) { m_brushType = type; };
+    static double scaleForPressure(double pressure);
+
+private:
+    class ScaledBrush {
+    public:
+        ScaledBrush();
+        ScaledBrush(KisAlphaMaskSP scaledMask, const TQImage& scaledImage, double scale, double xScale, double yScale);
+
+        double scale() const { return m_scale; }
+        double xScale() const { return m_xScale; }
+        double yScale() const { return m_yScale; }
+        KisAlphaMaskSP tqmask() const { return m_tqmask; }
+        TQImage image() const { return m_image; }
+
+    private:
+        KisAlphaMaskSP m_tqmask;
+        TQImage m_image;
+        double m_scale;
+        double m_xScale;
+        double m_yScale;
+    };
+
+
+    bool init();
+    bool initFromPaintDev(KisPaintDevice* image, int x, int y, int w, int h);
+    void createScaledBrushes() const;
+
+    KisAlphaMaskSP scaleMask(const ScaledBrush *srcBrush, double scale, double subPixelX, double subPixelY) const;
+    TQImage scaleImage(const ScaledBrush *srcBrush, double scale, double subPixelX, double subPixelY) const;
+
+    static TQImage scaleImage(const TQImage& srcImage, int width, int height);
+    static TQImage interpolate(const TQImage& image1, const TQImage& image2, double t);
+
+    static KisAlphaMaskSP scaleSinglePixelMask(double scale, TQ_UINT8 tqmaskValue, double subPixelX, double subPixelY);
+    static TQImage scaleSinglePixelImage(double scale, TQRgb pixel, double subPixelX, double subPixelY);
+
+    // Find the scaled brush(es) nearest to the given scale.
+    void findScaledBrushes(double scale, const ScaledBrush **aboveBrush, const ScaledBrush **belowBrush) const;
+
+    // Initialize our boundary
+    void generateBoundary();
+
+    TQByteArray m_data;
+    bool m_ownData;
+    KisPoint m_hotSpot;
+    double m_spacing;
+    bool m_useColorAsMask;
+    bool m_hasColor;
+    TQImage m_img;
+    mutable TQValueVector<ScaledBrush> m_scaledBrushes;
+
+    TQ_INT32 m_width;
+    TQ_INT32 m_height;
+
+    TQ_UINT32 m_header_size;  /*  header_size = sizeof (BrushHeader) + brush name  */
+    TQ_UINT32 m_version;      /*  brush file version #  */
+    TQ_UINT32 m_bytes;        /*  depth of brush in bytes */
+    TQ_UINT32 m_magic_number; /*  GIMP brush magic number  */
+
+    enumBrushType m_brushType;
+
+    KisBoundary* m_boundary;
+
+};
+#endif // KIS_BRUSH_
+
diff --git a/chalk/core/kis_change_profile_visitor.h b/chalk/core/kis_change_profile_visitor.h
new file mode 100644
index 000000000..dea0eb4b1
--- /dev/null
+++ b/chalk/core/kis_change_profile_visitor.h
@@ -0,0 +1,109 @@
+/*
+ *  Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_CHANGE_PROFILE_VISITOR_H_
+#define KIS_CHANGE_PROFILE_VISITOR_H_
+
+#include "kis_global.h"
+#include "kis_types.h"
+#include "kis_layer_visitor.h"
+#include "kis_paint_layer.h"
+#include "kis_paint_device.h"
+#include "kis_adjustment_layer.h"
+#include "kis_group_layer.h"
+
+/**
+ * The Change Profile visitor walks over all layers and if the current
+ * layer has the specified colorspace AND the specified old profile, sets
+ * the colorspace to the same colorspace with the NEW profile, without doing
+ * conversions. This is essential if you have loaded an image that didn't
+ * have an embedded profile to which you want to attach the right profile.
+ */
+class KisChangeProfileVisitor :public KisLayerVisitor {
+public:
+    KisChangeProfileVisitor(KisColorSpace *oldColorSpace, KisColorSpace *dstColorSpace);
+    virtual ~KisChangeProfileVisitor();
+
+public:
+    virtual bool visit(KisPaintLayer *layer);
+    virtual bool visit(KisGroupLayer *layer);
+    virtual bool visit(KisPartLayer *layer);
+    virtual bool visit(KisAdjustmentLayer* layer);
+    
+private:
+    KisColorSpace *m_oldColorSpace;
+    KisColorSpace *m_dstColorSpace;
+};
+
+KisChangeProfileVisitor::KisChangeProfileVisitor(KisColorSpace * oldColorSpace, 
+                                                 KisColorSpace *dstColorSpace) :
+    KisLayerVisitor(),
+    m_oldColorSpace(oldColorSpace),
+    m_dstColorSpace(dstColorSpace)
+{
+}
+
+KisChangeProfileVisitor::~KisChangeProfileVisitor()
+{
+}
+
+bool KisChangeProfileVisitor::visit(KisGroupLayer * layer)
+{
+    // Clear the projection, we will have to re-render everything.
+    layer->resetProjection();
+    
+    KisLayerSP child = layer->firstChild();
+    while (child) {
+        child->accept(*this);
+        child = child->nextSibling();
+    }
+    layer->setDirty();
+    return true;
+}
+
+bool KisChangeProfileVisitor::visit(KisPaintLayer *layer)
+{
+    if (!layer) return false;
+    if (!layer->paintDevice()) return false;
+    if (!layer->paintDevice()->colorSpace()) return false;
+
+    KisColorSpace * cs = layer->paintDevice()->colorSpace();
+
+    if (cs == m_oldColorSpace) {
+    
+        layer->paintDevice()->setProfile(m_dstColorSpace->getProfile());
+
+        layer->setDirty();
+    }
+    return true;
+}
+
+bool KisChangeProfileVisitor::visit(KisPartLayer *)
+{
+    return true;
+}
+
+
+bool KisChangeProfileVisitor::visit(KisAdjustmentLayer * layer)
+{
+    layer->resetCache();
+    layer->setDirty();
+    return true;
+}
+
+#endif // KIS_CHANGE_PROFILE_VISITOR_H_
+
diff --git a/chalk/core/kis_colorspace_convert_visitor.h b/chalk/core/kis_colorspace_convert_visitor.h
new file mode 100644
index 000000000..e42c08930
--- /dev/null
+++ b/chalk/core/kis_colorspace_convert_visitor.h
@@ -0,0 +1,101 @@
+/*
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_COLORSPACE_CONVERT_VISITOR_H_
+#define KIS_COLORSPACE_CONVERT_VISITOR_H_
+
+#include "kis_global.h"
+#include "kis_types.h"
+#include "kis_layer_visitor.h"
+#include "kis_paint_layer.h"
+#include "kis_paint_device.h"
+#include "kis_adjustment_layer.h"
+#include "kis_group_layer.h"
+
+class KisColorSpaceConvertVisitor :public KisLayerVisitor {
+public:
+    KisColorSpaceConvertVisitor(KisColorSpace *dstColorSpace, TQ_INT32 renderingIntent);
+    virtual ~KisColorSpaceConvertVisitor();
+
+public:
+    virtual bool visit(KisPaintLayer *layer);
+    virtual bool visit(KisGroupLayer *layer);
+    virtual bool visit(KisPartLayer *layer);
+    virtual bool visit(KisAdjustmentLayer* layer);
+    
+private:
+    KisColorSpace *m_dstColorSpace;
+    TQ_INT32 m_renderingIntent;
+};
+
+KisColorSpaceConvertVisitor::KisColorSpaceConvertVisitor(KisColorSpace *dstColorSpace, TQ_INT32 renderingIntent) :
+    KisLayerVisitor(),
+    m_dstColorSpace(dstColorSpace),
+    m_renderingIntent(renderingIntent)
+{
+}
+
+KisColorSpaceConvertVisitor::~KisColorSpaceConvertVisitor()
+{
+}
+
+bool KisColorSpaceConvertVisitor::visit(KisGroupLayer * layer)
+{
+    // Clear the projection, we will have to re-render everything.
+    // The image is already set to the new colorspace, so this'll work.
+    layer->resetProjection();
+    
+    KisLayerSP child = layer->firstChild();
+    while (child) {
+        child->accept(*this);
+        child = child->nextSibling();
+    }
+    layer->setDirty();
+    return true;
+}
+
+bool KisColorSpaceConvertVisitor::visit(KisPaintLayer *layer)
+{
+    layer->paintDevice()->convertTo(m_dstColorSpace, m_renderingIntent);
+
+    layer->setDirty();
+    return true;
+}
+
+bool KisColorSpaceConvertVisitor::visit(KisPartLayer *)
+{
+    return true;
+}
+
+
+bool KisColorSpaceConvertVisitor::visit(KisAdjustmentLayer * layer)
+{
+    if (layer->filter()->name() == "perchannel") {
+        // Per-channel filters need to be reset because of different number
+        // of channels. This makes undo very tricky, but so be it.
+        // XXX: Make this more generic for after 1.6, when we'll have many
+        // channel-specific filters. 
+        KisFilter * f = KisFilterRegistry::instance()->get("perchannel");
+        layer->setFilter(f->configuration());
+    }
+    layer->resetCache();
+    layer->setDirty();
+    return true;
+}
+
+#endif // KIS_COLORSPACE_CONVERT_VISITOR_H_
+
diff --git a/chalk/core/kis_command.cc b/chalk/core/kis_command.cc
new file mode 100644
index 000000000..11da634b8
--- /dev/null
+++ b/chalk/core/kis_command.cc
@@ -0,0 +1,43 @@
+/*
+ *  Copyright (c) 1999 Michael Koch    <koch@kde.org>
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <tqstring.h>
+#include "kis_command.h"
+
+KisCommand::KisCommand(KisUndoAdapter *adapter)
+{
+    m_name = "";
+    m_undoAdapter = adapter;
+}
+
+KisCommand::KisCommand(const TQString& name, KisUndoAdapter *adapter)
+{
+    m_name = name;
+    m_undoAdapter = adapter;
+}
+
+KisCommand::~KisCommand()
+{
+}
+
+TQString KisCommand::name() const
+{
+    return m_name;
+}
+
diff --git a/chalk/core/kis_command.h b/chalk/core/kis_command.h
new file mode 100644
index 000000000..bc87bc5d0
--- /dev/null
+++ b/chalk/core/kis_command.h
@@ -0,0 +1,55 @@
+/*
+ *  Copyright (c) 1999 Michael Koch    <koch@kde.org>
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_COMMAND_H_
+#define KIS_COMMAND_H_
+
+#include <tqstring.h>
+#include <kcommand.h>
+
+class KisUndoAdapter;
+
+class KisCommand : public KCommand {
+    typedef KCommand super;
+
+public:
+    KisCommand(KisUndoAdapter *undoAdapter);
+    KisCommand(const TQString& name, KisUndoAdapter *undoAdapter);
+    virtual ~KisCommand();
+
+    virtual void execute() = 0;
+    virtual void unexecute() = 0;
+    virtual TQString name() const;
+
+protected:
+    KisUndoAdapter *adapter() const;
+
+private:
+    KisUndoAdapter *m_undoAdapter;
+    TQString m_name;
+};
+
+inline
+KisUndoAdapter *KisCommand::adapter() const
+{
+    return m_undoAdapter;
+}
+
+#endif // KIS_COMMAND_H_
+
diff --git a/chalk/core/kis_convolution_painter.cc b/chalk/core/kis_convolution_painter.cc
new file mode 100644
index 000000000..ea0351dfc
--- /dev/null
+++ b/chalk/core/kis_convolution_painter.cc
@@ -0,0 +1,426 @@
+/*
+ *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <cfloat>
+
+#include "tqbrush.h"
+#include "tqcolor.h"
+#include "tqfontinfo.h"
+#include "tqfontmetrics.h"
+#include "tqpen.h"
+#include "tqregion.h"
+#include "tqwmatrix.h"
+#include <tqimage.h>
+#include <tqmap.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqpointarray.h>
+#include <tqrect.h>
+#include <tqstring.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include <tqcolor.h>
+
+#include "kis_brush.h"
+#include "kis_global.h"
+#include "kis_image.h"
+#include "kis_iterators_pixel.h"
+#include "kis_layer.h"
+#include "kis_paint_device.h"
+#include "kis_painter.h"
+#include "kis_pattern.h"
+#include "kis_rect.h"
+#include "kis_colorspace.h"
+#include "kis_types.h"
+#include "kis_vec.h"
+#include "kis_selection.h"
+#include "kis_convolution_painter.h"
+
+
+KisKernelSP KisKernel::fromTQImage(const TQImage& img)
+{
+    KisKernelSP k = new KisKernel;
+    k->width = img.width();
+    k->height = img.height();
+    k->offset = 0;
+    uint count = k->width * k->height;
+    k->data = new TQ_INT32[count];
+    TQ_INT32* itData = k->data;
+    TQ_UINT8* itImg = (TQ_UINT8*)img.bits();
+    k->factor = 0;
+    for(uint i = 0; i < count; ++i , ++itData, itImg+=4)
+    {
+        *itData = 255 - ( *itImg + *(itImg+1) + *(itImg+2) ) / 3;
+        k->factor += *itData;
+    }
+    return k;
+}
+
+
+KisConvolutionPainter::KisConvolutionPainter()
+    : super()
+{
+}
+
+KisConvolutionPainter::KisConvolutionPainter(KisPaintDeviceSP device) : super(device)
+{
+}
+
+void KisConvolutionPainter::applyMatrix(KisKernelSP kernel, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h,
+                    KisConvolutionBorderOp borderOp,
+                    KisChannelInfo::enumChannelFlags  channelFlags )
+{
+    // Make the area we cover as small as possible
+    if (m_device->hasSelection()) {
+
+        TQRect r =  m_device->selection()->selectedRect().intersect(TQRect(x, y, w, h));
+        x = r.x();
+        y = r.y();
+        w = r.width();
+        h = r.height();
+
+    }
+
+    if ( w == 0 && h == 0 ) return;
+
+    // Determine the kernel's extent from the center pixel
+    TQ_INT32 kw, kh, khalfWidth, khalfHeight, xLastMinuskhw, yLastMinuskhh;
+    kw = kernel->width;
+    kh = kernel->height;
+    khalfWidth = (kw - 1) / 2;
+    khalfHeight = (kh - 1) / 2;
+
+    xLastMinuskhw = x + (w - khalfWidth);
+    yLastMinuskhh = y + (h - khalfHeight);
+
+    // Don't try to convolve on an area smaller than the kernel, or with a kernel that is not square or has no center pixel.
+    if (w < kw || h < kh || (kw&1) == 0 || (kh&1) == 0 || kernel->factor == 0 ) return;
+
+    m_cancelRequested = false;
+    int lastProgressPercent = 0;
+    emit notifyProgress(0);
+
+    KisColorSpace * cs = m_device->colorSpace();
+
+    // Determine whether we convolve border pixels, or not.
+    switch (borderOp) {
+        case BORDER_DEFAULT_FILL :
+            break;
+        case BORDER_REPEAT:
+            applyMatrixRepeat(kernel, x, y, w, h, channelFlags);
+            return;
+        case BORDER_WRAP:
+        case BORDER_AVOID:
+        default :
+            x += khalfWidth;
+            y += khalfHeight;
+            w -= kw - 1;
+            h -= kh - 1;
+    }
+
+    // Iterate over all pixels in our rect, create a cache of pixels around the current pixel and convolve them in the colorstrategy.
+
+    int cacheSize = kw * kh;
+    int cdepth = cs -> pixelSize();
+    TQ_UINT8** pixelPtrCache = new TQ_UINT8*[cacheSize];
+    for (int i = 0; i < cacheSize; i++)
+        pixelPtrCache[i] = new TQ_UINT8[cdepth];
+//     pixelPtrCache.fill(0);
+
+    // row == the y position of the pixel we want to change in the paint device
+    int row = y;
+
+    for (; row < y + h; ++row) {
+
+        // col = the x position of the pixel we want to change
+        int col = x;
+
+        KisHLineIteratorPixel hit = m_device->createHLineIterator(x, row, w, true);
+        bool needFull = true;
+        while (!hit.isDone()) {
+
+            // Iterate over all contributing pixels that are covered by the kernel
+            // krow = the y position in the kernel matrix
+            if(needFull)
+            {
+                TQ_INT32 i = 0;
+                for (TQ_INT32 krow = 0; krow <  kh; ++krow) {
+
+                    // col - khalfWidth = the left starting point of the kernel as centered on our pixel
+                    // krow - khalfHeight = the offset for the top of the kernel as centered on our pixel
+                    // kw = the width of the kernel
+
+                    // Fill the cache with pointers to the pixels under the kernel
+                    KisHLineIteratorPixel kit = m_device->createHLineIterator(col - khalfWidth, (row - khalfHeight) + krow, kw, false);
+                    while (!kit.isDone()) {
+                        memcpy(pixelPtrCache[i], kit.oldRawData(), cdepth);
+                        ++kit;
+                        ++i;
+                    }
+                }
+                needFull = false;
+                Q_ASSERT (i==kw*kh);
+            } else {
+                for (TQ_INT32 krow = 0; krow <  kh; ++krow) { // shift the cache to the left
+                    TQ_UINT8** d = pixelPtrCache + krow * kw;
+                    //memmove( d, d + 1, (kw-1)*sizeof(TQ_UINT8*));
+                    for (int i = 0; i < (kw-1); i++) {
+                        memcpy(d[i], d[i+1], cdepth);
+                    }
+                }
+                TQ_INT32 i = kw - 1;
+                KisVLineIteratorPixel kit = m_device->createVLineIterator(col + khalfWidth, row - khalfHeight, kh, false);
+                while (!kit.isDone()) {
+                    memcpy(pixelPtrCache[i], kit.oldRawData(), cdepth);
+                    ++kit;
+                    i += kw;
+                }
+            }
+            if (hit.isSelected()) {
+                cs->convolveColors(pixelPtrCache, kernel->data, channelFlags, hit.rawData(), kernel->factor, kernel->offset, kw * kh);
+//                 pixelPtrCache.fill(0);
+            }
+            ++col;
+            ++hit;
+        }
+
+        int progressPercent = 100 - ((((y + h) - row) * 100) / h);
+
+        if (progressPercent > lastProgressPercent) {
+            emit notifyProgress(progressPercent);
+            lastProgressPercent = progressPercent;
+
+            if (m_cancelRequested) {
+                for (int i = 0; i < cacheSize; i++)
+                    delete[] pixelPtrCache[i];
+                delete[] pixelPtrCache;
+
+                return;
+            }
+        }
+
+    }
+
+    addDirtyRect(TQRect(x, y, w, h));
+
+    emit notifyProgressDone();
+
+    for (int i = 0; i < cacheSize; i++)
+        delete[] pixelPtrCache[i];
+    delete[] pixelPtrCache;
+}
+
+void KisConvolutionPainter::applyMatrixRepeat(KisKernelSP kernel, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h,
+                           KisChannelInfo::enumChannelFlags channelFlags)
+{
+    int lastProgressPercent = 0;
+    // Determine the kernel's extent from the center pixel
+    TQ_INT32 kw, kh, khalfWidth, khalfHeight, xLastMinuskhw, yLastMinuskhh;
+    kw = kernel->width;
+    kh = kernel->height;
+    khalfWidth = (kw - 1) / 2;
+    khalfHeight = (kh - 1) / 2;
+
+    xLastMinuskhw = x + (w - khalfWidth);
+    yLastMinuskhh = y + (h - khalfHeight);
+
+    KisColorSpace * cs = m_device->colorSpace();
+
+    // Iterate over all pixels in our rect, create a cache of pixels around the current pixel and convolve them in the colorstrategy.
+
+    int cacheSize = kw * kh;
+    int cdepth = cs -> pixelSize();
+    TQ_UINT8** pixelPtrCache = new TQ_UINT8*[cacheSize];
+    for (int i = 0; i < cacheSize; i++)
+        pixelPtrCache[i] = new TQ_UINT8[cdepth];
+
+    // row == the y position of the pixel we want to change in the paint device
+    int row = y;
+
+    for (; row < y + h; ++row) {
+
+        // col = the x position of the pixel we want to change
+        int col = x;
+
+        KisHLineIteratorPixel hit = m_device->createHLineIterator(x, row, w, true);
+        bool needFull = true;
+
+        TQ_INT32 itStart = row - khalfHeight;
+        TQ_INT32 itH = kh;
+        if(itStart < 0)
+        {
+            itH += itStart;
+            itStart = 0;
+        } else if(itStart + kh > yLastMinuskhh)
+        {
+            itH -= itStart + kh - yLastMinuskhh;
+        }
+        KisVLineIteratorPixel kit = m_device->createVLineIterator(col + khalfWidth, itStart, itH, false);
+        while (!hit.isDone()) {
+
+            // Iterate over all contributing pixels that are covered by the kernel
+            // krow = the y position in the kernel matrix
+            if(needFull) // The cache has not been fill, so we need to fill it
+            {
+                TQ_INT32 i = 0;
+                TQ_INT32 krow = 0;
+                if( row < khalfHeight )
+                {
+                    // We are just outside the layer, all the row in the cache will be identical
+                    // so we need to create them only once, and then to copy them
+                    if( x < khalfWidth)
+                    { // the left pixels are outside of the layer, in the corner
+                        TQ_INT32 kcol = 0;
+                        KisHLineIteratorPixel kit = m_device->createHLineIterator(0, 0, kw, false);
+                        for(; kcol < (khalfWidth - x) + 1; ++kcol)
+                        { // First copy the address of the topleft pixel
+                            memcpy(pixelPtrCache[kcol], kit.oldRawData(), cdepth);
+                        }
+                        for(; kcol < kw; ++kcol)
+                        { // Then copy the address of the rest of the line
+                            ++kit;
+                            memcpy(pixelPtrCache[kcol], kit.oldRawData(), cdepth);
+                        }
+                    } else {
+                        uint kcol = 0;
+                        KisHLineIteratorPixel kit = m_device->createHLineIterator(col - khalfWidth, 0, kw, false);
+                        while (!kit.isDone()) {
+                            memcpy(pixelPtrCache[kcol], kit.oldRawData(), cdepth);
+                            ++kit;
+                            ++kcol;
+                        }
+                    }
+                    krow = 1; // we have allready done the first krow
+                    for(;krow < (khalfHeight - row); ++krow)
+                    {
+                        //    Copy the first line in the current line
+                        for (int i = 0; i < kw; i++)
+                            memcpy(pixelPtrCache[krow * kw + i], pixelPtrCache[i], cdepth);
+                    }
+                    i = krow * kw;
+                }
+                TQ_INT32 itH = kh;
+                if(row + khalfHeight > yLastMinuskhh)
+                {
+                    itH += yLastMinuskhh - row - khalfHeight;
+                }
+                for (; krow <  itH; ++krow) {
+
+                    // col - khalfWidth = the left starting point of the kernel as centered on our pixel
+                    // krow - khalfHeight = the offset for the top of the kernel as centered on our pixel
+                    // kw = the width of the kernel
+
+                    // Fill the cache with pointers to the pixels under the kernel
+                    TQ_INT32 itHStart = col - khalfWidth;
+                    TQ_INT32 itW = kw;
+                    if(itHStart < 0)
+                    {
+                        itW += itHStart;
+                        itHStart = 0;
+                    }
+                    KisHLineIteratorPixel kit = m_device->createHLineIterator(itHStart, (row - khalfHeight) + krow, itW, false);
+                    if( col < khalfWidth )
+                    {
+                        for(; i <  krow * kw + ( kw - itW ); i+= 1)
+                        {
+                            memcpy(pixelPtrCache[i], kit.oldRawData(), cdepth);
+                        }
+                    }
+                    while (!kit.isDone()) {
+                        memcpy(pixelPtrCache[i], kit.oldRawData(), cdepth);
+                        ++kit;
+                        ++i;
+                    }
+                }
+                TQ_INT32 lastvalid = i - kw;
+                for(; krow < kh; ++krow) {
+                    // Copy the last valid line in the current line
+                    for (int i = 0; i < kw; i++)
+                        memcpy(pixelPtrCache[krow * kw + i], pixelPtrCache[lastvalid + i],
+                                cdepth);
+                }
+                needFull = false;
+            } else {
+/*                for (TQ_INT32 krow = 0; krow <  kh; ++krow) { // shift the cache to the left
+                    TQ_UINT8** d = pixelPtrCache + krow * kw;
+//                     memmove( d, d + 1, (kw-1)*sizeof(TQ_UINT8*));
+                    for (int i = 0; i < (kw-1); i++) {
+                        memcpy(d[i], d[i+1], cdepth);
+                    }
+                }*/
+                TQ_UINT8* firstincache = pixelPtrCache[0];
+                memmove(pixelPtrCache, pixelPtrCache + 1, (cacheSize - 1) * sizeof(TQ_UINT8*) );
+                pixelPtrCache[cacheSize - 1] = firstincache;
+                if(col < xLastMinuskhw)
+                {
+                    TQ_INT32 i = kw - 1;
+//                         KisVLineIteratorPixel kit = m_device->createVLineIterator(col + khalfWidth, itStart, itH, false);
+                    kit.nextCol();
+                    if( row < khalfHeight )
+                    {
+                        for(; i < (khalfHeight- row ) * kw; i+=kw)
+                        {
+                            memcpy(pixelPtrCache[i], kit.oldRawData(), cdepth);
+                        }
+                    }
+                    while (!kit.isDone()) {
+                        memcpy(pixelPtrCache[i], kit.oldRawData(), cdepth);
+                        ++kit;
+                        i += kw;
+                    }
+                    TQ_INT32 lastvalid = i - kw;
+                    for(;i < kw*kh; i+=kw)
+                    {
+                        memcpy(pixelPtrCache[i], pixelPtrCache[lastvalid], cdepth);
+                    }
+                }
+            }
+            if (hit.isSelected()) {
+                cs->convolveColors(pixelPtrCache, kernel->data, channelFlags, hit.rawData(), kernel->factor, kernel->offset, kw * kh);
+            }
+            ++col;
+            ++hit;
+        }
+
+        int progressPercent = 100 - ((((y + h) - row) * 100) / h);
+
+        if (progressPercent > lastProgressPercent) {
+            emit notifyProgress(progressPercent);
+            lastProgressPercent = progressPercent;
+
+            if (m_cancelRequested) {
+                for (int i = 0; i < cacheSize; i++)
+                    delete[] pixelPtrCache[i];
+                delete[] pixelPtrCache;
+                return;
+            }
+        }
+
+    }
+
+    addDirtyRect(TQRect(x, y, w, h));
+
+    emit notifyProgressDone();
+    for (int i = 0; i < cacheSize; i++)
+        delete[] pixelPtrCache[i];
+    delete[] pixelPtrCache;
+}
diff --git a/chalk/core/kis_convolution_painter.h b/chalk/core/kis_convolution_painter.h
new file mode 100644
index 000000000..8c0b2bbaa
--- /dev/null
+++ b/chalk/core/kis_convolution_painter.h
@@ -0,0 +1,95 @@
+/*
+ *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_CONVOLUTION_PAINTER_H_
+#define KIS_CONVOLUTION_PAINTER_H_
+
+#include <tqimage.h>
+
+#include "ksharedptr.h"
+#include "kis_types.h"
+#include "kis_painter.h"
+
+#include "koffice_export.h"
+
+enum KisConvolutionBorderOp {
+    BORDER_DEFAULT_FILL = 0, // Use the default pixel to make up for the missing pixels on the border or the pixel that lies beyond
+                             // the rect we are convolving.
+    BORDER_WRAP = 1, // Use the pixel on the opposite side to make up for the missing pixels on the border. XXX: Not implemented yet
+    BORDER_REPEAT = 2, // Use the border for the missing pixels, too.
+    BORDER_AVOID = 3 // Skip convolving the border pixels at all.
+};
+
+class KisKernel;
+typedef KSharedPtr<KisKernel> KisKernelSP;
+
+class KisKernel : public KShared 
+{
+
+public:
+    
+    TQ_UINT32 width;
+    TQ_UINT32 height;
+    TQ_INT32 offset;
+    TQ_INT32 factor;
+    TQ_INT32 * data;
+
+    KisKernel() : width(0), height(0), offset(0), factor(0), data(0) {};
+
+    virtual ~KisKernel() { delete [] data; };
+
+    static KisKernelSP fromTQImage(const TQImage& img);
+
+};
+
+
+class KRITACORE_EXPORT KisConvolutionPainter : public KisPainter
+{
+
+    typedef KisPainter super;
+
+public:
+
+    KisConvolutionPainter();
+    KisConvolutionPainter(KisPaintDeviceSP device);
+
+    /**
+     * Convolve all channels in src using the specified kernel; there is only one kernel for all
+     * channels possible. By default the the border pixels are not convolved, that is, convolving
+     * starts with at (x + kernel.width/2, y + kernel.height/2) and stops at w - (kernel.width/2)
+     * and h - (kernel.height/2)
+     *
+     * The border op decides what to do with pixels too close to the edge of the rect as defined above.
+     *
+     * The channels flag determines which set out of color channels, alpha channels, substance or substrate
+     * channels we convolve.
+     *
+     * Note that we do not (currently) support different kernels for different channels _or_ channel types.
+     */
+    void applyMatrix(KisKernelSP kernel, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h,
+                     KisConvolutionBorderOp borderOp = BORDER_AVOID,
+                     KisChannelInfo::enumChannelFlags channelFlags = KisChannelInfo::FLAG_COLOR);
+private:
+    /**
+     * This function is called by applyMatrix when borderOp == BORDER_REPEAT
+     */
+    void applyMatrixRepeat(KisKernelSP kernel, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h,
+                           KisChannelInfo::enumChannelFlags channelFlags);
+
+
+};
+#endif //KIS_CONVOLUTION_PAINTER_H_
diff --git a/chalk/core/kis_crop_visitor.h b/chalk/core/kis_crop_visitor.h
new file mode 100644
index 000000000..0988a920f
--- /dev/null
+++ b/chalk/core/kis_crop_visitor.h
@@ -0,0 +1,109 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_CROP_VISITOR_H_
+#define KIS_CROP_VISITOR_H_
+
+#include "tqrect.h"
+
+#include "klocale.h"
+
+#include "kis_layer_visitor.h"
+#include "kis_types.h"
+#include "kis_layer.h"
+#include "kis_group_layer.h"
+#include "kis_paint_layer.h"
+#include "kis_adjustment_layer.h"
+#include "kis_transaction.h"
+#include <kis_selected_transaction.h>
+
+class KisProgressDisplayInterface;
+class KisFilterStrategy;
+
+class KisCropVisitor : public KisLayerVisitor {
+
+public:
+
+    KisCropVisitor( const TQRect & rc, bool movelayers = true) 
+        : KisLayerVisitor()
+        , m_rect(rc), m_movelayers(movelayers)
+    {
+    }
+
+    virtual ~KisCropVisitor()
+    {
+    }
+
+    /**
+     * Crops the specified layer and adds the undo information to the undo adapter of the
+     * layer's image.
+     */
+    bool visit(KisPaintLayer *layer) 
+    {
+        KisPaintDeviceSP dev = layer->paintDevice();
+        KisSelectedTransaction * t = 0;
+        if (layer->undoAdapter() && layer->undoAdapter()->undo())
+            t = new KisSelectedTransaction(i18n("Crop"), dev.data());
+
+        dev->crop(m_rect);
+
+        if (layer->undoAdapter() && layer->undoAdapter()->undo()) {
+            layer->undoAdapter()->addCommand(t);
+        }
+        
+        if(m_movelayers) {
+            if(layer->undoAdapter() && layer->undoAdapter()->undo()) {
+                KNamedCommand * cmd = dev->moveCommand(layer->x() - m_rect.x(), layer->y() - m_rect.y());
+      	        layer->undoAdapter()->addCommand(cmd);
+    	    }
+        }
+        layer->setDirty(dev->image()->bounds());
+        return true;
+    };
+
+    bool visit(KisGroupLayer *layer)
+    {
+	layer->resetProjection();
+
+        KisLayerSP child = layer->firstChild();
+        while (child) {
+            child->accept(*this);
+            child = child->nextSibling();
+        }
+        layer->setDirty();
+        return true;
+    };
+
+    bool visit(KisPartLayer */*layer*/)
+    {
+        return true;
+    };
+
+    virtual bool visit(KisAdjustmentLayer* layer)
+    {
+        layer->resetCache();
+        return true;
+    }
+    
+
+private:
+    TQRect m_rect;
+    bool m_movelayers;
+};
+
+
+#endif
diff --git a/chalk/core/kis_datamanager.h b/chalk/core/kis_datamanager.h
new file mode 100644
index 000000000..79f7ddb8c
--- /dev/null
+++ b/chalk/core/kis_datamanager.h
@@ -0,0 +1,217 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_DATAMANAGER_H_
+#define KIS_DATAMANAGER_H_
+
+#include <tqglobal.h>
+#include <tqvaluevector.h>
+#include <tqrect.h>
+
+class KoStore;
+
+
+// Change the following two lines to switch (at compiletime) to another datamanager
+#include "tiles/kis_tileddatamanager.h"
+#define ACTUAL_DATAMGR KisTiledDataManager
+
+/**
+ * KisDataManager defines the interface that modules responsible for
+ * storing and retrieving data must inmplement. Data modules, like
+ * the tile manager, are responsible for:
+ *
+ * * Storing undo/redo data
+ * * Offering ordererd and unordered iterators over rects of pixels
+ * * (eventually) efficiently loading and saving data in a format
+ * that may allow deferred loading.
+ *
+ * A datamanager knows nothing about the type of pixel data except
+ * how many TQ_UINT8's a single pixel takes.
+ */
+class KisDataManager : public ACTUAL_DATAMGR {
+
+public:
+    KisDataManager(TQ_UINT32 pixelSize, const TQ_UINT8 *defPixel) : ACTUAL_DATAMGR(pixelSize, defPixel) {}
+    KisDataManager(const KisDataManager& dm) : ACTUAL_DATAMGR(dm) { }
+
+public:
+    /**
+     * Sets the default pixel. Note that this might change every occurrance, and it might not, but new data
+     * well be initialised with this pixel
+     */
+    inline void setDefaultPixel(const TQ_UINT8 *defPixel) { return ACTUAL_DATAMGR::setDefaultPixel(defPixel); }
+
+    /**
+     * Gets the default pixel.
+     */
+     inline const TQ_UINT8 *defaultPixel() const { return ACTUAL_DATAMGR::defaultPixel(); }
+
+    /**
+     * Reguests a memento from the data manager. There is only one memento active
+     * at any given moment for a given paint device and all and any
+     * write actions on the datamanger builds undo data into this memento
+     * necessary to rollback the transaction.
+     */
+    inline KisMementoSP getMemento() { return ACTUAL_DATAMGR::getMemento(); }
+
+    /**
+     * Restores the image data to the state at the time of the getMemento() call.
+     *
+     * Note that rollback should be performed with mementos in the reverse order of
+     * their creation, as mementos only store incremental changes
+     */
+    inline void rollback(KisMementoSP memento) { ACTUAL_DATAMGR::rollback(memento); }
+
+    /**
+     * Restores the image data to the state at the time of the rollback call of the memento.
+     *
+     * Note that rollforward must only be called when an rollback have previously been performed, and
+     * no intermittent actions have been performed (though it's ok to rollback other mementos and
+     * roll them forward again)
+     */
+    inline void rollforward(KisMementoSP memento) { ACTUAL_DATAMGR::rollforward(memento); }
+
+public:
+    /**
+     * Reads and writes the tiles from/onto a KoStore (wich is simply a file within a zip file)
+     *
+     */
+    inline bool write(KoStore *store) { return ACTUAL_DATAMGR::write(store); }
+    inline bool read(KoStore *store) { return ACTUAL_DATAMGR::read(store); }
+
+public:
+
+    /**
+     * Returns the number of bytes a pixel takes
+     */
+    inline TQ_UINT32 pixelSize() { return ACTUAL_DATAMGR::pixelSize(); }
+
+    /**
+     * Return the extent of the data in x,y,w,h.
+     */
+    inline void extent(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const
+                         { return ACTUAL_DATAMGR::extent(x, y, w, h); }
+
+     TQRect extent() const { return ACTUAL_DATAMGR::extent(); }
+
+
+public:
+
+    /**
+      * Crop or extend the data to x, y, w, h.
+      */
+    inline void setExtent(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h)
+                         { return ACTUAL_DATAMGR::setExtent(x, y, w, h); }
+
+    inline void setExtent(const TQRect & rect) { setExtent(rect.x(), rect.y(), rect.width(), rect.height()); }
+
+public:
+
+    /**
+     * Clear the specified rect to the specified value.
+     */
+    inline void clear(TQ_INT32 x, TQ_INT32 y,
+           TQ_INT32 w, TQ_INT32 h,
+           TQ_UINT8 def) { ACTUAL_DATAMGR::clear(x, y, w, h, def); }
+
+    /**
+     * Clear the specified rect to the specified pixel value.
+     */
+    inline void clear(TQ_INT32 x, TQ_INT32 y,
+           TQ_INT32 w, TQ_INT32 h,
+           const TQ_UINT8 * def) { ACTUAL_DATAMGR::clear(x, y, w, h, def); }
+
+    /**
+     * Clear all back to default values.
+     */
+    inline void clear() { ACTUAL_DATAMGR::clear(); }
+
+
+public:
+
+    /**
+     * Copy the specified rect from the specified data into this
+     * data.
+     */
+    inline void paste(KisDataManagerSP data,  TQ_INT32 sx, TQ_INT32 sy, TQ_INT32 dx, TQ_INT32 dy,
+           TQ_INT32 w, TQ_INT32 h) { ACTUAL_DATAMGR::paste(data, sx, sy, dx, dy, w, h); }
+
+public:
+    /**
+     * Get a read-only pointer to the specified pixel.
+     */
+    inline KDE_DEPRECATED const TQ_UINT8* pixel(TQ_INT32 x, TQ_INT32 y)
+          { return ACTUAL_DATAMGR::pixel(x, y); }
+
+    /**
+     * Get a read-write pointer to the specified pixel.
+     */
+    inline KDE_DEPRECATED TQ_UINT8* writablePixel(TQ_INT32 x, TQ_INT32 y)
+          { return ACTUAL_DATAMGR::writablePixel(x, y); }
+
+    /**
+     * Write the specified data to x, y. There is no checking on pixelSize!
+     */
+    inline void setPixel(TQ_INT32 x, TQ_INT32 y, const TQ_UINT8 * data)
+        { ACTUAL_DATAMGR::setPixel(x, y, data);}
+
+
+     /**
+      * Copy the bytes in the specified rect to a chunk of memory.
+      * The pixelSize in bytes is w * h * pixelSize. XXX: Better
+      * use TQValueVector?
+      */
+     inline void readBytes(TQ_UINT8 * data,
+               TQ_INT32 x, TQ_INT32 y,
+               TQ_INT32 w, TQ_INT32 h)
+        { ACTUAL_DATAMGR::readBytes(data, x, y, w, h);}
+
+     /**
+     * Copy the bytes to the specified rect. w * h * pixelSize bytes will be read, whether
+     * the caller prepared them or not. XXX: Better use TQValueVector?
+      */
+     inline void writeBytes(const TQ_UINT8 * data,
+             TQ_INT32 x, TQ_INT32 y,
+             TQ_INT32 w, TQ_INT32 h)
+        {ACTUAL_DATAMGR::writeBytes( data, x, y, w, h); }
+
+    // Get the number of contiguous columns starting at x, valid for all values
+    // of y between minY and maxY.
+    inline TQ_INT32 numContiguousColumns(TQ_INT32 x, TQ_INT32 minY, TQ_INT32 maxY)
+        { return ACTUAL_DATAMGR::numContiguousColumns(x, minY, maxY); }
+
+
+    // Get the number of contiguous rows starting at y, valid for all values
+    // of x between minX and maxX.
+    inline TQ_INT32 numContiguousRows(TQ_INT32 y, TQ_INT32 minX, TQ_INT32 maxX)
+        { return ACTUAL_DATAMGR::numContiguousRows(y, minX, maxX); }
+
+
+    // Get the row stride at pixel (x, y). This is the number of bytes to add to a
+    // pointer to pixel (x, y) to access (x, y + 1).
+    inline TQ_INT32 rowStride(TQ_INT32 x, TQ_INT32 y)
+        { return ACTUAL_DATAMGR::rowStride(x, y); }
+
+protected:
+    friend class KisRectIterator;
+    friend class KisHLineIterator;
+    friend class KisVLineIterator;
+};
+
+
+#endif // KIS_DATAMANAGER_H_
+
diff --git a/chalk/core/kis_exif_info.cc b/chalk/core/kis_exif_info.cc
new file mode 100644
index 000000000..5d54ed5e7
--- /dev/null
+++ b/chalk/core/kis_exif_info.cc
@@ -0,0 +1,66 @@
+/*
+ * This file is part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kis_exif_info.h"
+
+#include <stdlib.h>
+
+#include <kdebug.h>
+
+KisExifInfo::KisExifInfo()
+{}
+
+
+KisExifInfo::~KisExifInfo()
+{}
+
+
+bool KisExifInfo::load(const TQDomElement& elmt)
+{
+    if(elmt.tagName() != "ExifInfo")
+        return false;
+    for( TQDomNode node = elmt.firstChild(); !node.isNull(); node = node.nextSibling() )
+    {
+        TQDomElement e = node.toElement();
+        if ( !e.isNull() )
+        {
+            if(e.tagName() == "ExifValue")
+            {
+                TQString key = e.attribute("name");
+                ExifValue eV;
+                eV.load(e);
+                setValue(key, eV);
+            }
+        }
+    }
+    return true;
+}
+
+TQDomElement KisExifInfo::save(TQDomDocument& doc)
+{
+    TQDomElement elmt = doc.createElement("ExifInfo");
+    for( KisExifInfo::evMap::const_iterator it = begin(); it != end(); ++it)
+    {
+        ExifValue ev = it.data();
+        TQDomElement evD = ev.save( doc);
+        evD.setAttribute("name", it.key());
+        elmt.appendChild(evD);
+    }
+    return elmt;
+}
diff --git a/chalk/core/kis_exif_info.h b/chalk/core/kis_exif_info.h
new file mode 100644
index 000000000..d3fa3428b
--- /dev/null
+++ b/chalk/core/kis_exif_info.h
@@ -0,0 +1,58 @@
+/*
+ * This file is part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_DOCUMENT_INFO_EXIF_H
+#define KIS_DOCUMENT_INFO_EXIF_H
+
+#include "kis_exif_value.h"
+
+#include <tqdom.h> 
+#include <tqmap.h>
+
+class KisExifInfo
+{
+    public:
+        KisExifInfo();
+        virtual ~KisExifInfo();
+
+        virtual bool load(const TQDomElement& elmt);
+        virtual TQDomElement save(TQDomDocument& doc);
+
+        bool getValue(TQString name, ExifValue& value)
+        {
+            if ( m_values.tqfind( name ) == m_values.end() ) {
+                return false;
+            }
+            else {
+                value = m_values[name];
+                return true;
+            }
+        }
+        void setValue(TQString name, ExifValue value)
+        {
+            m_values[name] = value;
+        }
+        typedef TQMap<TQString, ExifValue> evMap;
+        evMap::const_iterator begin() const { return m_values.begin(); }
+        evMap::const_iterator end() const { return m_values.end(); }
+    private:
+        evMap m_values;
+};
+
+#endif
diff --git a/chalk/core/kis_exif_value.cc b/chalk/core/kis_exif_value.cc
new file mode 100644
index 000000000..1b7bcf324
--- /dev/null
+++ b/chalk/core/kis_exif_value.cc
@@ -0,0 +1,678 @@
+/*
+ * This file is part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_exif_value.h"
+
+#include <kdebug.h>
+#include <kmdcodec.h>
+
+namespace {
+void set16Bit (unsigned char *data, ExifValue::ByteOrder order, const TQ_UINT16* value)
+{
+    switch (order) {
+        case ExifValue::BYTE_ORDER_MOTOROLA:
+            data[0] = (unsigned char) (*value >> 8);
+            data[1] = (unsigned char) *value;
+            break;
+        case ExifValue::BYTE_ORDER_INTEL:
+            data[0] = (unsigned char) *value;
+            data[1] = (unsigned char) (*value >> 8);
+            break;
+    }
+}
+
+void get16Bit (const unsigned char *data, ExifValue::ByteOrder order, TQ_UINT16* value)
+{
+    switch (order) {
+        case ExifValue::BYTE_ORDER_MOTOROLA:
+            *value = ((data[0] << 8) | data[1]);
+            break;
+        case ExifValue::BYTE_ORDER_INTEL:
+            *value = ((data[1] << 8) | data[0]);
+            break;
+    }
+}
+
+void get32Bit (const unsigned char *data, ExifValue::ByteOrder order, TQ_UINT32* value)
+{
+    switch (order) {
+        case ExifValue::BYTE_ORDER_MOTOROLA:
+            *value = ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]);
+            break;
+        case ExifValue::BYTE_ORDER_INTEL:
+            *value = ((data[3] << 24) | (data[2] << 16) | (data[1] << 8) | data[0]);
+    }
+}
+
+void set32Bit(unsigned char *data, ExifValue::ByteOrder order, const TQ_UINT32* value)
+{
+    switch (order) {
+        case ExifValue::BYTE_ORDER_MOTOROLA:
+            data[0] = (unsigned char) (*value >> 24);
+            data[1] = (unsigned char) (*value >> 16);
+            data[2] = (unsigned char) (*value >> 8);
+            data[3] = (unsigned char) *value;
+            break;
+        case ExifValue::BYTE_ORDER_INTEL:
+            data[3] = (unsigned char) (*value >> 24);
+            data[2] = (unsigned char) (*value >> 16);
+            data[1] = (unsigned char) (*value >> 8);
+            data[0] = (unsigned char) *value;
+            break;
+    }
+}
+
+void get64Bit (const unsigned char *data, ExifValue::ByteOrder order, TQ_UINT64* value)
+{
+    switch (order) {
+        case ExifValue::BYTE_ORDER_MOTOROLA:
+            *value = (((TQ_UINT64)data[0] << 56) | ((TQ_UINT64)data[1] << 48) | ((TQ_UINT64)data[2] << 40) | ((TQ_UINT64)data[3] << 32) | ((TQ_UINT64)data[4] << 24) | ((TQ_UINT64)data[5] << 16) | ((TQ_UINT64)data[6] << 8) | (TQ_UINT64)data[7]);
+            break;
+        case ExifValue::BYTE_ORDER_INTEL:
+            *value = (((TQ_UINT64)data[7] << 56) | ((TQ_UINT64)data[6] << 48) | ((TQ_UINT64)data[5] << 40) | ((TQ_UINT64)data[4] << 32) | ((TQ_UINT64)data[3] << 24) | ((TQ_UINT64)data[2] << 16) | ((TQ_UINT64)data[1] << 8) | (TQ_UINT64)data[0]);
+    }
+}
+
+void set64Bit(unsigned char *data, ExifValue::ByteOrder order, const TQ_UINT64* value)
+{
+    switch (order) {
+        case ExifValue::BYTE_ORDER_MOTOROLA:
+            data[0] = (unsigned char) (*value >> 56);
+            data[1] = (unsigned char) (*value >> 48);
+            data[2] = (unsigned char) (*value >> 40);
+            data[3] = (unsigned char) (*value >> 32);
+            data[4] = (unsigned char) (*value >> 24);
+            data[5] = (unsigned char) (*value >> 16);
+            data[6] = (unsigned char) (*value >> 8);
+            data[7] = (unsigned char) *value;
+            break;
+        case ExifValue::BYTE_ORDER_INTEL:
+            data[7] = (unsigned char) (*value >> 56);
+            data[6] = (unsigned char) (*value >> 48);
+            data[5] = (unsigned char) (*value >> 40);
+            data[4] = (unsigned char) (*value >> 32);
+            data[3] = (unsigned char) (*value >> 24);
+            data[2] = (unsigned char) (*value >> 16);
+            data[1] = (unsigned char) (*value >> 8);
+            data[0] = (unsigned char) *value;
+            break;
+    }
+}
+
+
+}
+
+ExifValue::ExifValue(ExifType ntype, unsigned char *data, unsigned int size, int ifd, uint ncomponents, ExifValue::ByteOrder order ) : m_ifd(ifd), m_type(ntype), m_components(ncomponents), m_value(0)
+{
+    allocData();
+    setValue(data, size, order);
+}
+
+void ExifValue::allocData()
+{
+    if( type() != EXIF_TYPE_ASCII && type() != EXIF_TYPE_UNDEFINED)
+    {
+        m_value = new ExifNumber[components()];
+    } else if ( type() == EXIF_TYPE_ASCII )
+    {
+        m_value = new TQString();
+    } else if ( type() == EXIF_TYPE_UNDEFINED)
+    {
+        m_value = new UByteArray();
+    }
+}
+
+bool ExifValue::load(const TQDomElement& elmt)
+{
+    TQString attr;
+    if( (attr = elmt.attribute("ifd")).isNull() )
+        return false;
+    m_ifd = attr.toInt();
+    if( (attr = elmt.attribute("components")).isNull() )
+        return false;
+    m_components = attr.toInt();
+    if( (attr = elmt.attribute("type")).isNull() )
+        return false;
+    m_type = (ExifValue::ExifType)attr.toInt();
+    allocData();
+    switch(type())
+    {
+        case EXIF_TYPE_BYTE:
+            for(uint i = 0; i < components(); i++)
+            {
+                if( (attr = elmt.attribute(TQString("value%1").tqarg(i) ) ).isNull() )
+                {
+                    setValue(i, (TQ_UINT8)0);
+                } else {
+                    setValue(i, (TQ_UINT8) attr.toUInt());
+                }
+            }
+            break;
+        case EXIF_TYPE_ASCII:
+            setAsAscii( elmt.attribute("value" ) );
+            break;
+        case EXIF_TYPE_SHORT:
+            for(uint i = 0; i < components(); i++)
+            {
+                if( (attr = elmt.attribute(TQString("value%1").tqarg(i) ) ).isNull() )
+                {
+                    setValue(i, (TQ_UINT16)0);
+                } else {
+                    setValue(i, (TQ_UINT16) attr.toUInt());
+                }
+            }
+            break;
+        case EXIF_TYPE_LONG:
+            for(uint i = 0; i < components(); i++)
+            {
+                if( (attr = elmt.attribute(TQString("value%1").tqarg(i) ) ).isNull() )
+                {
+                    setValue(i, (TQ_UINT32)0);
+                } else {
+                    setValue(i, (TQ_UINT32) attr.toUInt());
+                }
+            }
+            break;
+        case EXIF_TYPE_RATIONAL:
+            for(uint i = 0; i < components(); i++)
+            {
+                KisExifRational r;
+                if( (attr = elmt.attribute(TQString("numerator%1").tqarg(i) ) ).isNull() )
+                {
+                    r.numerator = (TQ_UINT32)0;
+                } else {
+                    r.numerator = (TQ_UINT32) attr.toUInt();
+                }
+                if( (attr = elmt.attribute(TQString("denominator%1").tqarg(i) ) ).isNull() )
+                {
+                    r.denominator = (TQ_UINT32)0;
+                } else {
+                    r.denominator = (TQ_UINT32) attr.toUInt();
+                }
+                setValue(i, r);
+            }
+            break;
+        case EXIF_TYPE_SBYTE:
+            for(uint i = 0; i < components(); i++)
+            {
+                if( (attr = elmt.attribute(TQString("value%1").tqarg(i) ) ).isNull() )
+                {
+                    setValue(i, (TQ_INT8)0);
+                } else {
+                    setValue(i, (TQ_INT8) attr.toInt());
+                }
+            }
+            break;
+        case EXIF_TYPE_UNDEFINED:
+        {
+            TQString instr = elmt.attribute("value");
+            TQByteArray out;
+            TQByteArray in = instr.utf8();
+            KCodecs::base64Decode( in, out);
+            out.resize(out.size() - 2 );
+            setAsUndefined((uchar*)out.data(), out.size() );
+        }
+        break;
+        case EXIF_TYPE_SSHORT:
+            for(uint i = 0; i < components(); i++)
+            {
+                if( (attr = elmt.attribute(TQString("value%1").tqarg(i) ) ).isNull() )
+                {
+                    setValue(i, (TQ_INT16)0);
+                } else {
+                    setValue(i, (TQ_INT16) attr.toInt());
+                }
+            }
+            break;
+        case EXIF_TYPE_SLONG:
+            for(uint i = 0; i < components(); i++)
+            {
+                if( (attr = elmt.attribute(TQString("value%1").tqarg(i) ) ).isNull() )
+                {
+                    setValue(i, (TQ_INT32)0);
+                } else {
+                    setValue(i, (TQ_INT32) attr.toInt());
+                }
+            }
+            break;
+        case EXIF_TYPE_SRATIONAL:
+            for(uint i = 0; i < components(); i++)
+            {
+                KisExifSRational r;
+                if( (attr = elmt.attribute(TQString("numerator%1").tqarg(i) ) ).isNull() )
+                {
+                    r.numerator = (TQ_INT32)0;
+                } else {
+                    r.numerator = (TQ_INT32) attr.toInt();
+                }
+                if( (attr = elmt.attribute(TQString("denominator%1").tqarg(i) ) ).isNull() )
+                {
+                    r.denominator = (TQ_UINT32)0;
+                } else {
+                    r.denominator = (TQ_UINT32) attr.toInt();
+                }
+                setValue(i, r);
+            }
+            break;
+        case EXIF_TYPE_FLOAT:
+            for(uint i = 0; i < components(); i++)
+            {
+                if( (attr = elmt.attribute(TQString("value%1").tqarg(i) ) ).isNull() )
+                {
+                    setValue(i, (float)0);
+                } else {
+                    setValue(i, (float) attr.toFloat());
+                }
+            }
+            break;
+        case EXIF_TYPE_DOUBLE:
+            for(uint i = 0; i < components(); i++)
+            {
+                if( (attr = elmt.attribute(TQString("value%1").tqarg(i) ) ).isNull() )
+                {
+                    setValue(i, (double)0);
+                } else {
+                    setValue(i, (double) attr.toDouble());
+                }
+            }
+            break;
+        case EXIF_TYPE_UNKNOW:
+            break;
+
+    }
+    return true;
+}
+
+TQDomElement ExifValue::save(TQDomDocument& doc)
+{
+    TQDomElement elmt = doc.createElement("ExifValue");
+    elmt.setAttribute("ifd", ifd());
+    elmt.setAttribute("components", components() );
+    elmt.setAttribute("type", type() );
+    switch(type())
+    {
+        case EXIF_TYPE_BYTE:
+            for(uint i = 0; i < components(); i++)
+                elmt.setAttribute(TQString("value%1").tqarg(i), asByte( i ) );
+            break;
+        case EXIF_TYPE_ASCII:
+            elmt.setAttribute("value", asAscii() );
+            break;
+        case EXIF_TYPE_SHORT:
+            for(uint i = 0; i < components(); i++)
+                elmt.setAttribute(TQString("value%1").tqarg(i), asShort( i ) );
+            break;
+        case EXIF_TYPE_LONG:
+            for(uint i = 0; i < components(); i++)
+                elmt.setAttribute(TQString("value%1").tqarg(i), asLong( i ) );
+            break;
+        case EXIF_TYPE_RATIONAL:
+            for(uint i = 0; i < components(); i++)
+            {
+                KisExifRational r = asRational(i);
+                elmt.setAttribute(TQString("numerator%1").tqarg(i), r.numerator );
+                elmt.setAttribute(TQString("denominator%1").tqarg(i), r.denominator );
+            }
+            break;
+        case EXIF_TYPE_SBYTE:
+            for(uint i = 0; i < components(); i++)
+                elmt.setAttribute(TQString("value%1").tqarg(i), asSByte( i ) );
+            break;
+        case EXIF_TYPE_UNDEFINED:
+        {
+            UByteArray value = asUndefined();
+            TQByteArray data;
+            data.setRawData((char*)value.data(), value.size());
+            TQByteArray tqencodedData;
+            KCodecs::base64Encode( data, tqencodedData );
+            data.resetRawData( (char*)value.data(), value.size());
+            elmt.setAttribute("value", TQString(tqencodedData));
+        }
+            break;
+        case EXIF_TYPE_SSHORT:
+            for(uint i = 0; i < components(); i++)
+                elmt.setAttribute(TQString("value%1").tqarg(i), asSShort( i ) );
+            break;
+        case EXIF_TYPE_SLONG:
+            for(uint i = 0; i < components(); i++)
+                elmt.setAttribute(TQString("value%1").tqarg(i), asSLong( i ) );
+            break;
+        case EXIF_TYPE_SRATIONAL:
+            for(uint i = 0; i < components(); i++)
+            {
+                KisExifSRational r = asSRational(i);
+                elmt.setAttribute(TQString("numerator%1").tqarg(i), r.numerator );
+                elmt.setAttribute(TQString("denominator%1").tqarg(i), r.denominator );
+            }
+            break;
+        case EXIF_TYPE_FLOAT:
+            for(uint i = 0; i < components(); i++)
+                elmt.setAttribute(TQString("value%1").tqarg(i), asFloat( i ) );
+            break;
+        case EXIF_TYPE_DOUBLE:
+            for(uint i = 0; i < components(); i++)
+                elmt.setAttribute(TQString("value%1").tqarg(i), asDouble( i ) );
+            break;
+        case EXIF_TYPE_UNKNOW:
+            break;
+    }
+    return elmt;
+}
+
+
+void ExifValue::setValue(const unsigned char *data, unsigned int size, ExifValue::ByteOrder order)
+{
+    switch(type())
+    {
+        case EXIF_TYPE_BYTE:
+            if( size == components() )
+            {
+                ExifNumber n;
+                for(uint i = 0; i < components(); i++)
+                {
+                    n.m_byte = data[i];
+                    setAsExifNumber( i, n);
+                }
+            }
+            break;
+        case EXIF_TYPE_ASCII:
+            setAsAscii((char*) data);
+            break;
+        case EXIF_TYPE_SHORT:
+            if( size == 2*components() )
+            {
+                ExifNumber n;
+                for(uint i = 0; i < components(); i++)
+                {
+                    get16Bit( data + 2 * i, order, &n.m_short);
+                    setAsExifNumber( i, n);
+                }
+            }
+            break;
+        case EXIF_TYPE_LONG:
+            if( size == 4*components() )
+            {
+                ExifNumber n;
+                for(uint i = 0; i < components(); i++)
+                {
+                    get32Bit( data + 4 * i, order, &n.m_long);
+                    setAsExifNumber( i, n);
+                }
+            }
+            break;
+        case EXIF_TYPE_RATIONAL:
+            if( size == 8*components() )
+            {
+                ExifNumber n;
+                for(uint i = 0; i < components(); i++)
+                {
+                    get32Bit( data + 8 * i, order, &n.m_rational.numerator);
+                    get32Bit( data + 8 * i + 4, order, &n.m_rational.denominator);
+                    setAsExifNumber( i, n);
+                }
+            }
+            break;
+        case EXIF_TYPE_SBYTE:
+            if( size == components() )
+            {
+                ExifNumber n;
+                for(uint i = 0; i < components(); i++)
+                {
+                    n.m_sbyte = ((TQ_INT8*)data)[i];
+                    setAsExifNumber( i, n);
+                }
+            }
+            break;
+        case EXIF_TYPE_UNDEFINED:
+            setAsUndefined(data, size);
+            break;
+        case EXIF_TYPE_SSHORT:
+            if( size == 2*components() )
+            {
+                ExifNumber n;
+                for(uint i = 0; i < components(); i++)
+                {
+                    get16Bit( data + 2 * i, order, (TQ_UINT16*)&n.m_sshort);
+                    setAsExifNumber( i, n);
+                }
+            }
+            break;
+        case EXIF_TYPE_SLONG:
+            if( size == 4*components() )
+            {
+                ExifNumber n;
+                for(uint i = 0; i < components(); i++)
+                {
+                    get32Bit( data + 4 * i, order, (TQ_UINT32*)&n.m_slong);
+                    setAsExifNumber( i, n);
+                }
+            }
+            break;
+        case EXIF_TYPE_SRATIONAL:
+            if( size == 8*components() )
+            {
+                ExifNumber n;
+                for(uint i = 0; i < components(); i++)
+                {
+                    get32Bit( data + 8 * i, order, (TQ_UINT32*)&n.m_srational.numerator);
+                    get32Bit( data + 8 * i + 4, order, (TQ_UINT32*)&n.m_srational.denominator);
+                    setAsExifNumber( i, n);
+                }
+            }
+            break;
+        case EXIF_TYPE_FLOAT:
+            if( size == 4*components() )
+            {
+                ExifNumber n;
+                for(uint i = 0; i < components(); i++)
+                {
+                    get32Bit( data + 4 * i, order, (TQ_UINT32*)&n.m_float);
+                    setAsExifNumber( i, n);
+                }
+            }
+            break;
+        case EXIF_TYPE_DOUBLE:
+            if( size == 8*components() )
+            {
+                ExifNumber n;
+                for(uint i = 0; i < components(); i++)
+                {
+                    get64Bit( data + 8 * i, order, (TQ_UINT64*)&n.m_double);
+                    setAsExifNumber( i, n);
+                }
+            }
+            break;
+        case EXIF_TYPE_UNKNOW:
+            break;
+    }
+}
+
+void ExifValue::convertToData(unsigned char ** data, unsigned int* size, ExifValue::ByteOrder order)
+{
+    switch(type())
+    {
+        case EXIF_TYPE_BYTE:
+            *size = components();
+            *data = new uchar[*size];
+            for(uint i = 0; i < components(); i++)
+            {
+                (*data)[i] = asExifNumber(i).m_byte;
+            }
+            return;
+        case EXIF_TYPE_ASCII:
+        {
+            TQString str = asAscii();
+            *size = str.length();
+            *data = new uchar[ *size ];
+            uchar* ptr = *data;
+            memcpy(ptr, str.ascii(), (*size)*sizeof(uchar));
+        }
+        return;
+        break;
+        case EXIF_TYPE_SHORT:
+        {
+            *size = 2*components();
+            *data = new uchar[*size];
+            for(uint i = 0; i < components(); i++)
+            {
+                set16Bit( (*data) + 2 * i, order, &asExifNumber(i).m_short);
+            }
+            return;
+        }
+        case EXIF_TYPE_LONG:
+        {
+            *size = 4*components();
+            *data = new uchar[*size];
+            for(uint i = 0; i < components(); i++)
+            {
+                set32Bit( (*data) + 4 * i, order, &asExifNumber(i).m_long);
+            }
+            return;
+        }
+        case EXIF_TYPE_RATIONAL:
+            *size = 8*components();
+            *data = new uchar[*size];
+            for(uint i = 0; i < components(); i++)
+            {
+                ExifNumber n = asExifNumber(i);
+                set32Bit( (*data) + 8 * i, order, &n.m_rational.numerator);
+                set32Bit( (*data) + 8 * i + 4, order, &n.m_rational.denominator);
+            }
+            return;
+        case EXIF_TYPE_SBYTE:
+            *size = components();
+            *data = new uchar[*size];
+            for(uint i = 0; i < components(); i++)
+            {
+                *(((TQ_INT8*)*data) + i) = asExifNumber(i).m_sbyte;
+            }
+            return;
+        case EXIF_TYPE_UNDEFINED:
+        {
+            UByteArray array = asUndefined();
+            *size = array.size();
+            *data = new uchar[*size];
+            memcpy( *data, array.data(), (*size)*sizeof(unsigned char));
+        }
+        return;
+        case EXIF_TYPE_SSHORT:
+            *size = 2*components();
+            *data = new uchar[*size];
+            for(uint i = 0; i < components(); i++)
+            {
+                set16Bit( (*data) + 2 * i, order, (TQ_UINT16*)&asExifNumber(i).m_sshort);
+            }
+            return;
+        case EXIF_TYPE_SLONG:
+            *size = 4*components();
+            *data = new uchar[*size];
+            for(uint i = 0; i < components(); i++)
+            {
+                set32Bit( (*data) + 4 * i, order, (TQ_UINT32*)&asExifNumber(i).m_slong);
+            }
+            return;
+        case EXIF_TYPE_SRATIONAL:
+            *size = 8*components();
+            *data = new uchar[*size];
+            for(uint i = 0; i < components(); i++)
+            {
+                ExifNumber n = asExifNumber(i);
+                set32Bit( (*data) + 4 * i, order, (TQ_UINT32*)&asExifNumber(i).m_srational.numerator);
+                set32Bit( (*data) + 4 * i + 4, order, (TQ_UINT32*)&asExifNumber(i).m_srational.denominator);
+            }
+            return;
+        case EXIF_TYPE_FLOAT:
+            *size = 4*components();
+            *data = new uchar[*size];
+            for(uint i = 0; i < components(); i++)
+            {
+                set32Bit( (*data) + 4 * i, order, (TQ_UINT32*)&asExifNumber(i).m_float);
+            }
+            return;
+        case EXIF_TYPE_DOUBLE:
+            *size = 8*components();
+            *data = new uchar[*size];
+            for(uint i = 0; i < components(); i++)
+            {
+                set64Bit( (*data) + 4 * i, order, (TQ_UINT64*)&asExifNumber(i).m_double);
+            }
+            return;
+        case EXIF_TYPE_UNKNOW:
+            break;
+    }
+}
+
+TQString ExifValue::toString()
+{
+    switch(type())
+    {
+        case EXIF_TYPE_ASCII:
+            return asAscii();
+        case EXIF_TYPE_UNDEFINED:
+        {
+            TQString undefined = "undefined";
+            UByteArray array = asUndefined();
+            for(uint i = 0; i < components(); i++)
+            {
+                undefined += "\\" + TQString().setNum( array[i] );
+            }
+            return undefined;
+        }
+        default:
+        {
+            TQString str = "";
+            for(uint i = 0; i < components(); i++)
+            {
+                str += toString(i);
+            }
+            return str;
+        }
+    }
+}
+
+TQString ExifValue::toString(uint i)
+{
+    switch(type())
+    {
+        case EXIF_TYPE_BYTE:
+            return TQString("%1 ").tqarg( asExifNumber( i ).m_byte );
+        case EXIF_TYPE_SHORT:
+            return TQString("%1 ").tqarg( asExifNumber( i ).m_short );
+        case EXIF_TYPE_LONG:
+            return TQString("%1 ").tqarg( asExifNumber( i ).m_long );
+        case EXIF_TYPE_RATIONAL:
+            return TQString("%1 / %2 ").tqarg( asExifNumber( i ).m_rational.numerator ).tqarg( asExifNumber( i ).m_rational.denominator );
+        case EXIF_TYPE_SBYTE:
+            return TQString("%1 ").tqarg( asExifNumber( i ).m_sbyte );
+        case EXIF_TYPE_SSHORT:
+            return TQString("%1 ").tqarg( asExifNumber( i ).m_sshort );
+        case EXIF_TYPE_SLONG:
+            return TQString("%1 ").tqarg( asExifNumber( i ).m_slong );
+        case EXIF_TYPE_SRATIONAL:
+            return TQString("%1 / %2 ").tqarg( asExifNumber( i ).m_srational.numerator ).tqarg( asExifNumber( i ).m_srational.denominator );
+        case EXIF_TYPE_FLOAT:
+            return TQString("%1 ").tqarg( asExifNumber( i ).m_float );
+        case EXIF_TYPE_DOUBLE:
+            return TQString("%1 ").tqarg( asExifNumber( i ).m_double );
+        default:
+            return "unknow ";
+    }
+}
+
diff --git a/chalk/core/kis_exif_value.h b/chalk/core/kis_exif_value.h
new file mode 100644
index 000000000..44a3632bd
--- /dev/null
+++ b/chalk/core/kis_exif_value.h
@@ -0,0 +1,270 @@
+/*
+ * This file is part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_EXIF_VALUE_H
+#define KIS_EXIF_VALUE_H
+
+#include <tqdom.h> 
+
+#include <tqcstring.h>
+#include <tqstring.h>
+
+typedef TQMemArray<TQ_UINT8> UByteArray;
+
+struct KisExifRational {
+    TQ_UINT32 numerator;
+    TQ_UINT32 denominator;
+};
+
+struct KisExifSRational {
+    TQ_INT32 numerator;
+    TQ_INT32 denominator;
+};
+
+class ExifValue {
+    typedef union {
+        TQ_UINT8 m_byte;
+        TQ_UINT16 m_short;
+        TQ_UINT32 m_long;
+        KisExifRational m_rational;
+        TQ_INT8 m_sbyte;
+        TQ_INT16 m_sshort;
+        TQ_INT32 m_slong;
+        KisExifSRational m_srational;
+        float m_float;
+        double m_double;
+    } ExifNumber;
+    public:
+        enum ExifType {
+            EXIF_TYPE_BYTE       =  1,
+            EXIF_TYPE_ASCII      =  2,
+            EXIF_TYPE_SHORT      =  3,
+            EXIF_TYPE_LONG       =  4,
+            EXIF_TYPE_RATIONAL   =  5,
+            EXIF_TYPE_SBYTE      =  6,
+            EXIF_TYPE_UNDEFINED  =  7,
+            EXIF_TYPE_SSHORT     =  8,
+            EXIF_TYPE_SLONG      =  9,
+            EXIF_TYPE_SRATIONAL  = 10,
+            EXIF_TYPE_FLOAT      = 11,
+            EXIF_TYPE_DOUBLE     = 12,
+            EXIF_TYPE_UNKNOW     = 13
+        };
+        enum ByteOrder {
+            BYTE_ORDER_MOTOROLA,
+            BYTE_ORDER_INTEL
+        };
+        ExifValue() : m_ifd(-1), m_type(EXIF_TYPE_UNKNOW), m_components(0), m_value(0) { }
+        ExifValue(ExifType type, unsigned char *data, unsigned int size, int ifd, uint components, ExifValue::ByteOrder order);
+        
+        virtual bool load(const TQDomElement& elmt);
+        virtual TQDomElement save(TQDomDocument& doc);
+
+        /**
+         * Return the type of the array
+         */
+        inline ExifType type() { return m_type; }
+        inline const UByteArray asUndefined() {
+            if(m_type == EXIF_TYPE_UNDEFINED)
+                return *(UByteArray*) m_value;
+            return UByteArray();
+        }
+        inline void setAsUndefined(const unsigned char *data, unsigned int size)
+        {
+            if(m_type == EXIF_TYPE_UNDEFINED)
+            {
+                ((UByteArray*)m_value)->duplicate(data, size);
+                m_components = size;
+            }
+        }
+        inline const TQString asAscii() {
+            if(m_type == EXIF_TYPE_ASCII)
+                return TQString(*(TQString*) m_value);
+            return TQString();
+        }
+        inline void setAsAscii(char* data)
+        {
+            if(m_type == EXIF_TYPE_ASCII)
+            {
+                TQString str = TQString((char*) data);
+                *(TQString*)m_value = str;
+                m_components = str.length();
+            }
+        }
+        inline void setAsAscii(TQString str)
+        {
+            *(TQString*)m_value = str;
+            m_components = str.length();
+        }
+        void convertToData(unsigned char ** data, unsigned int* size, ExifValue::ByteOrder order);
+        /**
+         * Return the ifd number to which this ExifValue belongs.
+         */
+        inline int ifd() { return m_ifd; }
+        /**
+         * Return the number of components of this ExifValue
+         */
+        inline uint components() { return m_components; }
+        
+        /**
+         * This function return the value of a the ExifValue as a string.
+         */
+        TQString toString();
+        
+        inline TQ_UINT8 asByte(uint i)
+        {
+            if(m_type == EXIF_TYPE_BYTE)
+                return asExifNumber(i).m_byte;
+            return 0;
+        }
+        inline void setValue(uint i, TQ_UINT8 v)
+        {
+            ((ExifNumber*)m_value)[i].m_byte = v;
+        }
+        inline TQ_UINT8 asShort(uint i)
+        {
+            if(m_type == EXIF_TYPE_SHORT)
+                return asExifNumber(i).m_short;
+            return 0;
+        }
+        inline void setValue(uint i, TQ_UINT16 v)
+        {
+            ((ExifNumber*)m_value)[i].m_short = v;
+        }
+        inline TQ_UINT8 asLong(uint i)
+        {
+            if(m_type == EXIF_TYPE_LONG)
+                return asExifNumber(i).m_long;
+            return 0;
+        }
+        inline void setValue(uint i, TQ_UINT32 v)
+        {
+            ((ExifNumber*)m_value)[i].m_long = v;
+        }
+        inline KisExifRational asRational(uint i)
+        {
+            if(m_type == EXIF_TYPE_RATIONAL)
+                return asExifNumber(i).m_rational;
+            return KisExifRational();
+        }
+        inline void setValue(uint i, TQ_UINT32 n, TQ_UINT32 d)
+        {
+            ((ExifNumber*)m_value)[i].m_rational.numerator = n;
+            ((ExifNumber*)m_value)[i].m_rational.denominator = d;
+        }
+        inline void setValue(uint i, KisExifRational r)
+        {
+            ((ExifNumber*)m_value)[i].m_rational = r;
+        }
+        inline TQ_INT8 asSByte(uint i)
+        {
+            if(m_type == EXIF_TYPE_SBYTE)
+                return asExifNumber(i).m_sbyte;
+            return 0;
+        }
+        inline void setValue(uint i, TQ_INT8 v)
+        {
+            ((ExifNumber*)m_value)[i].m_sbyte = v;
+        }
+        inline TQ_INT16 asSShort(uint i)
+        {
+            if(m_type == EXIF_TYPE_SSHORT)
+                return asExifNumber(i).m_sshort;
+            return 0;
+        }
+        inline void setValue(uint i, TQ_INT16 v)
+        {
+            ((ExifNumber*)m_value)[i].m_sshort = v;
+        }
+        inline TQ_INT32 asSLong(uint i)
+        {
+            if(m_type == EXIF_TYPE_SLONG)
+                return asExifNumber(i).m_slong;
+            return 0;
+        }
+        inline void setValue(uint i, TQ_INT32 v)
+        {
+            ((ExifNumber*)m_value)[i].m_slong = v;
+        }
+        inline KisExifSRational asSRational(uint i)
+        {
+            if(m_type == EXIF_TYPE_SRATIONAL)
+                return asExifNumber(i).m_srational;
+            return KisExifSRational();
+        }
+        inline void setValue(uint i, KisExifSRational r)
+        {
+            ((ExifNumber*)m_value)[i].m_srational = r;
+        }
+        inline void setValue(uint i, TQ_INT32 n, TQ_INT32 d)
+        {
+            ((ExifNumber*)m_value)[i].m_srational.numerator = n;
+            ((ExifNumber*)m_value)[i].m_srational.denominator = d;
+        }
+        inline float asFloat(uint i)
+        {
+            if(m_type == EXIF_TYPE_FLOAT)
+                return asExifNumber(i).m_float;
+            return 0.;
+        }
+        inline void setValue(uint i, float v)
+        {
+            ((ExifNumber*)m_value)[i].m_float = v;
+        }
+        inline double asDouble(uint i)
+        {
+            if(m_type == EXIF_TYPE_DOUBLE)
+                return asExifNumber(i).m_double;
+            return 0.;
+        }
+        inline void setValue(uint i, double v)
+        {
+            ((ExifNumber*)m_value)[i].m_double = v;
+        }
+    private:
+        /**
+         * Return the ith component as a string.
+         */
+        TQString toString(uint i);
+        void setValue(const unsigned char *data, unsigned int size, ExifValue::ByteOrder order);
+        /**
+         * Return the ExifValue as a number.
+         */
+        inline const ExifNumber asExifNumber(uint index)
+        {
+            Q_ASSERT(index < m_components);
+            return ((ExifNumber*)m_value)[index];
+        }
+        inline void setAsExifNumber(uint index, ExifNumber n)
+        {
+            Q_ASSERT(index < m_components);
+            ((ExifNumber*)m_value)[index] = n;
+        }
+        /**
+         * This function will allocate the memory used for storing the current data.
+         */
+        void allocData();
+    private:
+        int m_ifd;
+        ExifType m_type;
+        uint m_components;
+        void *m_value;
+};
+
+#endif
diff --git a/chalk/core/kis_fill_painter.cc b/chalk/core/kis_fill_painter.cc
new file mode 100644
index 000000000..5b8fdcc91
--- /dev/null
+++ b/chalk/core/kis_fill_painter.cc
@@ -0,0 +1,407 @@
+/*
+ *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
+ *  Copyright (c) 2004 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <cfloat>
+#include <stack>
+
+#include "tqbrush.h"
+#include "tqfontinfo.h"
+#include "tqfontmetrics.h"
+#include "tqpen.h"
+#include "tqregion.h"
+#include "tqwmatrix.h"
+#include <tqimage.h>
+#include <tqmap.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqpointarray.h>
+#include <tqrect.h>
+#include <tqstring.h>
+
+#include <kdebug.h>
+#include <kcommand.h>
+#include <klocale.h>
+
+#include "kis_brush.h"
+#include "kis_debug_areas.h"
+#include "kis_image.h"
+#include "kis_layer.h"
+#include "kis_paint_device.h"
+#include "kis_painter.h"
+#include "kis_pattern.h"
+#include "kis_rect.h"
+#include "kis_colorspace.h"
+#include "kis_transaction.h"
+#include "kis_types.h"
+#include "kis_vec.h"
+#include "kis_selection.h"
+#include "kis_fill_painter.h"
+#include "kis_iterators_pixel.h"
+#include "kis_iterator.h"
+#include "kis_color.h"
+#include "kis_selection.h"
+
+namespace {
+}
+
+KisFillPainter::KisFillPainter()
+    : super()
+{
+    m_width = m_height = -1;
+    m_sampleMerged = false;
+    m_careForSelection = false;
+    m_fuzzy = false;
+}
+
+KisFillPainter::KisFillPainter(KisPaintDeviceSP device) : super(device)
+{
+    m_width = m_height = -1;
+    m_sampleMerged = false;
+    m_careForSelection = false;
+    m_fuzzy = false;
+}
+
+// 'regular' filling
+// XXX: This also needs renaming, since filling ought to keep the opacity and the composite op in mind,
+//      this is more eraseToColor.
+void KisFillPainter::fillRect(TQ_INT32 x1, TQ_INT32 y1, TQ_INT32 w, TQ_INT32 h, const KisColor& kc, TQ_UINT8 opacity)
+{
+    if (w > 0 && h > 0) {
+        // Make sure we're in the right colorspace
+
+        KisColor kc2(kc); // get rid of const
+        kc2.convertTo(m_device->colorSpace());
+        TQ_UINT8 * data = kc2.data();
+        m_device->colorSpace()->setAlpha(data, opacity, 1);
+
+        m_device->fill(x1, y1, w, h, data);
+
+        addDirtyRect(TQRect(x1, y1, w, h));
+    }
+}
+
+void KisFillPainter::fillRect(TQ_INT32 x1, TQ_INT32 y1, TQ_INT32 w, TQ_INT32 h, KisPattern * pattern) {
+    if (!pattern) return;
+    if (!pattern->valid()) return;
+    if (!m_device) return;
+
+
+    KisPaintDeviceSP patternLayer = pattern->image(m_device->colorSpace());
+
+    int sx, sy, sw, sh;
+
+    int y = y1;
+
+    if (y >= 0) {
+        sy = y % pattern->height();
+    } else {
+        sy = pattern->height() - (((-y - 1) % pattern->height()) + 1);
+    }
+
+    while (y < y1 + h) {
+        sh = TQMIN((y1 + h) - y, pattern->height() - sy);
+
+        int x = x1;
+
+        if (x >= 0) {
+            sx = x % pattern->width();
+        } else {
+            sx = pattern->width() - (((-x - 1) % pattern->width()) + 1);
+        }
+
+        while (x < x1 + w) {
+            sw = TQMIN((x1 + w) - x, pattern->width() - sx);
+
+            bitBlt(x, y, m_compositeOp, patternLayer.data(), m_opacity, sx, sy, sw, sh);
+            x += sw; sx = 0;
+        }
+
+        y+=sh; sy = 0;
+    }
+
+    addDirtyRect(TQRect(x1, y1, w, h));
+}
+
+// flood filling
+
+void KisFillPainter::fillColor(int startX, int startY) {
+    genericFillStart(startX, startY);
+
+    // Now create a layer and fill it
+    KisPaintDeviceSP filled = new KisPaintDevice(m_device->colorSpace(), "filled");
+    Q_CHECK_PTR(filled);
+    KisFillPainter painter(filled.data());
+    painter.fillRect(0, 0, m_width, m_height, m_paintColor);
+    painter.end();
+
+    genericFillEnd(filled);
+}
+
+void KisFillPainter::fillPattern(int startX, int startY) {
+    genericFillStart(startX, startY);
+
+    // Now create a layer and fill it
+    KisPaintDeviceSP filled = new KisPaintDevice(m_device->colorSpace(), "filled");
+    Q_CHECK_PTR(filled);
+    KisFillPainter painter(filled.data());
+    painter.fillRect(0, 0, m_width, m_height, m_pattern);
+    painter.end();
+
+    genericFillEnd(filled);
+}
+
+void KisFillPainter::genericFillStart(int startX, int startY) {
+    m_cancelRequested = false;
+
+    if (m_width < 0 || m_height < 0) {
+        if (m_device->image()) {
+            m_width = m_device->image()->width();
+            m_height = m_device->image()->height();
+        } else {
+            m_width = m_height = 500;
+        }
+    }
+
+    m_size = m_width * m_height;
+
+    // Create a selection from the surrounding area
+    m_selection = createFloodSelection(startX, startY);
+}
+
+void KisFillPainter::genericFillEnd(KisPaintDeviceSP filled) {
+    if (m_cancelRequested) {
+        m_width = m_height = -1;
+        return;
+    }
+
+    TQRect rc = m_selection->selectedRect();
+
+    bltSelection(rc.x(), rc.y(), m_compositeOp, filled, m_selection, m_opacity,
+                 rc.x(), rc.y(), rc.width(), rc.height());
+
+    emit notifyProgressDone();
+
+    m_width = m_height = -1;
+}
+
+struct FillSegment {
+    FillSegment(int x, int y/*, FillSegment* tqparent*/) : x(x), y(y)/*, tqparent(tqparent)*/ {}
+    int x;
+    int y;
+//    FillSegment* tqparent;
+};
+
+typedef enum { None = 0, Added = 1, Checked = 2 } tqStatus;
+
+KisSelectionSP KisFillPainter::createFloodSelection(int startX, int startY) {
+    if (m_width < 0 || m_height < 0) {
+        if (m_device->hasSelection() && m_careForSelection) {
+
+            TQRect rc = m_device->selection()->selectedRect();
+            m_width = rc.width() - (startX - rc.x());
+            m_height = rc.height() - (startY - rc.y());
+
+        } else if (m_device->image()) {
+
+            m_width = m_device->image()->width();
+            m_height = m_device->image()->height();
+
+        } else {
+            m_width = m_height = 500;
+        }
+    }
+
+    // Don't try to fill if we start outside the borders, just return an empty 'fill'
+    if (startX < 0 || startY < 0 || startX >= m_width || startY >= m_height)
+        return new KisSelection(m_device);
+
+    KisPaintDeviceSP sourceDevice = 0;
+
+    // sample merged?
+    if (m_sampleMerged) {
+        if (!m_device->image()) {
+            return new KisSelection(m_device);
+        }
+        sourceDevice = m_device->image()->mergedImage();
+    } else {
+        sourceDevice = m_device;
+    }
+
+    m_size = m_width * m_height;
+
+    KisSelectionSP selection = new KisSelection(m_device);
+    KisColorSpace * colorSpace = selection->colorSpace();
+    KisColorSpace * devColorSpace = sourceDevice->colorSpace();
+
+    TQ_UINT8* source = new TQ_UINT8[sourceDevice->pixelSize()];
+    KisHLineIteratorPixel pixelIt = sourceDevice->createHLineIterator(startX, startY, startX+1, false);
+
+    memcpy(source, pixelIt.rawData(), sourceDevice->pixelSize());
+
+    std::stack<FillSegment*> stack;
+
+    stack.push(new FillSegment(startX, startY/*, 0*/));
+
+    tqStatus* map = new tqStatus[m_size];
+
+    memset(map, None, m_size * sizeof(tqStatus));
+
+    int progressPercent = 0; int pixelsDone = 0; int currentPercent = 0;
+    emit notifyProgressStage(i18n("Making fill outline..."), 0);
+
+    bool hasSelection = m_careForSelection && sourceDevice->hasSelection();
+    KisSelectionSP srcSel = 0;
+    if (hasSelection)
+        srcSel = sourceDevice->selection();
+
+    while(!stack.empty()) {
+        FillSegment* segment = stack.top();
+        stack.pop();
+        if (map[m_width * segment->y + segment->x] == Checked) {
+            delete segment;
+            continue;
+        }
+        map[m_width * segment->y + segment->x] = Checked;
+
+        int x = segment->x;
+        int y = segment->y;
+
+        /* We need an iterator that is valid in the range (0,y) - (width,y). Therefore,
+        it is needed to start the iterator at the first position, and then skip to (x,y). */
+        pixelIt = sourceDevice->createHLineIterator(0, y, m_width, false);
+        pixelIt += x;
+        TQ_UINT8 diff = devColorSpace->difference(source, pixelIt.rawData());
+
+        if (diff >= m_threshold
+            || (hasSelection && srcSel->selected(pixelIt.x(), pixelIt.y()) == MIN_SELECTED)) {
+            delete segment;
+            continue;
+        }
+
+        // Here as well: start the iterator at (0,y)
+        KisHLineIteratorPixel selIt = selection->createHLineIterator(0, y, m_width, true);
+        selIt += x;
+        if (m_fuzzy)
+            colorSpace->fromTQColor(TQt::white, MAX_SELECTED - diff, selIt.rawData());
+        else
+            colorSpace->fromTQColor(TQt::white, MAX_SELECTED, selIt.rawData());
+
+        if (y > 0 && (map[m_width * (y - 1) + x] == None)) {
+            map[m_width * (y - 1) + x] = Added;
+            stack.push(new FillSegment(x, y-1));
+        }
+        if (y < (m_height - 1) && (map[m_width * (y + 1) + x] == None)) {
+            map[m_width * (y + 1) + x] = Added;
+            stack.push(new FillSegment(x, y+1));
+        }
+
+        ++pixelsDone;
+
+        bool stop = false;
+
+        --pixelIt;
+        --selIt;
+        --x;
+
+        // go to the left
+        while(!stop && x >= 0 && (map[m_width * y + x] != Checked) ) { // FIXME optimizeable?
+            map[m_width * y + x] = Checked;
+            diff = devColorSpace->difference(source, pixelIt.rawData());
+            if (diff >= m_threshold
+                || (hasSelection && srcSel->selected(pixelIt.x(), pixelIt.y()) == MIN_SELECTED)) {
+                stop = true;
+                continue;
+            }
+
+            if (m_fuzzy)
+                colorSpace->fromTQColor(TQt::white, MAX_SELECTED - diff, selIt.rawData());
+            else
+                colorSpace->fromTQColor(TQt::white, MAX_SELECTED, selIt.rawData());
+
+            if (y > 0 && (map[m_width * (y - 1) + x] == None)) {
+                map[m_width * (y - 1) + x] = Added;
+                stack.push(new FillSegment(x, y-1));
+            }
+            if (y < (m_height - 1) && (map[m_width * (y + 1) + x] == None)) {
+                map[m_width * (y + 1) + x] = Added;
+                stack.push(new FillSegment(x, y+1));
+            }
+            ++pixelsDone;
+            --pixelIt;
+            --selIt;
+            --x;
+        }
+
+        x = segment->x + 1;
+        delete segment;
+
+        if (map[m_width * y + x] == Checked)
+            continue;
+
+        // and go to the right
+        pixelIt = sourceDevice->createHLineIterator(x, y, m_width, false);
+        selIt = selection->createHLineIterator(x, y, m_width, true);
+
+        stop = false;
+        while(!stop && x < m_width && (map[m_width * y + x] != Checked) ) {
+            diff = devColorSpace->difference(source, pixelIt.rawData());
+            map[m_width * y + x] = Checked;
+
+            if (diff >= m_threshold
+                || (hasSelection && srcSel->selected(pixelIt.x(), pixelIt.y()) == MIN_SELECTED) ) {
+                stop = true;
+                continue;
+            }
+
+            if (m_fuzzy)
+                colorSpace->fromTQColor(TQt::white, MAX_SELECTED - diff, selIt.rawData());
+            else
+                colorSpace->fromTQColor(TQt::white, MAX_SELECTED, selIt.rawData());
+
+            if (y > 0 && (map[m_width * (y - 1) + x] == None)) {
+                map[m_width * (y - 1) + x] = Added;
+                stack.push(new FillSegment(x, y-1));
+            }
+            if (y < (m_height - 1) && (map[m_width * (y + 1) + x] == None)) {
+                map[m_width * (y + 1) + x] = Added;
+                stack.push(new FillSegment(x, y+1));
+            }
+            ++pixelsDone;
+            ++pixelIt;
+            ++selIt;
+            ++x;
+        }
+
+        if (m_size > 0) {
+            progressPercent = (pixelsDone * 100) / m_size;
+            if (progressPercent > currentPercent) {
+                emit notifyProgress(progressPercent);
+                currentPercent = progressPercent;
+            }
+        }
+    }
+
+
+    delete[] map;
+    delete[] source;
+
+    return selection;
+}
diff --git a/chalk/core/kis_fill_painter.h b/chalk/core/kis_fill_painter.h
new file mode 100644
index 000000000..da244a67d
--- /dev/null
+++ b/chalk/core/kis_fill_painter.h
@@ -0,0 +1,207 @@
+/*
+ *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
+ *  Copyright (c) 2004 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_FILL_PAINTER_H_
+#define KIS_FILL_PAINTER_H_
+
+#include <tqrect.h>
+
+#include "kis_meta_registry.h"
+#include "kis_color.h"
+#include "kis_colorspace_factory_registry.h"
+#include "kis_painter.h"
+#include "kis_types.h"
+#include <koffice_export.h>
+
+class KisPattern;
+
+// XXX: Filling should set dirty rect.
+/**
+ * This painter can be used to fill paint devices in different ways. This can also be used
+ * for flood filling related operations.
+ */
+class KRITACORE_EXPORT KisFillPainter : public KisPainter
+{
+
+    typedef KisPainter super;
+
+public:
+
+    /**
+     * Construct an empty painter. Use the begin(KisPaintDeviceSP) method to attach
+     * to a paint device
+     */
+    KisFillPainter();
+    /**
+     * Start painting on the specified paint device
+     */
+    KisFillPainter(KisPaintDeviceSP device);
+
+    /**
+     * Fill a rectangle with black transparent pixels (0, 0, 0, 0 for RGBA).
+     */
+    void eraseRect(TQ_INT32 x1, TQ_INT32 y1, TQ_INT32 w, TQ_INT32 h);
+    /**
+     * Overloaded version of the above function.
+     */
+    void eraseRect(const TQRect& rc);
+
+    /**
+     * Fill a rectangle with a certain color.
+     */
+    void fillRect(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, const KisColor& c);
+    /**
+     * Overloaded version of the above function.
+     */
+    void fillRect(const TQRect& rc, const KisColor& c);
+
+    /**
+     * Fill a rectangle with a certain color and opacity.
+     */
+    void fillRect(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, const KisColor& c, TQ_UINT8 opacity);
+    /**
+     * Overloaded version of the above function.
+     */
+    void fillRect(const TQRect& rc, const KisColor& c, TQ_UINT8 opacity);
+
+    /**
+     * Fill a rectangle with a certain pattern. The pattern is repeated if it does not fit the
+     * entire rectangle.
+     */
+    void fillRect(TQ_INT32 x1, TQ_INT32 y1, TQ_INT32 w, TQ_INT32 h, KisPattern * pattern);
+    /**
+     * Overloaded version of the above function.
+     */
+    void fillRect(const TQRect& rc, KisPattern * pattern);
+
+    /**
+     * Fills the enclosed area around the point with the set color. If there is a
+     * selection, the whole selection is filled
+     **/
+    void fillColor(int startX, int startY);
+
+    /**
+     * Fills the enclosed area around the point with the set pattern. If there is a
+     * selection, the whole selection is filled
+     **/
+    void fillPattern(int startX, int startY);
+
+    /**
+     * Returns a selection tqmask for the floodfill starting at the specified position.
+     **/
+    KisSelectionSP createFloodSelection(int startX, int startY);
+
+    /**
+     * Set the threshold for floodfill. The range is 0-255: 0 means the fill will only
+     * fill parts that are the exact same color, 255 means anything will be filled
+     */
+    void setFillThreshold(int threshold);
+    /** Returns the fill threshold, see setFillThreshold for details */
+    int fillThreshold() const { return m_threshold; }
+
+    /** Sets the width of the layer */
+    void setWidth(int w) { m_width = w; }
+
+    /** Sets the height of the layer */
+    void setHeight(int h) { m_height = h; }
+
+    /** If sample merged is set to true, the paint device will get the bounds of the
+     * floodfill from the complete image instead of the layer */
+    bool sampleMerged() const { return m_sampleMerged; }
+    /** Set sample merged. See sampleMerged() for details */
+    void setSampleMerged(bool set) { m_sampleMerged = set; }
+
+    /** If true, floodfill doesn't fill outside the selected area of a layer */
+    bool careForSelection() const { return m_careForSelection; }
+    /** Set caring for selection. See careForSelection for details */
+    void setCareForSelection(bool set) { m_careForSelection = set; }
+
+    /**
+     * If true, the floodfill will be fuzzy. This means that the 'value' of selectedness
+     * will depend on the difference between the sampled color and the color at the current
+     * position.
+     */
+    bool fuzzyFill() const { return m_fuzzy; }
+    /** Sets the fuzzyfill parameter. See fuzzyFill for details */
+    void setFuzzyFill(bool set) { m_fuzzy = set; }
+
+private:
+    // for floodfill
+    void genericFillStart(int startX, int startY);
+    void genericFillEnd(KisPaintDeviceSP filled);
+
+    KisSelectionSP m_selection;
+
+    int m_threshold;
+    int m_size;
+    int m_width, m_height;
+    TQRect m_rect;
+    bool m_sampleMerged;
+    bool m_careForSelection;
+    bool m_fuzzy;
+};
+
+
+inline
+void KisFillPainter::fillRect(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, const KisColor& c)
+{
+    fillRect(x, y, w, h, c, OPACITY_OPAQUE);
+}
+
+inline
+void KisFillPainter::fillRect(const TQRect& rc, const KisColor& c)
+{
+    fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_OPAQUE);
+}
+
+inline
+void KisFillPainter::eraseRect(TQ_INT32 x1, TQ_INT32 y1, TQ_INT32 w, TQ_INT32 h)
+{
+    KisColorSpace * cs = KisMetaRegistry::instance()->csRegistry()->getRGB8();
+    KisColor c(TQt::black, cs);
+    fillRect(x1, y1, w, h, c, OPACITY_TRANSPARENT);
+}
+
+inline
+void KisFillPainter::eraseRect(const TQRect& rc)
+{
+    KisColorSpace * cs = KisMetaRegistry::instance()->csRegistry()->getRGB8();
+    KisColor c(TQt::black, cs);
+    fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_TRANSPARENT);
+}
+
+inline
+void KisFillPainter::fillRect(const TQRect& rc, const KisColor& c, TQ_UINT8 opacity)
+{
+    fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, opacity);
+}
+
+inline
+void KisFillPainter::fillRect(const TQRect& rc, KisPattern *pattern)
+{
+    fillRect(rc.x(), rc.y(), rc.width(), rc.height(), pattern);
+}
+
+inline
+void KisFillPainter::setFillThreshold(int threshold)
+{
+    m_threshold = threshold;
+}
+
+
+#endif //KIS_FILL_PAINTER_H_
diff --git a/chalk/core/kis_filter.cc b/chalk/core/kis_filter.cc
new file mode 100644
index 000000000..ee396596a
--- /dev/null
+++ b/chalk/core/kis_filter.cc
@@ -0,0 +1,133 @@
+/*
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kis_filter.h"
+
+#include <tqstring.h>
+
+#include "kis_types.h"
+#include "kis_filter_configuration.h"
+
+KisFilter::KisFilter(const KisID& id, const TQString & category, const TQString & entry)
+    : KisProgressSubject(0, id.id().latin1())
+    , m_id(id)
+    , m_progressDisplay(0)
+    , m_category(category)
+    , m_entry(entry)
+{
+}
+
+KisFilterConfiguration * KisFilter::configuration(TQWidget*)
+{
+    return new KisFilterConfiguration(m_id.id(), 0);
+}
+
+KisFilterConfiguration * KisFilter::configuration()
+{
+    return new KisFilterConfiguration(m_id.id(), 0);
+}
+
+KisFilterConfigWidget * KisFilter::createConfigurationWidget(TQWidget *, KisPaintDeviceSP)
+{
+    return 0;
+}
+
+void KisFilter::setProgressDisplay(KisProgressDisplayInterface * progressDisplay)
+{
+    m_progressDisplay = progressDisplay;
+}
+
+
+void KisFilter::enableProgress() {
+    m_progressEnabled = true;
+    m_cancelRequested = false;
+}
+
+void KisFilter::disableProgress() {
+    m_progressEnabled = false;
+    m_cancelRequested = false;
+    m_progressDisplay = 0;
+}
+
+void KisFilter::setProgressTotalSteps(TQ_INT32 totalSteps)
+{
+    if (m_progressEnabled) {
+
+        m_progressTotalSteps = totalSteps;
+        m_lastProgressPerCent = 0;
+        m_progressSteps = 0;
+        emit notifyProgress(0);
+    }
+}
+
+void KisFilter::setProgress(TQ_INT32 progress)
+{
+    if (m_progressEnabled) {
+        TQ_INT32 progressPerCent = (progress * 100) / m_progressTotalSteps;
+        m_progressSteps = progress;
+
+        if (progressPerCent != m_lastProgressPerCent) {
+
+            m_lastProgressPerCent = progressPerCent;
+            emit notifyProgress(progressPerCent);
+        }
+    }
+}
+
+void KisFilter::incProgress()
+{
+    setProgress(++m_progressSteps);
+
+}
+
+void KisFilter::setProgressStage(const TQString& stage, TQ_INT32 progress)
+{
+    if (m_progressEnabled) {
+
+        TQ_INT32 progressPerCent = (progress * 100) / m_progressTotalSteps;
+
+        m_lastProgressPerCent = progressPerCent;
+        emit notifyProgressStage(stage, progressPerCent);
+    }
+}
+
+void KisFilter::setProgressDone()
+{
+    if (m_progressEnabled) {
+        emit notifyProgressDone();
+    }
+}
+
+
+bool KisFilter::autoUpdate() {
+    return m_autoUpdate;
+}
+
+void KisFilter::setAutoUpdate(bool set) {
+    m_autoUpdate = set;
+}
+
+TQRect KisFilter::enlargeRect(TQRect rect, KisFilterConfiguration* c) const {
+    int margin = overlapMarginNeeded(c);
+    rect.rLeft() -= margin;
+    rect.rTop() -= margin;
+    rect.rRight() += margin;
+    rect.rBottom() += margin;
+    return rect;
+}
+
+#include "kis_filter.moc"
diff --git a/chalk/core/kis_filter.h b/chalk/core/kis_filter.h
new file mode 100644
index 000000000..807ecff8b
--- /dev/null
+++ b/chalk/core/kis_filter.h
@@ -0,0 +1,201 @@
+/*
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef _KIS_FILTER_H_
+#define _KIS_FILTER_H_
+
+#include <list>
+
+#include <tqstring.h>
+
+#include <ksharedptr.h>
+#include <klocale.h>
+
+#include "kis_types.h"
+#include "kis_filter_registry.h"
+#include "kis_id.h"
+#include "kis_paint_device.h"
+#include "kis_progress_subject.h"
+#include "kis_filter_configuration.h"
+#include "kis_colorspace.h"
+#include "koffice_export.h"
+
+class KisColorSpace;
+class KisPreviewDialog;
+class KisProgressDisplayInterface;
+class KisFilterConfigWidget;
+class TQWidget;
+
+/**
+ * Basic interface of a Chalk filter.
+ */
+class KRITACORE_EXPORT KisFilter : public KisProgressSubject, public KShared {
+    Q_OBJECT
+  TQ_OBJECT
+public:
+
+    /**
+     * Construct a Chalk filter
+     */
+    KisFilter(const KisID& id, const TQString & category, const TQString & entry);
+    virtual ~KisFilter() {}
+
+public:
+
+    virtual void setProgressDisplay(KisProgressDisplayInterface * progressDisplay);
+
+    virtual void process(KisPaintDeviceSP src, KisPaintDeviceSP dst, KisFilterConfiguration*, const TQRect&) = 0;
+
+public:
+     /**
+      * @return a new configuration derived from the widget. If the widget is NULL or not the correct type,
+      *         a default configuration object will be returned
+      */
+     virtual KisFilterConfiguration * configuration(TQWidget*);
+
+     /**
+      * @return a default configuration object
+      * Normally this doesn't need to be overriden
+      */
+    virtual KisFilterConfiguration * configuration();
+
+    /**
+         * If true, this filter can be used in painting tools as a paint operation
+         */
+    virtual bool supportsPainting() { return false; };
+
+    /// This filter can be displayed in a preview dialog
+    virtual bool supportsPreview() { return false; };
+
+    /// This filter can be used in adjustment layers
+    // XXX: This uses supportsPreview() for backwards compatibility
+    virtual bool supportsAdjustmentLayers() { return supportsPreview(); };
+
+    /**
+     * Return a list of default configuration to demonstrates the use of the filter
+     * @return a list with a null element if the filter do not use a configuration
+     */
+    virtual std::list<KisFilterConfiguration*> listOfExamplesConfiguration(KisPaintDeviceSP )
+    { std::list<KisFilterConfiguration*> list; list.insert(list.begin(), 0); return list; }
+
+    /**
+     * Can this filter work incrementally when painting, or do we need to work
+     * on the state as it was before painting started. The former is faster.
+     */
+    virtual bool supportsIncrementalPainting() { return true; };
+
+    /**
+     * This filter supports cutting up the work area and filtering
+     * each chunk in a separate thread. Filters that need access to the
+     * whole area for correct computations should return false.
+     */
+    virtual bool supportsThreading() { return true; };
+
+    /**
+     * Used when threading is used -- the overlap margin is passed to the
+     * filter to use to compute pixels, but the margin is not pasted into the
+     * resulting image.
+     */
+    virtual int overlapMarginNeeded(KisFilterConfiguration* = 0) const { return 0; };
+
+    /**
+     * Similar to overlapMarginNeeded: some filters will alter a lot of pixels that are
+     * near to each other at the same time. So when you changed a single rectangle
+     * in a device, the actual rectangle that will feel the influence of this change
+     * might be bigger. Use this function to detirmine that rect.
+     * The default implementation makes a guess using overlapMarginNeeded.
+     */
+    virtual TQRect enlargeRect(TQRect rect, KisFilterConfiguration* = 0) const;
+
+    /**
+     * Determine the colorspace independence of this filter.
+     * @see ColorSpaceIndependence
+     *
+     * @return the degree of independence
+     */
+    virtual ColorSpaceIndependence colorSpaceIndependence() { return TO_RGBA8; };
+
+    /**
+     * Determine if this filter can work with this colorSpace. For instance, some
+     * colorspaces don't depend on lcms, and cannot do certain tasks. The colorsfilters
+     * are problems here.
+     * BSAR: I'm still not convinced that this is the right approach. I think that every
+     * colorspace should implement the api fully; and that the filter should simply call
+     * that api. After all, you don't need lcms to desaturate.
+     *
+     * @param colorsSpace
+     */
+    virtual bool workWith(KisColorSpace*) { return true; }
+
+    virtual void enableProgress();
+    virtual void disableProgress();
+
+    bool autoUpdate();
+
+    // Unique identification for this filter
+    inline const KisID id() const { return m_id; };
+    // Which submenu in the filters menu does filter want to go?
+
+    inline TQString menuCategory() const { return m_category; };
+    // The i18n'ed string this filter wants to show itself in the menu
+
+    inline TQString menuEntry() const { return m_entry; };
+
+    /**
+     * Create the configuration widget for this filter.
+     *
+     * @param tqparent the TQt owner widget of this widget
+     * @param dev the paintdevice this filter will act on
+     * @return NULL if the filter does not use user-settable configuration settings.
+     *         else return a pointer to the new configuration widget
+     */
+    virtual KisFilterConfigWidget * createConfigurationWidget(TQWidget * tqparent, KisPaintDeviceSP dev);
+
+    virtual void cancel() { m_cancelRequested = true; }
+
+    virtual void setAutoUpdate(bool set);
+    bool progressEnabled() const { return m_progressEnabled; }
+    inline bool cancelRequested() const { return m_progressEnabled && m_cancelRequested; }
+
+protected slots:
+
+    // Convenience functions for progress display.
+    void setProgressTotalSteps(TQ_INT32 totalSteps);
+    void setProgress(TQ_INT32 progress);
+    void incProgress();
+    void setProgressStage(const TQString& stage, TQ_INT32 progress);
+    void setProgressDone();
+    inline TQ_INT32 progress() { return m_progressSteps; }
+private:
+    bool m_cancelRequested;
+    bool m_progressEnabled;
+    bool m_autoUpdate;
+
+protected:
+    TQ_INT32 m_progressTotalSteps;
+    TQ_INT32 m_lastProgressPerCent;
+    TQ_INT32 m_progressSteps;
+
+    KisID m_id;
+    KisProgressDisplayInterface * m_progressDisplay;
+    TQString m_category; // The category in the filter menu this filter fits
+    TQString m_entry; // the i18n'ed accelerated menu text
+
+};
+
+
+#endif
diff --git a/chalk/core/kis_filter_config_widget.cc b/chalk/core/kis_filter_config_widget.cc
new file mode 100644
index 000000000..df7c13d5a
--- /dev/null
+++ b/chalk/core/kis_filter_config_widget.cc
@@ -0,0 +1,31 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+ 
+#include "kis_filter_config_widget.h"
+
+
+KisFilterConfigWidget::KisFilterConfigWidget(TQWidget * tqparent, const char * name, WFlags f)
+    : TQWidget(tqparent, name, f) 
+{
+}
+
+KisFilterConfigWidget::~KisFilterConfigWidget()
+{
+}
+
+#include "kis_filter_config_widget.moc"
diff --git a/chalk/core/kis_filter_config_widget.h b/chalk/core/kis_filter_config_widget.h
new file mode 100644
index 000000000..ddb600ab0
--- /dev/null
+++ b/chalk/core/kis_filter_config_widget.h
@@ -0,0 +1,50 @@
+/*
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef _KIS_FILTER_CONFIG_WIDGET_H_
+#define _KIS_FILTER_CONFIG_WIDGET_H_
+
+#include <tqwidget.h>
+#include "kis_filter_configuration.h"
+
+/**
+ * Empty base class. Filters can build their own configuration widgets that
+ * inherit this class. The configuration widget can emit sigPleaseUpdatePreview
+ * when it wants the preview in the filter dialog to be updated. 
+ */
+class KisFilterConfigWidget : public TQWidget {
+
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+
+    KisFilterConfigWidget(TQWidget * tqparent, const char * name = 0, WFlags f = 0 );
+    virtual ~KisFilterConfigWidget();
+
+    virtual void setConfiguration(KisFilterConfiguration * config) = 0;
+
+signals:
+
+    /**
+     * Subclasses should emit this signal whenever the preview should be
+     * be recalculated.
+     */
+    void sigPleaseUpdatePreview();
+};
+
+#endif
diff --git a/chalk/core/kis_filter_configuration.cc b/chalk/core/kis_filter_configuration.cc
new file mode 100644
index 000000000..b25dcb249
--- /dev/null
+++ b/chalk/core/kis_filter_configuration.cc
@@ -0,0 +1,185 @@
+/*
+ *  Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kis_filter.h"
+
+#include <kdebug.h>
+#include <tqdom.h>
+#include <tqstring.h>
+
+#include "kis_filter_registry.h"
+#include "kis_transaction.h"
+#include "kis_undo_adapter.h"
+#include "kis_painter.h"
+#include "kis_selection.h"
+#include "kis_id.h"
+#include "kis_canvas_subject.h"
+#include "kis_progress_display_interface.h"
+#include "kis_types.h"
+#include "kis_filter_config_widget.h"
+
+
+KisFilterConfiguration::KisFilterConfiguration(const KisFilterConfiguration & rhs)
+{
+    m_name = rhs.m_name;
+    m_version = rhs.m_version;
+    m_properties = rhs.m_properties;
+}
+
+void KisFilterConfiguration::fromXML(const TQString & s )
+{
+    m_properties.clear();
+
+    TQDomDocument doc;
+    doc.setContent( s );
+    TQDomElement e = doc.documentElement();
+    TQDomNode n = e.firstChild();
+
+    m_name = e.attribute("name");
+    m_version = e.attribute("version").toInt();
+
+    while (!n.isNull()) {
+        // We don't nest elements in filter configuration. For now...
+        TQDomElement e = n.toElement();
+        TQString name;
+        TQString type;
+        TQString value;
+
+        if (!e.isNull()) {
+            if (e.tagName() == "property") {
+                name = e.attribute("name");
+                type = e.attribute("type");
+                value = e.text();
+                // XXX Convert the variant pro-actively to the right type?
+                m_properties[name] = TQVariant(value);
+            }
+        }
+        n = n.nextSibling();
+    }
+    //dump();
+}
+
+TQString KisFilterConfiguration::toString()
+{
+    TQDomDocument doc = TQDomDocument("filterconfig");
+    TQDomElement root = doc.createElement( "filterconfig" );
+    root.setAttribute( "name", m_name );
+    root.setAttribute( "version", m_version );
+
+    doc.appendChild( root );
+
+    TQMap<TQString, TQVariant>::Iterator it;
+    for ( it = m_properties.begin(); it != m_properties.end(); ++it ) {
+        TQDomElement e = doc.createElement( "property" );
+        e.setAttribute( "name", it.key().latin1() );
+        TQVariant v = it.data();
+        e.setAttribute( "type", v.typeName() );
+        TQString s = v.asString();
+        TQDomText text = doc.createCDATASection(v.asString() ); // XXX: Unittest this!
+        e.appendChild(text);
+        root.appendChild(e);
+    }
+
+    return doc.toString();
+}
+
+const TQString & KisFilterConfiguration::name() const
+{
+    return m_name;
+}
+
+TQ_INT32 KisFilterConfiguration::version() const
+{
+    return m_version;
+}
+
+void KisFilterConfiguration::setProperty(const TQString & name, const TQVariant & value)
+{
+    if ( m_properties.tqfind( name ) == m_properties.end() ) {
+        m_properties.insert( name, value );
+    }
+    else {
+        m_properties[name] = value;
+    }
+}
+
+bool KisFilterConfiguration::getProperty(const TQString & name, TQVariant & value)
+{
+   if ( m_properties.tqfind( name ) == m_properties.end() ) {
+       return false;
+   }
+   else {
+       value = m_properties[name];
+       return true;
+   }
+}
+
+TQVariant KisFilterConfiguration::getProperty(const TQString & name)
+{
+    if ( m_properties.tqfind( name ) == m_properties.end() ) {
+        return TQVariant();
+    }
+    else {
+        return m_properties[name];
+    }
+}
+
+
+int KisFilterConfiguration::getInt(const TQString & name, int def)
+{
+    TQVariant v = getProperty(name);
+    if (v.isValid())
+        return v.asInt();
+    else
+        return def;
+
+}
+
+double KisFilterConfiguration::getDouble(const TQString & name, double def)
+{
+    TQVariant v = getProperty(name);
+    if (v.isValid())
+        return v.asDouble();
+    else
+        return def;
+}
+
+bool KisFilterConfiguration::getBool(const TQString & name, bool def)
+{
+    TQVariant v = getProperty(name);
+    if (v.isValid())
+        return v.asBool();
+    else
+        return def;
+}
+
+TQString KisFilterConfiguration::getString(const TQString & name, TQString def)
+{
+    TQVariant v = getProperty(name);
+    if (v.isValid())
+        return v.asString();
+    else
+        return def;
+}
+
+void KisFilterConfiguration::dump()
+{
+    TQMap<TQString, TQVariant>::Iterator it;
+    for ( it = m_properties.begin(); it != m_properties.end(); ++it ) {
+    }
+
+}
diff --git a/chalk/core/kis_filter_configuration.h b/chalk/core/kis_filter_configuration.h
new file mode 100644
index 000000000..8361861a7
--- /dev/null
+++ b/chalk/core/kis_filter_configuration.h
@@ -0,0 +1,105 @@
+/*
+ *  Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef _KIS_FILTER_CONFIGURATION_H_
+#define _KIS_FILTER_CONFIGURATION_H_
+
+#include <tqstring.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <kdebug.h>
+#include "koffice_export.h"
+
+class KisPreviewDialog;
+class KisProgressDisplayInterface;
+class KisFilterConfigWidget;
+class TQWidget;
+
+/**
+ * A KisFilterConfiguration is the serializable representation of
+ * the filter parameters. Filters can subclass this class to implement
+ * direct accessors to properties, but properties not in the map will
+ * not be serialized.
+ */
+class KRITACORE_EXPORT KisFilterConfiguration {
+
+public:
+
+    /**
+     * Create a new filter config.
+     */
+    KisFilterConfiguration(const TQString & name, TQ_INT32 version)
+        : m_name(name)
+        , m_version(version) {}
+
+    /**
+     * Deep copy the filter configFile
+     */
+    KisFilterConfiguration(const KisFilterConfiguration & rhs);
+            
+public:
+
+    /**
+     * Fill the filter configuration object from the XML encoded representation in s.
+     */
+    virtual void fromXML(const TQString &);
+
+    /**
+     * Create a serialized version of this filter config
+     */
+    virtual TQString toString();
+
+    /**
+     * Get the unique, language independent name of the filter.
+     */
+    const TQString & name() const;
+
+    /**
+     * Get the version of the filter that has created this config
+     */
+    TQ_INT32 version() const;
+
+    /**
+     * Set the property with name to value.
+     */
+    virtual void setProperty(const TQString & name, const TQVariant & value);
+
+    /**
+     * Set value to the value associated with property name
+     * @return false if the specified property did not exist.
+     */
+    virtual bool getProperty(const TQString & name, TQVariant & value);
+
+    virtual TQVariant getProperty(const TQString & name);
+
+    int getInt(const TQString & name, int def = 0);
+    double getDouble(const TQString & name, double def = 0.0);
+    bool getBool(const TQString & name, bool def = false);
+    TQString getString(const TQString & name, TQString def = TQString());
+    
+private:
+        void dump();
+    
+protected:
+
+    TQString m_name;
+    TQ_INT32 m_version;
+    TQMap<TQString, TQVariant> m_properties;
+    
+};
+
+#endif // _KIS_FILTER_CONFIGURATION_H_
diff --git a/chalk/core/kis_filter_registry.cc b/chalk/core/kis_filter_registry.cc
new file mode 100644
index 000000000..b7c8383ec
--- /dev/null
+++ b/chalk/core/kis_filter_registry.cc
@@ -0,0 +1,82 @@
+/*
+ *  Copyright (c) 2003 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <tqstring.h>
+#include <tqptrlist.h>
+
+#include <kaction.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kparts/plugin.h>
+#include <kservice.h>
+#include <ktrader.h>
+#include <kparts/componentfactory.h>
+#include "kis_debug_areas.h"
+#include <math.h>
+#include "kis_types.h"
+#include "kis_filter_registry.h"
+#include "kis_paint_device.h"
+#include "kis_filter.h"
+
+KisFilterRegistry *KisFilterRegistry::m_singleton = 0;
+
+KisFilterRegistry::KisFilterRegistry()
+{
+    Q_ASSERT(KisFilterRegistry::m_singleton == 0);
+    KisFilterRegistry::m_singleton = this;
+
+    KTrader::OfferList offers = KTrader::self()->query(TQString::tqfromLatin1("Chalk/Filter"),
+                                                         TQString::tqfromLatin1("(Type == 'Service') and "
+                                                                             "([X-Chalk-Version] == 2)"));
+
+    KTrader::OfferList::ConstIterator iter;
+
+    for(iter = offers.begin(); iter != offers.end(); ++iter)
+    {
+        KService::Ptr service = *iter;
+        int errCode = 0;
+        KParts::Plugin* plugin =
+             KParts::ComponentFactory::createInstanceFromService<KParts::Plugin> ( service, this, 0, TQStringList(), &errCode);
+        if ( plugin )
+            kdDebug(DBG_AREA_PLUGINS) << "found plugin " << service->property("Name").toString() << "\n";
+        else {
+            kdDebug(41006) << "found plugin " << service->property("Name").toString() << ", " << errCode << "\n";
+            if( errCode == KParts::ComponentFactory::ErrNoLibrary)
+            {
+                kdWarning(41006) << " Error loading plugin was : ErrNoLibrary " << KLibLoader::self()->lastErrorMessage() << endl;
+            }
+        }
+
+    }
+
+}
+
+KisFilterRegistry::~KisFilterRegistry()
+{
+}
+
+KisFilterRegistry* KisFilterRegistry::instance()
+{
+    if(KisFilterRegistry::m_singleton == 0)
+    {
+        KisFilterRegistry::m_singleton = new KisFilterRegistry();
+    }
+    return KisFilterRegistry::m_singleton;
+}
+
+#include "kis_filter_registry.moc"
diff --git a/chalk/core/kis_filter_registry.h b/chalk/core/kis_filter_registry.h
new file mode 100644
index 000000000..9ad9901d6
--- /dev/null
+++ b/chalk/core/kis_filter_registry.h
@@ -0,0 +1,53 @@
+/*
+ *  Copyright (c) 2003 Patrick Julien  <freak@codepimps.org>
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_FILTER_REGISTRY_H_
+#define KIS_FILTER_REGISTRY_H_
+
+#include <tqobject.h>
+
+#include "kis_types.h"
+#include "kis_generic_registry.h"
+
+#include <koffice_export.h>
+
+class TQString;
+class TQStringList;
+
+class KRITACORE_EXPORT KisFilterRegistry : public TQObject, public KisGenericRegistry<KisFilterSP>
+{
+
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    virtual ~KisFilterRegistry();
+    
+    static KisFilterRegistry* instance();
+
+private:
+    KisFilterRegistry();
+    KisFilterRegistry(const KisFilterRegistry&);
+    KisFilterRegistry operator=(const KisFilterRegistry&);
+
+private:
+     static KisFilterRegistry *m_singleton;
+};
+ 
+#endif // KIS_FILTERSPACE_REGISTRY_H_
diff --git a/chalk/core/kis_filter_strategy.cc b/chalk/core/kis_filter_strategy.cc
new file mode 100644
index 000000000..f82e6cb5a
--- /dev/null
+++ b/chalk/core/kis_filter_strategy.cc
@@ -0,0 +1,192 @@
+/*
+ *  Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <kdebug.h>
+#include <klocale.h>
+#include "kis_debug_areas.h"
+#include "kis_filter_strategy.h"
+#include <math.h>
+
+double KisHermiteFilterStrategy::valueAt(double t) const {
+        /* f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1 */
+        if(t < 0.0) t = -t;
+        if(t < 1.0) return((2.0 * t - 3.0) * t * t + 1.0);
+        return(0.0);
+}
+
+TQ_UINT32 KisHermiteFilterStrategy::intValueAt(TQ_INT32 t) const {
+        /* f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1 */
+        if(t < 0) t = -t;
+        if(t < 256)
+    {
+        t =(2 * t - 3*256) * t * t +(256<<16);
+
+        //go from .24 fixed point to .8 fixedpoint (hack only works with positve numbers, which it is)
+        t = (t + 0x8000) >> 16;
+
+        // go from .8 fixed point to 8bitscale. ie t = (t*255)/256;
+        if(t >= 128)
+            return t - 1;
+        return t;
+    }
+        return(0);
+}
+
+double KisCubicFilterStrategy::valueAt(double x) const {
+    if (x < -2.0)
+        return(0.0);
+    if (x < -1.0)
+        return((2.0+x)*(2.0+x)*(2.0+x)/6.0);
+    if (x < 0.0)
+        return((4.0+x*x*(-6.0-3.0*x))/6.0);
+    if (x < 1.0)
+        return((4.0+x*x*(-6.0+3.0*x))/6.0);
+    if (x < 2.0)
+        return((2.0-x)*(2.0-x)*(2.0-x)/6.0);
+    return(0.0);
+}
+
+TQ_UINT32 KisCubicFilterStrategy::intValueAt(TQ_INT32 x) const {
+    if (x < 2)
+        return 0;
+    if (x < -1)
+        return (2 + x) * (2 + x) * ( 2 + x) / 6;
+    if ( x < 0)
+        return (4 + x * x * ( -6 - 3 * x)) / 6;
+    if (x < 1)
+        return (4 + x * x * ( -6 + 3 * x)) / 6;
+    if (x < 2)
+        return (2 - x) * ( 2 - x) * (2 - x) / 6;    
+     return 0;   
+}
+
+double KisBoxFilterStrategy::valueAt(double t) const {
+        if((t > -0.5) && (t <= 0.5)) return(1.0);
+        return(0.0);
+}
+
+TQ_UINT32 KisBoxFilterStrategy::intValueAt(TQ_INT32 t) const {
+        /* f(t) = 1, -0.5 < t <= 0.5 */
+    if((t > -128) && (t <= 128))
+        return 255;
+    return 0;
+}
+
+double KisTriangleFilterStrategy::valueAt(double t) const {
+        if(t < 0.0) t = -t;
+        if(t < 1.0) return(1.0 - t);
+        return(0.0);
+}
+
+TQ_UINT32 KisTriangleFilterStrategy::intValueAt(TQ_INT32 t) const {
+        /* f(t) = |t|, -1 <= t <= 1 */
+        if(t < 0) t = -t;
+        if(t < 256)
+    {
+         // calc 256-1 but also go from .8 fixed point to 8bitscale. ie t = (t*255)/256; ie: if(t>=128) return t-1;
+        if(t>=128) return 256 - t;
+        return 255 - t;
+    }
+        return(0);
+}
+
+
+double KisBellFilterStrategy::valueAt(double t) const {
+        if(t < 0) t = -t;
+        if(t < .5) return(.75 - (t * t));
+        if(t < 1.5) {
+                t = (t - 1.5);
+                return(.5 * (t * t));
+        }
+        return(0.0);
+}
+
+double KisBSplineFilterStrategy::valueAt(double t) const {
+        double tt;
+
+        if(t < 0) t = -t;
+        if(t < 1) {
+                tt = t * t;
+                return((.5 * tt * t) - tt + (2.0 / 3.0));
+        } else if(t < 2) {
+                t = 2 - t;
+                return((1.0 / 6.0) * (t * t * t));
+        }
+        return(0.0);
+}
+
+double KisLanczos3FilterStrategy::valueAt(double t) const {
+        if(t < 0) t = -t;
+        if(t < 3.0) return(sinc(t) * sinc(t/3.0));
+        return(0.0);
+}
+
+double KisLanczos3FilterStrategy::sinc(double x) const {
+        const double pi=3.1415926535897932385;
+        x *= pi;
+        if(x != 0) return(sin(x) / x);
+        return(1.0);
+}
+
+double KisMitchellFilterStrategy::valueAt(double t) const {
+        const double B=1.0/3.0;
+        const double C=1.0/3.0;
+        double tt;
+
+        tt = t * t;
+        if(t < 0) t = -t;
+        if(t < 1.0) {
+                t = (((12.0 - 9.0 * B - 6.0 * C) * (t * tt)) + ((-18.0 + 12.0 * B + 6.0 * C) * tt) + (6.0 - 2 * B));
+                return(t / 6.0);
+        } else if(t < 2.0) {
+                t = (((-1.0 * B - 6.0 * C) * (t * tt)) + ((6.0 * B + 30.0 * C) * tt) + ((-12.0 * B - 48.0 * C) * t) + (8.0 * B + 24 * C));
+                return(t / 6.0);
+                }
+        return(0.0);
+}
+
+KisFilterStrategyRegistry *KisFilterStrategyRegistry::m_singleton = 0;
+
+KisFilterStrategyRegistry::KisFilterStrategyRegistry()
+{
+    Q_ASSERT(KisFilterStrategyRegistry::m_singleton == 0);
+    KisFilterStrategyRegistry::m_singleton = this;
+}
+
+KisFilterStrategyRegistry::~KisFilterStrategyRegistry()
+{
+}
+
+KisFilterStrategyRegistry* KisFilterStrategyRegistry::instance()
+{
+    if(KisFilterStrategyRegistry::m_singleton == 0)
+    {
+        KisFilterStrategyRegistry::m_singleton = new KisFilterStrategyRegistry();
+        Q_CHECK_PTR(KisFilterStrategyRegistry::m_singleton);
+        m_singleton->add(new KisHermiteFilterStrategy);
+        m_singleton->add(new KisBoxFilterStrategy);
+        m_singleton->add(new KisTriangleFilterStrategy);
+        m_singleton->add(new KisBellFilterStrategy);
+        m_singleton->add(new KisBSplineFilterStrategy);
+//         m_singleton->add(new KisLanczos3FilterStrategy);
+        m_singleton->add(new KisMitchellFilterStrategy);
+//         m_singleton->add(new KisCubicFilterStrategy);
+    }
+    return KisFilterStrategyRegistry::m_singleton;
+}
+
diff --git a/chalk/core/kis_filter_strategy.h b/chalk/core/kis_filter_strategy.h
new file mode 100644
index 000000000..55ef3d064
--- /dev/null
+++ b/chalk/core/kis_filter_strategy.h
@@ -0,0 +1,150 @@
+/*
+ *  Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_FILTER_STRATEGY_H_
+#define KIS_FILTER_STRATEGY_H_
+
+#include <klocale.h>
+
+#include "kis_types.h"
+#include "kis_generic_registry.h"
+#include "kis_id.h"
+
+class KisFilterStrategy
+{
+    public:
+        KisFilterStrategy(KisID id) : m_id(id) {}
+        virtual ~KisFilterStrategy() {}
+
+        KisID id() {return m_id;};
+        virtual double valueAt(double /*t*/) const {return 0;};
+        virtual TQ_UINT32 intValueAt(TQ_INT32 t) const {return TQ_UINT32(255*valueAt(t/256.0));};
+        double support() { return supportVal;};
+        TQ_UINT32 intSupport() { return intSupportVal;};
+        virtual bool boxSpecial() { return false;};
+    protected:
+        double supportVal;
+        TQ_UINT32 intSupportVal;
+        KisID m_id;
+};
+
+class KisHermiteFilterStrategy : public KisFilterStrategy
+{
+    public:
+        KisHermiteFilterStrategy() : KisFilterStrategy(KisID("Hermite", i18n("Hermite")))
+            {supportVal = 1.0; intSupportVal = 256;}
+        virtual ~KisHermiteFilterStrategy() {}
+        
+        virtual TQ_UINT32 intValueAt(TQ_INT32 t) const;
+        virtual double valueAt(double t) const;
+};
+
+class KisCubicFilterStrategy : public KisFilterStrategy
+{
+    public:
+        KisCubicFilterStrategy() : KisFilterStrategy(KisID("Bicubic", i18n("Bicubic")))
+            {supportVal = 1.0; intSupportVal = 256;}
+        virtual ~KisCubicFilterStrategy() {}
+        
+        virtual TQ_UINT32 intValueAt(TQ_INT32 t) const;
+        virtual double valueAt(double t) const;
+};
+
+class KisBoxFilterStrategy : public KisFilterStrategy
+{
+    public:
+        KisBoxFilterStrategy() : KisFilterStrategy(KisID("Box", i18n("Box")))
+             {supportVal = 0.5; intSupportVal = 128;}
+        virtual ~KisBoxFilterStrategy() {}
+
+        virtual TQ_UINT32 intValueAt(TQ_INT32 t) const;
+        virtual double valueAt(double t) const;
+        virtual bool boxSpecial() { return true;};
+};
+
+class KisTriangleFilterStrategy : public KisFilterStrategy
+{
+    public:
+        KisTriangleFilterStrategy() : KisFilterStrategy(KisID("Triangle", i18n("Triangle aka (bi)linear")))
+            {supportVal = 1.0; intSupportVal = 256;}
+        virtual ~KisTriangleFilterStrategy() {}
+
+        virtual TQ_UINT32 intValueAt(TQ_INT32 t) const;
+        virtual double valueAt(double t) const;
+};
+
+class KisBellFilterStrategy : public KisFilterStrategy
+{
+    public:
+        KisBellFilterStrategy() : KisFilterStrategy(KisID("Bell", i18n("Bell")))
+            {supportVal = 1.5; intSupportVal = 128+256;}
+        virtual ~KisBellFilterStrategy() {}
+
+        virtual double valueAt(double t) const;
+};
+
+class KisBSplineFilterStrategy : public KisFilterStrategy
+{
+    public:
+        KisBSplineFilterStrategy() : KisFilterStrategy(KisID("BSpline", i18n("BSpline")))
+            {supportVal = 2.0; intSupportVal = 512;}
+        virtual ~KisBSplineFilterStrategy() {}
+
+        virtual double valueAt(double t) const;
+};
+
+class KisLanczos3FilterStrategy : public KisFilterStrategy
+{
+    public:
+        KisLanczos3FilterStrategy() : KisFilterStrategy(KisID("Lanczos3", i18n("Lanczos3")))
+            {supportVal = 3.0; intSupportVal = 768;}
+        virtual ~KisLanczos3FilterStrategy() {}
+
+        virtual double valueAt(double t) const;
+    private:
+        double sinc(double x) const; 
+};
+
+class KisMitchellFilterStrategy : public KisFilterStrategy
+{
+    public:
+        KisMitchellFilterStrategy() : KisFilterStrategy(KisID("Mitchell", i18n("Mitchell")))
+            {supportVal = 2.0; intSupportVal = 256;}
+        virtual ~KisMitchellFilterStrategy() {}
+
+        virtual double valueAt(double t) const;
+};
+
+class KisFilterStrategyRegistry : public KisGenericRegistry<KisFilterStrategy *>
+{
+public:
+    virtual ~KisFilterStrategyRegistry();
+    
+    static KisFilterStrategyRegistry* instance();
+
+private:
+    KisFilterStrategyRegistry();
+     KisFilterStrategyRegistry(const KisFilterStrategyRegistry&);
+     KisFilterStrategyRegistry operator=(const KisFilterStrategyRegistry&);
+
+private:
+    static KisFilterStrategyRegistry *m_singleton;
+};
+
+#endif // KIS_FILTER_STRATEGY_H_
diff --git a/chalk/core/kis_gradient.cc b/chalk/core/kis_gradient.cc
new file mode 100644
index 000000000..efc370bb7
--- /dev/null
+++ b/chalk/core/kis_gradient.cc
@@ -0,0 +1,639 @@
+/*
+ *  kis_gradient.cc - part of Krayon
+ *
+ *  Copyright (c) 2000 Matthias Elter <elter@kde.org>
+ *                2001 John Califf
+ *                2004 Boudewijn Rempt <boud@valdyas.org>
+ *                2004 Adrian Page <adrian@pagenet.plus.com>
+ *                2004 Sven Langkamp <longamp@reallygood.de>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <cfloat>
+#include <cmath>
+
+#include <tqimage.h>
+#include <tqtextstream.h>
+#include <tqfile.h>
+
+#include <koColor.h>
+#include <kogradientmanager.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_gradient.h"
+
+#define PREVIEW_WIDTH 64
+#define PREVIEW_HEIGHT 64
+
+KisGradientSegment::RGBColorInterpolationStrategy *KisGradientSegment::RGBColorInterpolationStrategy::m_instance = 0;
+KisGradientSegment::HSVCWColorInterpolationStrategy *KisGradientSegment::HSVCWColorInterpolationStrategy::m_instance = 0;
+KisGradientSegment::HSVCCWColorInterpolationStrategy *KisGradientSegment::HSVCCWColorInterpolationStrategy::m_instance = 0;
+
+KisGradientSegment::LinearInterpolationStrategy *KisGradientSegment::LinearInterpolationStrategy::m_instance = 0;
+KisGradientSegment::CurvedInterpolationStrategy *KisGradientSegment::CurvedInterpolationStrategy::m_instance = 0;
+KisGradientSegment::SineInterpolationStrategy *KisGradientSegment::SineInterpolationStrategy::m_instance = 0;
+KisGradientSegment::SphereIncreasingInterpolationStrategy *KisGradientSegment::SphereIncreasingInterpolationStrategy::m_instance = 0;
+KisGradientSegment::SphereDecreasingInterpolationStrategy *KisGradientSegment::SphereDecreasingInterpolationStrategy::m_instance = 0;
+
+KisGradient::KisGradient(const TQString& file) : super(file)
+{
+}
+
+KisGradient::~KisGradient()
+{
+    for (uint i = 0; i < m_segments.count(); i++) {
+        delete m_segments[i];
+        m_segments[i] = 0;
+    }
+}
+
+bool KisGradient::load()
+{
+    return init();
+}
+
+bool KisGradient::save()
+{
+    return false;
+}
+
+TQImage KisGradient::img()
+{
+    return m_img;
+}
+
+bool KisGradient::init()
+{
+    KoGradientManager gradLoader;
+    KoGradient* grad = gradLoader.loadGradient(filename());
+
+    if( !grad )
+        return false;
+
+    m_segments.clear();
+
+    if( grad->colorStops.count() > 1 ) {
+        KoColorStop *colstop;
+        for(colstop = grad->colorStops.first(); colstop; colstop = grad->colorStops.next()) {
+            KoColorStop *colstopNext = grad->colorStops.next();
+
+            if(colstopNext) {
+                KoColor leftRgb((int)(colstop->color1 * 255 + 0.5), (int)(colstop->color2 * 255 + 0.5), (int)(colstop->color3 * 255 + 0.5));
+                KoColor rightRgb((int)(colstopNext->color1 * 255 + 0.5), (int)(colstopNext->color2 * 255 + 0.5), (int)(colstopNext->color3 * 255 + 0.5));
+
+                double midp = colstop->midpoint;
+                midp = colstop->offset + ((colstopNext->offset - colstop->offset) * midp);
+
+                Color leftColor(leftRgb.color(), colstop->opacity);
+                Color rightColor(rightRgb.color(), colstopNext->opacity);
+
+                KisGradientSegment *segment = new KisGradientSegment(colstop->interpolation, colstop->colorType, colstop->offset, midp, colstopNext->offset, leftColor, rightColor);
+                Q_CHECK_PTR(segment);
+
+                if ( !segment->isValid() ) {
+                    delete segment;
+                    return false;
+                }
+
+                m_segments.push_back(segment);
+                grad->colorStops.prev();
+            }
+            else {
+                grad->colorStops.prev();
+                break;
+            }
+        }
+    }
+    else
+        return false;
+
+    if (!m_segments.isEmpty()) {
+        m_img = generatePreview(PREVIEW_WIDTH, PREVIEW_HEIGHT);
+        setValid(true);
+        return true;
+    }
+    else {
+        return false;
+    }
+}
+
+void KisGradient::setImage(const TQImage& img)
+{
+    m_img = img;
+    m_img.detach();
+
+    setValid(true);
+}
+
+KisGradientSegment *KisGradient::segmentAt(double t) const
+{
+    Q_ASSERT(t >= 0 || t <= 1);
+    Q_ASSERT(!m_segments.empty());
+
+    for(TQValueVector<KisGradientSegment *>::const_iterator it = m_segments.begin(); it!= m_segments.end(); ++it)
+    {
+        if (t > (*it)->startOffset() - DBL_EPSILON && t < (*it)->endOffset() + DBL_EPSILON) {
+            return *it;
+        }
+    }
+
+    return 0;
+}
+
+void KisGradient::colorAt(double t, TQColor *color, TQ_UINT8 *opacity) const
+{
+    const KisGradientSegment *segment = segmentAt(t);
+    Q_ASSERT(segment != 0);
+
+    if (segment) {
+        Color col = segment->colorAt(t);
+        *color = col.color();
+        *opacity = static_cast<TQ_UINT8>(col.alpha() * OPACITY_OPAQUE + 0.5);
+    }
+}
+
+TQImage KisGradient::generatePreview(int width, int height) const
+{
+    TQImage img(width, height, 32);
+
+    for (int y = 0; y < img.height(); y++) {
+        for (int x = 0; x < img.width(); x++) {
+
+            int backgroundRed = 128 + 63 * ((x / 4 + y / 4) % 2);
+            int backgroundGreen = backgroundRed;
+            int backgroundBlue = backgroundRed;
+
+            TQColor color;
+            TQ_UINT8 opacity;
+            double t = static_cast<double>(x) / (img.width() - 1);
+
+            colorAt(t,  &color, &opacity);
+
+            double alpha = static_cast<double>(opacity) / OPACITY_OPAQUE;
+
+            int red = static_cast<int>((1 - alpha) * backgroundRed + alpha * color.red() + 0.5);
+            int green = static_cast<int>((1 - alpha) * backgroundGreen + alpha * color.green() + 0.5);
+            int blue = static_cast<int>((1 - alpha) * backgroundBlue + alpha * color.blue() + 0.5);
+
+            img.setPixel(x, y, tqRgb(red, green, blue));
+        }
+    }
+
+    return img;
+}
+
+KisGradientSegment::KisGradientSegment(int interpolationType, int colorInterpolationType, double startOffset, double middleOffset, double endOffset, const Color& startColor, const Color& endColor)
+{
+    m_interpolator = 0;
+
+    switch (interpolationType) {
+    case INTERP_LINEAR:
+        m_interpolator = LinearInterpolationStrategy::instance();
+        break;
+    case INTERP_CURVED:
+        m_interpolator = CurvedInterpolationStrategy::instance();
+        break;
+    case INTERP_SINE:
+        m_interpolator = SineInterpolationStrategy::instance();
+        break;
+    case INTERP_SPHERE_INCREASING:
+        m_interpolator = SphereIncreasingInterpolationStrategy::instance();
+        break;
+    case INTERP_SPHERE_DECREASING:
+        m_interpolator = SphereDecreasingInterpolationStrategy::instance();
+        break;
+    }
+
+    m_colorInterpolator = 0;
+
+    switch (colorInterpolationType) {
+    case COLOR_INTERP_RGB:
+        m_colorInterpolator = RGBColorInterpolationStrategy::instance();
+        break;
+    case COLOR_INTERP_HSV_CCW:
+        m_colorInterpolator = HSVCCWColorInterpolationStrategy::instance();
+        break;
+    case COLOR_INTERP_HSV_CW:
+        m_colorInterpolator = HSVCWColorInterpolationStrategy::instance();
+        break;
+    }
+
+    if (startOffset < DBL_EPSILON) {
+        m_startOffset = 0;
+    }
+    else
+    if (startOffset > 1 - DBL_EPSILON) {
+        m_startOffset = 1;
+    }
+    else {
+        m_startOffset = startOffset;
+    }
+
+    if (middleOffset < m_startOffset + DBL_EPSILON) {
+        m_middleOffset = m_startOffset;
+    }
+    else
+    if (middleOffset > 1 - DBL_EPSILON) {
+        m_middleOffset = 1;
+    }
+    else {
+        m_middleOffset = middleOffset;
+    }
+
+    if (endOffset < m_middleOffset + DBL_EPSILON) {
+        m_endOffset = m_middleOffset;
+    }
+    else
+    if (endOffset > 1 - DBL_EPSILON) {
+        m_endOffset = 1;
+    }
+    else {
+        m_endOffset = endOffset;
+    }
+
+    m_length = m_endOffset - m_startOffset;
+
+    if (m_length < DBL_EPSILON) {
+        m_middleT = 0.5;
+    }
+    else {
+        m_middleT = (m_middleOffset - m_startOffset) / m_length;
+    }
+
+    m_startColor = startColor;
+    m_endColor = endColor;
+}
+
+const Color& KisGradientSegment::startColor() const
+{
+    return m_startColor;
+}
+
+const Color& KisGradientSegment::endColor() const
+{
+    return m_endColor;
+}
+
+double KisGradientSegment::startOffset() const
+{
+    return m_startOffset;
+}
+
+double KisGradientSegment::middleOffset() const
+{
+    return m_middleOffset;
+}
+
+double KisGradientSegment::endOffset() const
+{
+    return m_endOffset;
+}
+
+void KisGradientSegment::setStartOffset(double t)
+{
+    m_startOffset = t;
+    m_length = m_endOffset - m_startOffset;
+
+    if (m_length < DBL_EPSILON) {
+        m_middleT = 0.5;
+    }
+    else {
+        m_middleT = (m_middleOffset - m_startOffset) / m_length;
+    }
+}
+void KisGradientSegment::setMiddleOffset(double t)
+{
+    m_middleOffset = t;
+
+    if (m_length < DBL_EPSILON) {
+        m_middleT = 0.5;
+    }
+    else {
+        m_middleT = (m_middleOffset - m_startOffset) / m_length;
+    }
+}
+
+void KisGradientSegment::setEndOffset(double t)
+{
+    m_endOffset = t;
+    m_length = m_endOffset - m_startOffset;
+
+    if (m_length < DBL_EPSILON) {
+        m_middleT = 0.5;
+    }
+    else {
+        m_middleT = (m_middleOffset - m_startOffset) / m_length;
+    }
+}
+
+int KisGradientSegment::interpolation() const
+{
+    return m_interpolator->type();
+}
+
+void KisGradientSegment::setInterpolation(int interpolationType)
+{
+    switch (interpolationType) {
+    case INTERP_LINEAR:
+        m_interpolator = LinearInterpolationStrategy::instance();
+        break;
+    case INTERP_CURVED:
+        m_interpolator = CurvedInterpolationStrategy::instance();
+        break;
+    case INTERP_SINE:
+        m_interpolator = SineInterpolationStrategy::instance();
+        break;
+    case INTERP_SPHERE_INCREASING:
+        m_interpolator = SphereIncreasingInterpolationStrategy::instance();
+        break;
+    case INTERP_SPHERE_DECREASING:
+        m_interpolator = SphereDecreasingInterpolationStrategy::instance();
+        break;
+    }
+}
+
+int KisGradientSegment::colorInterpolation() const
+{
+    return m_colorInterpolator->type();
+}
+
+void KisGradientSegment::setColorInterpolation(int colorInterpolationType)
+{
+    switch (colorInterpolationType) {
+    case COLOR_INTERP_RGB:
+        m_colorInterpolator = RGBColorInterpolationStrategy::instance();
+        break;
+    case COLOR_INTERP_HSV_CCW:
+        m_colorInterpolator = HSVCCWColorInterpolationStrategy::instance();
+        break;
+    case COLOR_INTERP_HSV_CW:
+        m_colorInterpolator = HSVCWColorInterpolationStrategy::instance();
+        break;
+    }
+}
+
+Color KisGradientSegment::colorAt(double t) const
+{
+    Q_ASSERT(t > m_startOffset - DBL_EPSILON && t < m_endOffset + DBL_EPSILON);
+
+    double segmentT;
+
+    if (m_length < DBL_EPSILON) {
+        segmentT = 0.5;
+    }
+    else {
+        segmentT = (t - m_startOffset) / m_length;
+    }
+
+    double colorT = m_interpolator->valueAt(segmentT, m_middleT);
+
+    Color color = m_colorInterpolator->colorAt(colorT, m_startColor, m_endColor);
+
+    return color;
+}
+
+bool KisGradientSegment::isValid() const
+{
+    if (m_interpolator == 0 || m_colorInterpolator ==0)
+        return false;
+    return true;
+}
+
+KisGradientSegment::RGBColorInterpolationStrategy *KisGradientSegment::RGBColorInterpolationStrategy::instance()
+{
+    if (m_instance == 0) {
+        m_instance = new RGBColorInterpolationStrategy();
+        Q_CHECK_PTR(m_instance);
+    }
+
+    return m_instance;
+}
+
+Color KisGradientSegment::RGBColorInterpolationStrategy::colorAt(double t, Color start, Color end) const
+{
+    int startRed = start.color().red();
+    int startGreen = start.color().green();
+    int startBlue = start.color().blue();
+    double startAlpha = start.alpha();
+    int red = static_cast<int>(startRed + t * (end.color().red() - startRed) + 0.5);
+    int green = static_cast<int>(startGreen + t * (end.color().green() - startGreen) + 0.5);
+    int blue = static_cast<int>(startBlue + t * (end.color().blue() - startBlue) + 0.5);
+    double alpha = startAlpha + t * (end.alpha() - startAlpha);
+
+    return Color(TQColor(red, green, blue), alpha);
+}
+
+KisGradientSegment::HSVCWColorInterpolationStrategy *KisGradientSegment::HSVCWColorInterpolationStrategy::instance()
+{
+    if (m_instance == 0) {
+        m_instance = new HSVCWColorInterpolationStrategy();
+        Q_CHECK_PTR(m_instance);
+    }
+
+    return m_instance;
+}
+
+Color KisGradientSegment::HSVCWColorInterpolationStrategy::colorAt(double t, Color start, Color end) const
+{
+    KoColor sc = KoColor(start.color());
+    KoColor ec = KoColor(end.color());
+    
+    int s = static_cast<int>(sc.S() + t * (ec.S() - sc.S()) + 0.5);
+    int v = static_cast<int>(sc.V() + t * (ec.V() - sc.V()) + 0.5);
+    int h;
+    
+    if (ec.H() < sc.H()) {
+        h = static_cast<int>(ec.H() + (1 - t) * (sc.H() - ec.H()) + 0.5);
+    }
+    else {
+        h = static_cast<int>(ec.H() + (1 - t) * (360 - ec.H() + sc.H()) + 0.5);
+        
+        if (h > 359) {
+            h -= 360;
+        }
+    }
+    
+    double alpha = start.alpha() + t * (end.alpha() - start.alpha());
+
+    return Color(KoColor(h, s, v, KoColor::csHSV).color(), alpha);
+}
+
+KisGradientSegment::HSVCCWColorInterpolationStrategy *KisGradientSegment::HSVCCWColorInterpolationStrategy::instance()
+{
+    if (m_instance == 0) {
+        m_instance = new HSVCCWColorInterpolationStrategy();
+        Q_CHECK_PTR(m_instance);
+    }
+
+    return m_instance;
+}
+
+Color KisGradientSegment::HSVCCWColorInterpolationStrategy::colorAt(double t, Color start, Color end) const
+{
+    KoColor sc = KoColor(start.color());
+    KoColor se = KoColor(end.color());
+
+    int s = static_cast<int>(sc.S() + t * (se.S() - sc.S()) + 0.5);
+    int v = static_cast<int>(sc.V() + t * (se.V() - sc.V()) + 0.5);
+    int h;
+
+    if (sc.H() < se.H()) {
+        h = static_cast<int>(sc.H() + t * (se.H() - sc.H()) + 0.5);
+    }
+    else {
+        h = static_cast<int>(sc.H() + t * (360 - sc.H() + se.H()) + 0.5);
+
+        if (h > 359) {
+            h -= 360;
+        }
+    }
+
+    double alpha = start.alpha() + t * (end.alpha() - start.alpha());
+
+    return Color(KoColor(h, s, v, KoColor::csHSV).color(), alpha);
+}
+
+KisGradientSegment::LinearInterpolationStrategy *KisGradientSegment::LinearInterpolationStrategy::instance()
+{
+    if (m_instance == 0) {
+        m_instance = new LinearInterpolationStrategy();
+        Q_CHECK_PTR(m_instance);
+    }
+
+    return m_instance;
+}
+
+double KisGradientSegment::LinearInterpolationStrategy::calcValueAt(double t, double middle)
+{
+    Q_ASSERT(t > -DBL_EPSILON && t < 1 + DBL_EPSILON);
+    Q_ASSERT(middle > -DBL_EPSILON && middle < 1 + DBL_EPSILON);
+
+    double value = 0;
+
+    if (t <= middle) {
+        if (middle < DBL_EPSILON) {
+            value = 0;
+        }
+        else {
+            value = (t / middle) * 0.5;
+        }
+    }
+    else {
+        if (middle > 1 - DBL_EPSILON) {
+            value = 1;
+        }
+        else {
+            value = ((t - middle) / (1 - middle)) * 0.5 + 0.5;
+        }
+    }
+
+    return value;
+}
+
+double KisGradientSegment::LinearInterpolationStrategy::valueAt(double t, double middle) const
+{
+    return calcValueAt(t, middle);
+}
+
+KisGradientSegment::CurvedInterpolationStrategy::CurvedInterpolationStrategy()
+{
+    m_logHalf = log(0.5);
+}
+
+KisGradientSegment::CurvedInterpolationStrategy *KisGradientSegment::CurvedInterpolationStrategy::instance()
+{
+    if (m_instance == 0) {
+        m_instance = new CurvedInterpolationStrategy();
+        Q_CHECK_PTR(m_instance);
+    }
+
+    return m_instance;
+}
+
+double KisGradientSegment::CurvedInterpolationStrategy::valueAt(double t, double middle) const
+{
+    Q_ASSERT(t > -DBL_EPSILON && t < 1 + DBL_EPSILON);
+    Q_ASSERT(middle > -DBL_EPSILON && middle < 1 + DBL_EPSILON);
+
+    double value = 0;
+
+    if (middle < DBL_EPSILON) {
+        middle = DBL_EPSILON;
+    }
+
+    value = pow(t, m_logHalf / log(middle));
+
+    return value;
+}
+
+KisGradientSegment::SineInterpolationStrategy *KisGradientSegment::SineInterpolationStrategy::instance()
+{
+    if (m_instance == 0) {
+        m_instance = new SineInterpolationStrategy();
+        Q_CHECK_PTR(m_instance);
+    }
+
+    return m_instance;
+}
+
+double KisGradientSegment::SineInterpolationStrategy::valueAt(double t, double middle) const
+{
+    double lt = LinearInterpolationStrategy::calcValueAt(t, middle);
+    double value = (sin(-M_PI_2 + M_PI * lt) + 1.0) / 2.0;
+
+    return value;
+}
+
+KisGradientSegment::SphereIncreasingInterpolationStrategy *KisGradientSegment::SphereIncreasingInterpolationStrategy::instance()
+{
+    if (m_instance == 0) {
+        m_instance = new SphereIncreasingInterpolationStrategy();
+        Q_CHECK_PTR(m_instance);
+    }
+
+    return m_instance;
+}
+
+double KisGradientSegment::SphereIncreasingInterpolationStrategy::valueAt(double t, double middle) const
+{
+    double lt = LinearInterpolationStrategy::calcValueAt(t, middle) - 1;
+    double value = sqrt(1 - lt * lt);
+
+    return value;
+}
+
+KisGradientSegment::SphereDecreasingInterpolationStrategy *KisGradientSegment::SphereDecreasingInterpolationStrategy::instance()
+{
+    if (m_instance == 0) {
+        m_instance = new SphereDecreasingInterpolationStrategy();
+        Q_CHECK_PTR(m_instance);
+    }
+
+    return m_instance;
+}
+
+double KisGradientSegment::SphereDecreasingInterpolationStrategy::valueAt(double t, double middle) const
+{
+    double lt = LinearInterpolationStrategy::calcValueAt(t, middle);
+    double value = 1 - sqrt(1 - lt * lt);
+
+    return value;
+}
+
+#include "kis_gradient.moc"
+
diff --git a/chalk/core/kis_gradient.h b/chalk/core/kis_gradient.h
new file mode 100644
index 000000000..50bc0fd8b
--- /dev/null
+++ b/chalk/core/kis_gradient.h
@@ -0,0 +1,265 @@
+/*
+ *  kis_gradient.h - part of Krayon
+ *
+ *  Copyright (c) 2000 Matthias Elter  <elter@kde.org>
+ *                2004 Boudewijn Rempt <boud@valdyas.org>
+ *                2004 Adrian Page <adrian@pagenet.plus.com>
+ *                2004 Sven Langkamp <longamp@reallygood.de>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_GRADIENT_H
+#define KIS_GRADIENT_H
+
+#include <tqvaluevector.h>
+#include <tqcolor.h>
+
+#include <kio/job.h>
+
+#include "kis_resource.h"
+#include "kis_global.h"
+
+class TQImage;
+
+enum {
+    INTERP_LINEAR = 0,
+    INTERP_CURVED,
+    INTERP_SINE,
+    INTERP_SPHERE_INCREASING,
+    INTERP_SPHERE_DECREASING
+};
+
+enum {
+    COLOR_INTERP_RGB,
+    COLOR_INTERP_HSV_CCW,
+    COLOR_INTERP_HSV_CW
+};
+
+// TODO: Replace TQColor with KisColor
+class Color {
+    public:
+        Color() { m_alpha = 0; }
+        Color(const TQColor& color, double alpha) { m_color = color; m_alpha = alpha; }
+
+        const TQColor& color() const { return m_color; }
+        double alpha() const { return m_alpha; }
+
+    private:
+        TQColor m_color;
+        double m_alpha;
+};
+
+class KisGradientSegment {
+    public:
+        KisGradientSegment(int interpolationType, int colorInterpolationType, double startOffset, double middleOffset, double endOffset, const Color& startColor, const Color& endColor);
+
+        // startOffset <= t <= endOffset
+        Color colorAt(double t) const;
+
+        const Color& startColor() const;
+        const Color& endColor() const;
+
+        void setStartColor(const Color& color) { m_startColor = color; }
+        void setEndColor(const Color& color) { m_endColor = color; }
+
+        double startOffset() const;
+        double middleOffset() const;
+        double endOffset() const;
+
+        void setStartOffset(double t);
+        void setMiddleOffset(double t);
+        void setEndOffset(double t);
+
+        double length() { return m_length; }
+
+        int interpolation() const;
+        int colorInterpolation() const;
+
+        void setInterpolation(int interpolationType);
+        void setColorInterpolation(int colorInterpolationType);
+
+        bool isValid() const;
+    protected:
+
+        class ColorInterpolationStrategy {
+        public:
+            ColorInterpolationStrategy() {}
+            virtual ~ColorInterpolationStrategy() {}
+
+            virtual Color colorAt(double t, Color start, Color end) const = 0;
+            virtual int type() const = 0;
+        };
+
+        class RGBColorInterpolationStrategy : public ColorInterpolationStrategy {
+        public:
+            static RGBColorInterpolationStrategy *instance();
+
+            virtual Color colorAt(double t, Color start, Color end) const;
+            virtual int type() const { return COLOR_INTERP_RGB; }
+
+        private:
+            RGBColorInterpolationStrategy() {}
+
+            static RGBColorInterpolationStrategy *m_instance;
+        };
+
+        class HSVCWColorInterpolationStrategy : public ColorInterpolationStrategy {
+        public:
+            static HSVCWColorInterpolationStrategy *instance();
+
+            virtual Color colorAt(double t, Color start, Color end) const;
+            virtual int type() const { return COLOR_INTERP_HSV_CW; }
+        private:
+            HSVCWColorInterpolationStrategy() {}
+
+            static HSVCWColorInterpolationStrategy *m_instance;
+        };
+
+        class HSVCCWColorInterpolationStrategy : public ColorInterpolationStrategy {
+        public:
+            static HSVCCWColorInterpolationStrategy *instance();
+
+            virtual Color colorAt(double t, Color start, Color end) const;
+            virtual int type() const { return COLOR_INTERP_HSV_CCW; }
+        private:
+            HSVCCWColorInterpolationStrategy() {}
+
+            static HSVCCWColorInterpolationStrategy *m_instance;
+        };
+
+        class InterpolationStrategy {
+        public:
+            InterpolationStrategy() {}
+            virtual ~InterpolationStrategy() {}
+
+            virtual double valueAt(double t, double middle) const = 0;
+            virtual int type() const = 0;
+        };
+
+        class LinearInterpolationStrategy : public InterpolationStrategy {
+        public:
+            static LinearInterpolationStrategy *instance();
+
+            virtual double valueAt(double t, double middle) const;
+            virtual int type() const { return INTERP_LINEAR; }
+
+            // This does the actual calculation and is made
+            // static as an optimisation for the other
+            // strategies that need this for their own calculation.
+            static double calcValueAt(double t, double middle);
+
+        private:
+            LinearInterpolationStrategy() {}
+
+            static LinearInterpolationStrategy *m_instance;
+        };
+
+        class CurvedInterpolationStrategy : public InterpolationStrategy {
+        public:
+            static CurvedInterpolationStrategy *instance();
+
+            virtual double valueAt(double t, double middle) const;
+            virtual int type() const { return INTERP_CURVED; }
+        private:
+            CurvedInterpolationStrategy();
+
+            static CurvedInterpolationStrategy *m_instance;
+            double m_logHalf;
+        };
+
+        class SphereIncreasingInterpolationStrategy : public InterpolationStrategy {
+        public:
+            static SphereIncreasingInterpolationStrategy *instance();
+
+            virtual double valueAt(double t, double middle) const;
+            virtual int type() const { return INTERP_SPHERE_INCREASING; }
+        private:
+            SphereIncreasingInterpolationStrategy() {}
+
+            static SphereIncreasingInterpolationStrategy *m_instance;
+        };
+
+        class SphereDecreasingInterpolationStrategy : public InterpolationStrategy {
+        public:
+            static SphereDecreasingInterpolationStrategy *instance();
+
+            virtual double valueAt(double t, double middle) const;
+            virtual int type() const { return INTERP_SPHERE_DECREASING; }
+        private:
+            SphereDecreasingInterpolationStrategy() {}
+
+            static SphereDecreasingInterpolationStrategy *m_instance;
+        };
+
+        class SineInterpolationStrategy : public InterpolationStrategy {
+        public:
+            static SineInterpolationStrategy *instance();
+
+            virtual double valueAt(double t, double middle) const;
+            virtual int type() const { return INTERP_SINE; }
+        private:
+            SineInterpolationStrategy() {}
+
+            static SineInterpolationStrategy *m_instance;
+        };
+    private:
+        InterpolationStrategy *m_interpolator;
+        ColorInterpolationStrategy *m_colorInterpolator;
+
+        double m_startOffset;
+        double m_middleOffset;
+        double m_endOffset;
+        double m_length;
+        double m_middleT;
+
+        Color m_startColor;
+        Color m_endColor;
+};
+
+class KisGradient : public KisResource {
+    typedef KisResource super;
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    KisGradient(const TQString& file);
+    virtual ~KisGradient();
+
+    virtual bool load();
+    virtual bool save();
+    virtual TQImage img();
+    virtual TQImage generatePreview(int width, int height) const;
+
+    void colorAt(double t, TQColor *color, TQ_UINT8 *opacity) const;
+    
+    KisGradientSegment *segmentAt(double t) const;
+
+protected:
+    inline void pushSegment( KisGradientSegment* segment ) { m_segments.push_back(segment); };
+    void setImage(const TQImage& img);
+
+    TQValueVector<KisGradientSegment *> m_segments;
+
+private:
+    bool init();
+
+private:
+    TQByteArray m_data;
+    TQImage m_img;
+};
+
+#endif // KIS_GRADIENT_H
+
diff --git a/chalk/core/kis_gradient_painter.cc b/chalk/core/kis_gradient_painter.cc
new file mode 100644
index 000000000..2258d8991
--- /dev/null
+++ b/chalk/core/kis_gradient_painter.cc
@@ -0,0 +1,723 @@
+/*
+ *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <cfloat>
+
+#include "tqbrush.h"
+#include "tqcolor.h"
+#include "tqfontinfo.h"
+#include "tqfontmetrics.h"
+#include "tqpen.h"
+#include "tqregion.h"
+#include "tqwmatrix.h"
+#include <tqimage.h>
+#include <tqmap.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqpointarray.h>
+#include <tqrect.h>
+#include <tqstring.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_brush.h"
+#include "kis_debug_areas.h"
+#include "kis_gradient.h"
+#include "kis_image.h"
+#include "kis_iterators_pixel.h"
+#include "kis_layer.h"
+#include "kis_paint_device.h"
+#include "kis_pattern.h"
+#include "kis_rect.h"
+#include "kis_colorspace.h"
+#include "kis_types.h"
+#include "kis_vec.h"
+#include "kis_selection.h"
+#include "kis_gradient_painter.h"
+#include "kis_meta_registry.h"
+#include "kis_colorspace_factory_registry.h"
+
+namespace {
+
+    class GradientShapeStrategy {
+    public:
+        GradientShapeStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd);
+        virtual ~GradientShapeStrategy() {}
+
+        virtual double valueAt(double x, double y) const = 0;
+
+    protected:
+        KisPoint m_gradientVectorStart;
+        KisPoint m_gradientVectorEnd;
+    };
+
+    GradientShapeStrategy::GradientShapeStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd)
+        : m_gradientVectorStart(gradientVectorStart), m_gradientVectorEnd(gradientVectorEnd)
+    {
+    }
+
+
+    class LinearGradientStrategy : public GradientShapeStrategy {
+        typedef GradientShapeStrategy super;
+    public:
+        LinearGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd);
+
+        virtual double valueAt(double x, double y) const;
+
+    protected:
+        double m_normalisedVectorX;
+        double m_normalisedVectorY;
+        double m_vectorLength;
+    };
+
+    LinearGradientStrategy::LinearGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd)
+        : super(gradientVectorStart, gradientVectorEnd)
+    {
+        double dx = gradientVectorEnd.x() - gradientVectorStart.x();
+        double dy = gradientVectorEnd.y() - gradientVectorStart.y();
+
+        m_vectorLength = sqrt((dx * dx) + (dy * dy));
+
+        if (m_vectorLength < DBL_EPSILON) {
+            m_normalisedVectorX = 0;
+            m_normalisedVectorY = 0;
+        }
+        else {
+            m_normalisedVectorX = dx / m_vectorLength;
+            m_normalisedVectorY = dy / m_vectorLength;
+        }
+    }
+
+    double LinearGradientStrategy::valueAt(double x, double y) const
+    {
+        double vx = x - m_gradientVectorStart.x();
+        double vy = y - m_gradientVectorStart.y();
+
+        // Project the vector onto the normalised gradient vector.
+        double t = vx * m_normalisedVectorX + vy * m_normalisedVectorY;
+
+        if (m_vectorLength < DBL_EPSILON) {
+            t = 0;
+        }
+        else {
+            // Scale to 0 to 1 over the gradient vector length.
+            t /= m_vectorLength;
+        }
+
+        return t;
+    }
+
+
+    class BiLinearGradientStrategy : public LinearGradientStrategy {
+        typedef LinearGradientStrategy super;
+    public:
+        BiLinearGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd);
+
+        virtual double valueAt(double x, double y) const;
+    };
+
+    BiLinearGradientStrategy::BiLinearGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd)
+        : super(gradientVectorStart, gradientVectorEnd)
+    {
+    }
+
+    double BiLinearGradientStrategy::valueAt(double x, double y) const
+    {
+        double t = super::valueAt(x, y);
+
+        // Reflect
+        if (t < -DBL_EPSILON) {
+            t = -t;
+        }
+
+        return t;
+    }
+
+
+    class RadialGradientStrategy : public GradientShapeStrategy {
+        typedef GradientShapeStrategy super;
+    public:
+        RadialGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd);
+
+        virtual double valueAt(double x, double y) const;
+
+    protected:
+        double m_radius;
+    };
+
+    RadialGradientStrategy::RadialGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd)
+        : super(gradientVectorStart, gradientVectorEnd)
+    {
+        double dx = gradientVectorEnd.x() - gradientVectorStart.x();
+        double dy = gradientVectorEnd.y() - gradientVectorStart.y();
+
+        m_radius = sqrt((dx * dx) + (dy * dy));
+    }
+
+    double RadialGradientStrategy::valueAt(double x, double y) const
+    {
+        double dx = x - m_gradientVectorStart.x();
+        double dy = y - m_gradientVectorStart.y();
+
+        double distance = sqrt((dx * dx) + (dy * dy));
+
+        double t;
+
+        if (m_radius < DBL_EPSILON) {
+            t = 0;
+        }
+        else {
+            t = distance / m_radius;
+        }
+
+        return t;
+    }
+
+
+    class SquareGradientStrategy : public GradientShapeStrategy {
+        typedef GradientShapeStrategy super;
+    public:
+        SquareGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd);
+
+        virtual double valueAt(double x, double y) const;
+
+    protected:
+        double m_normalisedVectorX;
+        double m_normalisedVectorY;
+        double m_vectorLength;
+    };
+
+    SquareGradientStrategy::SquareGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd)
+        : super(gradientVectorStart, gradientVectorEnd)
+    {
+        double dx = gradientVectorEnd.x() - gradientVectorStart.x();
+        double dy = gradientVectorEnd.y() - gradientVectorStart.y();
+
+        m_vectorLength = sqrt((dx * dx) + (dy * dy));
+
+        if (m_vectorLength < DBL_EPSILON) {
+            m_normalisedVectorX = 0;
+            m_normalisedVectorY = 0;
+        }
+        else {
+            m_normalisedVectorX = dx / m_vectorLength;
+            m_normalisedVectorY = dy / m_vectorLength;
+        }
+    }
+
+    double SquareGradientStrategy::valueAt(double x, double y) const
+    {
+        double px = x - m_gradientVectorStart.x();
+        double py = y - m_gradientVectorStart.y();
+
+        double distance1 = 0;
+        double distance2 = 0;
+
+        if (m_vectorLength > DBL_EPSILON) {
+
+            // Point to line distance is:
+            // distance = ((l0.y() - l1.y()) * p.x() + (l1.x() - l0.x()) * p.y() + l0.x() * l1.y() - l1.x() * l0.y()) / m_vectorLength;
+            //
+            // Here l0 = (0, 0) and |l1 - l0| = 1
+
+            distance1 = -m_normalisedVectorY * px + m_normalisedVectorX * py;
+            distance1 = fabs(distance1);
+
+            // Rotate point by 90 degrees and get the distance to the perpendicular
+            distance2 = -m_normalisedVectorY * -py + m_normalisedVectorX * px;
+            distance2 = fabs(distance2);
+        }
+
+        double t = TQMAX(distance1, distance2) / m_vectorLength;
+
+        return t;
+    }
+
+
+    class ConicalGradientStrategy : public GradientShapeStrategy {
+        typedef GradientShapeStrategy super;
+    public:
+        ConicalGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd);
+
+        virtual double valueAt(double x, double y) const;
+
+    protected:
+        double m_vectorAngle;
+    };
+
+    ConicalGradientStrategy::ConicalGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd)
+        : super(gradientVectorStart, gradientVectorEnd)
+    {
+        double dx = gradientVectorEnd.x() - gradientVectorStart.x();
+        double dy = gradientVectorEnd.y() - gradientVectorStart.y();
+
+        // Get angle from 0 to 2 PI.
+        m_vectorAngle = atan2(dy, dx) + M_PI;
+    }
+
+    double ConicalGradientStrategy::valueAt(double x, double y) const
+    {
+        double px = x - m_gradientVectorStart.x();
+        double py = y - m_gradientVectorStart.y();
+
+        double angle = atan2(py, px) + M_PI;
+
+        angle -= m_vectorAngle;
+
+        if (angle < 0) {
+            angle += 2 * M_PI;
+        }
+
+        double t = angle / (2 * M_PI);
+
+        return t;
+    }
+
+
+    class ConicalSymetricGradientStrategy : public GradientShapeStrategy {
+        typedef GradientShapeStrategy super;
+    public:
+        ConicalSymetricGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd);
+
+        virtual double valueAt(double x, double y) const;
+
+    protected:
+        double m_vectorAngle;
+    };
+
+    ConicalSymetricGradientStrategy::ConicalSymetricGradientStrategy(const KisPoint& gradientVectorStart, const KisPoint& gradientVectorEnd)
+        : super(gradientVectorStart, gradientVectorEnd)
+    {
+        double dx = gradientVectorEnd.x() - gradientVectorStart.x();
+        double dy = gradientVectorEnd.y() - gradientVectorStart.y();
+
+        // Get angle from 0 to 2 PI.
+        m_vectorAngle = atan2(dy, dx) + M_PI;
+    }
+
+    double ConicalSymetricGradientStrategy::valueAt(double x, double y) const
+    {
+        double px = x - m_gradientVectorStart.x();
+        double py = y - m_gradientVectorStart.y();
+
+        double angle = atan2(py, px) + M_PI;
+
+        angle -= m_vectorAngle;
+
+        if (angle < 0) {
+            angle += 2 * M_PI;
+        }
+
+        double t;
+
+        if (angle < M_PI) {
+            t = angle / M_PI;
+        }
+        else {
+            t = 1 - ((angle - M_PI) / M_PI);
+        }
+
+        return t;
+    }
+
+
+    class GradientRepeatStrategy {
+    public:
+        GradientRepeatStrategy() {}
+        virtual ~GradientRepeatStrategy() {}
+
+        virtual double valueAt(double t) const = 0;
+    };
+
+
+    class GradientRepeatNoneStrategy : public GradientRepeatStrategy {
+    public:
+        static GradientRepeatNoneStrategy *instance();
+
+        virtual double valueAt(double t) const;
+
+    private:
+        GradientRepeatNoneStrategy() {}
+
+        static GradientRepeatNoneStrategy *m_instance;
+    };
+
+    GradientRepeatNoneStrategy *GradientRepeatNoneStrategy::m_instance = 0;
+
+    GradientRepeatNoneStrategy *GradientRepeatNoneStrategy::instance()
+    {
+        if (m_instance == 0) {
+            m_instance = new GradientRepeatNoneStrategy();
+            Q_CHECK_PTR(m_instance);
+        }
+
+        return m_instance;
+    }
+
+    // Output is clamped to 0 to 1.
+    double GradientRepeatNoneStrategy::valueAt(double t) const
+    {
+        double value = t;
+
+        if (t < DBL_EPSILON) {
+            value = 0;
+        }
+        else
+            if (t > 1 - DBL_EPSILON) {
+                value = 1;
+            }
+
+        return value;
+    }
+
+
+    class GradientRepeatForwardsStrategy : public GradientRepeatStrategy {
+    public:
+        static GradientRepeatForwardsStrategy *instance();
+
+        virtual double valueAt(double t) const;
+
+    private:
+        GradientRepeatForwardsStrategy() {}
+
+        static GradientRepeatForwardsStrategy *m_instance;
+    };
+
+    GradientRepeatForwardsStrategy *GradientRepeatForwardsStrategy::m_instance = 0;
+
+    GradientRepeatForwardsStrategy *GradientRepeatForwardsStrategy::instance()
+    {
+        if (m_instance == 0) {
+            m_instance = new GradientRepeatForwardsStrategy();
+            Q_CHECK_PTR(m_instance);
+        }
+
+        return m_instance;
+    }
+
+    // Output is 0 to 1, 0 to 1, 0 to 1...
+    double GradientRepeatForwardsStrategy::valueAt(double t) const
+    {
+        int i = static_cast<int>(t);
+
+        if (t < DBL_EPSILON) {
+            i--;
+        }
+
+        double value = t - i;
+
+        return value;
+    }
+
+
+    class GradientRepeatAlternateStrategy : public GradientRepeatStrategy {
+    public:
+        static GradientRepeatAlternateStrategy *instance();
+
+        virtual double valueAt(double t) const;
+
+    private:
+        GradientRepeatAlternateStrategy() {}
+
+        static GradientRepeatAlternateStrategy *m_instance;
+    };
+
+    GradientRepeatAlternateStrategy *GradientRepeatAlternateStrategy::m_instance = 0;
+
+    GradientRepeatAlternateStrategy *GradientRepeatAlternateStrategy::instance()
+    {
+        if (m_instance == 0) {
+            m_instance = new GradientRepeatAlternateStrategy();
+            Q_CHECK_PTR(m_instance);
+        }
+
+        return m_instance;
+    }
+
+    // Output is 0 to 1, 1 to 0, 0 to 1, 1 to 0...
+    double GradientRepeatAlternateStrategy::valueAt(double t) const
+    {
+        if (t < 0) {
+            t = -t;
+        }
+
+        int i = static_cast<int>(t);
+
+                double value = t - i;
+
+        if (i % 2 == 1) {
+            value = 1 - value;
+        }
+
+        return value;
+    }
+}
+
+KisGradientPainter::KisGradientPainter()
+    : super()
+{
+    m_gradient = 0;
+}
+
+KisGradientPainter::KisGradientPainter(KisPaintDeviceSP device) : super(device), m_gradient(0)
+{
+}
+
+bool KisGradientPainter::paintGradient(const KisPoint& gradientVectorStart,
+                       const KisPoint& gradientVectorEnd,
+                       enumGradientShape tqshape,
+                       enumGradientRepeat repeat,
+                       double antiAliasThreshold,
+                       bool reverseGradient,
+                       TQ_INT32 startx,
+                       TQ_INT32 starty,
+                       TQ_INT32 width,
+                       TQ_INT32 height)
+{
+    m_cancelRequested = false;
+
+    if (!m_gradient) return false;
+
+    GradientShapeStrategy *tqshapeStrategy = 0;
+
+    switch (tqshape) {
+    case GradientShapeLinear:
+        tqshapeStrategy = new LinearGradientStrategy(gradientVectorStart, gradientVectorEnd);
+        break;
+    case GradientShapeBiLinear:
+        tqshapeStrategy = new BiLinearGradientStrategy(gradientVectorStart, gradientVectorEnd);
+        break;
+    case GradientShapeRadial:
+        tqshapeStrategy = new RadialGradientStrategy(gradientVectorStart, gradientVectorEnd);
+        break;
+    case GradientShapeSquare:
+        tqshapeStrategy = new SquareGradientStrategy(gradientVectorStart, gradientVectorEnd);
+        break;
+    case GradientShapeConical:
+        tqshapeStrategy = new ConicalGradientStrategy(gradientVectorStart, gradientVectorEnd);
+        break;
+    case GradientShapeConicalSymetric:
+        tqshapeStrategy = new ConicalSymetricGradientStrategy(gradientVectorStart, gradientVectorEnd);
+        break;
+    }
+    Q_CHECK_PTR(tqshapeStrategy);
+
+    GradientRepeatStrategy *repeatStrategy = 0;
+
+    switch (repeat) {
+    case GradientRepeatNone:
+        repeatStrategy = GradientRepeatNoneStrategy::instance();
+        break;
+    case GradientRepeatForwards:
+        repeatStrategy = GradientRepeatForwardsStrategy::instance();
+        break;
+    case GradientRepeatAlternate:
+        repeatStrategy = GradientRepeatAlternateStrategy::instance();
+        break;
+    }
+    Q_ASSERT(repeatStrategy != 0);
+
+
+    //If the device has a selection only iterate over that selection
+    TQRect r;
+    if( m_device->hasSelection() ) {
+        r = m_device->selection()->selectedExactRect();
+        startx = r.x();
+        starty = r.y();
+        width = r.width();
+        height = r.height();
+    }
+
+    TQ_INT32 endx = startx + width - 1;
+    TQ_INT32 endy = starty + height - 1;
+
+    TQImage layer (width, height, 32);
+    layer.setAlphaBuffer(true);
+
+    int pixelsProcessed = 0;
+    int lastProgressPercent = 0;
+
+    emit notifyProgressStage(i18n("Rendering gradient..."), 0);
+
+    int totalPixels = width * height;
+
+    if (antiAliasThreshold < 1 - DBL_EPSILON) {
+        totalPixels *= 2;
+    }
+
+    for (int y = starty; y <= endy; y++) {
+        for (int x = startx; x <= endx; x++) {
+
+            double t = tqshapeStrategy->valueAt( x, y);
+            t = repeatStrategy->valueAt(t);
+
+            if (reverseGradient) {
+                t = 1 - t;
+            }
+
+            TQColor color;
+            TQ_UINT8 opacity;
+
+            m_gradient->colorAt(t, &color, &opacity);
+
+            layer.setPixel(x - startx, y - starty,
+                           tqRgba(color.red(), color.green(), color.blue(), opacity));
+
+            pixelsProcessed++;
+
+            int progressPercent = (pixelsProcessed * 100) / totalPixels;
+
+            if (progressPercent > lastProgressPercent) {
+                emit notifyProgress(progressPercent);
+                lastProgressPercent = progressPercent;
+
+                if (m_cancelRequested) {
+                    break;
+                }
+            }
+            if (m_cancelRequested) {
+                break;
+            }
+        }
+    }
+
+    if (!m_cancelRequested && antiAliasThreshold < 1 - DBL_EPSILON) {
+
+        TQColor color;
+        emit notifyProgressStage(i18n("Anti-aliasing gradient..."), lastProgressPercent);
+        TQ_UINT8 * layerPointer = layer.bits();
+        for (int y = starty; y <= endy; y++) {
+            for (int x = startx; x <= endx; x++) {
+
+                double maxDistance = 0;
+
+                TQ_UINT8 redThis = layerPointer[2];
+                TQ_UINT8 greenThis = layerPointer[1];
+                TQ_UINT8 blueThis = layerPointer[0];
+                TQ_UINT8 thisPixelOpacity = layerPointer[3];
+
+                for (int yOffset = -1; yOffset < 2; yOffset++) {
+                    for (int xOffset = -1; xOffset < 2; xOffset++) {
+
+                        if (xOffset != 0 || yOffset != 0) {
+                            int sampleX = x + xOffset;
+                            int sampleY = y + yOffset;
+
+                            if (sampleX >= startx && sampleX <= endx && sampleY >= starty && sampleY <= endy) {
+                                uint x = sampleX - startx;
+                                uint y = sampleY - starty;
+                                TQ_UINT8 * pixelPos = layer.bits() + (y * width * 4) + (x * 4);
+                                TQ_UINT8 red = *(pixelPos +2);
+                                TQ_UINT8 green = *(pixelPos + 1);
+                                TQ_UINT8 blue = *pixelPos;
+                                TQ_UINT8 opacity = *(pixelPos + 3);
+
+                                double dRed = (red * opacity - redThis * thisPixelOpacity) / 65535.0;
+                                double dGreen = (green * opacity - greenThis * thisPixelOpacity) / 65535.0;
+                                double dBlue = (blue * opacity - blueThis * thisPixelOpacity) / 65535.0;
+
+                                #define SQRT_3 1.7320508
+
+                                double distance =/* sqrt(*/dRed * dRed + dGreen * dGreen + dBlue * dBlue/*) / SQRT_3*/;
+
+                                if (distance > maxDistance) {
+                                    maxDistance = distance;
+                                }
+                            }
+                        }
+                    }
+                }
+
+                if (maxDistance > 3.*antiAliasThreshold*antiAliasThreshold) {
+                    const int numSamples = 4;
+
+                    int totalRed = 0;
+                    int totalGreen = 0;
+                    int totalBlue = 0;
+                    int totalOpacity = 0;
+
+                    for (int ySample = 0; ySample < numSamples; ySample++) {
+                        for (int xSample = 0; xSample < numSamples; xSample++) {
+
+                            double sampleWidth = 1.0 / numSamples;
+
+                            double sampleX = x - 0.5 + (sampleWidth / 2) + xSample * sampleWidth;
+                            double sampleY = y - 0.5 + (sampleWidth / 2) + ySample * sampleWidth;
+
+                            double t = tqshapeStrategy->valueAt(sampleX, sampleY);
+                            t = repeatStrategy->valueAt(t);
+
+                            if (reverseGradient) {
+                                t = 1 - t;
+                            }
+
+                            TQ_UINT8 opacity;
+
+                            m_gradient->colorAt(t, &color, &opacity);
+
+                            totalRed += color.red();
+                            totalGreen += color.green();
+                            totalBlue += color.blue();
+                            totalOpacity += opacity;
+                        }
+                    }
+
+                    int red = totalRed / (numSamples * numSamples);
+                    int green = totalGreen / (numSamples * numSamples);
+                    int blue = totalBlue / (numSamples * numSamples);
+                    int opacity = totalOpacity / (numSamples * numSamples);
+
+                    layer.setPixel(x - startx, y - starty, tqRgba(red, green, blue, opacity));
+                }
+
+                pixelsProcessed++;
+
+                int progressPercent = (pixelsProcessed * 100) / totalPixels;
+
+                if (progressPercent > lastProgressPercent) {
+                    emit notifyProgress(progressPercent);
+                    lastProgressPercent = progressPercent;
+
+                    if (m_cancelRequested) {
+                        break;
+                    }
+                }
+                layerPointer += 4;
+            }
+
+            if (m_cancelRequested) {
+                break;
+            }
+        }
+    }
+
+    if (!m_cancelRequested) {
+        kdDebug() << "Have we got a selection? " << m_device->hasSelection() << endl;
+        KisPaintDeviceSP dev = new KisPaintDevice(KisMetaRegistry::instance()->csRegistry()->getRGB8(), "temporary device for gradient");
+        dev->writeBytes(layer.bits(), startx, starty, width, height);
+        bltSelection(startx, starty, m_compositeOp, dev, m_opacity, startx, starty, width, height);
+    }
+    delete tqshapeStrategy;
+
+    emit notifyProgressDone();
+
+    return !m_cancelRequested;
+}
diff --git a/chalk/core/kis_gradient_painter.h b/chalk/core/kis_gradient_painter.h
new file mode 100644
index 000000000..fc31b117a
--- /dev/null
+++ b/chalk/core/kis_gradient_painter.h
@@ -0,0 +1,84 @@
+/*
+ *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_GRADIENT_PAINTER_H_
+#define KIS_GRADIENT_PAINTER_H_
+
+#include <kcommand.h>
+
+#include "kis_global.h"
+#include "kis_types.h"
+#include "kis_point.h"
+#include "kis_painter.h"
+#include <koffice_export.h>
+
+class KisGradient;
+
+
+// XXX: Need to set dirtyRect in KisPainter
+class KRITACORE_EXPORT KisGradientPainter : public KisPainter
+{
+
+    typedef KisPainter super;
+
+public:
+
+        KisGradientPainter();
+        KisGradientPainter(KisPaintDeviceSP device);
+
+
+    enum enumGradientShape {
+        GradientShapeLinear,
+        GradientShapeBiLinear,
+        GradientShapeRadial,
+        GradientShapeSquare,
+        GradientShapeConical,
+        GradientShapeConicalSymetric
+    };
+
+    enum enumGradientRepeat {
+        GradientRepeatNone,
+        GradientRepeatForwards,
+        GradientRepeatAlternate
+    };
+
+    void setGradient(KisGradient& gradient) { m_gradient = &gradient; }
+    void setGradient(KisGradient* gradient) { m_gradient = gradient; }
+
+    /**
+     * Paint a gradient in the rect between startx, starty, width and height.
+     * XXX: What does the returned bool mean?
+     * XXX: Make cs-independent
+     */
+    bool paintGradient(const KisPoint& gradientVectorStart,
+               const KisPoint& gradientVectorEnd,
+               enumGradientShape tqshape,
+               enumGradientRepeat repeat,
+               double antiAliasThreshold,
+               bool reverseGradient,
+               TQ_INT32 startx,
+               TQ_INT32 starty,
+               TQ_INT32 width,
+               TQ_INT32 height);
+
+
+private:
+    KisGradient *m_gradient;
+
+
+};
+#endif //KIS_GRADIENT_PAINTER_H_
diff --git a/chalk/core/kis_group_layer.cc b/chalk/core/kis_group_layer.cc
new file mode 100644
index 000000000..a3a353397
--- /dev/null
+++ b/chalk/core/kis_group_layer.cc
@@ -0,0 +1,428 @@
+/*
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+
+#include <kdebug.h>
+#include <kglobal.h>
+#include <tqimage.h>
+#include <tqdatetime.h>
+
+#include "kis_types.h"
+#include "kis_layer.h"
+#include "kis_group_layer.h"
+#include "kis_layer_visitor.h"
+#include "kis_debug_areas.h"
+#include "kis_image.h"
+#include "kis_paint_device.h"
+#include "kis_merge_visitor.h"
+#include "kis_fill_painter.h"
+
+KisGroupLayer::KisGroupLayer(KisImage *img, const TQString &name, TQ_UINT8 opacity) :
+    super(img, name, opacity),
+    m_x(0),
+    m_y(0)
+{
+    m_projection = new KisPaintDevice(this, img->colorSpace(), name.latin1());
+}
+
+KisGroupLayer::KisGroupLayer(const KisGroupLayer &rhs) :
+    super(rhs),
+    m_x(rhs.m_x),
+    m_y(rhs.m_y)
+{
+    for(vKisLayerSP_cit it = rhs.m_layers.begin(); it != rhs.m_layers.end(); ++it)
+    {
+        this->addLayer(it->data()->clone(), 0);
+    }
+    m_projection = new KisPaintDevice(*rhs.m_projection.data());
+    m_projection->setParentLayer(this);
+}
+
+KisLayerSP KisGroupLayer::clone() const
+{
+    return new KisGroupLayer(*this);
+}
+
+KisGroupLayer::~KisGroupLayer()
+{
+    m_layers.clear();
+}
+
+
+void KisGroupLayer::setDirty(bool propagate)
+{
+    KisLayer::setDirty(propagate);
+    if (propagate) emit (sigDirty(m_dirtyRect));
+}
+
+void KisGroupLayer::setDirty(const TQRect & rc, bool propagate)
+{
+    KisLayer::setDirty(rc, propagate);
+    if (propagate) emit sigDirty(rc);
+}
+
+void KisGroupLayer::resetProjection(KisPaintDevice* to)
+{
+    if (to)
+        m_projection = new KisPaintDevice(*to); /// XXX ### look into Copy on Write here (CoW)
+    else
+        m_projection = new KisPaintDevice(this, image()->colorSpace(), name().latin1());
+}
+
+bool KisGroupLayer::paintLayerInducesProjectionOptimization(KisPaintLayer* l) {
+    return l && l->paintDevice()->colorSpace() == m_image->colorSpace() && l->visible()
+             && l->opacity() == OPACITY_OPAQUE && !l->temporaryTarget() && !l->hasMask();
+}
+
+KisPaintDeviceSP KisGroupLayer::projection(const TQRect & rect)
+{
+    // We don't have a tqparent, and we've got only one child: abuse the child's
+    // paint device as the projection if the child is visible and 100% opaque
+    if (tqparent() == 0 && childCount() == 1) {
+        KisPaintLayerSP l = dynamic_cast<KisPaintLayer*>(firstChild().data());
+        if (paintLayerInducesProjectionOptimization(l)) {
+            l->setClean(rect);
+            setClean(rect);
+            return l->paintDevice();
+        }
+    }
+    // No need for updates, we're clean
+    if (!dirty()) {
+        return m_projection;
+    }
+    // No need for updates -- the desired area wasn't dirty
+    if (!rect.intersects(m_dirtyRect)) {
+        return m_projection;
+    }
+
+
+    // Okay, we need to update the intersection between
+    // what's dirty and what's asked us to be updated.
+    // XXX Nooo, that doesn't work, since the call to setClean following this, is actually:
+    // m_dirtyRect = TQRect(); So the non-intersecting part gets brilliantly lost otherwise.
+    const TQRect rc = m_dirtyRect;//rect.intersect(m_dirtyRect);
+
+    updateProjection(rc);
+    setClean(rect);
+
+    return m_projection;
+}
+
+uint KisGroupLayer::childCount() const
+{
+    return m_layers.count();
+}
+
+KisLayerSP KisGroupLayer::firstChild() const
+{
+    return at(0);
+}
+
+KisLayerSP KisGroupLayer::lastChild() const
+{
+    return at(childCount() - 1);
+}
+
+KisLayerSP KisGroupLayer::at(int index) const
+{
+    if (childCount() && index >= 0 && kClamp(uint(index), uint(0), childCount() - 1) == uint(index))
+        return m_layers.at(reverseIndex(index));
+    return 0;
+}
+
+int KisGroupLayer::index(KisLayerSP layer) const
+{
+    if (layer->tqparent().data() == this)
+        return layer->index();
+    return -1;
+}
+
+void KisGroupLayer::setIndex(KisLayerSP layer, int index)
+{
+    if (layer->tqparent().data() != this)
+        return;
+    //TODO optimize
+    removeLayer(layer);
+    addLayer(layer, index);
+}
+
+bool KisGroupLayer::addLayer(KisLayerSP newLayer, int x)
+{
+    if (x < 0 || kClamp(uint(x), uint(0), childCount()) != uint(x) ||
+        newLayer->tqparent() || m_layers.tqcontains(newLayer))
+    {
+        kdWarning() << "invalid input to KisGroupLayer::addLayer(KisLayerSP newLayer, int x)!" << endl;
+        return false;
+    }
+    uint index(x);
+    if (index == 0)
+        m_layers.append(newLayer);
+    else
+        m_layers.insert(m_layers.begin() + reverseIndex(index) + 1, newLayer);
+    for (uint i = childCount() - 1; i > index; i--)
+        at(i)->m_index++;
+    newLayer->m_parent = this;
+    newLayer->m_index = index;
+    newLayer->setImage(image());
+    newLayer->setDirty(newLayer->extent());
+    setDirty();
+    return true;
+}
+
+bool KisGroupLayer::addLayer(KisLayerSP newLayer, KisLayerSP aboveThis)
+{
+    if (aboveThis && aboveThis->tqparent().data() != this)
+    {
+        kdWarning() << "invalid input to KisGroupLayer::addLayer(KisLayerSP newLayer, KisLayerSP aboveThis)!" << endl;
+        return false;
+    }
+    return addLayer(newLayer, aboveThis ? aboveThis->index() : childCount());
+}
+
+bool KisGroupLayer::removeLayer(int x)
+{
+    if (x >= 0 && kClamp(uint(x), uint(0), childCount() - 1) == uint(x))
+    {
+        uint index(x);
+        for (uint i = childCount() - 1; i > index; i--)
+            at(i)->m_index--;
+        KisLayerSP removedLayer = at(index);
+
+        removedLayer->m_parent = 0;
+        removedLayer->m_index = -1;
+        m_layers.erase(m_layers.begin() + reverseIndex(index));
+        setDirty(removedLayer->extent());
+        if (childCount() < 1) {
+            // No tqchildren, nothing to show for it.
+            m_projection->clear();
+            setDirty();
+        }
+        return true;
+    }
+    kdWarning() << "invalid input to KisGroupLayer::removeLayer()!" << endl;
+    return false;
+}
+
+bool KisGroupLayer::removeLayer(KisLayerSP layer)
+{
+    if (layer->tqparent().data() != this)
+    {
+        kdWarning() << "invalid input to KisGroupLayer::removeLayer()!" << endl;
+        return false;
+    }
+
+    return removeLayer(layer->index());
+}
+
+void KisGroupLayer::setImage(KisImage *image)
+{
+    super::setImage(image);
+    for (vKisLayerSP_it it = m_layers.begin(); it != m_layers.end(); ++it)
+    {
+        (*it)->setImage(image);
+    }
+}
+
+TQRect KisGroupLayer::extent() const
+{
+    TQRect groupExtent;
+
+    for (vKisLayerSP_cit it = m_layers.begin(); it != m_layers.end(); ++it)
+    {
+        groupExtent |= (*it)->extent();
+    }
+
+    return groupExtent;
+}
+
+TQRect KisGroupLayer::exactBounds() const
+{
+    TQRect groupExactBounds;
+
+    for (vKisLayerSP_cit it = m_layers.begin(); it != m_layers.end(); ++it)
+    {
+        groupExactBounds |= (*it)->exactBounds();
+    }
+
+    return groupExactBounds;
+}
+
+TQ_INT32 KisGroupLayer::x() const
+{
+    return m_x;
+}
+
+void KisGroupLayer::setX(TQ_INT32 x)
+{
+    TQ_INT32 delta = x - m_x;
+
+    for (vKisLayerSP_cit it = m_layers.begin(); it != m_layers.end(); ++it)
+    {
+        KisLayerSP layer = *it;
+        layer->setX(layer->x() + delta);
+    }
+    m_x = x;
+}
+
+TQ_INT32 KisGroupLayer::y() const
+{
+    return m_y;
+}
+
+void KisGroupLayer::setY(TQ_INT32 y)
+{
+    TQ_INT32 delta = y - m_y;
+
+    for (vKisLayerSP_cit it = m_layers.begin(); it != m_layers.end(); ++it)
+    {
+        KisLayerSP layer = *it;
+        layer->setY(layer->y() + delta);
+    }
+
+    m_y = y;
+}
+
+TQImage KisGroupLayer::createThumbnail(TQ_INT32 w, TQ_INT32 h)
+{
+    return m_projection->createThumbnail(w, h);
+}
+
+void KisGroupLayer::updateProjection(const TQRect & rc)
+{
+    if (!m_dirtyRect.isValid()) return;
+
+    // Get the first layer in this group to start compositing with
+    KisLayerSP child = lastChild();
+
+    // No child -- clear the projection. Without tqchildren, a group layer is empty.
+    if (!child) m_projection->clear();
+
+    KisLayerSP startWith = 0;
+    KisAdjustmentLayerSP adjLayer = 0;
+    KisLayerSP tmpPaintLayer = 0;
+
+    // If this is the rootlayer, don't do anything with adj. layers that are below the
+    // first paintlayer
+    bool gotPaintLayer = (tqparent() != 0);
+
+    // Look through all the child layers, searching for the first dirty layer
+    // if it's found, and if we have found an adj. layer before the the dirty layer,
+    // composite from the first adjustment layer searching back from the first dirty layer
+    while (child) {
+        KisAdjustmentLayerSP tmpAdjLayer = dynamic_cast<KisAdjustmentLayer*>(child.data());
+        if (tmpAdjLayer) {
+            if (gotPaintLayer) {
+                // If this adjustment layer is dirty, start compositing with the
+                // previous layer, if there's one.
+                if (tmpAdjLayer->dirty(rc) && adjLayer != 0 && adjLayer->visible()) {
+                    startWith = adjLayer->prevSibling();
+                    break;
+                }
+                else if (tmpAdjLayer->visible() && !tmpAdjLayer->dirty(rc)) {
+                    // This is the first adj. layer that is not dirty -- the perfect starting point
+                    adjLayer = tmpAdjLayer;
+                }
+                else {
+                    startWith = tmpPaintLayer;
+                }
+            }
+        }
+        else {
+            tmpPaintLayer = child;
+            gotPaintLayer = true;
+            // A non-adjustmentlayer that's dirty; if there's an adjustmentlayer
+            // with a cache, we'll start from there.
+            if (child->dirty(rc)) {
+                if (adjLayer != 0 && adjLayer->visible()) {
+                    // the first layer on top of the adj. layer
+                    startWith = adjLayer->prevSibling();
+                }
+                else {
+                    startWith = child;
+                }
+                // break here: if there's no adj layer, we'll start with the layer->lastChild
+                break;
+            }
+        }
+        child = child->prevSibling();
+    }
+
+    if (adjLayer != 0 && startWith == 0 && gotPaintLayer && adjLayer->prevSibling()) {
+        startWith = adjLayer->prevSibling();
+    }
+
+    // No adj layer -- all layers inside the group must be recomposited
+    if (adjLayer == 0) {
+        startWith = lastChild();
+    }
+
+    if (startWith == 0) {
+        return;
+    }
+
+    bool first = true; // The first layer in a stack needs special compositing
+
+    // Fill the projection either with the cached data, or erase it.
+    KisFillPainter gc(m_projection);
+    if (adjLayer != 0) {
+        gc.bitBlt(rc.left(), rc.top(),
+                  COMPOSITE_COPY, adjLayer->cachedPaintDevice(), OPACITY_OPAQUE,
+                  rc.left(), rc.top(), rc.width(), rc.height());
+        first = false;
+    }
+    else {
+        gc.eraseRect(rc);
+        first = true;
+    }
+    gc.end();
+
+    KisMergeVisitor visitor(m_projection, rc);
+
+    child = startWith;
+
+    while(child)
+    {
+        if(first)
+        {
+            // Copy the lowest layer rather than compositing it with the background
+            // or an empty image. This means the layer's composite op is ignored,
+            // which is consistent with Photoshop and gimp.
+            const KisCompositeOp cop = child->compositeOp();
+            const bool block = child->signalsBlocked();
+            child->blockSignals(true);
+            // Composite op copy doesn't take a tqmask/selection into account, so we need
+            // to make a difference between a paintlayer with a tqmask, and one without
+            KisPaintLayer* l = dynamic_cast<KisPaintLayer*>(child.data());
+            if (l && l->hasMask())
+                child->m_compositeOp = COMPOSITE_OVER;
+            else
+                child->m_compositeOp = COMPOSITE_COPY;
+            child->blockSignals(block);
+            child->accept(visitor);
+            child->blockSignals(true);
+            child->m_compositeOp = cop;
+            child->blockSignals(block);
+            first = false;
+        }
+        else
+            child->accept(visitor);
+
+        child = child->prevSibling();
+    }
+}
+
+#include "kis_group_layer.moc"
diff --git a/chalk/core/kis_group_layer.h b/chalk/core/kis_group_layer.h
new file mode 100644
index 000000000..3a2e042ad
--- /dev/null
+++ b/chalk/core/kis_group_layer.h
@@ -0,0 +1,141 @@
+/*
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+#ifndef KIS_GROUP_LAYER_H_
+#define KIS_GROUP_LAYER_H_
+
+#include <ksharedptr.h>
+
+#include "kis_layer.h"
+#include "kis_types.h"
+
+#include "kis_paint_layer.h"
+
+class KisMergeVisitor;
+
+/**
+ * A KisLayer that bundles child layers into a single layer.
+ * The top layer is firstChild(), with index 0; the bottommost lastChild() with index childCount() - 1.
+ * KisLayer::nextSibling() moves towards higher indices, from the top to the bottom layer; prevSibling() the reverse.
+ * (Implementation detail: internally, the indices are reversed, for speed.)
+ **/
+class KisGroupLayer : public KisLayer {
+    typedef KisLayer super;
+
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    KisGroupLayer(KisImage *img, const TQString &name, TQ_UINT8 opacity);
+    KisGroupLayer(const KisGroupLayer& rhs);
+    virtual ~KisGroupLayer();
+
+    virtual KisLayerSP clone() const;
+public:
+
+    /**
+     * Set the entire layer extent dirty; this percolates up to tqparent layers all the
+     * way to the root layer.
+     */
+    virtual void setDirty(bool propagate = true);
+
+    /**
+     * Add the given rect to the set of dirty rects for this layer;
+     * this percolates up to tqparent layers all the way to the root
+     * layer.
+     */
+    virtual void setDirty(const TQRect & rect, bool propagate = true);
+
+    virtual void activate() {};
+
+    virtual void deactivate() {};
+
+    virtual TQ_INT32 x() const;
+    virtual void setX(TQ_INT32);
+
+    virtual TQ_INT32 y() const;
+    virtual void setY(TQ_INT32);
+
+    // Sets this layer and all its descendants' owner image to the given image.
+    virtual void setImage(KisImage *image);
+
+    virtual TQRect extent() const;
+    virtual TQRect exactBounds() const;
+
+    virtual bool accept(KisLayerVisitor &v)
+        {
+//            kdDebug(41001) << "GROUP\t\t" << name()
+//                    << " dirty: " << dirty()
+//                    << ", " << m_layers.count() << " tqchildren "
+//                    << ", projection: " << m_projection
+//                    << "\n";
+            return v.visit(this);
+        };
+
+    virtual void resetProjection(KisPaintDevice* to = 0); /// will copy from to, if !0, CoW!!
+    virtual KisPaintDeviceSP projection(const TQRect & rect);
+
+    virtual uint childCount() const;
+
+    virtual KisLayerSP firstChild() const;
+    virtual KisLayerSP lastChild() const;
+
+    /// Returns the layer at the specified index.
+    virtual KisLayerSP at(int index) const;
+
+    /// Returns the index of the layer if it's in this group, or -1 otherwise.
+    virtual int index(KisLayerSP layer) const;
+
+    /// Moves the specified layer to the specified index in the group, if it's already a member of this group.
+    virtual void setIndex(KisLayerSP layer, int index);
+
+    /** Adds the layer to this group at the specified index. childCount() is a valid index and appends to the end.
+        Fails and returns false if the layer is already in this group or any other (remove it first.) */
+    virtual bool addLayer(KisLayerSP newLayer, int index);
+
+    /**
+     * Add the specified layer above the specified layer (if aboveThis == 0, the bottom is used) */
+    virtual bool addLayer(KisLayerSP newLayer, KisLayerSP aboveThis);
+
+    /// Removes the layer at the specified index from the group.
+    virtual bool removeLayer(int index);
+
+    /// Removes the layer from this group. Fails if there's no such layer in this group.
+    virtual bool removeLayer(KisLayerSP layer);
+
+    virtual TQImage createThumbnail(TQ_INT32 w, TQ_INT32 h);
+
+    /// Returns if the layer will induce the projection hack (if the only layer in this group)
+    virtual bool paintLayerInducesProjectionOptimization(KisPaintLayer* l);
+signals:
+
+    void sigDirty(TQRect rc);
+    
+private:
+    
+    void updateProjection(const TQRect & rc);
+    
+    inline int reverseIndex(int index) const { return childCount() - 1 - index; };
+    vKisLayerSP m_layers; // Contains the list of all layers
+    KisPaintDeviceSP m_projection; // The cached composition of all layers in this group
+
+    TQ_INT32 m_x;
+    TQ_INT32 m_y;
+};
+
+#endif // KIS_GROUP_LAYER_H_
+
diff --git a/chalk/core/kis_histogram.cc b/chalk/core/kis_histogram.cc
new file mode 100644
index 000000000..bece7c9a3
--- /dev/null
+++ b/chalk/core/kis_histogram.cc
@@ -0,0 +1,215 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt
+ *            (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kdebug.h>
+#include <tqdatetime.h> // ### Debug
+
+#include "kis_types.h"
+#include "kis_histogram.h"
+#include "kis_paint_layer.h"
+#include "kis_iterators_pixel.h"
+#include "kis_colorspace.h"
+#include "kis_debug_areas.h"
+
+KisHistogram::KisHistogram(KisPaintLayerSP layer,
+                           KisHistogramProducerSP producer,
+                           const enumHistogramType type)
+{
+    m_dev = layer->paintDevice();
+    m_type = type;
+    m_producer = producer;
+    m_selection = false;
+    m_channel = 0;
+
+    updateHistogram();
+}
+
+KisHistogram::KisHistogram(KisPaintDeviceSP paintdev,
+                           KisHistogramProducerSP producer,
+                           const enumHistogramType type)
+{
+    m_dev = paintdev;
+    m_type = type;
+    m_producer = producer;
+    m_selection = false;
+    m_channel = 0;
+
+    updateHistogram();
+}
+
+KisHistogram::~KisHistogram()
+{
+}
+
+void KisHistogram::updateHistogram()
+{
+    TQ_INT32 x,y,w,h;
+    m_dev->exactBounds(x,y,w,h);
+    KisRectIteratorPixel srcIt = m_dev->createRectIterator(x,y,w,h, false);
+    KisColorSpace* cs = m_dev->colorSpace();
+
+    TQTime t;
+    t.start();
+
+    // Let the producer do it's work
+    m_producer->clear();
+    int i;
+    // Handle degenerate case (this happens with the accumulating histogram,
+    // which has an empty device)
+    if (srcIt.isDone()) {
+        m_producer->addRegionToBin(0, 0, 0, cs);
+    } else {
+        while ( !srcIt.isDone() ) {
+            i = srcIt.nConseqPixels();
+            m_producer->addRegionToBin(srcIt.rawData(), srcIt.selectionMask(), i, cs);
+            srcIt += i;
+        }
+    }
+
+    computeHistogram();
+}
+
+void KisHistogram::computeHistogram()
+{
+    m_completeCalculations = calculateForRange(m_producer->viewFrom(),
+            m_producer->viewFrom() + m_producer->viewWidth());
+
+    if (m_selection) {
+        m_selectionCalculations = calculateForRange(m_selFrom, m_selTo);
+    } else {
+        m_selectionCalculations.clear();
+    }
+
+#if 1
+    dump();
+#endif
+}
+
+KisHistogram::Calculations KisHistogram::calculations() {
+    return m_completeCalculations.at(m_channel);
+}
+
+KisHistogram::Calculations KisHistogram::selectionCalculations() {
+    return m_selectionCalculations.at(m_channel);
+}
+
+TQValueVector<KisHistogram::Calculations> KisHistogram::calculateForRange(double from, double to) {
+    TQValueVector<Calculations> calculations;
+    uint count = m_producer->channels().count();
+
+    for (uint i = 0; i < count; i++) {
+        calculations.append(calculateSingleRange(i, from, to));
+    }
+
+    return calculations;
+}
+
+KisHistogram::Calculations KisHistogram::calculateSingleRange(int channel, double from, double to) {
+    Calculations c;
+
+    // XXX If from == to, we only want a specific bin, handle that properly!
+
+    double max = from, min = to, total = 0.0, mean = 0.0; //, median = 0.0, stddev = 0.0;
+    TQ_UINT32 high = 0, low = (TQ_UINT32) -1, count = 0;
+
+    if (m_producer->count() == 0) {
+        // We won't get anything, even if a range is specified
+        // XXX make sure all initial '0' values are correct here!
+        return c;
+    }
+
+    TQ_INT32 totbins = m_producer->numberOfBins();
+    TQ_UINT32 current;
+
+    // convert the double range into actual bins:
+    double factor = static_cast<double>(totbins) / m_producer->viewWidth();
+
+    TQ_INT32 fromBin = static_cast<TQ_INT32>((from - m_producer->viewFrom()) * factor);
+    TQ_INT32 toBin = fromBin + static_cast<TQ_INT32>((to - from) * factor);
+
+    // Min, max, count, low, high
+    for (TQ_INT32 i = fromBin; i < toBin; i++) {
+        current = m_producer->getBinAt(channel, i);
+        double pos = static_cast<double>(i) / factor + from;
+        if (current > high)
+            high = current;
+        if (current < low)
+            low = current;
+        if (current > 0) {
+            if (pos < min)
+                min = pos;
+            if (pos > max)
+                max = pos;
+        }
+        // We do the count here as well.
+        // we can't use m_producer->count() for this, because of the range
+        count += current;
+        total += current * pos;
+    }
+
+    if (count > 0)
+        mean = total / count;
+
+    c.m_high = high;
+    c.m_low = low;
+    c.m_count = count;
+    c.m_min = min;
+    c.m_max = max;
+    c.m_mean = mean;
+    c.m_total = total;
+
+    return c;
+}
+
+
+void KisHistogram::dump() {
+    kdDebug(DBG_AREA_MATH) << "Histogram\n";
+
+    switch (m_type) {
+    case LINEAR:
+        kdDebug(DBG_AREA_MATH) << "Linear histogram\n";
+        break;
+    case LOGARITHMIC:
+        kdDebug(DBG_AREA_MATH) << "Logarithmic histogram\n";
+    }
+
+    kdDebug(DBG_AREA_MATH) << "Dumping channel " << m_channel << endl;
+    Calculations c = calculations();
+
+/*        for( int i = 0; i <256; ++i ) {
+        kdDebug(DBG_AREA_MATH) << "Value "
+              << TQString().setNum(i)
+              << ": "
+              <<  TQString().setNum(m_values[i])
+              << "\n";
+        }*/
+    kdDebug(DBG_AREA_MATH) << "\n";
+
+    kdDebug(DBG_AREA_MATH) << "Max: " << TQString(TQString().setNum(c.getMax())) << "\n";
+    kdDebug(DBG_AREA_MATH) << "Min: " << TQString(TQString().setNum(c.getMin())) << "\n";
+    kdDebug(DBG_AREA_MATH) << "High: " << TQString(TQString().setNum(c.getHighest())) << "\n";
+    kdDebug(DBG_AREA_MATH) << "Low: " << TQString(TQString().setNum(c.getLowest())) << "\n";
+    kdDebug(DBG_AREA_MATH) << "Mean: " << TQString(m_producer->positionToString(c.getMean())) << "\n";
+    kdDebug(DBG_AREA_MATH) << "Total: " << TQString(TQString().setNum(c.getTotal())) << "\n";
+//    kdDebug(DBG_AREA_MATH) << "Median: " << TQString().setNum(m_median) << "\n";
+//    kdDebug(DBG_AREA_MATH) << "Stddev: " << TQString().setNum(m_stddev) << "\n";
+//    kdDebug(DBG_AREA_MATH) << "percentile: " << TQString().setNum(m_percentile) << "\n";
+
+    kdDebug(DBG_AREA_MATH) << "\n";
+}
diff --git a/chalk/core/kis_histogram.h b/chalk/core/kis_histogram.h
new file mode 100644
index 000000000..3d315994f
--- /dev/null
+++ b/chalk/core/kis_histogram.h
@@ -0,0 +1,150 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt
+ *            (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_HISTOGRAM_
+#define KIS_HISTOGRAM_
+
+#include "kis_types.h"
+#include "kis_colorspace.h"
+#include "kis_histogram_producer.h"
+
+enum enumHistogramType {
+    LINEAR,
+    LOGARITHMIC
+};
+/**
+ * The histogram class computes the histogram data from the specified layer
+ * for the specified channel, through the use of a KisHistogramProducer.
+ * This class is only for layers and paintdevices. KisImages are not supported,
+ * but you can use the mergedImage function to create a paintdevice and feed that to this class.
+ * 
+ * A Histogram also can have a selection: this is a specific range in the current histogram
+ * that will get calculations done on it as well. If the range's begin and end are the same,
+ * it is supposed to specify a single bin in the histogram.
+ * 
+ * The calculations are done in the range 0 - 1, instead of the native range that a pixel
+ * might have, so it's not always as precise as it could be. But you can't have it all...
+ */
+class KisHistogram : public KShared {
+
+public:
+    /**
+     * Class that stores the result of histogram calculations.
+     * Doubles are in the 0-1 range, use the producer's positionToString function to display it.
+     **/
+    class Calculations {
+
+        double m_max, m_min, m_mean, m_total, m_median, m_stddev;
+
+        TQ_UINT32 m_high, m_low, m_count;
+
+        friend class KisHistogram;
+
+    public:
+
+        Calculations() : m_max(0.0), m_min(0.0), m_mean(0.0), m_total(0.0), m_median(0.0),
+            m_stddev(0.0), m_high(0), m_low(0), m_count(0) {}
+        /**
+         * This function return the maximum bound of the histogram
+         * (values at greater position than the maximum are null)
+         */
+        inline double getMax() { return m_max; }
+        /**
+         * This function return the minimum bound of the histogram
+         * (values at smaller position than the minimum are null)
+         */
+        inline double getMin() { return m_min; }
+        /// This function return the highest value of the histogram
+        inline TQ_UINT32 getHighest() { return m_high; }
+        /// This function return the lowest value of the histogram
+        inline TQ_UINT32 getLowest() { return m_low; }
+        /// This function return the mean of value of the histogram
+        inline double getMean() { return m_mean; }
+        //double getMedian() { return m_median; }
+        //double getStandardDeviation() { return m_stddev; }
+        /// This function return the number of pixels used by the histogram
+        inline TQ_UINT32 getCount() { return m_count; }
+        /** The sum of (the contents of every bin * the double value of that bin)*/
+        inline double getTotal() { return m_total; }
+        //TQ_UINT8 getPercentile() { return m_percentile; } // What is this exactly? XXX
+    };
+
+    KisHistogram(KisPaintLayerSP layer, 
+                 KisHistogramProducerSP producer,
+                 const enumHistogramType type);
+
+    KisHistogram(KisPaintDeviceSP paintdev, 
+                 KisHistogramProducerSP producer,
+                 const enumHistogramType type);
+
+    virtual ~KisHistogram();
+
+    /** Updates the information in the producer */
+    void updateHistogram();
+
+    /**
+     * (Re)computes the mathematical information from the information currently in the producer.
+     * Needs to be called when you change the selection and want to get that information
+     **/
+    void computeHistogram();
+
+    /** The information on the entire view for the current channel */
+    Calculations calculations();
+    /** The information on the current selection for the current channel */
+    Calculations selectionCalculations();
+
+    inline TQ_UINT32 getValue(TQ_UINT8 i) { return m_producer->getBinAt(m_channel, i); }
+
+    inline enumHistogramType getHistogramType() { return m_type; }
+    inline void setHistogramType(enumHistogramType type) { m_type = type; }
+    inline void setProducer(KisHistogramProducerSP producer) { m_producer = producer; }
+    inline void setChannel(TQ_INT32 channel) { m_channel = channel; }
+    inline KisHistogramProducerSP producer() { return m_producer; }
+    inline TQ_INT32 channel() { return m_channel; }
+
+    inline bool hasSelection() { return m_selection; }
+    inline double selectionFrom() { return m_selFrom; }
+    inline double selectionTo() { return m_selTo; }
+    inline void setNoSelection() { m_selection = false; }
+    /** Sets the current selection */
+    inline void setSelection(double from, double to)
+        { m_selection = true; m_selFrom = from; m_selTo = to; }
+
+
+private:
+    // Dump the histogram to debug.
+    void dump();
+    TQValueVector<Calculations> calculateForRange(double from, double to);
+    Calculations calculateSingleRange(int channel, double from, double to);
+
+    KisPaintDeviceSP m_device;
+    KisHistogramProducerSP m_producer;
+
+    enumHistogramType m_type;
+
+    TQ_INT32 m_channel;
+    double m_selFrom, m_selTo;
+    bool m_selection;
+
+    KisPaintDeviceSP m_dev;
+
+    TQValueVector<Calculations> m_completeCalculations, m_selectionCalculations;
+};
+
+
+#endif // KIS_HISTOGRAM_WIDGET_
diff --git a/chalk/core/kis_image.cc b/chalk/core/kis_image.cc
new file mode 100644
index 000000000..30f3ad364
--- /dev/null
+++ b/chalk/core/kis_image.cc
@@ -0,0 +1,1702 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *  Copyright (c) 2007 Benjamin Schleimer <bensch128@yahoo.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <stdlib.h>
+#include <math.h>
+
+#include <config.h>
+#include LCMS_HEADER
+
+#include <tqimage.h>
+#include <tqpainter.h>
+#include <tqsize.h>
+#include <tqtl.h>
+#include <tqapplication.h>
+#include <tqthread.h>
+#include <tqdatetime.h>
+
+#include <kcommand.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_image_iface.h"
+
+#include "kis_annotation.h"
+#include "kis_colorspace_factory_registry.h"
+#include "kis_color.h"
+#include "kis_command.h"
+#include "kis_types.h"
+//#include "kis_guide.h"
+#include "kis_image.h"
+#include "kis_paint_device.h"
+#include "kis_paint_device_action.h"
+#include "kis_selection.h"
+#include "kis_painter.h"
+#include "kis_fill_painter.h"
+#include "kis_layer.h"
+#include "kis_group_layer.h"
+#include "kis_adjustment_layer.h"
+#include "kis_paint_layer.h"
+#include "kis_colorspace_convert_visitor.h"
+#include "kis_background.h"
+#include "kis_substrate.h"
+#include "kis_scale_visitor.h"
+#include "kis_nameserver.h"
+#include "kis_undo_adapter.h"
+#include "kis_merge_visitor.h"
+#include "kis_transaction.h"
+#include "kis_crop_visitor.h"
+#include "kis_transform_visitor.h"
+#include "kis_filter_strategy.h"
+#include "kis_profile.h"
+#include "kis_paint_layer.h"
+#include "kis_perspective_grid.h"
+#include "kis_change_profile_visitor.h"
+#include "kis_group_layer.h"
+#include "kis_iterators_pixel.h"
+#include "kis_shear_visitor.h"
+
+class KisImage::KisImagePrivate {
+public:
+    KisColor backgroundColor;
+    TQ_UINT32 lockCount;
+    bool     sizeChangedWhileLocked;
+    bool     selectionChangedWhileLocked;
+    KisSubstrateSP substrate;
+    KisPerspectiveGrid* perspectiveGrid;
+};
+
+
+namespace {
+
+    class KisResizeImageCmd : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        KisResizeImageCmd(KisUndoAdapter *adapter,
+                          KisImageSP img,
+                          TQ_INT32 width,
+                          TQ_INT32 height,
+                          TQ_INT32 oldWidth,
+                          TQ_INT32 oldHeight) : super(i18n("Resize Image"))
+            {
+                m_adapter = adapter;
+                m_img = img;
+                m_before = TQSize(oldWidth, oldHeight);
+                m_after = TQSize(width, height);
+            }
+
+        virtual ~KisResizeImageCmd()
+            {
+            }
+
+    public:
+        virtual void execute()
+            {
+                m_adapter->setUndo(false);
+                m_img->resize(m_after.width(), m_after.height());
+                m_adapter->setUndo(true);
+            }
+
+        virtual void unexecute()
+            {
+                m_adapter->setUndo(false);
+                m_img->resize(m_before.width(), m_before.height());
+                m_adapter->setUndo(true);
+            }
+
+    private:
+        KisUndoAdapter *m_adapter;
+        KisImageSP m_img;
+        TQSize m_before;
+        TQSize m_after;
+    };
+
+    // -------------------------------------------------------
+
+    class KisChangeLayersCmd : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        KisChangeLayersCmd(KisUndoAdapter *adapter, KisImageSP img,
+                           KisGroupLayerSP oldRootLayer, KisGroupLayerSP newRootLayer, const TQString& name)
+            : super(name)
+            {
+                m_adapter = adapter;
+                m_img = img;
+                m_oldRootLayer = oldRootLayer;
+                m_newRootLayer = newRootLayer;
+            }
+
+        virtual ~KisChangeLayersCmd()
+            {
+            }
+
+    public:
+        virtual void execute()
+            {
+                m_adapter->setUndo(false);
+                m_img->setRootLayer(m_newRootLayer);
+                m_adapter->setUndo(true);
+                m_img->notifyLayersChanged();
+            }
+
+        virtual void unexecute()
+            {
+                m_adapter->setUndo(false);
+                m_img->setRootLayer(m_oldRootLayer);
+                m_adapter->setUndo(true);
+                m_img->notifyLayersChanged();
+            }
+
+    private:
+        KisUndoAdapter *m_adapter;
+        KisImageSP m_img;
+        KisGroupLayerSP m_oldRootLayer;
+        KisGroupLayerSP m_newRootLayer;
+    };
+
+
+    // -------------------------------------------------------
+
+    class KisConvertImageTypeCmd : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        KisConvertImageTypeCmd(KisUndoAdapter *adapter, KisImageSP img,
+                               KisColorSpace * beforeColorSpace, KisColorSpace * afterColorSpace
+            ) : super(i18n("Convert Image Type"))
+            {
+                m_adapter = adapter;
+                m_img = img;
+                m_beforeColorSpace = beforeColorSpace;
+                m_afterColorSpace = afterColorSpace;
+            }
+
+        virtual ~KisConvertImageTypeCmd()
+            {
+            }
+
+    public:
+        virtual void execute()
+            {
+                m_adapter->setUndo(false);
+
+                m_img->setColorSpace(m_afterColorSpace);
+                m_img->setProfile(m_afterColorSpace->getProfile());
+
+                m_adapter->setUndo(true);
+            }
+
+        virtual void unexecute()
+            {
+                m_adapter->setUndo(false);
+
+                m_img->setColorSpace(m_beforeColorSpace);
+                m_img->setProfile(m_beforeColorSpace->getProfile());
+
+                m_adapter->setUndo(true);
+            }
+
+    private:
+        KisUndoAdapter *m_adapter;
+        KisImageSP m_img;
+        KisColorSpace * m_beforeColorSpace;
+        KisColorSpace * m_afterColorSpace;
+    };
+
+
+    // -------------------------------------------------------
+
+    class KisImageCommand : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        KisImageCommand(const TQString& name, KisImageSP image);
+        virtual ~KisImageCommand() {}
+
+        virtual void execute() = 0;
+        virtual void unexecute() = 0;
+
+    protected:
+        void setUndo(bool undo);
+
+        KisImageSP m_image;
+    };
+
+    KisImageCommand::KisImageCommand(const TQString& name, KisImageSP image) :
+        super(name), m_image(image)
+    {
+    }
+
+    void KisImageCommand::setUndo(bool undo)
+    {
+        if (m_image->undoAdapter()) {
+            m_image->undoAdapter()->setUndo(undo);
+        }
+    }
+
+
+    // -------------------------------------------------------
+
+    class KisLayerPositionCommand : public KisImageCommand {
+        typedef KisImageCommand super;
+
+    public:
+        KisLayerPositionCommand(const TQString& name, KisImageSP image, KisLayerSP layer, KisGroupLayerSP tqparent, KisLayerSP aboveThis) : super(name, image)
+            {
+                m_layer = layer;
+                m_oldParent = layer->tqparent();
+                m_oldAboveThis = layer->nextSibling();
+                m_newParent = tqparent;
+                m_newAboveThis = aboveThis;
+           }
+
+        virtual void execute()
+            {
+                setUndo(false);
+                m_image->moveLayer(m_layer, m_newParent, m_newAboveThis);
+                setUndo(true);
+            }
+
+        virtual void unexecute()
+            {
+                setUndo(false);
+                m_image->moveLayer(m_layer, m_oldParent, m_oldAboveThis);
+                setUndo(true);
+            }
+
+    private:
+        KisLayerSP m_layer;
+        KisGroupLayerSP m_oldParent;
+        KisLayerSP m_oldAboveThis;
+        KisGroupLayerSP m_newParent;
+        KisLayerSP m_newAboveThis;
+    };
+
+
+    // -------------------------------------------------------
+
+    class LayerAddCmd : public KisCommand {
+        typedef KisCommand super;
+
+    public:
+        LayerAddCmd(KisUndoAdapter *adapter, KisImageSP img, KisLayerSP layer) : super(i18n("Add Layer"), adapter)
+            {
+                m_img = img;
+                m_layer = layer;
+                m_parent = layer->tqparent();
+                m_aboveThis = layer->nextSibling();
+            }
+
+        virtual ~LayerAddCmd()
+            {
+            }
+
+        virtual void execute()
+            {
+                adapter()->setUndo(false);
+                m_img->addLayer(m_layer, m_parent.data(), m_aboveThis);
+                adapter()->setUndo(true);
+            }
+
+        virtual void unexecute()
+            {
+                adapter()->setUndo(false);
+                m_img->removeLayer(m_layer);
+                adapter()->setUndo(true);
+            }
+
+    private:
+        KisImageSP m_img;
+        KisLayerSP m_layer;
+        KisGroupLayerSP m_parent;
+        KisLayerSP m_aboveThis;
+    };
+
+    // -------------------------------------------------------
+
+    class LayerRmCmd : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        LayerRmCmd(KisUndoAdapter *adapter, KisImageSP img,
+                   KisLayerSP layer, KisGroupLayerSP wasParent, KisLayerSP wasAbove)
+            : super(i18n("Remove Layer"))
+            {
+                m_adapter = adapter;
+                m_img = img;
+                m_layer = layer;
+                m_prevParent = wasParent;
+                m_prevAbove = wasAbove;
+            }
+
+        virtual ~LayerRmCmd()
+            {
+            }
+
+        virtual void execute()
+            {
+                m_adapter->setUndo(false);
+                m_img->removeLayer(m_layer);
+                m_adapter->setUndo(true);
+            }
+
+        virtual void unexecute()
+            {
+                m_adapter->setUndo(false);
+                m_img->addLayer(m_layer, m_prevParent.data(), m_prevAbove);
+                m_adapter->setUndo(true);
+            }
+
+    private:
+        KisUndoAdapter *m_adapter;
+        KisImageSP m_img;
+        KisLayerSP m_layer;
+        KisGroupLayerSP m_prevParent;
+        KisLayerSP m_prevAbove;
+    };
+
+    class LayerMoveCmd: public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        LayerMoveCmd(KisUndoAdapter *adapter, KisImageSP img,
+                         KisLayerSP layer, KisGroupLayerSP wasParent, KisLayerSP wasAbove)
+            : super(i18n("Move Layer"))
+            {
+                m_adapter = adapter;
+                m_img = img;
+                m_layer = layer;
+                m_prevParent = wasParent;
+                m_prevAbove = wasAbove;
+                m_newParent = layer->tqparent();
+                m_newAbove = layer->nextSibling();
+            }
+
+        virtual ~LayerMoveCmd()
+            {
+            }
+
+        virtual void execute()
+            {
+                m_adapter->setUndo(false);
+                m_img->moveLayer(m_layer, m_newParent.data(), m_newAbove);
+                m_adapter->setUndo(true);
+            }
+
+        virtual void unexecute()
+            {
+                m_adapter->setUndo(false);
+                m_img->moveLayer(m_layer, m_prevParent.data(), m_prevAbove);
+                m_adapter->setUndo(true);
+            }
+
+    private:
+        KisUndoAdapter *m_adapter;
+        KisImageSP m_img;
+        KisLayerSP m_layer;
+        KisGroupLayerSP m_prevParent;
+        KisLayerSP m_prevAbove;
+        KisGroupLayerSP m_newParent;
+        KisLayerSP m_newAbove;
+    };
+
+
+    // -------------------------------------------------------
+
+    class LayerPropsCmd : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        LayerPropsCmd(KisLayerSP layer,
+                      KisImageSP img,
+                      KisUndoAdapter *adapter,
+                      const TQString& name,
+                      TQ_INT32 opacity,
+                      const KisCompositeOp& compositeOp) : super(i18n("Layer Property Changes"))
+            {
+                m_layer = layer;
+                m_img = img;
+                m_adapter = adapter;
+                m_name = name;
+                m_opacity = opacity;
+                m_compositeOp = compositeOp;
+            }
+
+        virtual ~LayerPropsCmd()
+            {
+            }
+
+    public:
+        virtual void execute()
+            {
+                TQString name = m_layer->name();
+                TQ_INT32 opacity = m_layer->opacity();
+                KisCompositeOp compositeOp = m_layer->compositeOp();
+
+                m_adapter->setUndo(false);
+                m_img->setLayerProperties(m_layer,
+                                            m_opacity,
+                                            m_compositeOp,
+                                            m_name);
+                m_adapter->setUndo(true);
+                m_name = name;
+                m_opacity = opacity;
+                m_compositeOp = compositeOp;
+                m_layer->setDirty();
+            }
+
+        virtual void unexecute()
+            {
+                execute();
+            }
+
+    private:
+        KisUndoAdapter *m_adapter;
+        KisLayerSP m_layer;
+        KisImageSP m_img;
+        TQString m_name;
+        TQ_INT32 m_opacity;
+        KisCompositeOp m_compositeOp;
+    };
+
+    // -------------------------------------------------------
+
+    class LockImageCommand : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        LockImageCommand(KisImageSP img, bool lockImage) : super("lock image")  // Not for translation, this
+            {                                                                   // is only ever used inside a macro command.
+                m_img = img;
+                m_lockImage = lockImage;
+            }
+
+        virtual ~LockImageCommand()
+            {
+            }
+
+        virtual void execute()
+            {
+                if (m_lockImage) {
+                    m_img->lock();
+                } else {
+                    m_img->unlock();
+                }
+            }
+
+        virtual void unexecute()
+            {
+                if (m_lockImage) {
+                    m_img->unlock();
+                } else {
+                    m_img->lock();
+                }
+            }
+
+    private:
+        KisImageSP m_img;
+        bool m_lockImage;
+    };
+}
+
+KisImage::KisImage(KisUndoAdapter *adapter, TQ_INT32 width, TQ_INT32 height,  KisColorSpace * colorSpace, const TQString& name)
+    : TQObject(0, name.latin1()), KShared()
+{
+    init(adapter, width, height, colorSpace, name);
+    setName(name);
+    m_dcop = 0L;
+}
+
+KisImage::KisImage(const KisImage& rhs) : TQObject(), KShared(rhs)
+{
+    m_dcop = 0L;
+    if (this != &rhs) {
+        m_private = new KisImagePrivate(*rhs.m_private);
+        m_private->perspectiveGrid = new KisPerspectiveGrid(*rhs.m_private->perspectiveGrid);
+        m_uri = rhs.m_uri;
+        m_name = TQString();
+        m_width = rhs.m_width;
+        m_height = rhs.m_height;
+        m_xres = rhs.m_xres;
+        m_yres = rhs.m_yres;
+        m_unit = rhs.m_unit;
+        m_colorSpace = rhs.m_colorSpace;
+        m_dirty = rhs.m_dirty;
+        m_adapter = rhs.m_adapter;
+
+        m_bkg = new KisBackground();
+        Q_CHECK_PTR(m_bkg);
+
+        m_rootLayer = static_cast<KisGroupLayer*>(rhs.m_rootLayer->clone().data());
+        connect(m_rootLayer, TQT_SIGNAL(sigDirty(TQRect)), this, TQT_SIGNAL(sigImageUpdated(TQRect)));
+            
+        m_annotations = rhs.m_annotations; // XXX the annotations would probably need to be deep-copied
+
+        m_nserver = new KisNameServer(i18n("Layer %1"), rhs.m_nserver->currentSeed() + 1);
+        Q_CHECK_PTR(m_nserver);
+
+        //m_guides = rhs.m_guides;
+
+        // Set this as the current image for the layers
+        m_rootLayer->setImage(this);
+        // Set the active paint layer
+        if(rhs.activeLayer() != NULL) {
+            TQString layerName = rhs.activeLayer()->name();
+            // kdDebug(12345) << "KisImage::KisImage: active layer = " << layerName << "\n";
+            KisLayerSP activeLayer = rootLayer()->findLayer(layerName);
+            Q_ASSERT(activeLayer);
+            activate(activeLayer);
+        } else {
+            activate(NULL);
+        }
+    }
+}
+
+
+
+DCOPObject * KisImage::dcopObject()
+{
+    if (!m_dcop) {
+        m_dcop = new KisImageIface(this);
+        Q_CHECK_PTR(m_dcop);
+    }
+    return m_dcop;
+}
+
+KisImage::~KisImage()
+{
+    delete m_private->perspectiveGrid;
+    delete m_private;
+    delete m_nserver;
+    delete m_dcop;
+}
+
+TQString KisImage::name() const
+{
+    return m_name;
+}
+
+void KisImage::setName(const TQString& name)
+{
+    if (!name.isEmpty())
+        m_name = name;
+}
+
+TQString KisImage::description() const
+{
+    return m_description;
+}
+
+void KisImage::setDescription(const TQString& description)
+{
+    if (!description.isEmpty())
+        m_description = description;
+}
+
+
+KisColor KisImage::backgroundColor() const
+{
+    return m_private->backgroundColor;
+}
+
+void KisImage::setBackgroundColor(const KisColor & color)
+{
+    m_private->backgroundColor = color;
+}
+
+
+TQString KisImage::nextLayerName() const
+{
+    if (m_nserver->currentSeed() == 0) {
+        m_nserver->number();
+        return i18n("background");
+    }
+
+    return m_nserver->name();
+}
+
+void KisImage::rollBackLayerName()
+{
+    m_nserver->rollback();
+}
+
+void KisImage::init(KisUndoAdapter *adapter, TQ_INT32 width, TQ_INT32 height,  KisColorSpace * colorSpace, const TQString& name)
+{
+    Q_ASSERT(colorSpace);
+
+    if (colorSpace == 0) {
+        colorSpace = KisMetaRegistry::instance()->csRegistry()->getRGB8();
+        kdWarning(41010) << "No colorspace specified: using RGBA\n";
+    }
+
+    m_private = new KisImagePrivate();
+    m_private->backgroundColor = KisColor(TQt::white, colorSpace);
+    m_private->lockCount = 0;
+    m_private->sizeChangedWhileLocked = false;
+    m_private->selectionChangedWhileLocked = false;
+    m_private->substrate = 0;
+    m_private->perspectiveGrid = new KisPerspectiveGrid();
+
+    m_adapter = adapter;
+
+    m_nserver = new KisNameServer(i18n("Layer %1"), 1);
+    m_name = name;
+
+    m_colorSpace = colorSpace;
+    m_bkg = new KisBackground();
+
+    m_rootLayer = new KisGroupLayer(this,"root", OPACITY_OPAQUE);
+    connect(m_rootLayer, TQT_SIGNAL(sigDirty(TQRect)), this, TQT_SIGNAL(sigImageUpdated(TQRect)));
+
+    m_xres = 1.0;
+    m_yres = 1.0;
+    m_unit = KoUnit::U_PT;
+    m_dirty = false;
+    m_width = width;
+    m_height = height;
+}
+
+bool KisImage::locked() const
+{
+    return m_private->lockCount != 0;
+}
+
+void KisImage::lock()
+{
+    if (!locked()) {
+        if (m_rootLayer) disconnect(m_rootLayer, TQT_SIGNAL(sigDirty(TQRect)), this, TQT_SIGNAL(sigImageUpdated(TQRect)));
+        m_private->sizeChangedWhileLocked = false;
+        m_private->selectionChangedWhileLocked = false;
+    }
+    m_private->lockCount++;
+}
+
+void KisImage::unlock()
+{
+    Q_ASSERT(locked());
+
+    if (locked()) {
+        m_private->lockCount--;
+
+        if (m_private->lockCount == 0) {
+            if (m_private->sizeChangedWhileLocked) {
+                // A size change implies a full image update so only send this.
+                emit sigSizeChanged(m_width, m_height);
+            } else {
+                if (m_rootLayer->dirty()) emit sigImageUpdated( m_rootLayer->dirtyRect() );
+            }
+
+            if (m_private->selectionChangedWhileLocked) {
+                emit sigActiveSelectionChanged(this);
+            }
+
+            if (m_rootLayer) connect(m_rootLayer, TQT_SIGNAL(sigDirty(TQRect)), this, TQT_SIGNAL(sigImageUpdated(TQRect)));
+        }
+    }
+}
+
+void KisImage::emitSizeChanged()
+{
+    if (!locked()) {
+        emit sigSizeChanged(m_width, m_height);
+    } else {
+        m_private->sizeChangedWhileLocked = true;
+    }
+}
+
+void KisImage::notifyLayerUpdated(KisLayerSP layer, TQRect rc)
+{
+    emit sigLayerUpdated(layer, rc);
+}
+
+void KisImage::resize(TQ_INT32 w, TQ_INT32 h, TQ_INT32 x, TQ_INT32 y, bool cropLayers)
+{
+    if (w != width() || h != height()) {
+
+        lock();
+
+        if (undo()) {
+            if (cropLayers)
+                m_adapter->beginMacro(i18n("Crop Image"));
+            else
+                m_adapter->beginMacro(i18n("Resize Image"));
+
+            m_adapter->addCommand(new LockImageCommand(this, true));
+            m_adapter->addCommand(new KisResizeImageCmd(m_adapter, this, w, h, width(), height()));
+        }
+
+        m_width = w;
+        m_height = h;
+
+        if (cropLayers) {
+            KisCropVisitor v(TQRect(x, y, w, h));
+            m_rootLayer->accept(v);
+        }
+
+        emitSizeChanged();
+
+        unlock();
+
+        if (undo()) {
+            m_adapter->addCommand(new LockImageCommand(this, false));
+            m_adapter->endMacro();
+        }
+    }
+}
+
+void KisImage::resize(const TQRect& rc, bool cropLayers)
+{
+    resize(rc.width(), rc.height(), rc.x(), rc.y(), cropLayers);
+}
+
+
+void KisImage::scale(double sx, double sy, KisProgressDisplayInterface *progress, KisFilterStrategy *filterStrategy)
+{
+    if (nlayers() == 0) return; // Nothing to scale
+
+    // New image size. XXX: Pass along to discourage rounding errors?
+    TQ_INT32 w, h;
+    w = (TQ_INT32)(( width() * sx) + 0.5);
+    h = (TQ_INT32)(( height() * sy) + 0.5);
+
+    if (w != width() || h != height()) {
+
+        lock();
+
+        if (undo()) {
+            m_adapter->beginMacro(i18n("Scale Image"));
+            m_adapter->addCommand(new LockImageCommand(this, true));
+        }
+#if 0
+        if ( colorSpace()->id() == KisID("RGBA") || colorSpace()->id() == KisID("CMYK") || colorSpace()->id() == KisID("GRAYA")) {
+            KisScaleVisitor v (this, sx, sy, progress, filterStrategy);
+            m_rootLayer->accept( v );
+        }
+        else {
+#endif
+            KisTransformVisitor visitor (this, sx, sy, 0.0, 0.0, 0.0, 0, 0, progress, filterStrategy);
+            m_rootLayer->accept(visitor);
+//        }
+
+        if (undo()) {
+            m_adapter->addCommand(new KisResizeImageCmd(m_adapter, this, w, h, width(), height()));
+        }
+
+        m_width = w;
+        m_height = h;
+
+        emitSizeChanged();
+
+        unlock();
+
+        if (undo()) {
+            m_adapter->addCommand(new LockImageCommand(this, false));
+            m_adapter->endMacro();
+        }
+    }
+}
+
+
+
+void KisImage::rotate(double radians, KisProgressDisplayInterface *progress)
+{
+    lock();
+
+    TQ_INT32 w = width();
+    TQ_INT32 h = height();
+    TQ_INT32 tx = TQ_INT32((w*cos(radians) - h*sin(radians) - w) / 2 + 0.5);
+    TQ_INT32 ty = TQ_INT32((h*cos(radians) + w*sin(radians) - h) / 2 + 0.5);
+    w = (TQ_INT32)(width()*TQABS(cos(radians)) + height()*TQABS(sin(radians)) + 0.5);
+    h = (TQ_INT32)(height()*TQABS(cos(radians)) + width()*TQABS(sin(radians)) + 0.5);
+
+    tx -= (w - width()) / 2;
+    ty -= (h - height()) / 2;
+
+    if (undo()) {
+        m_adapter->beginMacro(i18n("Rotate Image"));
+        m_adapter->addCommand(new LockImageCommand(this, true));
+    }
+
+    KisFilterStrategy *filter = KisFilterStrategyRegistry::instance()->get(KisID("Triangle"));
+    KisTransformVisitor visitor (this, 1.0, 1.0, 0, 0, radians, -tx, -ty, progress, filter);
+    m_rootLayer->accept(visitor);
+
+    if (undo()) m_adapter->addCommand(new KisResizeImageCmd(undoAdapter(), this, w, h, width(), height()));
+
+    m_width = w;
+    m_height = h;
+
+    emitSizeChanged();
+
+    unlock();
+
+    if (undo()) {
+        m_adapter->addCommand(new LockImageCommand(this, false));
+        m_adapter->endMacro();
+    }
+}
+
+void KisImage::shear(double angleX, double angleY, KisProgressDisplayInterface *m_progress)
+{
+    const double pi=3.1415926535897932385;
+
+    //new image size
+    TQ_INT32 w=width();
+    TQ_INT32 h=height();
+
+
+    if(angleX != 0 || angleY != 0){
+        double deltaY=height()*TQABS(tan(angleX*pi/180)*tan(angleY*pi/180));
+        w = (TQ_INT32) ( width() + TQABS(height()*tan(angleX*pi/180)) );
+        //ugly fix for the problem of having two extra pixels if only a shear along one
+        //axis is done. This has to be fixed in the cropping code in KisRotateVisitor!
+        if (angleX == 0 || angleY == 0)
+            h = (TQ_INT32) ( height() + TQABS(w*tan(angleY*pi/180)) );
+        else if (angleX > 0 && angleY > 0)
+            h = (TQ_INT32) ( height() + TQABS(w*tan(angleY*pi/180))- 2 * deltaY + 2 );
+        else if (angleX < 0 && angleY < 0)
+            h = (TQ_INT32) ( height() + TQABS(w*tan(angleY*pi/180))- 2 * deltaY + 2 );
+        else
+            h = (TQ_INT32) ( height() + TQABS(w*tan(angleY*pi/180)) );
+    }
+
+    if (w != width() || h != height()) {
+
+        lock();
+
+        if (undo()) {
+            m_adapter->beginMacro(i18n("Shear Image"));
+            m_adapter->addCommand(new LockImageCommand(this, true));
+        }
+
+        KisShearVisitor v(angleX, angleY, m_progress);
+        v.setUndoAdapter(undoAdapter());
+        rootLayer()->accept(v);
+
+        if (undo()) m_adapter->addCommand(new KisResizeImageCmd(m_adapter, this, w, h, width(), height()));
+
+        m_width = w;
+        m_height = h;
+
+        emitSizeChanged();
+
+        unlock();
+
+        if (undo()) {
+            m_adapter->addCommand(new LockImageCommand(this, false));
+            m_adapter->endMacro();
+        }
+    }
+}
+
+void KisImage::convertTo(KisColorSpace * dstColorSpace, TQ_INT32 renderingIntent)
+{
+    if ( m_colorSpace == dstColorSpace )
+    {
+        return;
+    }
+
+    lock();
+
+    KisColorSpace * oldCs = m_colorSpace;
+
+    if (undo()) {
+        m_adapter->beginMacro(i18n("Convert Image Type"));
+        m_adapter->addCommand(new LockImageCommand(this, true));
+    }
+
+    setColorSpace(dstColorSpace);
+
+    KisColorSpaceConvertVisitor visitor(dstColorSpace, renderingIntent);
+    m_rootLayer->accept(visitor);
+
+    unlock();
+
+    emit sigLayerPropertiesChanged( m_activeLayer );
+
+    if (undo()) {
+
+        m_adapter->addCommand(new KisConvertImageTypeCmd(undoAdapter(), this,
+                                                         oldCs, dstColorSpace));
+        m_adapter->addCommand(new LockImageCommand(this, false));
+        m_adapter->endMacro();
+    }
+}
+
+KisProfile *  KisImage::getProfile() const
+{
+    return colorSpace()->getProfile();
+}
+
+void KisImage::setProfile(const KisProfile * profile)
+{
+    if (profile == 0) return;
+
+    KisColorSpace * dstCs= KisMetaRegistry::instance()->csRegistry()->getColorSpace( colorSpace()->id(),
+                                                                                         profile);
+    if (dstCs) {
+
+        lock();
+
+        KisColorSpace * oldCs = colorSpace();
+        setColorSpace(dstCs);
+        emit(sigProfileChanged(const_cast<KisProfile *>(profile)));
+
+        KisChangeProfileVisitor visitor(oldCs, dstCs);
+        m_rootLayer->accept(visitor);
+
+        unlock();
+    }
+}
+
+double KisImage::xRes()
+{
+    return m_xres;
+}
+
+double KisImage::yRes()
+{
+    return m_yres;
+}
+
+void KisImage::setResolution(double xres, double yres)
+{
+    m_xres = xres;
+    m_yres = yres;
+}
+
+TQ_INT32 KisImage::width() const
+{
+    return m_width;
+}
+
+TQ_INT32 KisImage::height() const
+{
+    return m_height;
+}
+
+KisPaintDeviceSP KisImage::activeDevice()
+{
+    if (KisPaintLayer* layer = dynamic_cast<KisPaintLayer*>(m_activeLayer.data())) {
+        return layer->paintDeviceOrMask();
+    }
+    else if (KisAdjustmentLayer* layer = dynamic_cast<KisAdjustmentLayer*>(m_activeLayer.data())) {
+        if (layer->selection()) {
+            return layer->selection().data();
+        }
+    }
+    else if (KisGroupLayer * layer = dynamic_cast<KisGroupLayer*>(m_activeLayer.data())) {
+        // Find first child
+        KisLayerSP child = layer->lastChild();
+        while(child)
+        {
+            if (KisPaintLayer* layer = dynamic_cast<KisPaintLayer*>(child.data())) {
+                return layer->paintDevice();
+            }
+            child = child->prevSibling();
+        }
+        KisLayerSP sibling = layer->nextSibling();
+        while (sibling) {
+            if (KisPaintLayer* layer = dynamic_cast<KisPaintLayer*>(sibling.data())) {
+                return layer->paintDevice();
+            }
+            sibling = sibling->nextSibling();
+        }
+    }
+    else if (KisLayerSP layer = m_activeLayer) {
+        // A weird layer -- let's not return it, but a sibling
+        KisLayerSP sibling = layer->nextSibling();
+        while (sibling) {
+            if (KisPaintLayer* layer = dynamic_cast<KisPaintLayer*>(sibling.data())) {
+                return layer->paintDevice();
+            }
+            sibling = sibling->nextSibling();
+        }
+    }
+    // XXX: We're buggered!
+    return 0;
+}
+
+KisLayerSP KisImage::newLayer(const TQString& name, TQ_UINT8 opacity, const KisCompositeOp& compositeOp, KisColorSpace * colorstrategy)
+{
+    KisPaintLayer * layer;
+    if (colorstrategy)
+        layer = new KisPaintLayer(this, name, opacity, colorstrategy);
+    else
+        layer = new KisPaintLayer(this, name, opacity);
+    Q_CHECK_PTR(layer);
+
+    if (compositeOp.isValid())
+        layer->setCompositeOp(compositeOp);
+    layer->setVisible(true);
+
+    if (m_activeLayer != 0) {
+        addLayer(layer, m_activeLayer->tqparent().data(), m_activeLayer->nextSibling());
+    }
+    else {
+        addLayer(layer, m_rootLayer, 0);
+    }
+    activate(layer);
+
+    return layer;
+}
+
+void KisImage::setLayerProperties(KisLayerSP layer, TQ_UINT8 opacity, const KisCompositeOp& compositeOp, const TQString& name)
+{
+    if (layer && (layer->opacity() != opacity || layer->compositeOp() != compositeOp || layer->name() != name)) {
+        if (undo()) {
+            TQString oldname = layer->name();
+            TQ_INT32 oldopacity = layer->opacity();
+            KisCompositeOp oldCompositeOp = layer->compositeOp();
+            layer->setName(name);
+            layer->setOpacity(opacity);
+            layer->setCompositeOp(compositeOp);
+            m_adapter->addCommand(new LayerPropsCmd(layer, this, m_adapter, oldname, oldopacity, oldCompositeOp));
+        } else {
+            layer->setName(name);
+            layer->setOpacity(opacity);
+            layer->setCompositeOp(compositeOp);
+        }
+    }
+}
+
+KisGroupLayerSP KisImage::rootLayer() const
+{
+    return m_rootLayer;
+}
+
+KisLayerSP KisImage::activeLayer() const
+{
+    return m_activeLayer;
+}
+
+KisPaintDeviceSP KisImage::projection()
+{
+    return m_rootLayer->projection(TQRect(0, 0, m_width, m_height));
+}
+
+KisLayerSP KisImage::activate(KisLayerSP layer)
+{
+    if (layer != m_activeLayer) {
+        if (m_activeLayer) m_activeLayer->deactivate();
+        m_activeLayer = layer;
+        if (m_activeLayer) m_activeLayer->activate();
+        emit sigLayerActivated(m_activeLayer);
+        emit sigMaskInfoChanged();
+    }
+
+    return layer;
+}
+
+KisLayerSP KisImage::findLayer(const TQString& name) const
+{
+    return rootLayer()->findLayer(name);
+}
+
+KisLayerSP KisImage::findLayer(int id) const
+{
+    return rootLayer()->findLayer(id);
+}
+
+
+bool KisImage::addLayer(KisLayerSP layer, KisGroupLayerSP tqparent)
+{
+    return addLayer(layer, tqparent, tqparent->firstChild());
+}
+
+bool KisImage::addLayer(KisLayerSP layer, KisGroupLayerSP tqparent, KisLayerSP aboveThis)
+{
+    if (!tqparent)
+        return false;
+
+    const bool success = tqparent->addLayer(layer, aboveThis);
+    if (success)
+    {
+        KisPaintLayerSP player = dynamic_cast<KisPaintLayer*>(layer.data());
+        if (player != 0) {
+
+            // XXX: This should also be done whenever a layer grows!
+            TQValueVector<KisPaintDeviceAction *> actions = KisMetaRegistry::instance() ->
+                csRegistry()->paintDeviceActionsFor(player->paintDevice()->colorSpace());
+            for (uint i = 0; i < actions.count(); i++) {
+                actions.at(i)->act(player.data()->paintDevice(), width(), height());
+            }
+
+            connect(player, TQT_SIGNAL(sigMaskInfoChanged()), this, TQT_SIGNAL(sigMaskInfoChanged()));
+        }
+
+        if (layer->extent().isValid()) layer->setDirty();
+
+        if (!layer->temporary()) {
+            emit sigLayerAdded(layer);
+            activate(layer);
+        }
+
+
+        if (!layer->temporary() && undo()) {
+            m_adapter->addCommand(new LayerAddCmd(m_adapter, this, layer));
+        }
+    }
+
+    return success;
+}
+
+bool KisImage::removeLayer(KisLayerSP layer)
+{
+    if (!layer || layer->image() != this)
+        return false;
+
+    if (KisGroupLayerSP tqparent = layer->tqparent()) {
+        // Adjustment layers should mark the layers underneath them, whose rendering
+        // they have cached, diryt on removal. Otherwise, the group won't be re-rendered.
+        KisAdjustmentLayer * al = dynamic_cast<KisAdjustmentLayer*>(layer.data());
+        if (al) {
+            TQRect r = al->extent();
+            lock(); // Lock the image, because we are going to dirty a lot of layers
+            KisLayerSP l = layer->nextSibling();
+            while (l) {
+                KisAdjustmentLayer * al2 = dynamic_cast<KisAdjustmentLayer*>(l.data());
+                l->setDirty(r, false);
+                if (al2 != 0) break;
+                l = l->nextSibling();
+            }
+            unlock();
+        }
+        KisPaintLayerSP player = dynamic_cast<KisPaintLayer*>(layer.data());
+        if (player != 0) {
+            disconnect(player, TQT_SIGNAL(sigMaskInfoChanged()),
+                       this, TQT_SIGNAL(sigMaskInfoChanged()));
+        }
+        KisLayerSP l = layer->prevSibling();
+        TQRect r = layer->extent();
+        while (l) {
+            l->setDirty(r, false);
+            l = l->prevSibling();
+        }
+
+        KisLayerSP wasAbove = layer->nextSibling();
+        KisLayerSP wasBelow = layer->prevSibling();
+        const bool wasActive = layer == activeLayer();
+        // sigLayerRemoved can set it to 0, we don't want that in the else of wasActive!
+        KisLayerSP actLayer = activeLayer();
+        const bool success = tqparent->removeLayer(layer);
+        if (success) {
+            layer->setImage(0);
+            if (!layer->temporary() && undo()) {
+                m_adapter->addCommand(new LayerRmCmd(m_adapter, this, layer, tqparent, wasAbove));
+            }
+            if (!layer->temporary()) {
+                emit sigLayerRemoved(layer, tqparent, wasAbove);
+                if (wasActive) {
+                    if (wasBelow)
+                        activate(wasBelow);
+                    else if (wasAbove)
+                        activate(wasAbove);
+                    else if (tqparent != rootLayer())
+                        activate(tqparent.data());
+                    else
+                        activate(rootLayer()->firstChild());
+                } else {
+                    activate(actLayer);
+                }
+            }
+        }
+        return success;
+    }
+
+    return false;
+}
+
+bool KisImage::raiseLayer(KisLayerSP layer)
+{
+    if (!layer)
+        return false;
+    return moveLayer(layer, layer->tqparent().data(), layer->prevSibling());
+}
+
+bool KisImage::lowerLayer(KisLayerSP layer)
+{
+    if (!layer)
+        return false;
+    if (KisLayerSP next = layer->nextSibling())
+        return moveLayer(layer, layer->tqparent().data(), next->nextSibling());
+    return false;
+}
+
+bool KisImage::toTop(KisLayerSP layer)
+{
+    if (!layer)
+        return false;
+    return moveLayer(layer, rootLayer(), rootLayer()->firstChild());
+}
+
+bool KisImage::toBottom(KisLayerSP layer)
+{
+    if (!layer)
+        return false;
+    return moveLayer(layer, rootLayer(), 0);
+}
+
+bool KisImage::moveLayer(KisLayerSP layer, KisGroupLayerSP tqparent, KisLayerSP aboveThis)
+{
+    if (!tqparent)
+        return false;
+
+    KisGroupLayerSP wasParent = layer->tqparent();
+    KisLayerSP wasAbove = layer->nextSibling();
+
+    if (wasParent.data() == tqparent.data() && wasAbove.data() == aboveThis.data())
+        return false;
+
+    lock();
+
+    if (!wasParent->removeLayer(layer)) {
+        unlock();
+        return false;
+    }
+
+    const bool success = tqparent->addLayer(layer, aboveThis);
+
+    layer->setDirty();
+
+    unlock();
+
+    if (success)
+    {
+        emit sigLayerMoved(layer, wasParent, wasAbove);
+        if (undo())
+            m_adapter->addCommand(new LayerMoveCmd(m_adapter, this, layer, wasParent, wasAbove));
+    }
+    else //we already removed the layer above, but re-adding it failed, so...
+    {
+        emit sigLayerRemoved(layer, wasParent, wasAbove);
+        if (undo())
+            m_adapter->addCommand(new LayerRmCmd(m_adapter, this, layer, wasParent, wasAbove));
+    }
+
+    return success;
+}
+
+TQ_INT32 KisImage::nlayers() const
+{
+    return rootLayer()->numLayers() - 1;
+}
+
+TQ_INT32 KisImage::nHiddenLayers() const
+{
+    return rootLayer()->numLayers(KisLayer::Hidden);
+}
+
+void KisImage::flatten()
+{
+    KisGroupLayerSP oldRootLayer = m_rootLayer;
+    disconnect(oldRootLayer, TQT_SIGNAL(sigDirty(TQRect)), this, TQT_SIGNAL(sigImageUpdated(TQRect)));
+
+    KisPaintLayer *dst = new KisPaintLayer(this, nextLayerName(), OPACITY_OPAQUE, colorSpace());
+    Q_CHECK_PTR(dst);
+
+    TQRect rc = mergedImage()->extent();
+
+    KisPainter gc(dst->paintDevice());
+    gc.bitBlt(rc.x(), rc.y(), COMPOSITE_COPY, mergedImage(), OPACITY_OPAQUE, rc.left(), rc.top(), rc.width(), rc.height());
+
+    m_rootLayer = new KisGroupLayer(this, "", OPACITY_OPAQUE);
+    connect(m_rootLayer, TQT_SIGNAL(sigDirty(TQRect)), this, TQT_SIGNAL(sigImageUpdated(TQRect)));
+
+    if (undo()) {
+        m_adapter->beginMacro(i18n("Flatten Image"));
+        m_adapter->addCommand(new LockImageCommand(this, true));
+        m_adapter->addCommand(new KisChangeLayersCmd(m_adapter, this, oldRootLayer, m_rootLayer, ""));
+    }
+
+    lock();
+
+    addLayer(dst, m_rootLayer, 0);
+    activate(dst);
+
+    unlock();
+
+    notifyLayersChanged();
+
+    if (undo()) {
+        m_adapter->addCommand(new LockImageCommand(this, false));
+        m_adapter->endMacro();
+    }
+}
+
+
+void KisImage::mergeLayer(KisLayerSP layer)
+{
+    KisPaintLayer *player = new KisPaintLayer(this, layer->name(), OPACITY_OPAQUE, colorSpace());
+    Q_CHECK_PTR(player);
+
+    TQRect rc = layer->extent() | layer->nextSibling()->extent();
+
+    undoAdapter()->beginMacro(i18n("Merge with Layer Below"));
+
+    //Abuse the merge visitor to only merge two layers (if either are groups they'll recursively merge)
+    KisMergeVisitor visitor(player->paintDevice(), rc);
+    layer->nextSibling()->accept(visitor);
+    layer->accept(visitor);
+
+    removeLayer(layer->nextSibling());
+    addLayer(player, layer->tqparent(), layer);
+    removeLayer(layer);
+
+    undoAdapter()->endMacro();
+}
+
+
+void KisImage::setModified()
+{
+    emit sigImageModified();
+}
+
+void KisImage::renderToPainter(TQ_INT32 x1,
+                               TQ_INT32 y1,
+                               TQ_INT32 x2,
+                               TQ_INT32 y2,
+                               TQPainter &painter,
+                               KisProfile *  monitorProfile,
+                               PaintFlags paintFlags,
+                               float exposure)
+{
+
+    TQImage img = convertToTQImage(x1, y1, x2, y2, monitorProfile, exposure);
+
+    TQ_INT32 w = x2 - x1 + 1;
+    TQ_INT32 h = y2 - y1 + 1;
+
+
+    if (paintFlags & PAINT_BACKGROUND) {
+        m_bkg->paintBackground(img, x1, y1);
+        img.setAlphaBuffer(false);
+    }
+
+    if (paintFlags & PAINT_SELECTION) {
+        if (m_activeLayer != 0) {
+            m_activeLayer->paintSelection(img, x1, y1, w, h);
+        }
+    }
+
+    if (paintFlags & PAINT_MASKINACTIVELAYERS) {
+        if (m_activeLayer != 0) {
+            m_activeLayer->paintMaskInactiveLayers(img, x1, y1, w, h);
+        }
+    }
+
+    painter.drawImage(x1, y1, img, 0, 0, w, h);
+}
+
+TQImage KisImage::convertToTQImage(TQ_INT32 x1,
+                                 TQ_INT32 y1,
+                                 TQ_INT32 x2,
+                                 TQ_INT32 y2,
+                                 KisProfile * profile,
+                                 float exposure)
+{
+    TQ_INT32 w = x2 - x1 + 1;
+    TQ_INT32 h = y2 - y1 + 1;
+
+    KisPaintDeviceSP dev = m_rootLayer->projection(TQRect(x1, y1, w, h));
+    TQImage img = dev->convertToTQImage(profile, x1, y1, w, h, exposure);
+
+    if (!img.isNull()) {
+
+#ifdef __BIG_ENDIAN__
+        uchar * data = img.bits();
+        for (int i = 0; i < w * h; ++i) {
+            uchar r, g, b, a;
+            a = data[0];
+            b = data[1];
+            g = data[2];
+            r = data[3];
+            data[0] = r;
+            data[1] = g;
+            data[2] = b;
+            data[3] = a;
+            data += 4;
+        }
+#endif
+
+        return img;
+    }
+
+    return TQImage();
+}
+
+TQImage KisImage::convertToTQImage(const TQRect& r, const TQSize& scaledImageSize, KisProfile *profile, PaintFlags paintFlags, float exposure)
+{
+
+    if (r.isEmpty() || scaledImageSize.isEmpty()) {
+        return TQImage();
+    }
+
+    TQ_INT32 imageWidth = width();
+    TQ_INT32 imageHeight = height();
+    TQ_UINT32 pixelSize = colorSpace()->pixelSize();
+
+    double xScale = static_cast<double>(imageWidth) / scaledImageSize.width();
+    double yScale = static_cast<double>(imageHeight) / scaledImageSize.height();
+
+    TQRect srcRect;
+
+    srcRect.setLeft(static_cast<int>(r.left() * xScale));
+    srcRect.setRight(static_cast<int>(ceil((r.right() + 1) * xScale)) - 1);
+    srcRect.setTop(static_cast<int>(r.top() * yScale));
+    srcRect.setBottom(static_cast<int>(ceil((r.bottom() + 1) * yScale)) - 1);
+
+    KisPaintDeviceSP mergedImage = m_rootLayer->projection(srcRect);
+    TQTime t;
+    t.start();
+
+    TQ_UINT8 *scaledImageData = new TQ_UINT8[r.width() * r.height() * pixelSize];
+
+    TQ_UINT8 *imageRow = new TQ_UINT8[srcRect.width() * pixelSize];
+    const TQ_INT32 imageRowX = srcRect.x();
+
+    for (TQ_INT32 y = 0; y < r.height(); ++y) {
+
+        TQ_INT32 dstY = r.y() + y;
+        TQ_INT32 dstX = r.x();
+        TQ_INT32 srcY = (dstY * imageHeight) / scaledImageSize.height();
+
+        mergedImage->readBytes(imageRow, imageRowX, srcY, srcRect.width(), 1);
+
+        TQ_UINT8 *dstPixel = scaledImageData + (y * r.width() * pixelSize);
+        TQ_UINT32 columnsRemaining = r.width();
+
+        while (columnsRemaining > 0) {
+
+            TQ_INT32 srcX = (dstX * imageWidth) / scaledImageSize.width();
+
+            memcpy(dstPixel, imageRow + ((srcX - imageRowX) * pixelSize), pixelSize);
+
+            ++dstX;
+            dstPixel += pixelSize;
+            --columnsRemaining;
+        }
+    }
+    kdDebug() << "Time elapsed scaling image: " << t.elapsed() << endl;
+
+    delete [] imageRow;
+
+    TQImage image = colorSpace()->convertToTQImage(scaledImageData, r.width(), r.height(), profile, INTENT_PERCEPTUAL, exposure);
+    delete [] scaledImageData;
+
+#ifdef __BIG_ENDIAN__
+    uchar * data = image.bits();
+    for (int i = 0; i < image.width() * image.height(); ++i) {
+      uchar r, g, b, a;
+      a = data[0];
+      b = data[1];
+      g = data[2];
+      r = data[3];
+      data[0] = r;
+      data[1] = g;
+      data[2] = b;
+      data[3] = a;
+      data += 4;
+    }
+#endif
+
+    if (paintFlags & PAINT_BACKGROUND) {
+        m_bkg->paintBackground(image, r, scaledImageSize, TQSize(imageWidth, imageHeight));
+        image.setAlphaBuffer(false);
+    }
+
+    if (paintFlags & PAINT_SELECTION) {
+        if (m_activeLayer != 0) {
+            m_activeLayer->paintSelection(image, r, scaledImageSize, TQSize(imageWidth, imageHeight));
+        }
+    }
+
+    /*if (paintFlags & PAINT_MASKINACTIVELAYERS) {
+        if (m_activeLayer != 0) {
+            m_activeLayer->paintMaskInactiveLayers(img, x1, y1, w, h);
+        }
+    }*/
+
+    return image;
+}
+
+KisPaintDeviceSP KisImage::mergedImage()
+{
+    return m_rootLayer->projection(TQRect(0, 0, m_width, m_height));
+}
+
+KisColor KisImage::mergedPixel(TQ_INT32 x, TQ_INT32 y)
+{
+    return m_rootLayer->projection(TQRect(x, y, 1, 1))->colorAt(x, y);
+}
+
+void KisImage::notifyLayersChanged()
+{
+    emit sigLayersChanged(rootLayer());
+}
+
+void KisImage::notifyPropertyChanged(KisLayerSP layer)
+{
+    emit sigLayerPropertiesChanged(layer);
+}
+
+void KisImage::notifyImageLoaded()
+{
+}
+
+TQRect KisImage::bounds() const
+{
+    return TQRect(0, 0, width(), height());
+}
+
+
+void KisImage::setUndoAdapter(KisUndoAdapter * adapter)
+{
+    m_adapter = adapter;
+}
+
+
+KisUndoAdapter* KisImage::undoAdapter() const
+{
+    return m_adapter;
+}
+
+bool KisImage::undo() const
+{
+    return (m_adapter && m_adapter->undo());
+}
+
+//KisGuideMgr *KisImage::guides() const
+//{
+//    return const_cast<KisGuideMgr*>(&m_guides);
+//}
+
+void KisImage::slotSelectionChanged()
+{
+    slotSelectionChanged(bounds());
+}
+
+void KisImage::slotSelectionChanged(const TQRect& r)
+{
+    TQRect r2(r.x() - 1, r.y() - 1, r.width() + 2, r.height() + 2);
+
+    if (!locked()) {
+        emit sigActiveSelectionChanged(this);
+        emit sigSelectionChanged(this);
+    } else {
+        m_private->selectionChangedWhileLocked = true;
+    }
+}
+
+KisColorSpace * KisImage::colorSpace() const
+{
+    return m_colorSpace;
+}
+
+void KisImage::setColorSpace(KisColorSpace * colorSpace)
+{
+    m_colorSpace = colorSpace;
+    m_rootLayer->resetProjection();
+    emit sigColorSpaceChanged(colorSpace);
+}
+
+void KisImage::setRootLayer(KisGroupLayerSP rootLayer)
+{
+    disconnect(m_rootLayer, TQT_SIGNAL(sigDirty(TQRect)), this, TQT_SIGNAL(sigImageUpdated(TQRect)));
+
+    m_rootLayer = rootLayer;
+
+    if (!locked()) {
+        connect(m_rootLayer, TQT_SIGNAL(sigDirty(TQRect)), this, TQT_SIGNAL(sigImageUpdated(TQRect)));
+    }
+    activate(m_rootLayer->firstChild());
+}
+
+void KisImage::addAnnotation(KisAnnotationSP annotation)
+{
+    // Find the icc annotation, if there is one
+    vKisAnnotationSP_it it = m_annotations.begin();
+    while (it != m_annotations.end()) {
+        if ((*it)->type() == annotation->type()) {
+            *it = annotation;
+            return;
+        }
+        ++it;
+    }
+    m_annotations.push_back(annotation);
+}
+
+KisAnnotationSP KisImage::annotation(TQString type)
+{
+    vKisAnnotationSP_it it = m_annotations.begin();
+    while (it != m_annotations.end()) {
+        if ((*it)->type() == type) {
+            return *it;
+        }
+        ++it;
+    }
+    return 0;
+}
+
+void KisImage::removeAnnotation(TQString type)
+{
+    vKisAnnotationSP_it it = m_annotations.begin();
+    while (it != m_annotations.end()) {
+        if ((*it)->type() == type) {
+            m_annotations.erase(it);
+            return;
+        }
+        ++it;
+    }
+}
+
+vKisAnnotationSP_it KisImage::beginAnnotations()
+{
+    KisProfile * profile = colorSpace()->getProfile();
+    KisAnnotationSP annotation;
+
+    if (profile)
+        annotation =  profile->annotation();
+
+    if (annotation)
+         addAnnotation(annotation);
+    else
+        removeAnnotation("icc");
+
+    return m_annotations.begin();
+}
+
+vKisAnnotationSP_it KisImage::endAnnotations()
+{
+    return m_annotations.end();
+}
+
+KisBackgroundSP KisImage::background() const
+{
+    return m_bkg;
+}
+
+KisPerspectiveGrid* KisImage::perspectiveGrid()
+{
+    return m_private->perspectiveGrid;
+}
+
+#include "kis_image.moc"
+
diff --git a/chalk/core/kis_image.h b/chalk/core/kis_image.h
new file mode 100644
index 000000000..4db23d3c6
--- /dev/null
+++ b/chalk/core/kis_image.h
@@ -0,0 +1,461 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *                2006 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_IMAGE_H_
+#define KIS_IMAGE_H_
+
+#include <tqobject.h>
+#include <tqstring.h>
+#include <tqvaluevector.h>
+#include <tqmutex.h>
+
+#include <config.h>
+
+#include <ksharedptr.h>
+#include <kurl.h>
+
+#include "KoUnit.h"
+
+#include "kis_composite_op.h"
+#include "kis_global.h"
+#include "kis_types.h"
+#include "kis_annotation.h"
+#include "kis_paint_device.h"
+
+#include <koffice_export.h>
+
+
+class DCOPObject;
+class KCommand;
+
+class KoCommandHistory;
+
+class KisColorSpace;
+class KisNameServer;
+class KisUndoAdapter;
+class KisPainter;
+class KCommand;
+class KisColor;
+class KisFilterStrategy;
+class KisImageIface;
+class KisProfile;
+class KisProgressDisplayInterface;
+class KisPaintLayer;
+class KisPerspectiveGrid;
+
+class KRITACORE_EXPORT KisImage : public TQObject, public KShared {
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    KisImage(KisUndoAdapter * adapter, TQ_INT32 width, TQ_INT32 height, KisColorSpace * colorSpace, const TQString& name);
+    KisImage(const KisImage& rhs);
+    virtual ~KisImage();
+    virtual DCOPObject *dcopObject();
+
+public:
+    typedef enum enumPaintFlags {
+        PAINT_IMAGE_ONLY = 0,
+        PAINT_BACKGROUND = 1,
+        PAINT_SELECTION = 2,
+        PAINT_MASKINACTIVELAYERS = 4,
+        PAINT_EMBEDDED_RECT = 8 // If the current layer is an embedded part draw a rect around it
+    } PaintFlags;
+
+    /// Paint the specified rect onto the painter, adjusting the colors using the
+    /// given profile. The exposure setting is used if the image has a high dynamic range.
+    virtual void renderToPainter(TQ_INT32 x1,
+                    TQ_INT32 y1,
+                    TQ_INT32 x2,
+                    TQ_INT32 y2,
+                    TQPainter &painter,
+                    KisProfile *profile,
+                    PaintFlags paintFlags,
+                    float exposure = 0.0f);
+    /**
+    * Render the projection onto a TQImage. In contrast with the above method, the
+    * selection is not rendered.
+    */
+    virtual TQImage convertToTQImage(TQ_INT32 x1,
+                                    TQ_INT32 y1,
+                                    TQ_INT32 x2,
+                                    TQ_INT32 y2,
+                                    KisProfile * profile,
+                                    float exposure = 0.0f);
+
+    virtual TQImage convertToTQImage(const TQRect& r, const TQSize& fullImageSize, KisProfile *profile, PaintFlags paintFlags, float exposure = 0.0f);
+
+    KisBackgroundSP background() const;
+    KisSubstrateSP substrate() const;
+    
+
+public:
+
+    /**
+    * Lock the image to make sure no recompositing-causing signals get emitted
+    * while you're messing with the layers. Don't forget to unlock again.
+    */
+    void lock();
+
+    /**
+    * Unlock the image to make sure the rest of Chalk learns about changes in the image
+    * again. If the rootLayer is dirty on unlocking, an imgUpdated signal is sent out
+    * immediately.
+    */
+    void unlock();
+
+    /**
+    * Returns true if the image is locked.
+    */
+    bool locked() const;
+
+    KisColor backgroundColor() const;
+    void setBackgroundColor(const KisColor & color);
+
+    TQString name() const;
+    void setName(const TQString& name);
+
+    TQString description() const;
+    void setDescription(const TQString& description);
+
+    TQString nextLayerName() const;
+    void rollBackLayerName();
+    
+    KisPerspectiveGrid* perspectiveGrid();
+    void createPerspectiveGrid(TQPoint topLeft, TQPoint topRight, TQPoint bottomRight, TQPoint bottomLeft);
+    /**
+    * Resize the image to the specified width and height. The resize
+    * method handles the creating on an undo step itself.
+    *
+    * @param w the new width of the image
+    * @param h the new height of the image
+    * @param x the x position of the crop on all layer if cropLayers is true
+    * @param y the y position of the crop on all layer if cropLayers is true
+    * @param cropLayers if true, all layers are cropped to the new size.
+    */
+    void resize(TQ_INT32 w, TQ_INT32 h, TQ_INT32 x = 0, TQ_INT32 y = 0,  bool cropLayers = false);
+
+    /**
+    * Resize the image to the specified width and height. The resize
+    * method handles the creating on an undo step itself.
+    *
+    * @param rc the rect describing the new width and height of the image
+    * @param cropLayers if true, all layers are cropped to the new rect
+    */
+    void resize(const TQRect& rc, bool cropLayers = false);
+
+    void scale(double sx, double sy, KisProgressDisplayInterface *m_progress, KisFilterStrategy *filterStrategy);
+    void rotate(double radians, KisProgressDisplayInterface *m_progress);
+    void shear(double angleX, double angleY, KisProgressDisplayInterface *m_progress);
+
+    /**
+    * Convert the image and all its layers to the dstColorSpace
+    */
+    void convertTo(KisColorSpace * dstColorSpace, TQ_INT32 renderingIntent = INTENT_PERCEPTUAL);
+
+    // Get the profile associated with this image
+    KisProfile *  getProfile() const;
+
+    /**
+    * Set the profile of the image to the new profile and do the same for
+    * all layers that have the same colorspace and profile as the image.
+    * It doesn't do any pixel conversion.
+    *
+    * This is essential if you have loaded an image that didn't
+    * have an embedded profile to which you want to attach the right profile.
+    */
+
+    void setProfile(const KisProfile * profile);
+
+    /**
+    * Replace the current undo adapter with the specified undo adapter.
+    * The current undo adapter will _not_ be deleted.
+    */
+    void setUndoAdapter(KisUndoAdapter * undoAdapter);
+
+    /**
+    * Returns the current undo adapter. You can add new commands to the
+    * undo stack using the adapter
+    */
+    KisUndoAdapter *undoAdapter() const;
+
+    /**
+    * Returns true if this image wants undo information, false otherwise
+    */
+    bool undo() const;
+    /**
+    * Tell the image it's modified; this emits the sigImageModified signal. This happens
+    *  when the image needs to be saved
+    */
+    void setModified();
+
+    KisColorSpace * colorSpace() const;
+
+    // Resolution of the image == XXX: per inch?
+    double xRes();
+    double yRes();
+    void setResolution(double xres, double yres);
+
+    TQ_INT32 width() const;
+    TQ_INT32 height() const;
+
+    bool empty() const;
+
+    /**
+    *  returns a paintdevice that contains the merged layers of this image, within
+    * the bounds of this image (with the colorspace and profile of this image)
+    */
+    KisPaintDeviceSP mergedImage();
+
+    /*
+    * Returns the colour of the merged image at pixel (x, y).
+    */
+    KisColor mergedPixel(TQ_INT32 x, TQ_INT32 y);
+
+    /// Creates a new paint layer with the specified properties, adds it to the image, and returns it.
+    KisLayerSP newLayer(const TQString& name, TQ_UINT8 opacity,
+                            const KisCompositeOp& compositeOp = KisCompositeOp(), KisColorSpace * colorstrategy = 0);
+
+    /// Get the active painting device. Returns 0 if the active layer does not have a paint device.
+    KisPaintDeviceSP activeDevice();
+
+    void setLayerProperties(KisLayerSP layer, TQ_UINT8 opacity, const KisCompositeOp& compositeOp, const TQString& name);
+
+    KisGroupLayerSP rootLayer() const;
+    KisLayerSP activeLayer() const;
+
+    /// Return the projection; that is, the complete, composited representation
+    /// of this image.
+    KisPaintDeviceSP projection();
+    
+    KisLayerSP activate(KisLayerSP layer);
+    KisLayerSP findLayer(const TQString& name) const;
+    KisLayerSP findLayer(int id) const;
+
+    /// Move layer to specified position
+    bool moveLayer(KisLayerSP layer, KisGroupLayerSP tqparent, KisLayerSP aboveThis);
+
+    /**
+    * Add an already existing layer to the image. The layer is put on top
+    * of the layers in the specified layergroup
+    * @param layer the layer to be added
+    * @param tqparent the tqparent layer
+    */
+    bool addLayer(KisLayerSP layer, KisGroupLayerSP tqparent);
+    
+    /**
+    * Add already existing layer to image.
+    *
+    * @param layer the layer to be added
+    * @param tqparent the tqparent layer
+    * @param aboveThis in the list with child layers of the specified
+    *                  tqparent, add this layer above the specified sibling.
+    *                  if 0, the layer is put in the lowermost position in
+    *                  its group.
+    * @param notify If true, the image is immediately recomposited, if false,
+    *               no recomposition is done yet. The added layer is all
+    *
+    * returns false if adding the layer didn't work, true if the layer got added
+    */
+    bool addLayer(KisLayerSP layer, KisGroupLayerSP tqparent, KisLayerSP aboveThis);
+
+    /// Remove layer
+    bool removeLayer(KisLayerSP layer);
+
+    /// Move layer up one slot
+    bool raiseLayer(KisLayerSP layer);
+
+    /// Move layer down one slot
+    bool lowerLayer(KisLayerSP layer);
+
+    /// Move layer to top slot
+    bool toTop(KisLayerSP layer);
+
+    /// Move layer to bottom slot
+    bool toBottom(KisLayerSP layer);
+
+    TQ_INT32 nlayers() const;
+    TQ_INT32 nHiddenLayers() const;
+
+    KCommand *raiseLayerCommand(KisLayerSP layer);
+    KCommand *lowerLayerCommand(KisLayerSP layer);
+    KCommand *topLayerCommand(KisLayerSP layer);
+    KCommand *bottomLayerCommand(KisLayerSP layer);
+
+    /**
+    * Merge all visible layers and discard hidden ones.
+    * The resulting layer will be activated.
+    */
+    void flatten();
+
+    /**
+    * Merge the specified layer with the layer
+    * below this layer, remove the specified layer.
+    */
+    void mergeLayer(KisLayerSP l);
+
+    TQRect bounds() const;
+
+    /// use if the layers have changed _completely_ (eg. when flattening)
+    void notifyLayersChanged();
+
+    void notifyPropertyChanged(KisLayerSP layer);
+
+    void notifyImageLoaded();
+
+    void notifyLayerUpdated(KisLayerSP layer, TQRect rc);
+
+    void setColorSpace(KisColorSpace * colorSpace);
+    void setRootLayer(KisGroupLayerSP rootLayer);
+
+    //KisGuideMgr *guides() const;
+
+    /**
+    * Add an annotation for this image. This can be anything: Gamma, EXIF, etc.
+    * Note that the "icc" annotation is reserved for the colour strategies.
+    * If the annotation already exists, overwrite it with this one.
+    */
+    void addAnnotation(KisAnnotationSP annotation);
+
+    /** get the annotation with the given type, can return 0 */
+    KisAnnotationSP annotation(TQString type);
+
+    /** delete the annotation, if the image contains it */
+    void removeAnnotation(TQString type);
+
+    /**
+    * Start of an iteration over the annotations of this image (including the ICC Profile)
+    */
+    vKisAnnotationSP_it beginAnnotations();
+
+    /** end of an iteration over the annotations of this image */
+    vKisAnnotationSP_it endAnnotations();
+
+signals:
+
+    void sigActiveSelectionChanged(KisImageSP image);
+    void sigSelectionChanged(KisImageSP image);
+    void sigSelectionChanged(KisImageSP image, const TQRect& rect);
+
+    /// Emitted after a different layer is made active.
+    void sigLayerActivated(KisLayerSP layer);
+
+    /// Emitted after a layer is added: you can find out where by asking it for its tqparent(), et al.
+    void sigLayerAdded(KisLayerSP layer);
+
+    /** Emitted after a layer is removed.
+        It's no longer in the image, but still exists, so @p layer is valid.
+
+        @param layer the removed layer
+        @param tqparent the tqparent of the layer, before it was removed
+        @param wasAboveThis the layer it was above, before it was removed.
+    */
+    void sigLayerRemoved(KisLayerSP layer, KisGroupLayerSP wasParent, KisLayerSP wasAboveThis);
+
+    /** Emitted after a layer is moved to a different position under its tqparent layer, or its tqparent changes.
+
+        @param previousParent the tqparent of the layer, before it was moved
+        @param wasAboveThis the layer it was above, before it was moved.
+    */
+    void sigLayerMoved(KisLayerSP layer, KisGroupLayerSP previousParent, KisLayerSP wasAboveThis);
+
+    /// Emitted after a layer's properties (visible, locked, opacity, composite op, name, ...) change
+    void sigLayerPropertiesChanged(KisLayerSP layer);
+
+    /** Emitted when the list of layers has changed completely.
+        This means e.g. when the image is flattened, but not when it is rotated,
+        as the layers only change internally then.
+    */
+    void sigLayersChanged(KisGroupLayerSP rootLayer);
+
+    /**
+    * Emitted whenever an action has caused the image to be recomposited. This happens
+    * after calls to recomposite().
+    *
+    * @param rc The rect that has been recomposited.
+    */
+    void sigImageUpdated(TQRect rc);
+
+    /**
+    * Emitted whenever a layer is modified.
+    *
+    * @param layer The layer that has been modified.
+    * @param rc The rectangle that has been modified.
+    */
+    void sigLayerUpdated(KisLayerSP layer, TQRect rc);
+
+    /**
+    * Emitted whenever the image has been modified, so that it doesn't match with the version saved on disk.
+    */
+    void sigImageModified();
+
+    void sigSizeChanged(TQ_INT32 w, TQ_INT32 h);
+    void sigProfileChanged(KisProfile *  profile);
+    void sigColorSpaceChanged(KisColorSpace*  cs);
+
+
+    /// Emitted when any layer's tqmask info got updated (or when the current layer changes)
+    void sigMaskInfoChanged();
+public slots:
+    void slotSelectionChanged();
+    void slotSelectionChanged(const TQRect& r);
+
+
+private:
+    KisImage& operator=(const KisImage& rhs);
+    void init(KisUndoAdapter * adapter, TQ_INT32 width, TQ_INT32 height,  KisColorSpace * colorSpace, const TQString& name);
+    void emitSizeChanged();
+
+private:
+
+    KURL m_uri;
+    TQString m_name;
+    TQString m_description;
+
+    TQ_INT32 m_width;
+    TQ_INT32 m_height;
+
+    double m_xres;
+    double m_yres;
+
+    KoUnit::Unit m_unit;
+
+    KisColorSpace * m_colorSpace;
+
+    bool m_dirty;
+    TQRect m_dirtyRect;
+
+    KisBackgroundSP m_bkg;
+
+    KisGroupLayerSP m_rootLayer; // The layers are contained in here
+    KisLayerSP m_activeLayer;
+
+    KisNameServer *m_nserver;
+    KisUndoAdapter *m_adapter;
+    //KisGuideMgr m_guides;
+
+    DCOPObject *m_dcop;
+
+    vKisAnnotationSP m_annotations;
+
+    class KisImagePrivate;
+    KisImagePrivate * m_private;
+    
+};
+
+#endif // KIS_IMAGE_H_
diff --git a/chalk/core/kis_image_iface.cc b/chalk/core/kis_image_iface.cc
new file mode 100644
index 000000000..a52cc8a45
--- /dev/null
+++ b/chalk/core/kis_image_iface.cc
@@ -0,0 +1,97 @@
+/*
+ *  This file is part of the KDE project
+ *
+ *  Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#include <kapplication.h>
+
+#include "kis_image_iface.h"
+#include "kis_types.h"
+#include "kis_image.h"
+#include "kis_paint_device.h"
+#include "kis_paint_device_iface.h"
+#include <dcopclient.h>
+
+KisImageIface::KisImageIface( KisImage * img )
+    : DCOPObject(img->name().utf8())
+{
+    m_img = img;
+}
+
+int KisImageIface::height() const
+{
+    return m_img->height();
+}
+
+int KisImageIface::width() const
+{
+    return m_img->width();
+}
+
+void KisImageIface::setName(const TQString& name)
+{
+    m_img->setName( name );
+}
+
+void KisImageIface::rotateCCW()
+{
+    // XXX: Add progress display if there is a view
+    m_img->rotate(270, 0);
+}
+
+void KisImageIface::rotateCW()
+{
+    // XXX: Add progressdisplay if there is a view
+    m_img->rotate(90, 0);
+}
+
+void KisImageIface::rotate180()
+{
+    // XXX: Add progressdisplay if there is a view
+    m_img->rotate(180, 0);
+}
+
+void KisImageIface::rotate(double angle)
+{
+    // XXX: Add progressdisplay if there is a view
+    angle *= M_PI/180;
+    m_img->rotate(angle, 0);
+}
+
+DCOPRef KisImageIface::activeDevice()
+{
+    KisPaintDeviceSP dev = m_img->activeDevice();
+
+    if( !dev )
+        return DCOPRef();
+    else
+        return DCOPRef( kapp->dcopClient()->appId(),
+                        dev->dcopObject()->objId(),
+                        "KisPaintDeviceIface");
+
+}
+
+DCOPRef KisImageIface::colorSpace() const
+{
+    KisColorSpace * cs = m_img->colorSpace();
+    if ( !cs )
+        return DCOPRef();
+    else
+        return DCOPRef( kapp->dcopClient()->appId(),
+                        cs->dcopObject()->objId(),
+                        "KisColorSpaceIface" );
+}
diff --git a/chalk/core/kis_image_iface.h b/chalk/core/kis_image_iface.h
new file mode 100644
index 000000000..acf36738e
--- /dev/null
+++ b/chalk/core/kis_image_iface.h
@@ -0,0 +1,65 @@
+/*
+ * This file is part of the KDE project
+ *  Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_IMAGE_IFACE_H
+#define KIS_IMAGE_IFACE_H
+
+#include <dcopref.h>
+#include <dcopobject.h>
+
+
+#include <tqstring.h>
+
+class KisImage;
+class KisPaintDeviceIface;
+
+class KisImageIface : virtual public DCOPObject
+{
+    K_DCOP
+public:
+    KisImageIface( KisImage *img_ );
+k_dcop:
+
+    int height() const;
+    int width() const;
+
+    void setName(const TQString& name);
+
+    void rotateCCW();
+    void rotateCW();
+    void rotate180();
+    void rotate(double angle);
+
+    /**
+     * Get the active painting device.
+     */
+    DCOPRef activeDevice();
+
+    /**
+     * Get the colorspace of this image
+     */
+    DCOPRef colorSpace() const;
+
+
+private:
+
+    KisImage *m_img;
+};
+
+#endif
diff --git a/chalk/core/kis_imagepipe_brush.cc b/chalk/core/kis_imagepipe_brush.cc
new file mode 100644
index 000000000..5cef04d69
--- /dev/null
+++ b/chalk/core/kis_imagepipe_brush.cc
@@ -0,0 +1,456 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <math.h>
+
+#include <netinet/in.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include <tqimage.h>
+#include <tqpoint.h>
+#include <tqvaluevector.h>
+#include <tqfile.h>
+#include <tqregexp.h>
+#include <tqstringlist.h>
+#include <tqtextstream.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+#include <kapplication.h>
+
+#include "kis_global.h"
+#include "kis_paint_device.h"
+#include "kis_imagepipe_brush.h"
+#include "kis_brush.h"
+#include "kis_alpha_mask.h"
+#include "kis_layer.h"
+#include "kis_meta_registry.h"
+#include "kis_colorspace_factory_registry.h"
+
+
+KisPipeBrushParasite::KisPipeBrushParasite(const TQString& source)
+{
+    needsMovement = false;
+    TQRegExp basicSplitter(" ", true);
+    TQRegExp parasiteSplitter(":", true);
+    TQStringList parasites = TQStringList::split(basicSplitter, source);
+    for (uint i = 0; i < parasites.count(); i++) {
+        TQStringList splitted = TQStringList::split(parasiteSplitter, *parasites.at(i));
+        if (splitted.count() != 2) {
+            kdWarning(41001) << "Wrong count for this parasite key/value:" << *parasites.at(i) << endl;
+            continue;
+        }
+        TQString index = *splitted.at(0);
+        if (index == "dim") {
+            dim = (*splitted.at(1)).toInt();
+            if (dim < 1 || dim > MaxDim) {
+                dim = 1;
+            }
+        } else if (index.startsWith("sel")) {
+            int selIndex = index.mid(strlen("sel")).toInt();
+            if (selIndex >= 0 && selIndex < dim) {
+                TQString selectionMode = *splitted.at(1);
+                if (selectionMode == "incremental")
+                    selection[selIndex] = Incremental;
+                else if (selectionMode == "angular") {
+                    selection[selIndex] = Angular;
+                    needsMovement = true;
+                } else if (selectionMode == "random")
+                    selection[selIndex] = Random;
+                else if (selectionMode == "pressure")
+                    selection[selIndex] = Pressure;
+                else if (selectionMode == "xtilt")
+                    selection[selIndex] = TiltX;
+                else if (selectionMode == "ytilt")
+                    selection[selIndex] = TiltY;
+                else
+                    selection[selIndex] = Constant;
+            } else {
+                kdWarning(41001)<< "Sel: wrong index: " << selIndex << "(dim = " << dim << ")" << endl;
+            }
+        } else if (index.startsWith("rank")) {
+            int rankIndex = index.mid(strlen("rank")).toInt();
+            if (rankIndex < 0 || rankIndex > dim) {
+                kdWarning(41001) << "Rankindex out of range: " << rankIndex << endl;
+                continue;
+            }
+            rank[rankIndex] = (*splitted.at(1)).toInt();
+        } else if (index == "ncells") {
+            ncells = (*splitted.at(1)).toInt();
+            if (ncells < 1 ) {
+                kdWarning(41001) << "ncells out of range: " << ncells << endl;
+                ncells = 1;
+            }
+        }
+    }
+
+    for (int i = 0; i < dim; i++) {
+        index[i] = 0;
+    }
+
+    setBrushesCount();
+}
+
+void KisPipeBrushParasite::setBrushesCount() {
+    // I assume ncells is correct. If it isn't, complain to the parasite header.
+    brushesCount[0] = ncells / rank[0];
+    for (int i = 1; i < dim; i++) {
+        brushesCount[i] = brushesCount[i-1] / rank[i];
+    }
+}
+
+bool KisPipeBrushParasite::saveToDevice(TQIODevice* dev) const {
+    // write out something like
+    // <count> ncells:<count> dim:<dim> rank0:<rank0> sel0:<sel0> <...>
+
+    TQTextStream stream(dev);
+    /// FIXME things like step, placement and so are not added (nor loaded, as a matter of fact)
+    stream << ncells << " ncells:" << ncells << " dim:" << dim;
+
+    for (int i = 0; i < dim; i++) {
+        stream << " rank" << i << ":" << rank[i] << " sel" << i << ":";
+        switch (selection[i]) {
+            case Constant: stream << "constant"; break;
+            case Incremental: stream << "incremental"; break;
+            case Angular: stream << "angular"; break;
+            case Velocity: stream << "velocity"; break;
+            case Random: stream << "random"; break;
+            case Pressure: stream << "pressure"; break;
+            case TiltX: stream << "xtilt"; break;
+            case TiltY: stream << "ytilt"; break;
+        }
+    }
+
+    return true;
+}
+
+KisImagePipeBrush::KisImagePipeBrush(const TQString& filename) : super(filename)
+{
+    m_brushType = INVALID;
+    m_numOfBrushes = 0;
+    m_currentBrush = 0;
+}
+
+KisImagePipeBrush::KisImagePipeBrush(const TQString& name, int w, int h,
+                                     TQValueVector< TQValueVector<KisPaintDevice*> > devices,
+                                     TQValueVector<KisPipeBrushParasite::SelectionMode> modes)
+    : super("")
+{
+    Q_ASSERT(devices.count() == modes.count());
+    Q_ASSERT(devices.count() > 0);
+    Q_ASSERT(devices.count() < 2); // XXX Multidimensionals not supported yet, change to MaxDim!
+
+    setName(name);
+
+    m_parasite.dim = devices.count();
+    // XXX Change for multidim! :
+    m_parasite.ncells = devices.at(0).count();
+    m_parasite.rank[0] = m_parasite.ncells;
+    m_parasite.selection[0] = modes.at(0);
+    // XXX needsmovement!
+
+    m_parasite.setBrushesCount();
+
+    for (uint i = 0; i < devices.at(0).count(); i++) {
+        m_brushes.append(new KisBrush(devices.at(0).at(i), 0, 0, w, h));
+    }
+
+    setImage(m_brushes.at(0)->img());
+
+    m_brushType = PIPE_IMAGE;
+}
+
+KisImagePipeBrush::~KisImagePipeBrush()
+{
+    m_brushes.setAutoDelete(true);
+    m_brushes.clear();
+}
+
+bool KisImagePipeBrush::load()
+{
+    TQFile file(filename());
+    file.open(IO_ReadOnly);
+    m_data = file.readAll();
+    file.close();
+    return init();
+}
+
+bool KisImagePipeBrush::init()
+{
+    // XXX: this doesn't correctly load the image pipe brushes yet.
+
+    // XXX: This stuff is in utf-8, too.
+    // The first line contains the name -- this means we look until we arrive at the first newline
+    TQValueVector<char> line1;
+
+    TQ_UINT32 i = 0;
+
+    while (m_data[i] != '\n' && i < m_data.size()) {
+        line1.append(m_data[i]);
+        i++;
+    }
+    setName(i18n(TQString::fromUtf8(&line1[0], i).ascii()));
+
+    i++; // Skip past the first newline
+
+    // The second line contains the number of brushes, separated by a space from the parasite
+
+    // XXX: This stuff is in utf-8, too.
+     TQValueVector<char> line2;
+     while (m_data[i] != '\n' && i < m_data.size()) {
+        line2.append(m_data[i]);
+         i++;
+     }
+
+    TQString paramline = TQString::fromUtf8((&line2[0]), line2.size());
+    TQ_UINT32 m_numOfBrushes = paramline.left(paramline.tqfind(' ')).toUInt();
+    m_parasite = paramline.mid(paramline.tqfind(' ') + 1);
+    i++; // Skip past the second newline
+
+     TQ_UINT32 numOfBrushes = 0;
+      while (numOfBrushes < m_numOfBrushes && i < m_data.size()){
+        KisBrush * brush = new KisBrush(name() + "_" + numOfBrushes,
+                        m_data,
+                        i);
+        Q_CHECK_PTR(brush);
+
+        m_brushes.append(brush);
+
+         numOfBrushes++;
+     }
+
+    if (!m_brushes.isEmpty()) {
+        setValid(true);
+        if (m_brushes.at( 0 )->brushType() == MASK) {
+            m_brushType = PIPE_MASK;
+        }
+        else {
+            m_brushType = PIPE_IMAGE;
+        }
+        setSpacing(m_brushes.at(m_brushes.count() - 1)->spacing());
+        setWidth(m_brushes.at(0)->width());
+        setHeight(m_brushes.at(0)->height());
+    }
+
+    m_data.resize(0);
+    return true;
+}
+
+bool KisImagePipeBrush::save()
+{
+    TQFile file(filename());
+    file.open(IO_WriteOnly | IO_Truncate);
+    bool ok = saveToDevice(TQT_TQIODEVICE(&file));
+    file.close();
+    return ok;
+}
+
+bool KisImagePipeBrush::saveToDevice(TQIODevice* dev) const
+{
+    TQCString utf8Name = name().utf8(); // Names in v2 brushes are in UTF-8
+    char const* name = utf8Name.data();
+    int len = tqstrlen(name);
+
+    if (parasite().dim != 1) {
+        kdWarning(41001) << "Save to file for pipe brushes with dim != not yet supported!" << endl;
+        return false;
+    }
+
+    // Save this pipe brush: first the header, and then all individual brushes consecutively
+    // (this needs some care for when we have > 1 dimension), FIXME
+
+    // Gimp Pipe Brush header format: Name\n<number of brushes> <parasite>\n
+
+    // The name\n
+    if (dev->writeBlock(name, len) == -1)
+        return false;
+
+    if (dev->putch('\n') == -1)
+        return false;
+
+    // Write the parasite (also writes number of brushes)
+    if (!m_parasite.saveToDevice(dev))
+        return false;
+
+    if (dev->putch('\n') == -1)
+        return false;
+
+    // <gbr brushes>
+    for (uint i = 0; i < m_brushes.count(); i++)
+        if (!m_brushes.at(i)->saveToDevice(dev))
+            return false;
+
+    return true;
+}
+
+TQImage KisImagePipeBrush::img()
+{
+    if (m_brushes.isEmpty()) {
+        return 0;
+    }
+    else {
+        return m_brushes.at(0)->img();
+    }
+}
+
+KisAlphaMaskSP KisImagePipeBrush::tqmask(const KisPaintInformation& info, double subPixelX, double subPixelY) const
+{
+    if (m_brushes.isEmpty()) return 0;
+    selectNextBrush(info);
+    return m_brushes.at(m_currentBrush)->tqmask(info, subPixelX, subPixelY);
+}
+
+KisPaintDeviceSP KisImagePipeBrush::image(KisColorSpace * colorSpace, const KisPaintInformation& info, double subPixelX, double subPixelY) const
+{
+    if (m_brushes.isEmpty()) return 0;
+    selectNextBrush(info);
+    return m_brushes.at(m_currentBrush)->image(colorSpace, info, subPixelX, subPixelY);
+}
+
+void KisImagePipeBrush::setParasiteString(const TQString& parasite)
+{
+    m_parasiteString = parasite;
+    m_parasite = KisPipeBrushParasite(parasite);
+}
+
+
+enumBrushType KisImagePipeBrush::brushType() const
+{
+    if (m_brushType == PIPE_IMAGE && useColorAsMask()) {
+        return PIPE_MASK;
+    }
+    else {
+        return m_brushType;
+    }
+}
+
+bool KisImagePipeBrush::useColorAsMask() const
+{
+    if (m_brushes.count() > 0) {
+        return m_brushes.at(0)->useColorAsMask();
+    }
+    else {
+        return false;
+    }
+}
+
+void KisImagePipeBrush::setUseColorAsMask(bool useColorAsMask)
+{
+    for (uint i = 0; i < m_brushes.count(); i++) {
+        m_brushes.at(i)->setUseColorAsMask(useColorAsMask);
+    }
+}
+
+bool KisImagePipeBrush::hasColor() const
+{
+    if (m_brushes.count() > 0) {
+        return m_brushes.at(0)->hasColor();
+    }
+    else {
+        return false;
+    }
+}
+
+KisBoundary KisImagePipeBrush::boundary() {
+    Q_ASSERT(!m_brushes.isEmpty());
+    return m_brushes.at(0)->boundary();
+}
+
+void KisImagePipeBrush::selectNextBrush(const KisPaintInformation& info) const {
+    m_currentBrush = 0;
+    double angle;
+    for (int i = 0; i < m_parasite.dim; i++) {
+        int index = m_parasite.index[i];
+        switch (m_parasite.selection[i]) {
+            case KisPipeBrushParasite::Constant: break;
+            case KisPipeBrushParasite::Incremental:
+                index = (index + 1) % m_parasite.rank[i]; break;
+            case KisPipeBrushParasite::Random:
+                index = int(float(m_parasite.rank[i])*KApplication::random() / RAND_MAX); break;
+            case KisPipeBrushParasite::Pressure:
+                index = static_cast<int>(info.pressure * (m_parasite.rank[i] - 1) + 0.5); break;
+            case KisPipeBrushParasite::Angular:
+                // + M_PI_2 to be compatible with the gimp
+                angle = atan2(info.movement.y(), info.movement.x()) + M_PI_2;
+                // We need to be in the [0..2*Pi[ interval so that we can more nicely select it
+                if (angle < 0)
+                    angle += 2.0 * M_PI;
+                else if (angle > 2.0 * M_PI)
+                    angle -= 2.0 * M_PI;
+                index = static_cast<int>(angle / (2.0 * M_PI) * m_parasite.rank[i]);
+                break;
+            default:
+                kdWarning(41001) << "This parasite selectionMode has not been implemented. Reselecting"
+                        << " to Incremental" << endl;
+                m_parasite.selection[i] = KisPipeBrushParasite::Incremental;
+                index = 0;
+        }
+        m_parasite.index[i] = index;
+        m_currentBrush += m_parasite.brushesCount[i] * index;
+    }
+}
+
+bool KisImagePipeBrush::canPaintFor(const KisPaintInformation& info) {
+    if (info.movement.isNull() && m_parasite.needsMovement)
+        return false;
+    return true;
+}
+
+void KisImagePipeBrush::makeMaskImage() {
+    for (uint i = 0; i < m_brushes.count(); i++)
+        m_brushes.at(i)->makeMaskImage();
+
+    setBrushType(PIPE_MASK);
+    setUseColorAsMask(false);
+}
+
+KisImagePipeBrush* KisImagePipeBrush::clone() const {
+    // The obvious way of cloning each brush in this one doesn't work for some reason...
+
+    // XXX Multidimensionals not supported yet, change together with the constructor...
+    TQValueVector< TQValueVector<KisPaintDevice*> > devices;
+    TQValueVector<KisPipeBrushParasite::SelectionMode> modes;
+
+    devices.push_back(TQValueVector<KisPaintDevice*>());
+    modes.push_back(m_parasite.selection[0]);
+
+    for (uint i = 0; i < m_brushes.count(); i++) {
+        KisPaintDevice* pd = new KisPaintDevice(
+                KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("RGBA",""),""), "clone pd" );
+        pd->convertFromTQImage(m_brushes.at(i)->img(), "");
+        devices.at(0).append(pd);
+    }
+
+    KisImagePipeBrush* c = new KisImagePipeBrush(name(), width(), height(), devices, modes);
+    // XXX clean up devices
+
+    return c;
+}
+
+#include "kis_imagepipe_brush.moc"
+
diff --git a/chalk/core/kis_imagepipe_brush.h b/chalk/core/kis_imagepipe_brush.h
new file mode 100644
index 000000000..bc54204b6
--- /dev/null
+++ b/chalk/core/kis_imagepipe_brush.h
@@ -0,0 +1,169 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_IMAGEPIPE_BRUSH_
+#define KIS_IMAGEPIPE_BRUSH_
+
+#include <tqptrlist.h>
+#include <tqvaluelist.h>
+#include <tqvaluevector.h>
+#include <tqmap.h>
+#include <tqstring.h>
+
+#include <kio/job.h>
+
+#include "kis_resource.h"
+#include "kis_brush.h"
+#include "kis_global.h"
+
+class TQCString;
+class TQImage;
+class TQPoint;
+class TQSize;
+
+/**
+ * The parasite info that gets loaded from the terribly documented gimp pipe brush parasite.
+ * We only store data we actually use.
+ * BC: How it seems the dimension stuff interacts with rank, selectionMode and the actual
+ * selection of a brush to be drawn. So apparantly you can have at most 4 'dimensions'.
+ * Each dimension has a number of brushes, the rank. Each dimension has an associated selection
+ * mode and placement mode (which we don't use). The selection mode says us in which way
+ * which of the brushes or brush sets will be selected. In the case of a 1-dimensional pipe
+ * brush it is easy.
+ * However, when there are more dimensions it is a bit harder. You can according to the gimp
+ * source maximally use 4 dimensions. When you want to select a brush, you first go to the
+ * first dimension. Say it has a rank of 2. The code chooses one of the 2 according to the
+ * selection mode. Say we choose 2. Then the currentBrush will skip over all the brushes
+ * from the first element in dimension 1. Then in dimension we pick again from the choices
+ * we have in dimension 2. We again add the appropriate amount to currentBrush. And so on,
+ * until we have reached dimension dim. Or at least, that is how it looks like, we'll know
+ * for sure when we can test it better with >1 dim brushes and Angular selectionMode.
+ **/
+class KisPipeBrushParasite {
+public:
+    /// Set some default values
+    KisPipeBrushParasite() : ncells(0), dim(0), needsMovement(false) {
+        for (int i = 0; i < MaxDim; i++) {
+            rank[i] = index[i] = brushesCount[i] = 0;
+            selection[i] = Constant;
+        }
+    }
+    /// Initializes the brushesCount helper
+    void setBrushesCount();
+    /// Load the parasite from the source string
+    KisPipeBrushParasite(const TQString& source);
+    /**
+     * Saves a GIMP-compatible representation of this parasite to the device. Also writes the
+     * number of brushes (== ncells) (no trailing '\n') */
+    bool saveToDevice(TQIODevice* dev) const;
+
+    /** Velocity won't be supported, atm Angular and Tilt aren't either, but have chances of implementation */
+    enum SelectionMode {
+        Constant, Incremental, Angular, Velocity, Random, Pressure, TiltX, TiltY
+    };
+    enum Placement { DefaultPlacement, ConstantPlacement, RandomPlacement };
+    static int const MaxDim = 4;
+    //TQ_INT32 step;
+    TQ_INT32 ncells;
+    TQ_INT32 dim;
+    // Apparantly only used for editing a pipe brush, which we won't at the moment
+    // TQ_INT32 cols, rows;
+    // TQ_INT32 cellwidth, cellheight;
+    // Aparantly the gimp doesn't use this anymore? Anyway it is a bit weird to
+    // paint at someplace else than where your cursor displays it will...
+    //Placement placement;
+    TQ_INT32 rank[MaxDim];
+    SelectionMode selection[MaxDim];
+    /// The total count of brushes in each dimension (helper)
+    TQ_INT32 brushesCount[MaxDim];
+    /// The current index in each dimension, so that the selection modes know where to start
+    TQ_INT32 index[MaxDim];
+    /// If true, the brush won't be painted when there is no motion
+    bool needsMovement;
+};
+
+
+class KisImagePipeBrush : public KisBrush {
+    typedef KisBrush super;
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    KisImagePipeBrush(const TQString& filename);
+    /**
+     * Specialized constructor that makes a new pipe brush from a sequence of samesize
+     * devices. The fact that it's a vector of a vector, is to support multidimensional
+     * brushes (not yet supported!) */
+    KisImagePipeBrush(const TQString& name, int w, int h,
+                      TQValueVector< TQValueVector<KisPaintDevice*> > devices,
+                      TQValueVector<KisPipeBrushParasite::SelectionMode> modes);
+    virtual ~KisImagePipeBrush();
+
+    virtual bool load();
+    virtual bool save();
+    /// Will call KisBrush's saveToDevice as well
+    virtual bool saveToDevice(TQIODevice* dev) const;
+
+    /**
+      @return the next image in the pipe.
+      */
+    virtual TQImage img();
+
+    /**
+       @return the next tqmask in the pipe.
+    */
+    virtual KisAlphaMaskSP tqmask(const KisPaintInformation& info,
+                                double subPixelX = 0, double subPixelY = 0) const;
+    virtual KisPaintDeviceSP image(KisColorSpace * colorSpace, const KisPaintInformation& info,
+                             double subPixelX = 0, double subPixelY = 0) const;
+
+    virtual bool useColorAsMask() const;
+    virtual void setUseColorAsMask(bool useColorAsMask);
+    virtual bool hasColor() const;
+
+    virtual enumBrushType brushType() const;
+    
+    virtual KisBoundary boundary();
+    
+    KisPipeBrushParasite const& parasite() const { return m_parasite; }
+    
+    virtual bool canPaintFor(const KisPaintInformation& info);
+
+    virtual void makeMaskImage();
+
+    virtual KisImagePipeBrush* clone() const;
+
+private:
+    bool init();
+    void setParasiteString(const TQString& parasite);
+    void selectNextBrush(const KisPaintInformation& info) const;
+
+    TQString m_name;
+    TQString m_parasiteString; // Contains instructions on how to use the brush
+    mutable KisPipeBrushParasite m_parasite;
+    TQ_UINT32 m_numOfBrushes;
+    mutable TQ_UINT32 m_currentBrush;
+
+    TQByteArray m_data;
+    mutable TQPtrList<KisBrush> m_brushes;
+
+    enumBrushType m_brushType;
+    
+};
+
+#endif // KIS_IMAGEPIPE_BRUSH_
diff --git a/chalk/core/kis_iterator.cc b/chalk/core/kis_iterator.cc
new file mode 100644
index 000000000..0e0c2d813
--- /dev/null
+++ b/chalk/core/kis_iterator.cc
@@ -0,0 +1,142 @@
+/* This file is part of the KDE project
+ *   Copyright (c) 2004 Casper Boemann <cbr@boemann.dkt>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+
+#include <tqglobal.h>
+
+#include <kdebug.h>
+
+#include "kis_iterator.h"
+#include "kis_datamanager.h"
+#include "kis_tilediterator.h"
+
+KisRectIterator::KisRectIterator ( KisDataManager *dm, TQ_INT32  x, TQ_INT32  y, TQ_INT32  w, TQ_INT32  h, bool writable) 
+{
+    m_iter = new KisTiledRectIterator(dm, x, y, w, h, writable);
+}
+KisRectIterator::KisRectIterator(const KisRectIterator& rhs) 
+{
+    m_iter = rhs.m_iter;
+}
+
+KisRectIterator& KisRectIterator::operator=(const KisRectIterator& rhs)
+{
+    m_iter = rhs.m_iter;
+    return *this;
+}
+
+KisRectIterator::~KisRectIterator()
+{
+}
+
+TQ_UINT8 * KisRectIterator::rawData() const { return m_iter->rawData();}
+
+const TQ_UINT8 * KisRectIterator::oldRawData() const { return m_iter->oldRawData();}
+
+TQ_INT32 KisRectIterator::nConseqPixels() const { return m_iter->nConseqPixels(); }
+
+KisRectIterator & KisRectIterator::operator+=(int n) { m_iter->operator+=(n); return *this; }
+
+KisRectIterator & KisRectIterator::operator++() { m_iter->operator++(); return *this; }
+
+bool KisRectIterator::isDone()  const { return m_iter->isDone(); }
+
+TQ_INT32 KisRectIterator::x() const { return m_iter->x(); }
+TQ_INT32 KisRectIterator::y() const { return m_iter->y(); }
+
+//---------------------------------------------------------------------------------------
+
+KisHLineIterator::KisHLineIterator ( KisDataManager *dm, TQ_INT32  x, TQ_INT32 y, TQ_INT32 w, bool writable) 
+{
+    m_iter = new KisTiledHLineIterator(dm, x, y, w, writable);
+}
+
+KisHLineIterator::KisHLineIterator(const KisHLineIterator& rhs)
+{
+    m_iter = rhs.m_iter;
+}
+
+KisHLineIterator& KisHLineIterator::operator=(const KisHLineIterator& rhs)
+{ 
+
+    m_iter=rhs.m_iter; 
+    return *this; 
+}
+
+KisHLineIterator::~KisHLineIterator()
+{
+}
+
+TQ_UINT8 *KisHLineIterator::rawData() const 
+{ 
+    return m_iter->rawData();
+}
+
+const TQ_UINT8 *KisHLineIterator::oldRawData() const { return m_iter->oldRawData();}
+
+KisHLineIterator & KisHLineIterator::operator++() { m_iter->operator++(); return *this; }
+
+TQ_INT32 KisHLineIterator::nConseqHPixels() const { return m_iter->nConseqHPixels(); }
+
+KisHLineIterator & KisHLineIterator::operator+=(int n) { m_iter->operator+=(n); return *this; }
+
+KisHLineIterator & KisHLineIterator::operator--() { m_iter->operator--(); return *this; }
+
+bool KisHLineIterator::isDone()  const { return m_iter->isDone(); }
+
+TQ_INT32 KisHLineIterator::x() const { return m_iter->x(); }
+ 
+TQ_INT32 KisHLineIterator::y() const { return m_iter->y(); }
+
+void KisHLineIterator::nextRow() { m_iter->nextRow(); }
+
+//---------------------------------------------------------------------------------------
+
+KisVLineIterator::KisVLineIterator ( KisDataManager *dm, TQ_INT32  x, TQ_INT32 y, TQ_INT32  h, bool writable)
+{
+    m_iter = new KisTiledVLineIterator(dm, x, y, h, writable);
+}
+
+KisVLineIterator::KisVLineIterator(const KisVLineIterator& rhs)
+{
+    m_iter = rhs.m_iter;
+}
+
+KisVLineIterator& KisVLineIterator::operator=(const KisVLineIterator& rhs)
+{
+    m_iter = rhs.m_iter;
+    return *this; 
+}
+
+KisVLineIterator::~KisVLineIterator()
+{
+}
+
+TQ_UINT8 *KisVLineIterator::rawData() const { return m_iter->rawData();}
+
+const TQ_UINT8 * KisVLineIterator::oldRawData() const { return m_iter->oldRawData();}
+
+KisVLineIterator & KisVLineIterator::operator++() { m_iter->operator++(); return *this; }
+
+bool KisVLineIterator::isDone() const { return m_iter->isDone(); }
+
+TQ_INT32 KisVLineIterator::x() const { return m_iter->x(); }
+
+TQ_INT32 KisVLineIterator::y() const { return m_iter->y(); }
+
+void KisVLineIterator::nextCol() { return m_iter->nextCol(); }
diff --git a/chalk/core/kis_iterator.h b/chalk/core/kis_iterator.h
new file mode 100644
index 000000000..893461a56
--- /dev/null
+++ b/chalk/core/kis_iterator.h
@@ -0,0 +1,173 @@
+/* This file is part of the KDE project
+ *   Copyright (c) 2004 Casper Boemann <cbr@boemann.dkt>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+*/
+#ifndef KIS_ITERATOR_H_
+#define KIS_ITERATOR_H_
+
+#include <tqglobal.h>
+#include <ksharedptr.h>
+
+class KisTiledRectIterator;
+typedef KSharedPtr<KisTiledRectIterator> KisTiledRectIteratorSP;
+
+class KisTiledVLineIterator;
+typedef KSharedPtr<KisTiledVLineIterator> KisTiledVLineIteratorSP;
+
+class KisTiledHLineIterator;
+typedef KSharedPtr<KisTiledHLineIterator> KisTiledHLineIteratorSP;
+
+class KisDataManager;
+
+/**
+ * The KisRectIterator iterators over a rectangular area in the most efficient order. That is,
+ * there is no guarantee that the iterator will work scanline by scanline.
+ */
+class KisRectIterator
+{
+
+
+public:
+    KisRectIterator ( KisDataManager *dm, TQ_INT32  x, TQ_INT32  y, TQ_INT32  w, TQ_INT32  h, bool writable);
+
+public:
+    virtual ~KisRectIterator();
+    KisRectIterator(const KisRectIterator& rhs);
+    KisRectIterator& operator=(const KisRectIterator& rhs);
+
+
+public:
+    /// returns a pointer to the pixel data. Do NOT interpret the data - leave that to a colorstrategy
+    TQ_UINT8 * rawData() const;
+
+    /// Returns a pointer to the pixel data as it was at the moment of the last memento creation.
+    const TQ_UINT8 * oldRawData() const;
+
+    /// Returns the number of consequtive pixels that we point at
+    /// This is useful for optimizing
+    TQ_INT32 nConseqPixels() const;
+
+    /// Advances a number of pixels until it reaches the end of the rect
+    KisRectIterator & operator+=(int n);
+
+    /// Advances one pixel going to the beginning of the next line when it reaches the end of a line
+    KisRectIterator & operator++();
+
+    /// returns true when iterators has reached the end
+    bool isDone()  const;
+
+     // current x position
+     TQ_INT32 x() const;
+
+     // current y position
+     TQ_INT32 y() const;
+
+private:
+
+    KisTiledRectIteratorSP m_iter;
+};
+
+class KisHLineIterator
+{
+
+public:
+
+    KisHLineIterator ( KisDataManager *dm, TQ_INT32  x, TQ_INT32 y, TQ_INT32 w, bool writable);
+
+public:
+
+    virtual ~KisHLineIterator();
+    KisHLineIterator(const KisHLineIterator& rhs);
+    KisHLineIterator& operator=(const KisHLineIterator& rhs);
+
+public:
+    /// Returns a pointer to the pixel data. Do NOT interpret the data - leave that to a colorstrategy
+    TQ_UINT8 *rawData() const;
+
+    /// Returns a pointer to the pixel data as it was at the moment of the last memento creation.
+    const TQ_UINT8 *oldRawData() const;
+
+    /// Advances one pixel until it reaches the end of the line
+    KisHLineIterator & operator++();
+
+    /// Returns the number of consequtive horizontal pixels that we point at
+    /// This is useful for optimizing
+    TQ_INT32 nConseqHPixels() const;
+
+    /// Advances a number of pixels until it reaches the end of the line
+    KisHLineIterator & operator+=(int n);
+
+    /// Goes back one pixel until it reaches the beginning of the line
+    KisHLineIterator & operator--();
+
+    /// returns true when iterators has reached the end
+    bool isDone()  const;
+
+    /// current x position
+    TQ_INT32 x() const;
+
+    /// current y position
+    TQ_INT32 y() const;
+
+    /// increment to the next row and rewind to the begining
+    void nextRow();
+
+
+private:
+
+    KisTiledHLineIteratorSP m_iter;
+};
+
+class KisVLineIterator
+{
+
+public:
+    KisVLineIterator ( KisDataManager *dm, TQ_INT32  x, TQ_INT32 y, TQ_INT32  h, bool writable);
+public:
+    ~KisVLineIterator();
+    KisVLineIterator(const KisVLineIterator& rhs);
+    KisVLineIterator& operator=(const KisVLineIterator& rhs);
+
+public:
+    /// returns a pointer to the pixel data. Do NOT interpret the data - leave that to a colorstrategy
+    TQ_UINT8 *rawData() const;
+
+    /// Returns a pointer to the pixel data as it was at the moment of the last memento creation.
+    const TQ_UINT8 * oldRawData() const;
+
+    /// Advances one pixel until it reaches the end of the line
+    KisVLineIterator & operator++();
+
+    /// returns true when iterators has reached the end
+    bool isDone() const;
+
+    /// current x position
+    TQ_INT32 x() const;
+
+    /// current y position
+    TQ_INT32 y() const;
+    
+    /// increment to the next column and rewind to the begining
+    void nextCol();
+
+private:
+
+    KisTiledVLineIteratorSP m_iter;
+
+};
+
+#endif
diff --git a/chalk/core/kis_iteratorpixeltrait.h b/chalk/core/kis_iteratorpixeltrait.h
new file mode 100644
index 000000000..5d2c957ff
--- /dev/null
+++ b/chalk/core/kis_iteratorpixeltrait.h
@@ -0,0 +1,131 @@
+/* This file is part of the KDE project
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>, the original iteratorpixel
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>, made it into a trait
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KIS_ITERATORPIXELTRAIT_H_
+#define KIS_ITERATORPIXELTRAIT_H_
+
+#include "kis_iterator.h"
+#include <kis_paint_device.h>
+
+template< typename _iTp>
+class KisIteratorPixelTrait
+{
+public:
+    KisIteratorPixelTrait(KisPaintDevice * ndevice, _iTp *underlyingIterator)
+    :    m_device(ndevice),
+        m_underlyingIterator(underlyingIterator)
+    {
+        m_selectionIterator = NULL;
+    };
+
+    ~KisIteratorPixelTrait()
+    {
+        delete m_selectionIterator;
+    };
+
+    KisIteratorPixelTrait(const KisIteratorPixelTrait& rhs)
+    {
+        if (this == &rhs)
+            return;
+        m_device = rhs.m_device;
+        m_underlyingIterator = rhs.m_underlyingIterator;
+
+        if (rhs.m_selectionIterator) {
+            m_selectionIterator = new _iTp(*rhs.m_selectionIterator);
+        } else {
+            m_selectionIterator = 0;
+        }
+    }
+
+    KisIteratorPixelTrait& operator=(const KisIteratorPixelTrait& rhs)
+    {
+        if (this == &rhs)
+            return *this;
+        m_device = rhs.m_device;
+        m_underlyingIterator = rhs.m_underlyingIterator;
+
+        delete m_selectionIterator;
+        if (rhs.m_selectionIterator) {
+            m_selectionIterator = new _iTp(*rhs.m_selectionIterator);
+        } else {
+            m_selectionIterator = 0;
+        }
+
+        return *this;
+    }
+
+
+public:
+    /**
+     * Return one channel from the current kispixel. Does not check whether
+     * channel index actually exists in this colorspace.
+     */
+    inline TQ_UINT8 operator[](int index) const
+            { return m_underlyingIterator->rawData()[index]; };
+
+    /**
+     * Returns if the pixel is selected or not. This is much faster than first building a KisPixel
+     */
+    inline bool isSelected() const
+        {
+            if (m_selectionIterator)
+                return *(m_selectionIterator->rawData()) > SELECTION_THRESHOLD;
+            else
+                return true;
+        };
+
+    /**
+      * Returns the degree of selectedness of the pixel.
+      */
+    inline TQ_UINT8 selectedness() const
+        {
+            if (m_selectionIterator)
+                return *(m_selectionIterator->rawData());
+            else {
+                return MAX_SELECTED;
+            }
+        };
+
+    /**
+     * Returns the selectiontqmask from the current point; this is guaranteed
+     * to have the same number of consecutive pixels that the iterator has
+     * at a given point. It return a 0 if there is no selection.
+     */
+    inline TQ_UINT8 * selectionMask() const
+        {
+            if ( m_selectionIterator )
+                return m_selectionIterator->rawData();
+            else
+                return 0;
+        }
+
+
+protected:
+    KisPaintDevice *m_device;
+
+    inline void advance(int n){if (m_selectionIterator) for(int i=0; i< n; i++) ++(*m_selectionIterator);};
+    inline void retreat(){if (m_selectionIterator) --(*m_selectionIterator);};
+
+    void setSelectionIterator(_iTp *si){m_selectionIterator = si;};
+
+    _iTp *m_underlyingIterator;
+    _iTp *m_selectionIterator;
+};
+
+#endif
diff --git a/chalk/core/kis_iterators_pixel.cc b/chalk/core/kis_iterators_pixel.cc
new file mode 100644
index 000000000..3c5f1e445
--- /dev/null
+++ b/chalk/core/kis_iterators_pixel.cc
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the Chalk project
+ *
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_iterators_pixel.h"
+#include "kis_global.h"
+#include "kis_paint_device.h"
+
+KisHLineIteratorPixel::KisHLineIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable) :
+    KisHLineIterator(dm, x - offsetx, y - offsety, w, writable),
+    KisIteratorPixelTrait <KisHLineIterator> ( ndevice, this ),
+    m_offsetx(offsetx), m_offsety(offsety)
+{
+    if(sel_dm) {
+        KisHLineIterator * i = new KisHLineIterator(sel_dm, x - offsetx, y - offsety, w, false);
+        Q_CHECK_PTR(i);
+        KisIteratorPixelTrait <KisHLineIterator>::setSelectionIterator(i);
+    }
+}
+
+KisVLineIteratorPixel::KisVLineIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm, TQ_INT32 x, TQ_INT32 y, TQ_INT32 h, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable) :
+    KisVLineIterator(dm, x - offsetx, y - offsety, h, writable),
+    KisIteratorPixelTrait <KisVLineIterator> ( ndevice, this ),
+    m_offsetx(offsetx), m_offsety(offsety)
+{
+    if(sel_dm) {
+        KisVLineIterator * i = new KisVLineIterator(sel_dm, x - offsetx, y - offsety, h, false);
+        Q_CHECK_PTR(i);
+        KisIteratorPixelTrait <KisVLineIterator>::setSelectionIterator(i);
+    }
+}
+
+KisRectIteratorPixel::KisRectIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable) :
+    KisRectIterator(dm, x - offsetx, y - offsety, w, h, writable),
+    KisIteratorPixelTrait <KisRectIterator> ( ndevice, this ),
+    m_offsetx(offsetx), m_offsety(offsety)
+{
+    if(sel_dm) {
+        KisRectIterator * i = new KisRectIterator(sel_dm, x - offsetx, y - offsety, w, h, false);
+        Q_CHECK_PTR(i);
+        KisIteratorPixelTrait <KisRectIterator>::setSelectionIterator(i);
+    }
+}
diff --git a/chalk/core/kis_iterators_pixel.h b/chalk/core/kis_iterators_pixel.h
new file mode 100644
index 000000000..bd82f856e
--- /dev/null
+++ b/chalk/core/kis_iterators_pixel.h
@@ -0,0 +1,154 @@
+/* This file is part of the KDE project
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KIS_ITERATORS_PIXEL_H_
+#define KIS_ITERATORS_PIXEL_H_
+
+#include "kis_iterator.h"
+#include "kis_iteratorpixeltrait.h"
+
+/**
+ * The pixel iterators are high level iterarators. The lower level iterators merely return a pointer to some memory
+ * where a pixel begins; these iterators return KisPixels -- high-level representations of a pixel together with
+ * color model, profile and selectedness. You can access individual channels using the KisPixel [] operator, and .
+ */
+
+
+class KisHLineIteratorPixel : public KisHLineIterator, public KisIteratorPixelTrait <KisHLineIterator>
+{
+
+public:
+
+    KisHLineIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm,
+                           TQ_INT32 x , TQ_INT32 y , TQ_INT32 w, TQ_INT32 offsetx, TQ_INT32 offsety,
+                           bool writable);
+    
+    KisHLineIteratorPixel(const KisHLineIteratorPixel& rhs) : KisHLineIterator(rhs), KisIteratorPixelTrait<KisHLineIterator>(rhs)
+        { m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety; }
+        
+    KisHLineIteratorPixel& operator=(const KisHLineIteratorPixel& rhs)
+        {
+          KisHLineIterator::operator=(rhs);
+          KisIteratorPixelTrait<KisHLineIterator>::operator=(rhs);
+          m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety;
+          return *this;
+        }
+
+    inline KisHLineIteratorPixel & operator ++() { KisHLineIterator::operator++(); advance(1); return *this;}
+    inline KisHLineIteratorPixel & operator --() { KisHLineIterator::operator--(); retreat(); return *this;}
+
+    inline void nextRow() {
+      KisHLineIterator::nextRow();
+      if (m_selectionIterator) m_selectionIterator->nextRow();
+    }
+
+    /// Advances a number of pixels until it reaches the end of the line
+    KisHLineIteratorPixel & operator+=(int n) { KisHLineIterator::operator+=(n); advance(n); return *this; };
+
+    TQ_INT32 x() const { return KisHLineIterator::x() + m_offsetx; }
+    
+    TQ_INT32 y() const { return KisHLineIterator::y() + m_offsety; }
+    
+    TQ_INT32 nConseqHPixels() const {
+        if (m_selectionIterator) {
+            TQ_INT32 tqparent = KisHLineIteratorPixel::nConseqHPixels();
+            TQ_INT32 selection = m_selectionIterator->nConseqHPixels();
+            if (tqparent < selection)
+                return tqparent;
+            return selection;
+        }
+        return KisHLineIteratorPixel::nConseqHPixels();
+    }
+protected:
+
+    TQ_INT32 m_offsetx, m_offsety;
+};
+
+class KisVLineIteratorPixel : public KisVLineIterator, public KisIteratorPixelTrait <KisVLineIterator>
+{
+public:
+    KisVLineIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm,
+                           TQ_INT32 xpos , TQ_INT32 ypos , TQ_INT32 height, TQ_INT32 offsetx, TQ_INT32 offsety,
+                           bool writable);
+                           
+    KisVLineIteratorPixel(const KisVLineIteratorPixel& rhs) : KisVLineIterator(rhs), KisIteratorPixelTrait<KisVLineIterator>(rhs)
+        { m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety; }
+        
+    KisVLineIteratorPixel& operator=(const KisVLineIteratorPixel& rhs)
+        {
+          KisVLineIterator::operator=(rhs);
+          KisIteratorPixelTrait<KisVLineIterator>::operator=(rhs);
+          m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety;
+          return *this; }
+
+    inline KisVLineIteratorPixel & operator ++() { KisVLineIterator::operator++(); advance(1); return *this;}
+
+    inline void nextRow() {
+      KisVLineIterator::nextCol();
+      if (m_selectionIterator) m_selectionIterator->nextCol();
+    }
+
+    TQ_INT32 x() const { return KisVLineIterator::x() + m_offsetx; }
+    
+    TQ_INT32 y() const { return KisVLineIterator::y() + m_offsety; }
+
+protected:
+
+    TQ_INT32 m_offsetx, m_offsety;
+};
+
+class KisRectIteratorPixel : public KisRectIterator, public KisIteratorPixelTrait <KisRectIterator>
+{
+public:
+    KisRectIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm,
+                          TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, TQ_INT32 offsetx, TQ_INT32 offsety,
+                          bool writable);
+    
+    KisRectIteratorPixel(const KisRectIteratorPixel& rhs) : KisRectIterator(rhs), KisIteratorPixelTrait<KisRectIterator>(rhs)
+        { m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety; }
+        
+    KisRectIteratorPixel& operator=(const KisRectIteratorPixel& rhs)
+        {
+          KisRectIterator::operator=(rhs);
+          KisIteratorPixelTrait<KisRectIterator>::operator=(rhs);
+          m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety;
+          return *this; }
+
+    inline KisRectIteratorPixel & operator ++() { KisRectIterator::operator++(); advance(1); return *this;}
+
+    TQ_INT32 x() const { return KisRectIterator::x() + m_offsetx; }
+    
+    TQ_INT32 y() const { return KisRectIterator::y() + m_offsety; }
+
+    TQ_INT32 nConseqPixels() const {
+        if (m_selectionIterator) {
+            TQ_INT32 tqparent = KisRectIterator::nConseqPixels();
+            TQ_INT32 selection = m_selectionIterator->nConseqPixels();
+            if (tqparent < selection)
+                return tqparent;
+            return selection;
+        }
+        return KisRectIterator::nConseqPixels();
+    }
+
+protected:
+
+    TQ_INT32 m_offsetx, m_offsety;
+};
+
+#endif
diff --git a/chalk/core/kis_layer.cc b/chalk/core/kis_layer.cc
new file mode 100644
index 000000000..cac178e52
--- /dev/null
+++ b/chalk/core/kis_layer.cc
@@ -0,0 +1,611 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+
+#include <kdebug.h>
+#include <tqimage.h>
+
+#include "kis_debug_areas.h"
+#include "kis_group_layer.h"
+#include "kis_image.h"
+#include "kis_layer.h"
+#include "kis_painter.h"
+#include "kis_undo_adapter.h"
+
+namespace {
+
+    class KisLayerCommand : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        KisLayerCommand(const TQString& name, KisLayerSP layer);
+        virtual ~KisLayerCommand() {}
+
+        virtual void execute() = 0;
+        virtual void unexecute() = 0;
+
+    protected:
+        void setUndo(bool undo);
+
+        KisLayerSP m_layer;
+    };
+
+    KisLayerCommand::KisLayerCommand(const TQString& name, KisLayerSP layer) :
+        super(name), m_layer(layer)
+    {
+    }
+
+    void KisLayerCommand::setUndo(bool undo)
+    {
+        if (m_layer->undoAdapter()) {
+            m_layer->undoAdapter()->setUndo(undo);
+        }
+    }
+
+    class KisLayerLockedCommand : public KisLayerCommand {
+        typedef KisLayerCommand super;
+
+    public:
+        KisLayerLockedCommand(KisLayerSP layer, bool newLocked);
+
+        virtual void execute();
+        virtual void unexecute();
+
+    private:
+        bool m_newLocked;
+    };
+
+    KisLayerLockedCommand::KisLayerLockedCommand(KisLayerSP layer, bool newLocked) :
+        super(i18n("Lock Layer"), layer)
+    {
+        m_newLocked = newLocked;
+    }
+
+    void KisLayerLockedCommand::execute()
+    {
+        setUndo(false);
+        m_layer->setLocked(m_newLocked);
+        setUndo(true);
+    }
+
+    void KisLayerLockedCommand::unexecute()
+    {
+        setUndo(false);
+        m_layer->setLocked(!m_newLocked);
+        setUndo(true);
+    }
+
+    class KisLayerOpacityCommand : public KisLayerCommand {
+        typedef KisLayerCommand super;
+
+    public:
+        KisLayerOpacityCommand(KisLayerSP layer, TQ_UINT8 oldOpacity, TQ_UINT8 newOpacity);
+
+        virtual void execute();
+        virtual void unexecute();
+
+    private:
+        TQ_UINT8 m_oldOpacity;
+        TQ_UINT8 m_newOpacity;
+    };
+
+    KisLayerOpacityCommand::KisLayerOpacityCommand(KisLayerSP layer, TQ_UINT8 oldOpacity, TQ_UINT8 newOpacity) :
+        super(i18n("Layer Opacity"), layer)
+    {
+        m_oldOpacity = oldOpacity;
+        m_newOpacity = newOpacity;
+    }
+
+    void KisLayerOpacityCommand::execute()
+    {
+        setUndo(false);
+        m_layer->setOpacity(m_newOpacity);
+        setUndo(true);
+    }
+
+    void KisLayerOpacityCommand::unexecute()
+    {
+        setUndo(false);
+        m_layer->setOpacity(m_oldOpacity);
+        setUndo(true);
+    }
+
+    class KisLayerVisibilityCommand : public KisLayerCommand {
+        typedef KisLayerCommand super;
+
+    public:
+        KisLayerVisibilityCommand(KisLayerSP layer, bool newVisibility);
+
+        virtual void execute();
+        virtual void unexecute();
+
+    private:
+        bool m_newVisibility;
+    };
+
+    KisLayerVisibilityCommand::KisLayerVisibilityCommand(KisLayerSP layer, bool newVisibility) :
+        super(i18n("Layer Visibility"), layer)
+    {
+        m_newVisibility = newVisibility;
+    }
+
+    void KisLayerVisibilityCommand::execute()
+    {
+        setUndo(false);
+        m_layer->setVisible(m_newVisibility);
+        setUndo(true);
+    }
+
+    void KisLayerVisibilityCommand::unexecute()
+    {
+        setUndo(false);
+        m_layer->setVisible(!m_newVisibility);
+        setUndo(true);
+    }
+
+    class KisLayerCompositeOpCommand : public KisLayerCommand {
+        typedef KisLayerCommand super;
+
+    public:
+        KisLayerCompositeOpCommand(KisLayerSP layer, const KisCompositeOp& oldCompositeOp, const KisCompositeOp& newCompositeOp);
+
+        virtual void execute();
+        virtual void unexecute();
+
+    private:
+        KisCompositeOp m_oldCompositeOp;
+        KisCompositeOp m_newCompositeOp;
+    };
+
+    KisLayerCompositeOpCommand::KisLayerCompositeOpCommand(KisLayerSP layer, const KisCompositeOp& oldCompositeOp,
+                                       const KisCompositeOp& newCompositeOp) :
+        super(i18n("Layer Composite Mode"), layer)
+    {
+        m_oldCompositeOp = oldCompositeOp;
+        m_newCompositeOp = newCompositeOp;
+    }
+
+    void KisLayerCompositeOpCommand::execute()
+    {
+        setUndo(false);
+        m_layer->setCompositeOp(m_newCompositeOp);
+        setUndo(true);
+    }
+
+    void KisLayerCompositeOpCommand::unexecute()
+    {
+        setUndo(false);
+        m_layer->setCompositeOp(m_oldCompositeOp);
+        setUndo(true);
+    }
+
+    class KisLayerOffsetCommand : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        KisLayerOffsetCommand(KisLayerSP layer, const TQPoint& oldpos, const TQPoint& newpos);
+        virtual ~KisLayerOffsetCommand();
+
+        virtual void execute();
+        virtual void unexecute();
+
+    private:
+        void moveTo(const TQPoint& pos);
+
+    private:
+        KisLayerSP m_layer;
+        TQRect m_updateRect;
+        TQPoint m_oldPos;
+        TQPoint m_newPos;
+    };
+
+    KisLayerOffsetCommand::KisLayerOffsetCommand(KisLayerSP layer, const TQPoint& oldpos, const TQPoint& newpos) :
+        super(i18n("Move Layer"))
+    {
+        m_layer = layer;
+        m_oldPos = oldpos;
+        m_newPos = newpos;
+
+        TQRect currentBounds = m_layer->exactBounds();
+        TQRect oldBounds = currentBounds;
+        oldBounds.moveBy(oldpos.x() - newpos.x(), oldpos.y() - newpos.y());
+
+        m_updateRect = currentBounds | oldBounds;
+    }
+
+    KisLayerOffsetCommand::~KisLayerOffsetCommand()
+    {
+    }
+
+    void KisLayerOffsetCommand::execute()
+    {
+        moveTo(m_newPos);
+    }
+
+    void KisLayerOffsetCommand::unexecute()
+    {
+        moveTo(m_oldPos);
+    }
+
+    void KisLayerOffsetCommand::moveTo(const TQPoint& pos)
+    {
+        if (m_layer->undoAdapter()) {
+            m_layer->undoAdapter()->setUndo(false);
+        }
+
+        m_layer->setX(pos.x());
+        m_layer->setY(pos.y());
+
+        m_layer->setDirty(m_updateRect);
+
+        if (m_layer->undoAdapter()) {
+            m_layer->undoAdapter()->setUndo(true);
+        }
+    }
+}
+
+static int getID()
+{
+    static int id = 1;
+    return id++;
+}
+
+
+KisLayer::KisLayer(KisImage *img, const TQString &name, TQ_UINT8 opacity) :
+    TQObject(0, name.latin1()),
+    KShared(),
+    m_id(getID()),
+    m_index(-1),
+    m_opacity(opacity),
+    m_locked(false),
+    m_visible(true),
+    m_temporary(false),
+    m_name(name),
+    m_parent(0),
+    m_image(img),
+    m_compositeOp(COMPOSITE_OVER)
+{
+}
+
+KisLayer::KisLayer(const KisLayer& rhs) :
+    TQObject(),
+    KShared(rhs)
+{
+    if (this != &rhs) {
+        m_id = getID();
+        m_index = -1;
+        m_opacity = rhs.m_opacity;
+        m_locked = rhs.m_locked;
+        m_visible = rhs.m_visible;
+        m_temporary = rhs.m_temporary;
+        m_dirtyRect = rhs.m_dirtyRect;
+        m_name = rhs.m_name;
+        m_image = rhs.m_image;
+        m_parent = 0;
+        m_compositeOp = rhs.m_compositeOp;
+    }
+}
+
+KisLayer::~KisLayer()
+{
+}
+
+void KisLayer::setClean(const TQRect & rect)
+{
+    if (m_dirtyRect.isValid() && rect.isValid()) {
+
+        // XXX: We should only set the parts clean that were actually cleaned. However, extent and exactBounds conspire
+        // to make that very hard atm.
+        //if (rect.tqcontains(m_dirtyRect)) m_dirtyRect = TQRect();
+        m_dirtyRect = TQRect();
+    }
+
+}
+
+bool KisLayer::dirty()
+{
+    return m_dirtyRect.isValid();
+}
+
+
+bool KisLayer::dirty(const TQRect & rc)
+{
+    if (!m_dirtyRect.isValid() || !rc.isValid()) return false;
+
+    return rc.intersects(m_dirtyRect);
+}
+
+TQRect KisLayer::dirtyRect() const
+{
+    return m_dirtyRect;
+}
+
+void KisLayer::setDirty(bool propagate)
+{
+    TQRect rc = extent();
+
+    if (rc.isValid()) m_dirtyRect = rc;
+
+    // If we're dirty, our tqparent is dirty, if we've got a tqparent
+    if (propagate && m_parent && rc.isValid()) m_parent->setDirty(m_dirtyRect);
+
+    if (m_image && rc.isValid()) {
+        m_image->notifyLayerUpdated(this, rc);
+    }
+}
+
+void KisLayer::setDirty(const TQRect & rc, bool propagate)
+{
+    // If we're dirty, our tqparent is dirty, if we've got a tqparent
+
+    if (rc.isValid())
+        m_dirtyRect |= rc;
+
+    if (propagate && m_parent && m_dirtyRect.isValid())
+        m_parent->setDirty(m_dirtyRect);
+
+    if (m_image && rc.isValid()) {
+        m_image->notifyLayerUpdated(this, rc);
+    }
+}
+
+KisGroupLayerSP KisLayer::tqparent() const
+{
+    return m_parent;
+}
+
+KisLayerSP KisLayer::prevSibling() const
+{
+    if (!tqparent())
+        return 0;
+    return tqparent()->at(index() - 1);
+}
+
+KisLayerSP KisLayer::nextSibling() const
+{
+    if (!tqparent())
+        return 0;
+    return tqparent()->at(index() + 1);
+}
+
+int KisLayer::index() const
+{
+    return m_index;
+}
+
+void KisLayer::setIndex(int i)
+{
+    if (!tqparent())
+        return;
+    tqparent()->setIndex(this, i);
+}
+
+KisLayerSP KisLayer::findLayer(const TQString& n) const
+{
+    if (name() == n)
+        return const_cast<KisLayer*>(this); //HACK any less ugly way? findLayer() is conceptually const...
+    for (KisLayerSP layer = firstChild(); layer; layer = layer->nextSibling())
+        if (KisLayerSP found = layer->findLayer(n))
+            return found;
+    return 0;
+}
+
+KisLayerSP KisLayer::findLayer(int i) const
+{
+    if (id() == i)
+        return const_cast<KisLayer*>(this); //HACK
+    for (KisLayerSP layer = firstChild(); layer; layer = layer->nextSibling())
+        if (KisLayerSP found = layer->findLayer(i))
+            return found;
+    return 0;
+}
+
+int KisLayer::numLayers(int flags) const
+{
+    int num = 0;
+    if (matchesFlags(flags)) num++;
+    for (KisLayerSP layer = firstChild(); layer; layer = layer->nextSibling())
+        num += layer->numLayers(flags);
+    return num;
+}
+
+bool KisLayer::matchesFlags(int flags) const
+{
+    if ((flags & Visible) && !visible())
+        return false;
+    if ((flags & Hidden) && visible())
+        return false;
+    if ((flags & Locked) && !locked())
+        return false;
+    if ((flags & Unlocked) && locked())
+        return false;
+    return true;
+}
+
+TQ_UINT8 KisLayer::opacity() const
+{
+    return m_opacity;
+}
+
+void KisLayer::setOpacity(TQ_UINT8 val)
+{
+    if (m_opacity != val)
+    {
+        m_opacity = val;
+        setDirty();
+        notifyPropertyChanged();
+    }
+}
+
+KNamedCommand *KisLayer::setOpacityCommand(TQ_UINT8 newOpacity)
+{
+    return new KisLayerOpacityCommand(this, opacity(), newOpacity);
+}
+
+KNamedCommand *KisLayer::setOpacityCommand(TQ_UINT8 prevOpacity, TQ_UINT8 newOpacity)
+{
+    return new KisLayerOpacityCommand(this, prevOpacity, newOpacity);
+}
+
+const bool KisLayer::visible() const
+{
+    return m_visible;
+}
+
+void KisLayer::setVisible(bool v)
+{
+    if (m_visible != v) {
+
+        m_visible = v;
+        notifyPropertyChanged();
+        setDirty();
+
+        if (undoAdapter() && undoAdapter()->undo()) {
+            undoAdapter()->addCommand(setVisibleCommand(v));
+        }
+    }
+}
+
+KNamedCommand *KisLayer::setVisibleCommand(bool newVisibility)
+{
+    return new KisLayerVisibilityCommand(this, newVisibility);
+}
+
+bool KisLayer::locked() const
+{
+    return m_locked;
+}
+
+void KisLayer::setLocked(bool l)
+{
+    if (m_locked != l) {
+        m_locked = l;
+        notifyPropertyChanged();
+
+        if (undoAdapter() && undoAdapter()->undo()) {
+            undoAdapter()->addCommand(setLockedCommand(l));
+        }
+    }
+}
+
+bool KisLayer::temporary() const
+{
+    return m_temporary;
+}
+
+void KisLayer::setTemporary(bool t)
+{
+    m_temporary = t;
+}
+
+KNamedCommand *KisLayer::setLockedCommand(bool newLocked)
+{
+    return new KisLayerLockedCommand(this, newLocked);
+}
+
+TQString KisLayer::name() const
+{
+        return m_name;
+}
+
+void KisLayer::setName(const TQString& name)
+{
+    if (!name.isEmpty() && m_name != name)
+    {
+        m_name = name;
+        notifyPropertyChanged();
+    }
+}
+
+void KisLayer::setCompositeOp(const KisCompositeOp& compositeOp)
+{
+    if (m_compositeOp != compositeOp)
+    {
+       m_compositeOp = compositeOp;
+       notifyPropertyChanged();
+       setDirty();
+
+    }
+}
+
+KNamedCommand *KisLayer::setCompositeOpCommand(const KisCompositeOp& newCompositeOp)
+{
+    return new KisLayerCompositeOpCommand(this, compositeOp(), newCompositeOp);
+}
+
+KNamedCommand *KisLayer::moveCommand(TQPoint oldPosition, TQPoint newPosition)
+{
+    return new KisLayerOffsetCommand(this, oldPosition, newPosition);
+}
+
+KisUndoAdapter *KisLayer::undoAdapter() const
+{
+    if (m_image) {
+        return m_image->undoAdapter();
+    }
+    return 0;
+}
+
+void KisLayer::paintMaskInactiveLayers(TQImage &, TQ_INT32, TQ_INT32, TQ_INT32, TQ_INT32)
+{
+}
+
+void KisLayer::paintSelection(TQImage &, TQ_INT32, TQ_INT32, TQ_INT32, TQ_INT32)
+{
+}
+
+void KisLayer::paintSelection(TQImage &, const TQRect&, const TQSize&, const TQSize&)
+{
+}
+
+TQImage KisLayer::createThumbnail(TQ_INT32, TQ_INT32)
+{
+    return 0;
+}
+
+void KisLayer::notifyPropertyChanged()
+{
+    if(image() && !signalsBlocked())
+        image()->notifyPropertyChanged(this);
+}
+
+void KisLayerSupportsIndirectPainting::setTemporaryTarget(KisPaintDeviceSP t) {
+     m_temporaryTarget = t;
+}
+
+void KisLayerSupportsIndirectPainting::setTemporaryCompositeOp(const KisCompositeOp& c) {
+     m_compositeOp = c;
+}
+
+void KisLayerSupportsIndirectPainting::setTemporaryOpacity(TQ_UINT8 o) {
+    m_compositeOpacity = o;
+}
+
+KisPaintDeviceSP KisLayerSupportsIndirectPainting::temporaryTarget() {
+    return m_temporaryTarget;
+}
+
+KisCompositeOp KisLayerSupportsIndirectPainting::temporaryCompositeOp() const {
+    return m_compositeOp;
+}
+
+TQ_UINT8 KisLayerSupportsIndirectPainting::temporaryOpacity() const {
+    return m_compositeOpacity;
+}
+
+#include "kis_layer.moc"
diff --git a/chalk/core/kis_layer.h b/chalk/core/kis_layer.h
new file mode 100644
index 000000000..09ecd2357
--- /dev/null
+++ b/chalk/core/kis_layer.h
@@ -0,0 +1,257 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+#ifndef KIS_LAYER_H_
+#define KIS_LAYER_H_
+
+#include <tqobject.h>
+#include "kis_types.h"
+#include "kis_layer_visitor.h"
+#include "kis_composite_op.h"
+#include <koffice_export.h>
+
+class KNamedCommand;
+class TQPainter;
+class KisUndoAdapter;
+class KisGroupLayer;
+
+/**
+ * Abstract class that represents the concept of a Layer in Chalk. This is not related
+ * to the paint devices: this is merely an abstraction of how layers can be stacked and
+ * rendered differently.
+ * Regarding the previous-, first-, next- and lastChild() calls, first means that it the layer
+ * is at the top of the group in the layerlist, using next will iterate to the bottom to last,
+ * whereas previous will go up to first again.
+ **/
+class KRITACORE_EXPORT KisLayer : public TQObject, public KShared
+{
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    KisLayer(KisImage *img, const TQString &name, TQ_UINT8 opacity);
+    KisLayer(const KisLayer& rhs);
+    virtual ~KisLayer();
+
+    
+    /**
+     * Set the specified rect to clean
+     */
+    virtual void setClean(const TQRect & rect);
+    
+    /**
+     * If the layer has been changed and not been composited yet, this returns true
+     */
+    virtual bool dirty();
+
+    /**
+     * Return true if the given rect intersects the dirty rect(s) of this layer
+     */
+    virtual bool dirty(const TQRect & rc);
+
+
+    virtual TQRect dirtyRect() const;
+    
+    
+    /**
+     * Set the entire layer extent dirty; this percolates up to tqparent layers all the
+     * way to the root layer.
+     */
+    virtual void setDirty(bool propagate = true);
+
+    /**
+     * Add the given rect to the set of dirty rects for this layer;
+     * this percolates up to tqparent layers all the way to the root
+     * layer.
+     */
+    virtual void setDirty(const TQRect & rect, bool propagate = true);
+    
+    /// Return a copy of this layer
+    virtual KisLayerSP clone() const = 0;
+
+    /// Returns the ID of the layer, which is guaranteed to be unique among all KisLayers.
+    int id() const { return m_id; }
+
+    /* Returns the index of the layer in its tqparent's list of child layers. Indices
+     * increase from 0, which is the topmost layer in the list, to the bottommost.
+     */
+    virtual int index() const;
+
+    /// Moves this layer to the specified index within its tqparent's list of child layers.
+    virtual void setIndex(int index);
+
+    /**
+     * Returns the tqparent layer of a layer. This is 0 only for a root layer; otherwise
+     * this will be an actual GroupLayer */
+    virtual KisGroupLayerSP tqparent() const;
+
+    /**
+     * Returns the previous sibling of this layer in the tqparent's list. This is the layer
+     * *above* this layer. 0 is returned if there is no tqparent, or if this child has no more
+     * previous siblings (== firstChild())
+     */
+    virtual KisLayerSP prevSibling() const;
+
+    /**
+     * Returns the next sibling of this layer in the tqparent's list. This is the layer *below*
+     * this layer. 0 is returned if there is no tqparent, or if this child has no more next 
+     * siblings (== lastChild())
+     */
+    virtual KisLayerSP nextSibling() const;
+
+    /**
+     * Returns the sibling above this layer in its tqparent's list. 0 is returned if there is no tqparent,
+     * or if this layer is the topmost layer in its group. This is the same as calling prevSibling().
+     */
+    KisLayerSP siblingAbove() const { return prevSibling(); }
+
+    /**
+     * Returns the sibling below this layer in its tqparent's list. 0 is returned if there is no tqparent,
+     * or if this layer is the bottommost layer in its group.  This is the same as calling nextSibling().
+     */
+    KisLayerSP siblingBelow() const { return nextSibling(); }
+
+    /// Returns how many direct child layers this layer has (not recursive).
+    virtual uint childCount() const { return 0; }
+
+    /// Returns the first child layer of this layer (if it supports that).
+    virtual KisLayerSP firstChild() const { return 0; }
+
+    /// Returns the last child layer of this layer (if it supports that).
+    virtual KisLayerSP lastChild() const { return 0; }
+
+    /// Recursively searches this layer and any child layers for a layer with the specified name.
+    virtual KisLayerSP findLayer(const TQString& name) const;
+
+    /// Recursively searches this layer and any child layers for a layer with the specified ID.
+    virtual KisLayerSP findLayer(int id) const;
+
+    enum { Visible = 1, Hidden = 2, Locked = 4, Unlocked = 8 };
+
+    /// Returns the total number of layers in this layer, its child layers, and their child layers recursively, optionally ones with the specified properties Visible or Locked, which you can OR together.
+    virtual int numLayers(int type = 0) const;
+
+public:
+    /// Called when the layer is made active
+    virtual void activate() {};
+
+    /// Called when another layer is made active
+    virtual void deactivate() {};
+
+public:
+    virtual TQ_INT32 x() const = 0;
+    virtual void setX(TQ_INT32) = 0;
+
+    virtual TQ_INT32 y() const = 0;
+    virtual void setY(TQ_INT32) = 0;
+
+    virtual KNamedCommand *moveCommand(TQPoint oldPosition, TQPoint newPosition);
+
+    /// Returns an approximation of where the bounds on actual data are in this layer
+    virtual TQRect extent() const = 0;
+    /// Returns the exact bounds of where the actual data resides in this layer
+    virtual TQRect exactBounds() const = 0;
+
+    virtual const bool visible() const;
+    virtual void setVisible(bool v);
+    KNamedCommand *setVisibleCommand(bool visiblel);
+
+    TQ_UINT8 opacity() const;
+    void setOpacity(TQ_UINT8 val);
+    KNamedCommand *setOpacityCommand(TQ_UINT8 val);
+    KNamedCommand *setOpacityCommand(TQ_UINT8 prevOpacity, TQ_UINT8 newOpacity);
+
+    bool locked() const;
+    void setLocked(bool l);
+    KNamedCommand *setLockedCommand(bool locked);
+
+    void notifyPropertyChanged();
+
+    bool temporary() const;
+    void setTemporary(bool t);
+
+    virtual TQString name() const;
+    virtual void setName(const TQString& name);
+
+    KisCompositeOp compositeOp() { return m_compositeOp; }
+    void setCompositeOp(const KisCompositeOp& compositeOp);
+    KNamedCommand *setCompositeOpCommand(const KisCompositeOp& compositeOp);
+
+    KisImage *image() const { return m_image; }
+    virtual void setImage(KisImage *image) { m_image = image; }
+
+    KisUndoAdapter *undoAdapter() const;
+
+    /// paints a tqmask where the selection on this layer resides
+    virtual void paintSelection(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+    virtual void paintSelection(TQImage &img, const TQRect& scaledImageRect, const TQSize& scaledImageSize, const TQSize& imageSize);
+
+    /// paints where no data is on this layer. Useful when it is a transparent layer stacked on top of another one
+    virtual void paintMaskInactiveLayers(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+
+    /// Returns a thumbnail in requested size. The TQImage may have transparent parts.
+    /// May also return 0
+    virtual TQImage createThumbnail(TQ_INT32 w, TQ_INT32 h);
+
+    /// Accept the KisLayerVisitor (for the Visitor design pattern), should call the correct function on the KisLayerVisitor for this layer type
+    virtual bool accept(KisLayerVisitor &) = 0;
+
+private:
+    friend class KisGroupLayer;
+
+    bool matchesFlags(int flags) const;
+
+    int m_id;
+    int m_index;
+    TQ_UINT8 m_opacity;
+    bool m_locked;
+    bool m_visible;
+    bool m_temporary;
+
+    // XXX: keep a list of dirty rects instead of always aggegrating them
+    TQRect m_dirtyRect;
+    TQString m_name;
+    KisGroupLayerSP m_parent;
+    KisImage *m_image;
+
+    // Operation used to composite this layer with the layers _under_ this layer
+    KisCompositeOp m_compositeOp;
+};
+
+// For classes that support indirect painting
+class KRITACORE_EXPORT KisLayerSupportsIndirectPainting {
+    // To simulate the indirect painting
+    KisPaintDeviceSP m_temporaryTarget;
+    KisCompositeOp m_compositeOp;
+    TQ_UINT8 m_compositeOpacity;
+public:
+    // Indirect painting
+    void setTemporaryTarget(KisPaintDeviceSP t);
+    void setTemporaryCompositeOp(const KisCompositeOp& c);
+    void setTemporaryOpacity(TQ_UINT8 o);
+    KisPaintDeviceSP temporaryTarget();
+    KisCompositeOp temporaryCompositeOp() const;
+    TQ_UINT8 temporaryOpacity() const;
+
+    // Or I could make KisLayer a virtual base of KisLayerSupportsIndirectPainting and so, but
+    // I'm sure virtual diamond inheritance isn't as appreciated as this
+    virtual KisLayer* layer() = 0;
+};
+
+#endif // KIS_LAYER_H_
+
diff --git a/chalk/core/kis_layer_visitor.h b/chalk/core/kis_layer_visitor.h
new file mode 100644
index 000000000..4326bc54b
--- /dev/null
+++ b/chalk/core/kis_layer_visitor.h
@@ -0,0 +1,43 @@
+/*
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_LAYER_VISITOR_H_
+#define KIS_LAYER_VISITOR_H_
+
+#include "kis_global.h"
+#include "kis_types.h"
+
+class KisPaintLayer;
+class KisGroupLayer;
+class KisPartLayer;
+class KisAdjustmentLayer;
+
+class KisLayerVisitor {
+public:
+    KisLayerVisitor() {};
+    virtual ~KisLayerVisitor() {};
+
+public:
+    virtual bool visit(KisPaintLayer *layer) = 0;
+    virtual bool visit(KisGroupLayer *layer) = 0;
+    virtual bool visit(KisPartLayer *layer) = 0;
+    virtual bool visit(KisAdjustmentLayer *layer) = 0;
+};
+
+
+#endif // KIS_LAYER_VISITOR_H_
+
diff --git a/chalk/core/kis_math_toolbox.cpp b/chalk/core/kis_math_toolbox.cpp
new file mode 100644
index 000000000..f4fdf88c3
--- /dev/null
+++ b/chalk/core/kis_math_toolbox.cpp
@@ -0,0 +1,166 @@
+/*
+ *  This file is part of the KDE project
+ *
+ *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_math_toolbox.h"
+
+#ifdef HAVE_OPENEXR
+#include <half.h>
+#endif
+
+#include "kis_basic_math_toolbox.h"
+#include "kis_iterators_pixel.h"
+
+
+KisMathToolbox::KisMathToolbox(KisID id) : m_id(id)
+{
+}
+
+KisMathToolbox::~KisMathToolbox()
+{
+}
+
+KisMathToolboxFactoryRegistry::KisMathToolboxFactoryRegistry()
+{
+    add(new KisBasicMathToolbox());
+}
+KisMathToolboxFactoryRegistry::~KisMathToolboxFactoryRegistry()
+{
+}
+template<typename T>
+double toDouble(TQ_UINT8* data, int channelpos )
+{
+    return (float)( *((T*)(data + channelpos)) );
+}
+
+typedef double (*PtrToDouble)(TQ_UINT8*, int);
+
+template<typename T>
+void fromDouble(TQ_UINT8* data, int channelpos, double v )
+{
+    *((T*)(data + channelpos)) = (T)v;
+}
+
+typedef void (*PtrFromDouble)(TQ_UINT8*, int, double);
+
+
+void KisMathToolbox::transformToFR(KisPaintDeviceSP src, KisFloatRepresentation* fr, const TQRect& rect)
+{
+    TQ_INT32 depth = src->colorSpace()->nColorChannels();
+    TQMemArray<PtrToDouble> f(depth);
+    TQValueVector<KisChannelInfo *> cis = src->colorSpace()->channels();
+    for(TQ_INT32 k = 0; k < depth; k++)
+    {
+        switch( cis[k]->channelValueType() )
+        {
+            case KisChannelInfo::UINT8:
+                f[k] = toDouble<TQ_UINT8>;
+                break;
+            case KisChannelInfo::UINT16:
+                f[k] = toDouble<TQ_UINT16>;
+                break;
+#ifdef HAVE_OPENEXR		
+            case KisChannelInfo::FLOAT16:
+                f[k] = toDouble<half>;
+                break;
+#endif
+            case KisChannelInfo::FLOAT32:
+                f[k] = toDouble<float>;
+                break;
+            case KisChannelInfo::INT8:
+                f[k] = toDouble<TQ_INT8>;
+                break;
+            case KisChannelInfo::INT16:
+                f[k] = toDouble<TQ_INT16>;
+                break;
+            default:
+                kdWarning() << "Unsupported value type in KisMathToolbox" << endl;
+                return;
+        }
+    }
+    
+    for(int i = rect.y(); i < rect.height(); i++)
+    {
+        KisHLineIteratorPixel srcIt = src->createHLineIterator(rect.x(), i, rect.width(), false );
+        float *dstIt = fr->coeffs + (i-rect.y()) * fr->size * fr->depth;
+        while( ! srcIt.isDone() )
+        {
+            TQ_UINT8* v1 = srcIt.rawData();
+            for( int k = 0; k < depth; k++)
+            {
+                *dstIt = f[k](v1, cis[k]->pos());
+                ++dstIt;
+            }
+            ++srcIt;
+        }
+    }
+}
+
+void KisMathToolbox::transformFromFR(KisPaintDeviceSP dst, KisFloatRepresentation* fr, const TQRect& rect)
+{
+    TQ_INT32 depth = dst->colorSpace()->nColorChannels();
+    TQMemArray<PtrFromDouble> f(depth);
+    TQValueVector<KisChannelInfo *> cis = dst->colorSpace()->channels();
+    for(TQ_INT32 k = 0; k < depth; k++)
+    {
+        switch( cis[k]->channelValueType() )
+        {
+            case KisChannelInfo::UINT8:
+                f[k] = fromDouble<TQ_UINT8>;
+                break;
+            case KisChannelInfo::UINT16:
+                f[k] = fromDouble<TQ_UINT16>;
+                break;
+#ifdef HAVE_OPENEXR
+            case KisChannelInfo::FLOAT16:
+                f[k] = fromDouble<half>;
+                break;
+#endif		
+            case KisChannelInfo::FLOAT32:
+                f[k] = fromDouble<float>;
+                break;
+            case KisChannelInfo::INT8:
+                f[k] = fromDouble<TQ_INT8>;
+                break;
+            case KisChannelInfo::INT16:
+                f[k] = fromDouble<TQ_INT16>;
+                break;
+            default:
+                kdWarning() << "Unsupported value type in KisMathToolbox" << endl;
+                return;
+        }
+    }
+    for(int i = rect.y(); i < rect.height(); i++)
+    {
+        KisHLineIteratorPixel dstIt = dst->createHLineIterator(rect.x(), i, rect.width(), true );
+        float *srcIt = fr->coeffs + (i-rect.y()) * fr->size * fr->depth;
+        while( ! dstIt.isDone() )
+        {
+            TQ_UINT8* v1 = dstIt.rawData();
+            for( int k = 0; k < depth; k++)
+            {
+                f[k](v1, cis[k]->pos(), *srcIt);
+                ++srcIt;
+            }
+            ++dstIt;
+        }
+    }
+}
+
+#include "kis_math_toolbox.moc"
diff --git a/chalk/core/kis_math_toolbox.h b/chalk/core/kis_math_toolbox.h
new file mode 100644
index 000000000..8d5bef506
--- /dev/null
+++ b/chalk/core/kis_math_toolbox.h
@@ -0,0 +1,124 @@
+/*
+ *  This file is part of the KDE project
+ *
+ *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_MATH_TOOLBOX_H
+#define KIS_MATH_TOOLBOX_H
+
+#include <tqobject.h>
+
+// typedef unsigned int uint;
+
+#include <kis_generic_registry.h>
+#include "kis_paint_device.h"
+#include "kis_types.h"
+
+#include <new>
+
+class KisMathToolbox : public TQObject {
+    Q_OBJECT
+  TQ_OBJECT
+    public:
+        struct KisFloatRepresentation {
+            KisFloatRepresentation(uint nsize, uint ndepth) throw(std::bad_alloc ) : coeffs(new float[nsize*nsize*ndepth]) ,size(nsize), depth(ndepth)
+            {
+                // XXX: Valgrind shows that these are being used without being initialised.
+                for (TQ_UINT32 i = 0; i < nsize*nsize*ndepth; ++i) {
+                    coeffs[i] = 0;
+                }
+            }
+            ~KisFloatRepresentation() { if(coeffs) delete[] coeffs; }
+            float* coeffs;
+            uint size;
+            uint depth;
+        };
+        typedef KisFloatRepresentation KisWavelet;
+    public:
+        KisMathToolbox(KisID id);
+        ~KisMathToolbox();
+    public:
+        inline KisID id() { return m_id; };
+        /**
+         * This function initialize a wavelet structure
+         * @param lay the layer that will be used for the transformation
+         */
+        inline KisWavelet* initWavelet(KisPaintDeviceSP lay, const TQRect&) throw(std::bad_alloc );
+        inline uint fastWaveletTotalSteps(const TQRect&);
+        /**
+         * This function reconstruct the layer from the information of a wavelet
+         * @param src layer from which the wavelet will be computed
+         * @param buff if set to 0, the buffer will be initialized by the function,
+         * you might want to give a buff to the function if you want to use the same buffer
+         * in transformToWavelet and in untransformToWavelet, use initWavelet to initialize
+         * the buffer
+         */
+         virtual KisWavelet* fastWaveletTransformation(KisPaintDeviceSP src, const TQRect&, KisWavelet* buff = 0) =0;
+        /**
+         * This function reconstruct the layer from the information of a wavelet
+         * @param dst layer on which the wavelet will be untransform
+         * @param wav the wavelet
+         * @param buff if set to 0, the buffer will be initialized by the function,
+         * you might want to give a buff to the function if you want to use the same buffer
+         * in transformToWavelet and in untransformToWavelet, use initWavelet to initialize
+         * the buffer
+         */
+         virtual void fastWaveletUntransformation(KisPaintDeviceSP dst, const TQRect&, KisWavelet* wav, KisWavelet* buff = 0) =0;
+    signals:
+        void nextStep();
+    protected:
+        /**
+         * This function transform a paint device into a KisFloatRepresentation, this function is colorspace independant,
+         * for Wavelet, Pyramid and FFT the data is allways the exact value of the channel stored in a float.
+         */
+        void transformToFR(KisPaintDeviceSP src, KisFloatRepresentation*, const TQRect&);
+        /**
+         * This function transform a KisFloatRepresentation into a paint device, this function is colorspace independant,
+         * for Wavelet, Pyramid and FFT the data is allways the exact value of the channel stored in a float.
+         */
+        void transformFromFR(KisPaintDeviceSP dst, KisFloatRepresentation*, const TQRect&);
+    private:
+        KisID m_id;
+};
+
+class KisMathToolboxFactoryRegistry : public KisGenericRegistry<KisMathToolbox*> {
+    public:
+        KisMathToolboxFactoryRegistry();
+        ~KisMathToolboxFactoryRegistry();
+};
+
+
+inline KisMathToolbox::KisWavelet* KisMathToolbox::initWavelet(KisPaintDeviceSP src, const TQRect& rect) throw(std::bad_alloc )
+{
+    int size;
+    int maxrectsize = (rect.height() < rect.width()) ? rect.width() : rect.height();
+    for(size = 2; size < maxrectsize; size *= 2) ;
+    TQ_INT32 depth = src->colorSpace()->nColorChannels();
+    return new KisWavelet(size, depth);
+}
+
+inline uint KisMathToolbox::fastWaveletTotalSteps(const TQRect& rect)
+{
+    int size, steps;
+    int maxrectsize = (rect.height() < rect.width()) ? rect.width() : rect.height();
+    steps = 0;
+    for(size = 2; size < maxrectsize; size *= 2) steps += size / 2; ;
+    return steps;
+}
+
+#endif
diff --git a/chalk/core/kis_merge_visitor.h b/chalk/core/kis_merge_visitor.h
new file mode 100644
index 000000000..680533845
--- /dev/null
+++ b/chalk/core/kis_merge_visitor.h
@@ -0,0 +1,358 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *  Copyright (c) 2006 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_MERGE_H_
+#define KIS_MERGE_H_
+
+#include <tqrect.h>
+
+#include "kis_types.h"
+#include "kis_paint_device.h"
+#include "kis_layer_visitor.h"
+#include "kis_painter.h"
+#include "kis_image.h"
+#include "kis_layer.h"
+#include "kis_group_layer.h"
+#include "kis_adjustment_layer.h"
+#include "kis_paint_layer.h"
+#include "kis_part_layer_iface.h"
+#include "kis_filter.h"
+#include "kis_filter_configuration.h"
+#include "kis_filter_registry.h"
+#include "kis_selection.h"
+#include "kis_transaction.h"
+#include "kis_iterators_pixel.h"
+
+class KisMergeVisitor : public KisLayerVisitor {
+public:
+    /**
+     * Don't even _think_ of creating a merge visitor without a projection; without a projection,
+     * the adjustmentlayers won't work.
+     */
+    KisMergeVisitor(KisPaintDeviceSP projection, const TQRect& rc) :
+        KisLayerVisitor()
+    {
+        Q_ASSERT(projection);
+
+        m_projection = projection;
+        m_rc = rc;
+    }
+
+private:
+    // Helper for the indirect painting (keep above to inhibit gcc-2.95 ICE)
+    template<class Target>
+    KSharedPtr<Target> paintIndirect(KisPaintDeviceSP source,
+                                     KSharedPtr<Target> target,
+                                     KisLayerSupportsIndirectPainting* layer,
+                                     TQ_INT32 sx, TQ_INT32 sy, TQ_INT32 dx, TQ_INT32 dy,
+                                     TQ_INT32 w, TQ_INT32 h) {
+        KisPainter gc2(target.data());
+        gc2.bitBlt(dx, dy, COMPOSITE_COPY, source,
+                   OPACITY_OPAQUE, sx, sy, w, h);
+        gc2.bitBlt(dx, dy, layer->temporaryCompositeOp(), layer->temporaryTarget(),
+                   layer->temporaryOpacity(), sx, sy, w, h);
+        gc2.end();
+        return target;
+    }
+
+public:
+    virtual bool visit(KisPaintLayer *layer)
+    {
+        
+        if (m_projection == 0) {
+            return false;
+        }
+        
+        kdDebug(41010) << "Visiting on paint layer " << layer->name() << ", visible: " << layer->visible()
+                << ", temporary: " << layer->temporary() << ", extent: "
+                << layer->extent() << ", dirty: " << layer->dirtyRect() << ", paint rect: " << m_rc << endl;
+        if (!layer->visible())
+            return true;
+
+        TQ_INT32 sx, sy, dx, dy, w, h;
+
+        TQRect rc = layer->paintDevice()->extent() & m_rc;
+
+        // Indirect painting?
+        KisPaintDeviceSP tempTarget = layer->temporaryTarget();
+        if (tempTarget) {
+            rc = (layer->paintDevice()->extent() | tempTarget->extent()) & m_rc;
+        }
+
+        sx = rc.left();
+        sy = rc.top();
+        w  = rc.width();
+        h  = rc.height();
+        dx = sx;
+        dy = sy;
+
+        KisPainter gc(m_projection);
+        KisPaintDeviceSP source = layer->paintDevice();
+
+        if (!layer->hasMask()) {
+            if (tempTarget) {
+                KisPaintDeviceSP temp = new KisPaintDevice(source->colorSpace());
+                source = paintIndirect(source, temp, layer, sx, sy, dx, dy, w, h);
+            }
+
+            gc.bitBlt(dx, dy, layer->compositeOp(), source, layer->opacity(), sx, sy, w, h);
+        } else {
+            if (layer->renderMask()) {
+                // To display the tqmask, we don't do things with composite op and opacity
+                // This is like the gimp does it, I guess that's ok?
+
+                // Note that here we'll use m_rc, because even if the extent of the device is
+                // empty, we want a full tqmask to be drawn! (we don't change rc, since
+                // it'd mess with setClean). This is because KisPainter::bitBlt &'s with
+                // the source device's extent. This is ok in normal circumstances, but
+                // we changed the default tile. Fixing this properly would mean fixing it there.
+                sx = m_rc.left();
+                sy = m_rc.top();
+                w  = m_rc.width();
+                h  = m_rc.height();
+                dx = sx;
+                dy = sy;
+
+                // The problem is that the extent of the layer tqmask might not be extended
+                // enough. Check if that is the case
+                KisPaintDeviceSP tqmask = layer->getMask();
+                TQRect mextent = tqmask->extent();
+                if ((mextent & m_rc) != m_rc) {
+                    // Iterate over all pixels in the m_rc area. With just accessing the
+                    // tiles in read-write mode, we ensure that the tiles get created if they
+                    // do not exist. If they do, they'll remain untouched since we don't
+                    // actually write data to it.
+                    // XXX Admission: this is actually kind of a hack :-(
+                    KisRectIteratorPixel it = tqmask->createRectIterator(sx, sy, w, h, true);
+                    while (!it.isDone())
+                        ++it;
+                }
+                if (tempTarget) {
+                    KisPaintDeviceSP temp = new KisPaintDevice(source->colorSpace());
+                    tqmask = paintIndirect(tqmask, temp, layer, sx, sy, dx, dy, w, h);
+                }
+
+                gc.bitBlt(dx, dy, COMPOSITE_OVER, tqmask, OPACITY_OPAQUE, sx, sy, w, h);
+            } else {
+                KisSelectionSP tqmask = layer->getMaskAsSelection();
+                // The indirect painting happens on the tqmask
+                if (tempTarget && layer->editMask()) {
+                    KisPaintDeviceSP tqmaskSrc = layer->getMask();
+                    KisPaintDeviceSP temp = new KisPaintDevice(tqmaskSrc->colorSpace());
+                    temp = paintIndirect(tqmaskSrc, temp, layer, sx, sy, dx, dy, w, h);
+                    // Blegh
+                    KisRectIteratorPixel srcIt = temp->createRectIterator(sx, sy, w, h, false);
+                    KisRectIteratorPixel dstIt = tqmask->createRectIterator(sx, sy, w, h, true);
+
+                    while(!dstIt.isDone()) {
+                        // Same as in convertMaskToSelection
+                        *dstIt.rawData() = *srcIt.rawData();
+                        ++srcIt;
+                        ++dstIt;
+                    }
+                } else if (tempTarget) {
+                    // We have a tqmask, and paint indirect, but not on the tqmask
+                    KisPaintDeviceSP temp = new KisPaintDevice(source->colorSpace());
+                    source = paintIndirect(source, temp, layer, sx, sy, dx, dy, w, h);
+                }
+
+                gc.bltSelection(dx, dy,
+                                layer->compositeOp(),
+                                source,
+                                tqmask,
+                                layer->opacity(), sx, sy, w, h);
+            }
+        }
+
+        layer->setClean( rc );
+        return true;
+    }
+
+    virtual bool visit(KisGroupLayer *layer)
+    {
+        
+        if (m_projection == 0) {
+            return false;
+        }
+        
+        kdDebug(41010) << "Visiting on group layer " << layer->name() << ", visible: " << layer->visible() << ", extent: "
+                << layer->extent() << ", dirty: " << layer->dirtyRect() << ", paint rect: " << m_rc << endl;
+                
+        if (!layer->visible())
+            return true;
+        
+        TQ_INT32 sx, sy, dx, dy, w, h;
+
+        // This automatically makes sure the projection is up-to-date for the specified rect.
+        KisPaintDeviceSP dev = layer->projection(m_rc);
+        TQRect rc = dev->extent() & m_rc;
+
+        sx = rc.left();
+        sy = rc.top();
+        w  = rc.width();
+        h  = rc.height();
+        dx = sx;
+        dy = sy;
+
+        KisPainter gc(m_projection);
+        gc.bitBlt(dx, dy, layer->compositeOp(), dev, layer->opacity(), sx, sy, w, h);
+
+        return true;
+    }
+
+    virtual bool visit(KisPartLayer* layer)
+    {
+
+        kdDebug(41010) << "Visiting on part layer " << layer->name() << ", visible: " << layer->visible() << ", extent: "
+                << layer->extent() << ", dirty: " << layer->dirtyRect() << ", paint rect: " << m_rc << endl;
+        
+        if (m_projection == 0) {
+            return false;
+        }
+        if (!layer->visible())
+            return true;
+
+        KisPaintDeviceSP dev(layer->prepareProjection(m_projection, m_rc));
+        if (!dev)
+            return true;
+
+        TQ_INT32 sx, sy, dx, dy, w, h;
+
+        TQRect rc = dev->extent() & m_rc;
+
+        sx= rc.left();
+        sy = rc.top();
+        w = rc.width();
+        h = rc.height();
+        dx = sx;
+        dy = sy;
+
+        KisPainter gc(m_projection);
+        gc.bitBlt(dx, dy, layer->compositeOp() , dev, layer->opacity(), sx, sy, w, h);
+
+        layer->setClean(rc);
+        return true;
+    }
+
+    virtual bool visit(KisAdjustmentLayer* layer)
+    {
+        kdDebug(41010) << "Visiting on adjustment layer " << layer->name() << ", visible: " << layer->visible() << ", extent: "
+                << layer->extent() << ", dirty: " << layer->dirtyRect() << ", paint rect: " << m_rc << endl;
+
+        if (m_projection == 0) {
+            return true;
+        }
+
+        if (!layer->visible())
+            return true;
+
+        KisPaintDeviceSP tempTarget = layer->temporaryTarget();
+        if (tempTarget) {
+            m_rc = (layer->extent() | tempTarget->extent()) & m_rc;
+        }
+
+        if (m_rc.width() == 0 || m_rc.height() == 0) // Don't even try
+            return true;
+
+        KisFilterConfiguration * cfg = layer->filter();
+        if (!cfg) return false;
+
+
+        KisFilter * f = KisFilterRegistry::instance()->get( cfg->name() );
+        if (!f) return false;
+
+        // Possibly enlarge the rect that changed (like for convolution filters)
+        // m_rc = f->enlargeRect(m_rc, cfg);
+        KisSelectionSP selection = layer->selection();
+
+        // Copy of the projection -- use the copy-on-write trick. XXX NO COPY ON WRITE YET =(
+        //KisPaintDeviceSP tmp = new KisPaintDevice(*m_projection);
+        KisPaintDeviceSP tmp = 0;
+        KisSelectionSP sel = selection;
+        // If there's a selection, only keep the selected bits
+        if (selection != 0) {
+            tmp = new KisPaintDevice(m_projection->colorSpace());
+
+            KisPainter gc(tmp);
+            TQRect selectedRect = selection->selectedRect();
+            selectedRect &= m_rc;
+
+            if (selectedRect.width() == 0 || selectedRect.height() == 0) // Don't even try
+                return true;
+
+            // Don't forget that we need to take into account the extended sourcing area as well
+            //selectedRect = f->enlargeRect(selectedRect, cfg);
+
+            //kdDebug() << k_funcinfo << selectedRect << endl;
+            tmp->setX(selection->getX());
+            tmp->setY(selection->getY());
+
+            // Indirect painting
+            if (tempTarget) {
+                sel = new KisSelection();
+                sel = paintIndirect(selection.data(), sel, layer, m_rc.left(), m_rc.top(),
+                                    m_rc.left(), m_rc.top(), m_rc.width(), m_rc.height());
+            }
+
+            gc.bitBlt(selectedRect.x(), selectedRect.y(), COMPOSITE_COPY, m_projection,
+                      selectedRect.x(), selectedRect.y(),
+                      selectedRect.width(), selectedRect.height());
+            gc.end();
+        } else {
+            tmp = new KisPaintDevice(*m_projection);
+        }
+
+        // Some filters will require usage of oldRawData, which is not available without
+        // a transaction!
+        KisTransaction* cmd = new KisTransaction("", tmp);
+
+        // Filter the temporary paint device -- remember, these are only the selected bits,
+        // if there was a selection.
+        f->process(tmp, tmp, cfg, m_rc);
+
+        delete cmd;
+
+        // Copy the filtered bits onto the projection 
+        KisPainter gc(m_projection);
+        if (selection)
+            gc.bltSelection(m_rc.left(), m_rc.top(),
+                            COMPOSITE_OVER, tmp, sel, layer->opacity(),
+                            m_rc.left(), m_rc.top(), m_rc.width(), m_rc.height());
+        else
+            gc.bitBlt(m_rc.left(), m_rc.top(),
+                      COMPOSITE_OVER, tmp, layer->opacity(),
+                      m_rc.left(), m_rc.top(), m_rc.width(), m_rc.height());
+        gc.end();
+
+        // Copy the finished projection onto the cache
+        gc.begin(layer->cachedPaintDevice());
+        gc.bitBlt(m_rc.left(), m_rc.top(),
+                  COMPOSITE_COPY, m_projection, OPACITY_OPAQUE,
+                  m_rc.left(), m_rc.top(), m_rc.width(), m_rc.height());
+        layer->setClean(m_rc);
+        return true;
+    }
+
+private:
+    KisPaintDeviceSP m_projection;
+    TQRect m_rc;
+};
+
+#endif // KIS_MERGE_H_
+
diff --git a/chalk/core/kis_meta_registry.cc b/chalk/core/kis_meta_registry.cc
new file mode 100644
index 000000000..c6025869a
--- /dev/null
+++ b/chalk/core/kis_meta_registry.cc
@@ -0,0 +1,68 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <tqstringlist.h>
+#include <tqdir.h>
+#include <kstandarddirs.h>
+#include <kglobal.h>
+
+#include <config.h>
+#include LCMS_HEADER
+
+#include <kis_colorspace_factory_registry.h>
+#include <kis_math_toolbox.h>
+#include <kis_meta_registry.h>
+
+KisMetaRegistry * KisMetaRegistry::m_singleton = 0;
+
+KisMetaRegistry::KisMetaRegistry()
+{
+    // Create the colorspaces and load the profiles
+
+    KGlobal::instance()->dirs()->addResourceType("kis_profiles",
+                                                     KStandardDirs::kde_default("data") + "chalk/profiles/");
+                          
+    // Add those things here as well, since we are not yet using KisDoc's KisFactory instance (which inits these as well)
+    KGlobal::instance()->dirs()->addResourceType("kis_profiles", KStandardDirs::kde_default("data") + "chalk/profiles/");
+    KGlobal::instance()->dirs()->addResourceDir("kis_profiles", "/usr/share/color/icc");
+    KGlobal::instance()->dirs()->addResourceDir("kis_profiles", TQDir::homeDirPath() + TQString("/.icc/"));
+    KGlobal::instance()->dirs()->addResourceDir("kis_profiles", TQDir::homeDirPath() + TQString("/.color/icc/"));
+
+    TQStringList profileFilenames;
+    profileFilenames += KGlobal::instance()->dirs()->findAllResources("kis_profiles", "*.icm", true /* recursive */);
+    profileFilenames += KGlobal::instance()->dirs()->findAllResources("kis_profiles", "*.ICM", true);
+    profileFilenames += KGlobal::instance()->dirs()->findAllResources("kis_profiles", "*.ICC", true);
+    profileFilenames += KGlobal::instance()->dirs()->findAllResources("kis_profiles", "*.icc", true);
+    // Set lcms to return NUll/false etc from failing calls, rather than aborting the app.
+    cmsErrorAction(LCMS_ERROR_SHOW);
+
+    m_csRegistry = new KisColorSpaceFactoryRegistry(profileFilenames);
+    m_mtRegistry = new KisMathToolboxFactoryRegistry();
+}
+
+KisMetaRegistry::~KisMetaRegistry()
+{
+}
+
+KisMetaRegistry * KisMetaRegistry::instance()
+{
+    if ( KisMetaRegistry::m_singleton == 0 ) {
+        KisMetaRegistry::m_singleton = new KisMetaRegistry();
+    }
+    return KisMetaRegistry::m_singleton;
+}
+
diff --git a/chalk/core/kis_meta_registry.h b/chalk/core/kis_meta_registry.h
new file mode 100644
index 000000000..42aeee3d1
--- /dev/null
+++ b/chalk/core/kis_meta_registry.h
@@ -0,0 +1,49 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef _KIS_META_REGISTRY_
+#define _KIS_META_REGISTRY_
+
+class KisColorSpaceFactoryRegistry;
+class KisMathToolboxFactoryRegistry;
+
+/**
+ * A single singleton that provides access to several registries.
+ *
+ * XXX: Maybe this should go into the SDK
+ */
+class KisMetaRegistry {
+
+public:
+
+    virtual ~KisMetaRegistry();
+    static KisMetaRegistry* instance();
+
+    KisColorSpaceFactoryRegistry * csRegistry() { return m_csRegistry; };
+    KisMathToolboxFactoryRegistry* mtRegistry() { return m_mtRegistry; };
+private:
+
+    KisMetaRegistry();
+    KisMetaRegistry( const KisMetaRegistry& );
+    KisMetaRegistry operator=( const KisMetaRegistry& );
+
+    static KisMetaRegistry * m_singleton;
+
+    KisColorSpaceFactoryRegistry * m_csRegistry;
+    KisMathToolboxFactoryRegistry* m_mtRegistry;
+};
+#endif
diff --git a/chalk/core/kis_nameserver.cc b/chalk/core/kis_nameserver.cc
new file mode 100644
index 000000000..ff66144d6
--- /dev/null
+++ b/chalk/core/kis_nameserver.cc
@@ -0,0 +1,49 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kis_nameserver.h"
+
+KisNameServer::KisNameServer(const TQString& prefix, TQ_INT32 seed)
+{
+    m_prefix = prefix;
+    m_generator = seed;
+}
+
+KisNameServer::~KisNameServer()
+{
+}
+
+TQString KisNameServer::name()
+{
+    return m_prefix.tqarg(m_generator++);
+}
+
+TQ_INT32 KisNameServer::currentSeed() const
+{
+    return m_generator;
+}
+
+TQ_INT32 KisNameServer::number()
+{
+    return m_generator++;
+}
+
+void KisNameServer::rollback()
+{
+    m_generator--;
+}
+
diff --git a/chalk/core/kis_nameserver.h b/chalk/core/kis_nameserver.h
new file mode 100644
index 000000000..a6989853b
--- /dev/null
+++ b/chalk/core/kis_nameserver.h
@@ -0,0 +1,40 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_NAMESERVER_H_
+#define KIS_NAMESERVER_H_
+
+#include <tqstring.h>
+#include "kis_global.h"
+
+class KisNameServer {
+public:
+    KisNameServer(const TQString& prefix, TQ_INT32 seed = 1);
+    ~KisNameServer();
+
+    TQString name();
+    TQ_INT32 number();
+    TQ_INT32 currentSeed() const;
+    void rollback();
+
+private:
+    TQ_INT32 m_generator;
+    TQString m_prefix;
+};
+
+#endif // KIS_NAMESERVER_H_
+
diff --git a/chalk/core/kis_paint_device.cc b/chalk/core/kis_paint_device.cc
new file mode 100644
index 000000000..1ce2e98f2
--- /dev/null
+++ b/chalk/core/kis_paint_device.cc
@@ -0,0 +1,1285 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <tqrect.h>
+#include <tqwmatrix.h>
+#include <tqimage.h>
+#include <tqdatetime.h>
+#include <tqapplication.h>
+#include <tqvaluelist.h>
+#include <tqtimer.h>
+
+#include <kcommand.h>
+#include <klocale.h>
+#include <kdebug.h>
+
+#include <KoStore.h>
+
+#include "kis_global.h"
+#include "kis_types.h"
+#include "kis_painter.h"
+#include "kis_fill_painter.h"
+#include "kis_undo_adapter.h"
+#include "kis_iterator.h"
+#include "kis_iterators_pixel.h"
+#include "kis_iteratorpixeltrait.h"
+#include "kis_random_accessor.h"
+#include "kis_random_sub_accessor.h"
+#include "kis_transaction.h"
+#include "kis_profile.h"
+#include "kis_color.h"
+#include "kis_integer_maths.h"
+#include "kis_colorspace_factory_registry.h"
+#include "kis_selection.h"
+#include "kis_layer.h"
+#include "kis_paint_device_iface.h"
+#include "kis_paint_device.h"
+#include "kis_datamanager.h"
+#include "kis_memento.h"
+#include "kis_selection.h"
+
+#include "kis_exif_info.h"
+
+namespace {
+
+    class KisPaintDeviceCommand : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        KisPaintDeviceCommand(const TQString& name, KisPaintDeviceSP paintDevice);
+        virtual ~KisPaintDeviceCommand() {}
+
+        virtual void execute() = 0;
+        virtual void unexecute() = 0;
+
+    protected:
+        void setUndo(bool undo);
+
+        KisPaintDeviceSP m_paintDevice;
+    };
+
+    KisPaintDeviceCommand::KisPaintDeviceCommand(const TQString& name, KisPaintDeviceSP paintDevice) :
+        super(name), m_paintDevice(paintDevice)
+    {
+    }
+
+    void KisPaintDeviceCommand::setUndo(bool undo)
+    {
+        if (m_paintDevice->undoAdapter()) {
+            m_paintDevice->undoAdapter()->setUndo(undo);
+        }
+    }
+
+    class MoveCommand : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        MoveCommand(KisPaintDeviceSP device, const TQPoint& oldpos, const TQPoint& newpos);
+        virtual ~MoveCommand();
+
+        virtual void execute();
+        virtual void unexecute();
+
+    private:
+        void moveTo(const TQPoint& pos);
+        void undoOff();
+        void undoOn();
+
+    private:
+        KisPaintDeviceSP m_device;
+        TQPoint m_oldPos;
+        TQPoint m_newPos;
+    };
+
+    MoveCommand::MoveCommand(KisPaintDeviceSP device, const TQPoint& oldpos, const TQPoint& newpos) :
+        super(i18n("Move Layer"))
+    {
+        m_device = device;
+        m_oldPos = oldpos;
+        m_newPos = newpos;
+    }
+
+    MoveCommand::~MoveCommand()
+    {
+    }
+
+    void MoveCommand::undoOff()
+    {
+        if (m_device->undoAdapter()) {
+            m_device->undoAdapter()->setUndo(false);
+        }
+    }
+
+    void MoveCommand::undoOn()
+    {
+        if (m_device->undoAdapter()) {
+            m_device->undoAdapter()->setUndo(true);
+        }
+    }
+
+    void MoveCommand::execute()
+    {
+        undoOff();
+        moveTo(m_newPos);
+        undoOn();
+    }
+
+    void MoveCommand::unexecute()
+    {
+        undoOff();
+        moveTo(m_oldPos);
+        undoOn();
+    }
+
+    void MoveCommand::moveTo(const TQPoint& pos)
+    {
+        m_device->move(pos.x(), pos.y());
+    }
+
+    class KisConvertLayerTypeCmd : public KNamedCommand {
+        typedef KNamedCommand super;
+
+    public:
+        KisConvertLayerTypeCmd(KisUndoAdapter *adapter, KisPaintDeviceSP paintDevice,
+                       KisDataManagerSP beforeData, KisColorSpace * beforeColorSpace,
+                       KisDataManagerSP afterData, KisColorSpace * afterColorSpace
+                ) : super(i18n("Convert Layer Type"))
+            {
+                m_adapter = adapter;
+                m_paintDevice = paintDevice;
+                m_beforeData = beforeData;
+                m_beforeColorSpace = beforeColorSpace;
+                m_afterData = afterData;
+                m_afterColorSpace = afterColorSpace;
+            }
+
+        virtual ~KisConvertLayerTypeCmd()
+            {
+            }
+
+    public:
+        virtual void execute()
+            {
+                m_adapter->setUndo(false);
+                m_paintDevice->setData(m_afterData, m_afterColorSpace);
+                m_adapter->setUndo(true);
+            }
+
+        virtual void unexecute()
+            {
+                m_adapter->setUndo(false);
+                m_paintDevice->setData(m_beforeData, m_beforeColorSpace);
+                m_adapter->setUndo(true);
+            }
+
+    private:
+        KisUndoAdapter *m_adapter;
+
+        KisPaintDeviceSP m_paintDevice;
+
+        KisDataManagerSP m_beforeData;
+        KisColorSpace * m_beforeColorSpace;
+
+        KisDataManagerSP m_afterData;
+        KisColorSpace * m_afterColorSpace;
+    };
+
+}
+
+KisPaintDevice::KisPaintDevice(KisColorSpace * colorSpace, const char * name) :
+        TQObject(0, name), KShared(), m_exifInfo(0),  m_lock( false )
+{
+    if (colorSpace == 0) {
+        kdWarning(41001) << "Cannot create paint device without colorstrategy!\n";
+        return;
+    }
+    m_longRunningFilterTimer = 0;
+    m_dcop = 0;
+
+    m_x = 0;
+    m_y = 0;
+
+    m_pixelSize = colorSpace->pixelSize();
+    m_nChannels = colorSpace->nChannels();
+
+    TQ_UINT8* defPixel = new TQ_UINT8 [ m_pixelSize ];
+    colorSpace->fromTQColor(TQt::black, OPACITY_TRANSPARENT, defPixel);
+
+    m_datamanager = new KisDataManager(m_pixelSize, defPixel);
+    delete [] defPixel;
+
+    Q_CHECK_PTR(m_datamanager);
+    m_extentIsValid = true;
+
+    m_parentLayer = 0;
+
+    m_colorSpace = colorSpace;
+
+    m_hasSelection = false;
+    m_selectionDeselected = false;
+    m_selection = 0;
+
+}
+
+KisPaintDevice::KisPaintDevice(KisLayer *tqparent, KisColorSpace * colorSpace, const char * name) :
+        TQObject(0, name), KShared(), m_exifInfo(0), m_lock( false )
+{
+
+    m_longRunningFilterTimer = 0;
+    m_dcop = 0;
+
+    m_x = 0;
+    m_y = 0;
+
+    m_hasSelection = false;
+    m_selectionDeselected = false;
+    m_selection = 0;
+
+    m_parentLayer = tqparent;
+
+    if (colorSpace == 0 && tqparent != 0 && tqparent->image() != 0) {
+        m_colorSpace = tqparent->image()->colorSpace();
+    }
+    else {
+        m_colorSpace = colorSpace;
+    }
+
+    Q_ASSERT( m_colorSpace );
+
+    m_pixelSize = m_colorSpace->pixelSize();
+    m_nChannels = m_colorSpace->nChannels();
+
+    TQ_UINT8* defPixel = new TQ_UINT8[ m_pixelSize ];
+    m_colorSpace->fromTQColor(TQt::black, OPACITY_TRANSPARENT, defPixel);
+
+    m_datamanager = new KisDataManager(m_pixelSize, defPixel);
+    delete [] defPixel;
+    Q_CHECK_PTR(m_datamanager);
+    m_extentIsValid = true;
+
+    if ( TQString ( name ) == TQString( "Layer 1" ) ) {
+        m_longRunningFilters = m_colorSpace->createBackgroundFilters();
+
+        if (!m_longRunningFilters.isEmpty()) {
+            m_longRunningFilterTimer = new TQTimer(this);
+            connect(m_longRunningFilterTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(runBackgroundFilters()));
+            m_longRunningFilterTimer->start(2000);
+        }
+    }
+}
+
+
+KisPaintDevice::KisPaintDevice(const KisPaintDevice& rhs) : TQObject(), KShared(rhs)
+{
+    if (this != &rhs) {
+        m_longRunningFilterTimer = 0;
+        m_parentLayer = 0;
+        m_dcop = rhs.m_dcop;
+        if (rhs.m_datamanager) {
+            m_datamanager = new KisDataManager(*rhs.m_datamanager);
+            Q_CHECK_PTR(m_datamanager);
+        }
+        else {
+            kdWarning() << "rhs " << rhs.name() << " has no datamanager\n";
+        }
+        m_extentIsValid = rhs.m_extentIsValid;
+        m_x = rhs.m_x;
+        m_y = rhs.m_y;
+        m_colorSpace = rhs.m_colorSpace;
+        m_hasSelection = rhs.m_hasSelection;
+
+        if  ( m_hasSelection )
+            m_selection = new KisSelection(*rhs.m_selection);
+        else
+            m_selection = 0;
+
+        m_pixelSize = rhs.m_pixelSize;
+        m_nChannels = rhs.m_nChannels;
+        if(rhs.m_exifInfo)
+        {
+            m_exifInfo = new KisExifInfo(*rhs.m_exifInfo);
+        }
+        else {
+            m_exifInfo = 0;
+        }
+    }
+}
+
+KisPaintDevice::~KisPaintDevice()
+{
+    delete m_dcop;
+    delete m_longRunningFilterTimer;
+    TQValueList<KisFilter*>::iterator it;
+    TQValueList<KisFilter*>::iterator end = m_longRunningFilters.end();
+    for (it = m_longRunningFilters.begin(); it != end; ++it) {
+        KisFilter * f = (*it);
+        delete f;
+    }
+    m_longRunningFilters.clear();
+    //delete m_exifInfo;
+}
+
+DCOPObject *KisPaintDevice::dcopObject()
+{
+    if (!m_dcop) {
+        m_dcop = new KisPaintDeviceIface(this);
+        Q_CHECK_PTR(m_dcop);
+    }
+    return m_dcop;
+}
+
+KisLayer *KisPaintDevice::tqparentLayer() const
+{
+    return m_parentLayer;
+}
+
+void KisPaintDevice::setParentLayer(KisLayer *tqparentLayer)
+{
+    m_parentLayer = tqparentLayer;
+}
+
+void KisPaintDevice::setDirty(const TQRect & rc)
+{
+    if (m_parentLayer) m_parentLayer->setDirty(rc);
+}
+
+void KisPaintDevice::setDirty()
+{
+    if (m_parentLayer) m_parentLayer->setDirty();
+}
+
+KisImage *KisPaintDevice::image() const
+{
+    if (m_parentLayer) {
+        return m_parentLayer->image();
+    } else {
+        return 0;
+    }
+}
+
+
+void KisPaintDevice::move(TQ_INT32 x, TQ_INT32 y)
+{
+    TQRect dirtyRect = extent();
+
+    m_x = x;
+    m_y = y;
+
+    dirtyRect |= extent();
+
+    if(m_selection)
+    {
+        m_selection->setX(x);
+        m_selection->setY(y);
+    }
+
+    setDirty(dirtyRect);
+
+    emit positionChanged(this);
+}
+
+void KisPaintDevice::move(const TQPoint& pt)
+{
+    move(pt.x(), pt.y());
+}
+
+KNamedCommand * KisPaintDevice::moveCommand(TQ_INT32 x, TQ_INT32 y)
+{
+    KNamedCommand * cmd = new MoveCommand(this, TQPoint(m_x, m_y), TQPoint(x, y));
+    Q_CHECK_PTR(cmd);
+    cmd->execute();
+    return cmd;
+}
+
+void KisPaintDevice::extent(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const
+{
+    m_datamanager->extent(x, y, w, h);
+    x += m_x;
+    y += m_y;
+}
+
+TQRect KisPaintDevice::extent() const
+{
+    TQ_INT32 x, y, w, h;
+    extent(x, y, w, h);
+    return TQRect(x, y, w, h);
+}
+
+bool KisPaintDevice::extentIsValid() const
+{
+    return m_extentIsValid;
+}
+
+void KisPaintDevice::setExtentIsValid(bool isValid)
+{
+    m_extentIsValid = isValid;
+}
+
+void KisPaintDevice::exactBounds(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const
+{
+    TQRect r = exactBounds();
+    x = r.x();
+    y = r.y();
+    w = r.width();
+    h = r.height();
+}
+
+TQRect KisPaintDevice::exactBoundsOldMethod() const
+{
+    TQ_INT32 x, y, w, h, boundX, boundY, boundW, boundH;
+    extent(x, y, w, h);
+
+    extent(boundX, boundY, boundW, boundH);
+
+    const TQ_UINT8* defaultPixel = m_datamanager->defaultPixel();
+
+    bool found = false;
+
+    for (TQ_INT32 y2 = y; y2 < y + h ; ++y2) {
+        KisHLineIterator it = const_cast<KisPaintDevice *>(this)->createHLineIterator(x, y2, w, false);
+        while (!it.isDone() && found == false) {
+            if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
+                boundY = y2;
+                found = true;
+                break;
+            }
+            ++it;
+        }
+        if (found) break;
+    }
+
+    found = false;
+
+    for (TQ_INT32 y2 = y + h; y2 > y ; --y2) {
+        KisHLineIterator it = const_cast<KisPaintDevice *>(this)->createHLineIterator(x, y2, w, false);
+        while (!it.isDone() && found == false) {
+            if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
+                boundH = y2 - boundY + 1;
+                found = true;
+                break;
+            }
+            ++it;
+        }
+        if (found) break;
+    }
+    found = false;
+
+    for (TQ_INT32 x2 = x; x2 < x + w ; ++x2) {
+        KisVLineIterator it = const_cast<KisPaintDevice *>(this)->createVLineIterator(x2, y, h, false);
+        while (!it.isDone() && found == false) {
+            if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
+                boundX = x2;
+                found = true;
+                break;
+            }
+            ++it;
+        }
+        if (found) break;
+    }
+
+    found = false;
+
+    // Look for right edge )
+    for (TQ_INT32 x2 = x + w; x2 > x ; --x2) {
+        KisVLineIterator it = const_cast<KisPaintDevice *>(this)->createVLineIterator(x2, y, h, false);
+        while (!it.isDone() && found == false) {
+            if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
+                boundW = x2 - boundX + 1; // XXX: I commented this
+                                          // +1 out, but why? It
+                                          // should be correct, since
+                                          // we've found the first
+                                          // pixel that should be
+                                          // included, and it should
+                                          // be added to the width.
+                found = true;
+                break;
+            }
+            ++it;
+        }
+        if (found) break;
+    }
+
+    return TQRect(boundX, boundY, boundW, boundH);
+}
+
+TQRect KisPaintDevice::exactBoundsImprovedOldMethod() const
+{
+    // Solution n°2
+    TQ_INT32  x, y, w, h, boundX2, boundY2, boundW2, boundH2;
+    extent(x, y, w, h);
+    extent(boundX2, boundY2, boundW2, boundH2);
+
+    const TQ_UINT8* defaultPixel = m_datamanager->defaultPixel();
+    bool found = false;
+    {
+        KisHLineIterator it = const_cast<KisPaintDevice *>(this)->createHLineIterator(x, y, w, false);
+        for (TQ_INT32 y2 = y; y2 < y + h ; ++y2) {
+            while (!it.isDone() && found == false) {
+                if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
+                    boundY2 = y2;
+                    found = true;
+                    break;
+                }
+                ++it;
+            }
+            if (found) break;
+            it.nextRow();
+        }
+    }
+
+    found = false;
+
+    for (TQ_INT32 y2 = y + h; y2 > y ; --y2) {
+        KisHLineIterator it = const_cast<KisPaintDevice *>(this)->createHLineIterator(x, y2, w, false);
+        while (!it.isDone() && found == false) {
+            if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
+                boundH2 = y2 - boundY2 + 1;
+                found = true;
+                break;
+            }
+            ++it;
+        }
+        if (found) break;
+    }
+    found = false;
+
+    {
+        KisVLineIterator it = const_cast<KisPaintDevice *>(this)->createVLineIterator(x, boundY2, boundH2, false);
+        for (TQ_INT32 x2 = x; x2 < x + w ; ++x2) {
+            while (!it.isDone() && found == false) {
+                if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
+                    boundX2 = x2;
+                    found = true;
+                    break;
+                }
+                ++it;
+            }
+            if (found) break;
+            it.nextCol();
+        }
+    }
+
+    found = false;
+
+    // Look for right edge )
+    {
+        for (TQ_INT32 x2 = x + w; x2 > x ; --x2) {
+            KisVLineIterator it = const_cast<KisPaintDevice *>(this)->createVLineIterator(/*x + w*/ x2, boundY2, boundH2, false);
+            while (!it.isDone() && found == false) {
+                if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
+                    boundW2 = x2 - boundX2 + 1; // XXX: I commented this
+                                            // +1 out, but why? It
+                                            // should be correct, since
+                                            // we've found the first
+                                            // pixel that should be
+                                            // included, and it should
+                                            // be added to the width.
+                    found = true;
+                    break;
+                }
+                ++it;
+            }
+            if (found) break;
+        }
+    }
+    return TQRect(boundX2, boundY2, boundW2, boundH2);
+}
+
+
+TQRect KisPaintDevice::exactBounds() const
+{
+    TQRect r2 = exactBoundsImprovedOldMethod();
+    return r2;
+}
+
+void KisPaintDevice::crop(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h)
+{
+     m_datamanager->setExtent(x - m_x, y - m_y, w, h);
+}
+
+
+void KisPaintDevice::crop(TQRect r)
+{
+    r.moveBy(-m_x, -m_y); m_datamanager->setExtent(r);
+}
+
+void KisPaintDevice::clear()
+{
+    m_datamanager->clear();
+}
+
+void KisPaintDevice::fill(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, const TQ_UINT8 *fillPixel)
+{
+    m_datamanager->clear(x, y, w, h, fillPixel);
+}
+
+void KisPaintDevice::mirrorX()
+{
+    TQRect r;
+    if (hasSelection()) {
+        r = selection()->selectedRect();
+    }
+    else {
+        r = exactBounds();
+    }
+
+    for (TQ_INT32 y = r.top(); y <= r.bottom(); ++y) {
+        KisHLineIteratorPixel srcIt = createHLineIterator(r.x(), y, r.width(), false);
+        KisHLineIteratorPixel dstIt = createHLineIterator(r.x(), y, r.width(), true);
+
+        dstIt += r.width() - 1;
+
+        while (!srcIt.isDone()) {
+            if (srcIt.isSelected()) {
+                memcpy(dstIt.rawData(), srcIt.oldRawData(), m_pixelSize);
+            }
+            ++srcIt;
+            --dstIt;
+
+        }
+    }
+    if (m_parentLayer) {
+        m_parentLayer->setDirty(r);
+    }
+}
+
+void KisPaintDevice::mirrorY()
+{
+    /* Read a line from bottom to top and and from top to bottom and write their values to each other */
+    TQRect r;
+    if (hasSelection()) {
+        r = selection()->selectedRect();
+    }
+    else {
+        r = exactBounds();
+    }
+
+
+    TQ_INT32 y1, y2;
+    for (y1 = r.top(), y2 = r.bottom(); y1 <= r.bottom(); ++y1, --y2) {
+        KisHLineIteratorPixel itTop = createHLineIterator(r.x(), y1, r.width(), true);
+        KisHLineIteratorPixel itBottom = createHLineIterator(r.x(), y2, r.width(), false);
+        while (!itTop.isDone() && !itBottom.isDone()) {
+            if (itBottom.isSelected()) {
+                memcpy(itTop.rawData(), itBottom.oldRawData(), m_pixelSize);
+            }
+            ++itBottom;
+            ++itTop;
+        }
+    }
+
+    if (m_parentLayer) {
+        m_parentLayer->setDirty(r);
+    }
+}
+
+KisMementoSP KisPaintDevice::getMemento()
+{
+    return m_datamanager->getMemento();
+}
+
+void KisPaintDevice::rollback(KisMementoSP memento) { m_datamanager->rollback(memento); }
+
+void KisPaintDevice::rollforward(KisMementoSP memento) { m_datamanager->rollforward(memento); }
+
+bool KisPaintDevice::write(KoStore *store)
+{
+    bool retval = m_datamanager->write(store);
+    emit ioProgress(100);
+
+        return retval;
+}
+
+bool KisPaintDevice::read(KoStore *store)
+{
+    bool retval = m_datamanager->read(store);
+    emit ioProgress(100);
+
+        return retval;
+}
+
+void KisPaintDevice::convertTo(KisColorSpace * dstColorSpace, TQ_INT32 renderingIntent)
+{
+    kdDebug(41004) << "Converting " << name() << " to " << dstColorSpace->id().id() << " from "
+              << m_colorSpace->id().id() << "\n";
+    if ( colorSpace() == dstColorSpace )
+    {
+        return;
+    }
+
+    KisPaintDevice dst(dstColorSpace);
+    dst.setX(getX());
+    dst.setY(getY());
+
+    TQ_INT32 x, y, w, h;
+    extent(x, y, w, h);
+
+    for (TQ_INT32 row = y; row < y + h; ++row) {
+
+        TQ_INT32 column = x;
+        TQ_INT32 columnsRemaining = w;
+
+        while (columnsRemaining > 0) {
+
+            TQ_INT32 numContiguousDstColumns = dst.numContiguousColumns(column, row, row);
+            TQ_INT32 numContiguousSrcColumns = numContiguousColumns(column, row, row);
+
+            TQ_INT32 columns = TQMIN(numContiguousDstColumns, numContiguousSrcColumns);
+            columns = TQMIN(columns, columnsRemaining);
+
+            //const TQ_UINT8 *srcData = pixel(column, row);
+            //TQ_UINT8 *dstData = dst.writablePixel(column, row);
+            KisHLineIteratorPixel srcIt = createHLineIterator(column, row, columns, false);
+            KisHLineIteratorPixel dstIt = dst.createHLineIterator(column, row, columns, true);
+
+            const TQ_UINT8 *srcData = srcIt.rawData();
+            TQ_UINT8 *dstData = dstIt.rawData();
+
+
+            m_colorSpace->convertPixelsTo(srcData, dstData, dstColorSpace, columns, renderingIntent);
+
+            column += columns;
+            columnsRemaining -= columns;
+        }
+    }
+
+    KisDataManagerSP oldData = m_datamanager;
+    KisColorSpace *oldColorSpace = m_colorSpace;
+
+    setData(dst.m_datamanager, dstColorSpace);
+
+    if (undoAdapter() && undoAdapter()->undo()) {
+        undoAdapter()->addCommand(new KisConvertLayerTypeCmd(undoAdapter(), this, oldData, oldColorSpace, m_datamanager, m_colorSpace));
+    }
+}
+
+void KisPaintDevice::setProfile(KisProfile * profile)
+{
+    if (profile == 0) return;
+
+    KisColorSpace * dstSpace =
+            KisMetaRegistry::instance()->csRegistry()->getColorSpace( colorSpace()->id(),
+                                                                      profile);
+    if (dstSpace)
+        m_colorSpace = dstSpace;
+
+}
+
+void KisPaintDevice::setData(KisDataManagerSP data, KisColorSpace * colorSpace)
+{
+    m_datamanager = data;
+    m_colorSpace = colorSpace;
+    m_pixelSize = m_colorSpace->pixelSize();
+    m_nChannels = m_colorSpace->nChannels();
+
+    if (m_parentLayer) {
+        m_parentLayer->setDirty(extent());
+        m_parentLayer->notifyPropertyChanged();
+    }
+}
+
+KisUndoAdapter *KisPaintDevice::undoAdapter() const
+{
+    if (m_parentLayer && m_parentLayer->image()) {
+        return m_parentLayer->image()->undoAdapter();
+    }
+    return 0;
+}
+
+void KisPaintDevice::convertFromTQImage(const TQImage& image, const TQString &srcProfileName,
+                                           TQ_INT32 offsetX, TQ_INT32 offsetY)
+{
+    TQImage img = image;
+
+    // Chalk is little-endian inside.
+    if (img.bitOrder() == TQImage::LittleEndian) {
+	img = img.convertBitOrder(TQImage::BigEndian);
+    }
+    kdDebug() << k_funcinfo << img.bitOrder()<< endl;
+    // Chalk likes bgra (convertDepth returns *this is the img is alread 32 bits)
+    img = img.convertDepth( 32 );
+#if 0
+    // XXX: Apply import profile
+    if (colorSpace() == KisMetaRegistry::instance()->csRegistry() ->getColorSpace(KisID("RGBA",""),"")) {
+        writeBytes(img.bits(), 0, 0, img.width(), img.height());
+    }
+    else {
+#endif
+        TQ_UINT8 * dstData = new TQ_UINT8[img.width() * img.height() * pixelSize()];
+        KisMetaRegistry::instance()->csRegistry()
+                ->getColorSpace(KisID("RGBA",""),srcProfileName)->
+                        convertPixelsTo(img.bits(), dstData, colorSpace(), img.width() * img.height());
+        writeBytes(dstData, offsetX, offsetY, img.width(), img.height());
+//    }
+}
+
+TQImage KisPaintDevice::convertToTQImage(KisProfile *  dstProfile, float exposure)
+{
+    TQ_INT32 x1;
+    TQ_INT32 y1;
+    TQ_INT32 w;
+    TQ_INT32 h;
+
+    x1 = - getX();
+    y1 = - getY();
+
+    if (image()) {
+        w = image()->width();
+        h = image()->height();
+    }
+    else {
+        extent(x1, y1, w, h);
+    }
+
+    return convertToTQImage(dstProfile, x1, y1, w, h, exposure);
+}
+
+// XXX: is this faster than building the TQImage ourselves? It makes
+TQImage KisPaintDevice::convertToTQImage(KisProfile *  dstProfile, TQ_INT32 x1, TQ_INT32 y1, TQ_INT32 w, TQ_INT32 h, float exposure)
+{
+    if (w < 0)
+        return TQImage();
+
+    if (h < 0)
+        return TQImage();
+
+    TQ_UINT8 * data = new TQ_UINT8 [w * h * m_pixelSize];
+    Q_CHECK_PTR(data);
+
+    // XXX: Is this really faster than converting line by line and building the TQImage directly?
+    //      This copies potentially a lot of data.
+    readBytes(data, x1, y1, w, h);
+    TQImage image = colorSpace()->convertToTQImage(data, w, h, dstProfile, INTENT_PERCEPTUAL, exposure);
+    delete[] data;
+
+    return image;
+}
+
+KisPaintDeviceSP KisPaintDevice::createThumbnailDevice(TQ_INT32 w, TQ_INT32 h)
+{
+    KisPaintDeviceSP thumbnail = new KisPaintDevice(colorSpace(), "thumbnail");
+
+    thumbnail->clear();
+
+    int srcw, srch;
+    if( image() )
+    {
+        srcw = image()->width();
+        srch = image()->height();
+    }
+    else
+    {
+        const TQRect e = exactBounds();
+        srcw = e.width();
+        srch = e.height();
+    }
+
+    if (w > srcw)
+    {
+        w = srcw;
+        h = TQ_INT32(double(srcw) / w * h);
+    }
+    if (h > srch)
+    {
+        h = srch;
+        w = TQ_INT32(double(srch) / h * w);
+    }
+
+    if (srcw > srch)
+        h = TQ_INT32(double(srch) / srcw * w);
+    else if (srch > srcw)
+        w = TQ_INT32(double(srcw) / srch * h);
+
+    for (TQ_INT32 y=0; y < h; ++y) {
+        TQ_INT32 iY = (y * srch ) / h;
+        for (TQ_INT32 x=0; x < w; ++x) {
+            TQ_INT32 iX = (x * srcw ) / w;
+            thumbnail->setPixel(x, y, colorAt(iX, iY));
+        }
+    }
+
+    return thumbnail;
+
+}
+
+
+TQImage KisPaintDevice::createThumbnail(TQ_INT32 w, TQ_INT32 h)
+{
+    int srcw, srch;
+    if( image() )
+    {
+        srcw = image()->width();
+        srch = image()->height();
+    }
+    else
+    {
+        const TQRect e = extent();
+        srcw = e.width();
+        srch = e.height();
+    }
+
+    if (w > srcw)
+    {
+        w = srcw;
+        h = TQ_INT32(double(srcw) / w * h);
+    }
+    if (h > srch)
+    {
+        h = srch;
+        w = TQ_INT32(double(srch) / h * w);
+    }
+
+    if (srcw > srch)
+        h = TQ_INT32(double(srch) / srcw * w);
+    else if (srch > srcw)
+        w = TQ_INT32(double(srcw) / srch * h);
+
+    TQColor c;
+    TQ_UINT8 opacity;
+    TQImage img(w,h,32);
+
+    for (TQ_INT32 y=0; y < h; ++y) {
+        TQ_INT32 iY = (y * srch ) / h;
+        for (TQ_INT32 x=0; x < w; ++x) {
+            TQ_INT32 iX = (x * srcw ) / w;
+            pixel(iX, iY, &c, &opacity);
+            const TQRgb rgb = c.rgb();
+            img.setPixel(x, y, tqRgba(tqRed(rgb), tqGreen(rgb), tqBlue(rgb), opacity));
+        }
+    }
+
+    return img;
+}
+
+KisRectIteratorPixel KisPaintDevice::createRectIterator(TQ_INT32 left, TQ_INT32 top, TQ_INT32 w, TQ_INT32 h, bool writable)
+{
+    if(hasSelection())
+        return KisRectIteratorPixel(this, m_datamanager, m_selection->m_datamanager, left, top, w, h, m_x, m_y, writable);
+    else
+        return KisRectIteratorPixel(this, m_datamanager, NULL, left, top, w, h, m_x, m_y, writable);
+}
+
+KisHLineIteratorPixel  KisPaintDevice::createHLineIterator(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, bool writable)
+{
+    if(hasSelection())
+        return KisHLineIteratorPixel(this, m_datamanager, m_selection->m_datamanager, x, y, w, m_x, m_y, writable);
+    else
+        return KisHLineIteratorPixel(this, m_datamanager, NULL, x, y, w, m_x, m_y, writable);
+}
+
+KisVLineIteratorPixel  KisPaintDevice::createVLineIterator(TQ_INT32 x, TQ_INT32 y, TQ_INT32 h, bool writable)
+{
+    if(hasSelection())
+        return KisVLineIteratorPixel(this, m_datamanager, m_selection->m_datamanager, x, y, h, m_x, m_y, writable);
+    else
+        return KisVLineIteratorPixel(this, m_datamanager, NULL, x, y, h, m_x, m_y, writable);
+
+}
+
+KisRandomAccessorPixel KisPaintDevice::createRandomAccessor(TQ_INT32 x, TQ_INT32 y, bool writable) {
+    if(hasSelection())
+        return KisRandomAccessorPixel(m_datamanager, m_selection->m_datamanager, x, y, m_x, m_y, writable);
+    else
+        return KisRandomAccessorPixel(m_datamanager, NULL, x, y, m_x, m_y, writable);
+}
+
+KisRandomSubAccessorPixel KisPaintDevice::createRandomSubAccessor()
+{
+    return KisRandomSubAccessorPixel(this);
+}
+
+void KisPaintDevice::emitSelectionChanged()
+{
+    if (m_parentLayer && m_parentLayer->image()) {
+        m_parentLayer->image()->slotSelectionChanged();
+    }
+}
+
+void KisPaintDevice::emitSelectionChanged(const TQRect& r)
+{
+    if (m_parentLayer && m_parentLayer->image()) {
+        m_parentLayer->image()->slotSelectionChanged(r);
+    }
+}
+
+KisSelectionSP KisPaintDevice::selection()
+{
+    if ( m_selectionDeselected && m_selection ) {
+        m_selectionDeselected = false;
+    }
+    else if (!m_selection) {
+        m_selection = new KisSelection(this);
+        Q_CHECK_PTR(m_selection);
+        m_selection->setX(m_x);
+        m_selection->setY(m_y);
+    }
+    m_hasSelection = true;
+
+    return m_selection;
+}
+
+
+bool KisPaintDevice::hasSelection()
+{
+    return m_hasSelection;
+}
+
+bool KisPaintDevice::selectionDeselected()
+{
+    return m_selectionDeselected;
+}
+
+
+void KisPaintDevice::deselect()
+{
+    if (m_selection && m_hasSelection) {
+        m_hasSelection = false;
+        m_selectionDeselected = true;
+    }
+}
+
+void KisPaintDevice::reselect()
+{
+    m_hasSelection = true;
+    m_selectionDeselected = false;
+}
+
+void KisPaintDevice::addSelection(KisSelectionSP selection) {
+
+    KisPainter painter(this->selection().data());
+    TQRect r = selection->selectedExactRect();
+    painter.bitBlt(r.x(), r.y(), COMPOSITE_OVER, selection.data(), r.x(), r.y(), r.width(), r.height());
+    painter.end();
+}
+
+void KisPaintDevice::subtractSelection(KisSelectionSP selection) {
+    KisPainter painter(this->selection().data());
+    selection->invert();
+
+    TQRect r = selection->selectedExactRect();
+    painter.bitBlt(r.x(), r.y(), COMPOSITE_ERASE, selection.data(), r.x(), r.y(), r.width(), r.height());
+
+    selection->invert();
+    painter.end();
+}
+
+void KisPaintDevice::clearSelection()
+{
+    if (!hasSelection()) return;
+
+    TQRect r = m_selection->selectedExactRect();
+
+    if (r.isValid()) {
+
+        for (TQ_INT32 y = 0; y < r.height(); y++) {
+
+            KisHLineIterator devIt = createHLineIterator(r.x(), r.y() + y, r.width(), true);
+            KisHLineIterator selectionIt = m_selection->createHLineIterator(r.x(), r.y() + y, r.width(), false);
+
+            while (!devIt.isDone()) {
+                // XXX: Optimize by using stretches
+
+                m_colorSpace->applyInverseAlphaU8Mask( devIt.rawData(), selectionIt.rawData(), 1);
+
+                ++devIt;
+                ++selectionIt;
+            }
+        }
+
+        if (m_parentLayer) {
+            m_parentLayer->setDirty(r);
+        }
+    }
+}
+
+void KisPaintDevice::applySelectionMask(KisSelectionSP tqmask)
+{
+    TQRect r = tqmask->selectedRect();
+    crop(r);
+
+    for (TQ_INT32 y = r.top(); y <= r.bottom(); ++y) {
+
+        KisHLineIterator pixelIt = createHLineIterator(r.x(), y, r.width(), true);
+        KisHLineIterator tqmaskIt = tqmask->createHLineIterator(r.x(), y, r.width(), false);
+
+        while (!pixelIt.isDone()) {
+            // XXX: Optimize by using stretches
+
+            m_colorSpace->applyAlphaU8Mask( pixelIt.rawData(), tqmaskIt.rawData(), 1);
+
+            ++pixelIt;
+            ++tqmaskIt;
+        }
+    }
+}
+
+KisSelectionSP KisPaintDevice::setSelection( KisSelectionSP selection)
+{
+    if (selection) {
+        KisSelectionSP oldSelection = m_selection;
+        m_selection = selection;
+        m_hasSelection = true;
+        return oldSelection;
+    }
+    else return 0;
+}
+
+bool KisPaintDevice::pixel(TQ_INT32 x, TQ_INT32 y, TQColor *c, TQ_UINT8 *opacity)
+{
+    KisHLineIteratorPixel iter = createHLineIterator(x, y, 1, false);
+
+    TQ_UINT8 *pix = iter.rawData();
+
+    if (!pix) return false;
+
+    colorSpace()->toTQColor(pix, c, opacity);
+
+    return true;
+}
+
+
+bool KisPaintDevice::pixel(TQ_INT32 x, TQ_INT32 y, KisColor * kc)
+{
+    KisHLineIteratorPixel iter = createHLineIterator(x, y, 1, false);
+
+    TQ_UINT8 *pix = iter.rawData();
+
+    if (!pix) return false;
+
+    kc->setColor(pix, m_colorSpace);
+
+    return true;
+}
+
+KisColor KisPaintDevice::colorAt(TQ_INT32 x, TQ_INT32 y)
+{
+    //return KisColor(m_datamanager->pixel(x - m_x, y - m_y), m_colorSpace);
+    KisHLineIteratorPixel iter = createHLineIterator(x, y, 1, true);
+    return KisColor(iter.rawData(), m_colorSpace);
+}
+
+bool KisPaintDevice::setPixel(TQ_INT32 x, TQ_INT32 y, const TQColor& c, TQ_UINT8  opacity)
+{
+    KisHLineIteratorPixel iter = createHLineIterator(x, y, 1, true);
+
+    colorSpace()->fromTQColor(c, opacity, iter.rawData());
+
+    return true;
+}
+
+bool KisPaintDevice::setPixel(TQ_INT32 x, TQ_INT32 y, const KisColor& kc)
+{
+    TQ_UINT8 * pix;
+    if (kc.colorSpace() != m_colorSpace) {
+        KisColor kc2 (kc, m_colorSpace);
+        pix = kc2.data();
+    }
+    else {
+        pix = kc.data();
+    }
+
+    KisHLineIteratorPixel iter = createHLineIterator(x, y, 1, true);
+    memcpy(iter.rawData(), pix, m_colorSpace->pixelSize());
+
+    return true;
+}
+
+
+TQ_INT32 KisPaintDevice::numContiguousColumns(TQ_INT32 x, TQ_INT32 minY, TQ_INT32 maxY)
+{
+    return m_datamanager->numContiguousColumns(x - m_x, minY - m_y, maxY - m_y);
+}
+
+TQ_INT32 KisPaintDevice::numContiguousRows(TQ_INT32 y, TQ_INT32 minX, TQ_INT32 maxX)
+{
+    return m_datamanager->numContiguousRows(y - m_y, minX - m_x, maxX - m_x);
+}
+
+TQ_INT32 KisPaintDevice::rowStride(TQ_INT32 x, TQ_INT32 y)
+{
+    return m_datamanager->rowStride(x - m_x, y - m_y);
+}
+
+const TQ_UINT8* KisPaintDevice::pixel(TQ_INT32 x, TQ_INT32 y)
+{
+    return m_datamanager->pixel(x - m_x, y - m_y);
+}
+
+TQ_UINT8* KisPaintDevice::writablePixel(TQ_INT32 x, TQ_INT32 y)
+{
+    return m_datamanager->writablePixel(x - m_x, y - m_y);
+}
+
+void KisPaintDevice::setX(TQ_INT32 x)
+{
+    m_x = x;
+    if(m_selection && m_selection != this)
+        m_selection->setX(x);
+}
+
+void KisPaintDevice::setY(TQ_INT32 y)
+{
+    m_y = y;
+    if(m_selection && m_selection != this)
+        m_selection->setY(y);
+}
+
+
+void KisPaintDevice::readBytes(TQ_UINT8 * data, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h)
+{
+    m_datamanager->readBytes(data, x - m_x, y - m_y, w, h);
+}
+
+void KisPaintDevice::writeBytes(const TQ_UINT8 * data, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h)
+{
+    m_datamanager->writeBytes( data, x - m_x, y - m_y, w, h);
+}
+
+
+KisDataManagerSP KisPaintDevice::dataManager() const
+{
+    return m_datamanager;
+}
+
+KisExifInfo* KisPaintDevice::exifInfo()
+{
+    if(!m_exifInfo)
+        m_exifInfo = new KisExifInfo();
+    return m_exifInfo;
+}
+
+void KisPaintDevice::runBackgroundFilters()
+{
+    if ( m_lock ) return;
+
+    KisTransaction * cmd = new KisTransaction("Running autofilters", this);
+
+    TQRect rc = extent();
+    if (!m_longRunningFilters.isEmpty()) {
+        TQValueList<KisFilter*>::iterator it;
+        TQValueList<KisFilter*>::iterator end = m_longRunningFilters.end();
+        for (it = m_longRunningFilters.begin(); it != end; ++it) {
+            (*it)->process(this, this, 0, rc);
+        }
+    }
+    if (cmd && undoAdapter()) undoAdapter()->addCommand(cmd);
+
+    if (m_parentLayer) m_parentLayer->setDirty(rc);
+}
+
+#include "kis_paint_device.moc"
diff --git a/chalk/core/kis_paint_device.h b/chalk/core/kis_paint_device.h
new file mode 100644
index 000000000..6e804afe6
--- /dev/null
+++ b/chalk/core/kis_paint_device.h
@@ -0,0 +1,597 @@
+/*
+ *  copyright (c) 2002 patrick julien <freak@codepimps.org>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+#ifndef KIS_PAINT_DEVICE_IMPL_H_
+#define KIS_PAINT_DEVICE_IMPL_H_
+
+#include <tqcolor.h>
+#include <tqobject.h>
+#include <tqpixmap.h>
+#include <tqptrlist.h>
+#include <tqrect.h>
+#include <tqvaluelist.h>
+#include <tqstring.h>
+
+#include "kis_types.h"
+#include "kdebug.h"
+#include "kis_global.h"
+#include "kis_image.h"
+#include "kis_colorspace.h"
+#include "kis_canvas_controller.h"
+#include "kis_color.h"
+#include <koffice_export.h>
+
+class DCOPObject;
+
+class TQImage;
+class TQSize;
+class TQPoint;
+class TQWMatrix;
+class TQTimer;
+
+class KNamedCommand;
+
+class KoStore;
+
+class KisExifInfo;
+class KisHLineIteratorPixel;
+class KisImage;
+class KisRectIteratorPixel;
+class KisVLineIteratorPixel;
+class KisRandomAccessorPixel;
+class KisRandomSubAccessorPixel;
+class KisUndoAdapter;
+class KisFilter;
+class KisDataManager;
+typedef KSharedPtr<KisDataManager> KisDataManagerSP;
+
+class KisMemento;
+typedef KSharedPtr<KisMemento> KisMementoSP;
+
+
+/**
+ * A paint device contains the actual pixel data and offers methods
+ * to read and write pixels. A paint device has an integer x,y position
+ * (i.e., are not positioned on the image with sub-pixel accuracy).
+ * A KisPaintDevice doesn't have any fixed size, the size change dynamicaly
+ * when pixels are accessed by an iterator.
+ */
+class KRITACORE_EXPORT KisPaintDevice
+    : public TQObject
+    , public KShared
+{
+
+        Q_OBJECT
+  TQ_OBJECT
+
+public:
+
+    /**
+     * Create a new paint device with the specified colorspace.
+     *
+     * @param colorSpace the colorspace of this paint device
+     * @param name for debugging purposes
+     */
+    KisPaintDevice(KisColorSpace * colorSpace, const char * name = 0);
+
+    /**
+     * Create a new paint device with the specified colorspace. The
+     * tqparentLayer will be notified of changes to this paint device.
+     *
+     * @param tqparentLayer the layer that contains this paint device.
+     * @param colorSpace the colorspace of this paint device
+     * @param name for debugging purposes
+     */
+    KisPaintDevice(KisLayer *tqparentLayer, KisColorSpace * colorSpace, const char * name = 0);
+
+    KisPaintDevice(const KisPaintDevice& rhs);
+    virtual ~KisPaintDevice();
+    virtual DCOPObject *dcopObject();
+
+    void lock(bool lock) { m_lock = lock; }
+
+public:
+
+    /**
+     * Write the pixels of this paint device into the specified file store.
+     */
+    virtual bool write(KoStore *store);
+
+    /**
+     * Fill this paint device with the pixels from the specified file store.
+     */
+    virtual bool read(KoStore *store);
+
+public:
+
+    /**
+     * Moves the device to these new coordinates (so no incremental move or so)
+     */
+    virtual void move(TQ_INT32 x, TQ_INT32 y);
+
+    /**
+     * Convenience method for the above
+     */
+    virtual void move(const TQPoint& pt);
+
+    /**
+     * Move the paint device to the specified location and make it possible to
+     * undo the move.
+     */
+    virtual KNamedCommand * moveCommand(TQ_INT32 x, TQ_INT32 y);
+
+    /**
+     * Returns true of x,y is within the extent of this paint device
+     */
+    bool tqcontains(TQ_INT32 x, TQ_INT32 y) const;
+
+    /**
+     * Convenience method for the above
+     */
+    bool tqcontains(const TQPoint& pt) const;
+
+    /**
+     * Retrieve the bounds of the paint device. The size is not exact,
+     * but may be larger if the underlying datamanager works that way.
+     * For instance, the tiled datamanager keeps the extent to the nearest
+     * multiple of 64.
+     */
+    virtual void extent(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const;
+    virtual TQRect extent() const;
+
+    /**
+     * XXX: This should be a temporay hack, awaiting a proper fix.
+     *
+     * Indicates whether the extent really represents the extent. For example,
+     * the KisBackground checkerboard pattern is generated by filling the
+     * default tile but it will return an empty extent.
+     */
+    bool extentIsValid() const;
+
+    /// Convience method for the above
+    void setExtentIsValid(bool isValid);
+
+    /**
+     * Get the exact bounds of this paint device. This may be very slow,
+     * especially on larger paint devices because it does a linear scanline search.
+     */
+    virtual void exactBounds(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const;
+    virtual TQRect exactBounds() const;
+    virtual TQRect exactBoundsOldMethod() const;
+    virtual TQRect exactBoundsImprovedOldMethod() const;
+
+    /**
+     * Cut the paint device down to the specified rect
+     */
+    void crop(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+
+    /// Convience method for the above
+    void crop(TQRect r);
+
+    /**
+     * Complete erase the current paint device. Its size will become 0.
+     */
+    virtual void clear();
+
+    /**
+     * Fill the given rectangle with the given pixel.
+     */
+    void fill(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, const TQ_UINT8 *fillPixel);
+
+    /**
+     * Read the bytes representing the rectangle described by x, y, w, h into
+     * data. If data is not big enough, Chalk will gladly overwrite the rest
+     * of your precious memory.
+     *
+     * Since this is a copy, you need to make sure you have enough memory.
+     *
+     * Reading from areas not previously initialized will read the default
+     * pixel value into data but not initialize that region.
+     */
+    virtual void readBytes(TQ_UINT8 * data, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+
+    /**
+     * Copy the bytes in data into the rect specified by x, y, w, h. If the
+     * data is too small or uninitialized, Chalk will happily read parts of
+     * memory you never wanted to be read.
+     *
+     * If the data is written to areas of the paint device not previously initialized,
+     * the paint device will grow.
+     */
+    virtual void writeBytes(const TQ_UINT8 * data, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+
+    /**
+     * Get the number of contiguous columns starting at x, valid for all values
+     * of y between minY and maxY.
+     */
+    TQ_INT32 numContiguousColumns(TQ_INT32 x, TQ_INT32 minY, TQ_INT32 maxY);
+
+    /**
+     * Get the number of contiguous rows starting at y, valid for all values
+     * of x between minX and maxX.
+     */
+    TQ_INT32 numContiguousRows(TQ_INT32 y, TQ_INT32 minX, TQ_INT32 maxX);
+
+    /**
+     * Get the row stride at pixel (x, y). This is the number of bytes to add to a
+     * pointer to pixel (x, y) to access (x, y + 1).
+     */
+    TQ_INT32 rowStride(TQ_INT32 x, TQ_INT32 y);
+
+    /**
+     * Get a read-only pointer to pixel (x, y).
+     */
+    KDE_DEPRECATED const TQ_UINT8* pixel(TQ_INT32 x, TQ_INT32 y);
+
+    /**
+     * Get a read-write pointer to pixel (x, y).
+     */
+    KDE_DEPRECATED TQ_UINT8* writablePixel(TQ_INT32 x, TQ_INT32 y);
+
+    /**
+     *   Converts the paint device to a different colorspace
+     */
+    virtual void convertTo(KisColorSpace * dstColorSpace, TQ_INT32 renderingIntent = INTENT_PERCEPTUAL);
+
+    /**
+     * Changes the profile of the colorspace of this paint device to the given
+     * profile. If the given profile is 0, nothing happens.
+     */
+    virtual void setProfile(KisProfile * profile);
+    
+    /**
+     * Fill this paint device with the data from img; starting at (offsetX, offsetY)
+     * @param srcProfileName name of the RGB profile to interpret the img as. "" is interpreted as sRGB
+     */
+    virtual void convertFromTQImage(const TQImage& img, const TQString &srcProfileName, TQ_INT32 offsetX = 0, TQ_INT32 offsetY = 0);
+
+    /**
+     * Create an RGBA TQImage from a rectangle in the paint device.
+     *
+     * @param x Left coordinate of the rectangle
+     * @param y Top coordinate of the rectangle
+     * @param w Width of the rectangle in pixels
+     * @param h Height of the rectangle in pixels
+     * @param dstProfile RGB profile to use in conversion. May be 0, in which
+     * case it's up to the colour strategy to choose a profile (most
+     * like sRGB).
+     * @param exposure The exposure setting used to render a preview of a high dynamic range image.
+     */
+    virtual TQImage convertToTQImage(KisProfile *  dstProfile, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, float exposure = 0.0f);
+
+    /**
+     * Create an RGBA TQImage from a rectangle in the paint device. The rectangle is defined by the tqparent image's bounds.
+     *
+     * @param dstProfile RGB profile to use in conversion. May be 0, in which
+     * case it's up to the colour strategy to choose a profile (most
+     * like sRGB).
+     * @param exposure The exposure setting used to render a preview of a high dynamic range image.
+     */
+    virtual TQImage convertToTQImage(KisProfile *  dstProfile, float exposure = 0.0f);
+
+    /**
+     * Creates a paint device thumbnail of the paint device, retaining the aspect ratio.
+     * The width and height of the returned device won't exceed \p maxw and \p maxw, but they may be smaller.
+     */
+
+    KisPaintDeviceSP createThumbnailDevice(TQ_INT32 w, TQ_INT32 h);
+            
+    /**
+     * Creates a thumbnail of the paint device, retaining the aspect ratio.
+     * The width and height of the returned TQImage won't exceed \p maxw and \p maxw, but they may be smaller.
+     * The colors are not corrected for display!
+     */
+    virtual TQImage createThumbnail(TQ_INT32 maxw, TQ_INT32 maxh);
+
+
+    /**
+     * Fill c and opacity with the values found at x and y.
+     *
+     * The color values will be transformed from the profile of
+     * this paint device to the display profile.
+     *
+     * @return true if the operation was succesful.
+     */
+    bool pixel(TQ_INT32 x, TQ_INT32 y, TQColor *c, TQ_UINT8 *opacity);
+
+
+    /**
+     * Fill kc with the values found at x and y. This method differs
+     * from the above in using KisColor, which can be of any colorspace
+     *
+     * The color values will be transformed from the profile of
+     * this paint device to the display profile.
+     *
+     * @return true if the operation was succesful.
+     */
+    bool pixel(TQ_INT32 x, TQ_INT32 y, KisColor * kc);
+
+    /**
+     * Return the KisColor of the pixel at x,y.
+     */
+    KisColor colorAt(TQ_INT32 x, TQ_INT32 y);
+
+    /**
+     * Set the specified pixel to the specified color. Note that this
+     * bypasses KisPainter. the PaintDevice is here used as an equivalent
+     * to TQImage, not TQPixmap. This means that this is not undoable; also,
+     * there is no compositing with an existing value at this location.
+     *
+     * The color values will be transformed from the display profile to
+     * the paint device profile.
+     *
+     * Note that this will use 8-bit values and may cause a significant
+     * degradation when used on 16-bit or hdr quality images.
+     *
+     * @return true if the operation was succesful
+     *
+     */
+    bool setPixel(TQ_INT32 x, TQ_INT32 y, const TQColor& c, TQ_UINT8 opacity);
+
+    bool setPixel(TQ_INT32 x, TQ_INT32 y, const KisColor& kc);
+
+    KisColorSpace * colorSpace() const;
+
+    KisDataManagerSP dataManager() const;
+
+    /**
+     * Replace the pixel data, color strategy, and profile.
+     */
+    void setData(KisDataManagerSP data, KisColorSpace * colorSpace);
+
+    /**
+     * The X offset of the paint device
+     */
+    TQ_INT32 getX() const;
+
+    /**
+     * The Y offset of the paint device
+     */
+    TQ_INT32 getY() const;
+
+    /**
+     * Return the X offset of the paint device
+     */
+    void setX(TQ_INT32 x);
+
+    /**
+     * Return the Y offset of the paint device
+     */
+    void setY(TQ_INT32 y);
+
+
+    /**
+     * Return the number of bytes a pixel takes.
+     */
+    virtual TQ_INT32 pixelSize() const;
+
+    /**
+     * Return the number of channels a pixel takes
+     */
+    virtual TQ_INT32 nChannels() const;
+
+    /**
+     * Return the image that contains this paint device, or 0 if it is not
+     * part of an image. This is the same as calling tqparentLayer()->image().
+     */
+    KisImage *image() const;
+
+    /**
+     * Returns the KisLayer that contains this paint device, or 0 if this is not
+     * part of a layer.
+     */
+    KisLayer *tqparentLayer() const;
+
+    /**
+     * Set the KisLayer that contains this paint device, or 0 if this is not
+     * part of a layer.
+     */
+    void setParentLayer(KisLayer *tqparentLayer);
+
+    /**
+     * Add the specified rect top the tqparent layer (if present)
+     */
+    virtual void setDirty(const TQRect & rc);
+
+    /**
+     * Set the tqparent layer completely dirty, if this paint device has one.
+     */
+    virtual void setDirty();
+    
+    
+    /**
+     * Mirror the device along the X axis
+     */
+    void mirrorX();
+    /**
+     * Mirror the device along the Y axis
+     */
+    void mirrorY();
+
+    KisMementoSP getMemento();
+    void rollback(KisMementoSP memento);
+    void rollforward(KisMementoSP memento);
+
+    /**
+     * This function return an iterator which points to the first pixel of an rectangle
+     */
+    KisRectIteratorPixel createRectIterator(TQ_INT32 left, TQ_INT32 top, TQ_INT32 w, TQ_INT32 h, bool writable);
+
+    /**
+     * This function return an iterator which points to the first pixel of a horizontal line
+     */
+    KisHLineIteratorPixel createHLineIterator(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, bool writable);
+
+    /**
+     * This function return an iterator which points to the first pixel of a vertical line
+     */
+    KisVLineIteratorPixel createVLineIterator(TQ_INT32 x, TQ_INT32 y, TQ_INT32 h, bool writable);
+
+    /**
+     * This function creates a random accessor which allow to randomly access any pixels on
+     * the paint device.
+     * <b>Note:</b> random access is way slower than iterators, allways use iterators whenever
+     * you can
+     */
+    KisRandomAccessorPixel createRandomAccessor(TQ_INT32 x, TQ_INT32 y, bool writable);
+    
+    /**
+     * This function create a random accessor which can easily access to sub pixel values.
+     */
+    KisRandomSubAccessorPixel createRandomSubAccessor();
+    
+    /** Get the current selection or create one if this paintdevice hasn't got a selection yet. */
+    KisSelectionSP selection();
+
+    /** Adds the specified selection to the currently active selection for this paintdevice */
+    void addSelection(KisSelectionSP selection);
+
+    /** Subtracts the specified selection from the currently active selection for this paindevice */
+    void subtractSelection(KisSelectionSP selection);
+
+    /** Whether there is a valid selection for this paintdevice. */
+    bool hasSelection();
+
+   /** Whether the previous selection was deselected. */
+    bool selectionDeselected();
+
+    /** Deselect the selection for this paintdevice. */
+    void deselect();
+
+    /** Reinstates the old selection */
+    void reselect();
+        
+    /** Clear the selected pixels from the paint device */
+    void clearSelection();
+
+    /**
+     * Apply a tqmask to the image data, i.e. multiply each pixel's opacity by its
+     * selectedness in the tqmask.
+     */
+    void applySelectionMask(KisSelectionSP tqmask);
+
+    /**
+     * Sets the selection of this paint device to the new selection,
+     * returns the old selection, if there was an old selection,
+     * otherwise 0
+     */
+    KisSelectionSP setSelection(KisSelectionSP selection);
+
+    /**
+     * Notify the owning image that the current selection has changed.
+     */
+    void emitSelectionChanged();
+
+    /**
+     * Notify the owning image that the current selection has changed.
+     *
+     * @param r the area for which the selection has changed
+     */
+    void emitSelectionChanged(const TQRect& r);
+
+    
+    KisUndoAdapter *undoAdapter() const;
+
+    /**
+     * Return the exifInfo associated with this layer. If no exif infos are
+     * available, the function will create it.
+     */
+    KisExifInfo* exifInfo();
+    /**
+     * This function return true if the layer has exif info associated with it.
+     */
+    bool hasExifInfo() { return m_exifInfo != 0; }
+signals:
+    void positionChanged(KisPaintDeviceSP device);
+    void ioProgress(TQ_INT8 percentage);
+    void profileChanged(KisProfile *  profile);
+
+private slots:
+
+    void runBackgroundFilters();
+    
+private:
+    KisPaintDevice& operator=(const KisPaintDevice&);
+
+protected:
+    KisDataManagerSP m_datamanager;
+    
+private:
+    /* The KisLayer that contains this paint device, or 0 if this is not 
+     * part of a layer.
+     */
+    KisLayer *m_parentLayer;
+
+    bool m_extentIsValid;
+
+    TQ_INT32 m_x;
+    TQ_INT32 m_y;
+    KisColorSpace * m_colorSpace;
+    // Cached for quick access
+    TQ_INT32 m_pixelSize;
+    TQ_INT32 m_nChannels;
+
+    // Whether the selection is active
+    bool m_hasSelection;
+    bool m_selectionDeselected;
+    
+    // Contains the actual selection. For now, there can be only
+    // one selection per layer. XXX: is this a limitation?
+    KisSelectionSP m_selection;
+    
+    DCOPObject * m_dcop;
+
+    KisExifInfo* m_exifInfo;
+
+    TQValueList<KisFilter*> m_longRunningFilters;
+    TQTimer * m_longRunningFilterTimer;
+
+    bool m_lock;
+};
+
+inline TQ_INT32 KisPaintDevice::pixelSize() const
+{
+    Q_ASSERT(m_pixelSize > 0);
+    return m_pixelSize;
+}
+
+inline TQ_INT32 KisPaintDevice::nChannels() const
+{
+    Q_ASSERT(m_nChannels > 0);
+    return m_nChannels;
+;
+}
+
+inline KisColorSpace * KisPaintDevice::colorSpace() const
+{
+    Q_ASSERT(m_colorSpace != 0);
+        return m_colorSpace;
+}
+
+
+inline TQ_INT32 KisPaintDevice::getX() const
+{
+    return m_x;
+}
+
+inline TQ_INT32 KisPaintDevice::getY() const
+{
+    return m_y;
+}
+
+#endif // KIS_PAINT_DEVICE_IMPL_H_
+
diff --git a/chalk/core/kis_paint_device_action.h b/chalk/core/kis_paint_device_action.h
new file mode 100644
index 000000000..1e3d41f03
--- /dev/null
+++ b/chalk/core/kis_paint_device_action.h
@@ -0,0 +1,43 @@
+/*
+ *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_PAINTDEV_ACTION_H_
+#define KIS_PAINTDEV_ACTION_H_
+
+#include "kis_paint_device.h"
+class TQString;
+
+/**
+ * Defines an action to do with a paint device. It can be force used by the gui on creation
+ * of a layer, for example. Or just appear in a list of actions to do.
+ */
+class KisPaintDeviceAction {
+public:
+    virtual ~KisPaintDeviceAction() {}
+    /**
+     * Do something with the paint device. This can be anything, like, for example, popping
+     * up a dialog to choose a texture. The width and height are added because these may
+     * be needed in some cases.
+     */
+    virtual void act(KisPaintDeviceSP paintDev, TQ_INT32 w = 0, TQ_INT32 h = 0) const = 0;
+    /// The name of the action, to be displayed in the GUI
+    virtual TQString name() const = 0;
+    /// A description of the action, to be displayed in the GUI
+    virtual TQString description() const = 0;
+};
+
+#endif // KIS_PAINTDEV_ACTION_H_
diff --git a/chalk/core/kis_paint_device_iface.cc b/chalk/core/kis_paint_device_iface.cc
new file mode 100644
index 000000000..1aace538a
--- /dev/null
+++ b/chalk/core/kis_paint_device_iface.cc
@@ -0,0 +1,74 @@
+/*
+ *  This file is part of the KDE project
+ *
+ *  Copyright (C) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#include <kapplication.h>
+
+#include <dcopclient.h>
+
+#include "kis_paint_device_iface.h"
+#include "kis_colorspace_iface.h"
+#include "kis_colorspace.h"
+
+#include "kis_paint_device.h"
+
+KisPaintDeviceIface::KisPaintDeviceIface( KisPaintDevice * tqparent )
+    : DCOPObject("paintdevice")
+{
+    m_parent = tqparent;
+}
+
+TQ_INT32 KisPaintDeviceIface::pixelSize() const
+{
+    return m_parent->pixelSize();
+}
+
+TQ_INT32 KisPaintDeviceIface::nChannels() const
+{
+    return m_parent->nChannels();
+}
+
+TQByteArray KisPaintDeviceIface::readBytes(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h)
+{
+    TQByteArray b (w * h * m_parent->pixelSize());
+
+    m_parent->readBytes((TQ_UINT8*)b.data(), x, y, w, h);
+    return b;
+}
+
+void KisPaintDeviceIface::writeBytes(TQByteArray bytes, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h)
+{
+    m_parent->writeBytes((TQ_UINT8*)bytes.data(), x, y, w, h);
+}
+
+DCOPRef KisPaintDeviceIface::colorSpace() const
+{
+    KisColorSpace * cs = m_parent->colorSpace();
+    if ( !cs )
+        return DCOPRef();
+    else
+        return DCOPRef( kapp->dcopClient()->appId(),
+                        cs->dcopObject()->objId(),
+                        "KisColorSpaceIface" );
+}
+
+void KisPaintDeviceIface::setColorSpace(DCOPRef)
+{
+    // XXX: Figure out how to get the correct object from
+    //      the dcopref
+}
diff --git a/chalk/core/kis_paint_device_iface.h b/chalk/core/kis_paint_device_iface.h
new file mode 100644
index 000000000..df7c9372f
--- /dev/null
+++ b/chalk/core/kis_paint_device_iface.h
@@ -0,0 +1,85 @@
+/*
+ *  This file is part of the KDE project
+ *
+ *  Copyright (C) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef _KIS_PAINT_DEVICE_IFACE_H
+#define _KIS_PAINT_DEVICE_IFACE_H
+
+#include <dcopref.h>
+#include <dcopobject.h>
+
+#include <tqstring.h>
+
+class KisPaintDevice;
+
+class KisPaintDeviceIface : virtual public DCOPObject
+{
+    K_DCOP
+public:
+    KisPaintDeviceIface( KisPaintDevice * tqparent );
+k_dcop:
+
+    /**
+     * Return the number of bytes a pixel takes.
+     */
+    TQ_INT32 pixelSize() const;
+
+    /**
+     * Return the number of channels a pixel takes
+     */
+    TQ_INT32 nChannels() const;
+
+    /**
+     * Read the bytes representing the rectangle described by x, y, w, h into
+     * data. If data is not big enough, Chalk will gladly overwrite the rest
+     * of your precious memory.
+     *
+     * Since this is a copy, you need to make sure you have enough memory.
+     *
+     * Reading from areas not previously initialized will read the default
+     * pixel value into data.
+     */
+    TQByteArray readBytes(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+
+    /**
+     * Copy the bytes in data into the rect specified by x, y, w, h. If there
+     * data is too small or uninitialized, Chalk will happily read parts of
+     * memory you never wanted to be read.
+     *
+     * If the data is written to areas of the paint device not previously initialized,
+     * the paint device will grow.
+     */
+    void writeBytes(TQByteArray bytes, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+
+    /**
+     * Get the colorspace of this image
+     */
+    DCOPRef colorSpace() const;
+
+    /**
+     * Set the colorspace of this image
+     */
+    void setColorSpace(DCOPRef colorSpace);
+
+
+private:
+
+    KisPaintDevice *m_parent;
+};
+
+#endif
diff --git a/chalk/core/kis_paint_layer.cc b/chalk/core/kis_paint_layer.cc
new file mode 100644
index 000000000..636630673
--- /dev/null
+++ b/chalk/core/kis_paint_layer.cc
@@ -0,0 +1,509 @@
+/*
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *  Copyright (c) 2006 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+
+#include <kdebug.h>
+#include <tqimage.h>
+
+#include "kis_debug_areas.h"
+#include "kis_image.h"
+#include "kis_paint_layer.h"
+#include "kis_selection.h"
+#include "kis_painter.h"
+#include "kis_undo_adapter.h"
+#include "kis_iterators_pixel.h"
+#include "kis_paint_device.h"
+#include "kis_meta_registry.h"
+#include "kis_colorspace_factory_registry.h"
+#include "kis_datamanager.h"
+#include "kis_undo_adapter.h"
+
+KisPaintLayer::KisPaintLayer(KisImage *img, const TQString& name, TQ_UINT8 opacity, KisPaintDeviceSP dev)
+    : super(img, name, opacity)
+{
+    Q_ASSERT(img);
+    Q_ASSERT(dev);
+    m_paintdev = dev;
+    m_tqmask = 0;
+    m_tqmaskAsSelection = 0;
+    m_paintdev->setParentLayer(this);
+    m_renderMask = false;
+    m_editMask = true;
+}
+
+
+KisPaintLayer::KisPaintLayer(KisImage *img, const TQString& name, TQ_UINT8 opacity)
+    : super(img, name, opacity)
+{
+    Q_ASSERT(img);
+    m_paintdev = new KisPaintDevice(this, img->colorSpace(), name.latin1());
+    m_tqmask = 0;
+    m_tqmaskAsSelection = 0;
+    m_renderMask = false;
+    m_editMask = true;
+}
+
+KisPaintLayer::KisPaintLayer(KisImage *img, const TQString& name, TQ_UINT8 opacity, KisColorSpace * colorSpace)
+    : super(img, name, opacity)
+{
+    Q_ASSERT(img);
+    Q_ASSERT(colorSpace);
+    m_paintdev = new KisPaintDevice(this, colorSpace,  name.latin1());
+    m_tqmask = 0;
+    m_tqmaskAsSelection = 0;
+    m_renderMask = false;
+    m_editMask = true;
+}
+
+KisPaintLayer::KisPaintLayer(const KisPaintLayer& rhs) :
+        KisLayer(rhs), KisLayerSupportsIndirectPainting(rhs)
+{
+    m_paintdev = new KisPaintDevice( *rhs.m_paintdev.data() );
+    m_paintdev->setParentLayer(this);
+    if (rhs.hasMask()) {
+        m_tqmask = new KisPaintDevice(*rhs.m_tqmask.data());
+        m_tqmask->setParentLayer(this);
+    }
+    m_renderMask = rhs.m_renderMask;
+    m_editMask = rhs.m_editMask;
+}
+
+KisLayerSP KisPaintLayer::clone() const
+{
+    return new KisPaintLayer(*this);
+}
+
+KisPaintLayer::~KisPaintLayer()
+{
+    if (m_paintdev != 0) {
+        m_paintdev->setParentLayer(0);
+    }
+    if (m_tqmask != 0) {
+        m_tqmask->setParentLayer(0);
+    }
+}
+
+void KisPaintLayer::paintSelection(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h)
+{
+    if (m_paintdev && m_paintdev->hasSelection()) {
+        m_paintdev->selection()->paintSelection(img, x, y, w, h);
+    } else if (m_tqmask && m_editMask && m_tqmask->hasSelection()) {
+        m_tqmask->selection()->paintSelection(img, x, y, w, h);
+    }
+}
+
+void KisPaintLayer::paintSelection(TQImage &img, const TQRect& scaledImageRect, const TQSize& scaledImageSize, const TQSize& imageSize)
+{
+    if (m_paintdev && m_paintdev->hasSelection()) {
+        m_paintdev->selection()->paintSelection(img, scaledImageRect, scaledImageSize, imageSize);
+    } else if (m_tqmask && m_editMask && m_tqmask->hasSelection()) {
+        m_tqmask->selection()->paintSelection(img, scaledImageRect, scaledImageSize, imageSize);
+    }
+}
+
+void KisPaintLayer::paintMaskInactiveLayers(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h)
+{
+    uchar *j = img.bits();
+
+    KisColorSpace *cs = m_paintdev->colorSpace();
+
+    for (TQ_INT32 y2 = y; y2 < h + y; ++y2) {
+        KisHLineIteratorPixel it = m_paintdev->createHLineIterator(x, y2, w, false);
+        while ( ! it.isDone()) {
+            TQ_UINT8 s = cs->getAlpha(it.rawData());
+            if(s==0)
+            {
+                TQ_UINT8 g = (*(j + 0)  + *(j + 1 ) + *(j + 2 )) / 9;
+
+                *(j+0) = 128+g ;
+                *(j+1) = 165+g;
+                *(j+2) = 128+g;
+            }
+            j+=4;
+            ++it;
+        }
+    }
+}
+
+TQImage KisPaintLayer::createThumbnail(TQ_INT32 w, TQ_INT32 h)
+{
+    if (m_paintdev)
+        return m_paintdev->createThumbnail(w, h);
+    else
+        return TQImage();
+}
+
+
+TQ_INT32 KisPaintLayer::x() const {
+    if (m_paintdev)
+        return m_paintdev->getX();
+    else return 0;
+}
+
+void KisPaintLayer::setX(TQ_INT32 x)
+{
+    if (m_paintdev)
+        m_paintdev->setX(x);
+}
+
+TQ_INT32 KisPaintLayer::y() const {
+    if (m_paintdev)
+        return m_paintdev->getY();
+    else
+        return 0;
+}
+
+void KisPaintLayer::setY(TQ_INT32 y) {
+    if (m_paintdev)
+        m_paintdev->setY(y);
+}
+
+TQRect KisPaintLayer::extent() const {
+    if (m_paintdev)
+        return m_paintdev->extent();
+    else
+        return TQRect();
+}
+
+TQRect KisPaintLayer::exactBounds() const {
+    if (m_paintdev)
+        return m_paintdev->exactBounds();
+    else
+        return TQRect();
+}
+
+void KisPaintLayer::removeMask() {
+    if (!hasMask())
+        return;
+
+    m_tqmask->setParentLayer(0);
+    m_tqmask = 0;
+    m_tqmaskAsSelection = 0;
+    setDirty();
+
+    emit sigMaskInfoChanged();
+}
+
+// ### XXX Do we apply the tqmask outside the image boundaries too? I'd say no, but I'm not sure
+void KisPaintLayer::applyMask() {
+    if (!hasMask())
+        return;
+
+    int x, y, w, h;
+    m_paintdev->extent(x, y, w, h);
+
+    // A bit slow; but it works
+    KisPaintDeviceSP temp = new KisPaintDevice(m_paintdev->colorSpace());
+    KisPainter gc(temp);
+    gc.bltSelection(x, y, COMPOSITE_OVER, m_paintdev, m_tqmaskAsSelection, OPACITY_OPAQUE, x, y, w, h);
+    gc.end();
+    gc.begin(m_paintdev);
+    gc.bitBlt(x, y, COMPOSITE_COPY, temp, OPACITY_OPAQUE, x, y, w, h);
+    gc.end();
+
+    removeMask();
+}
+
+KisPaintDeviceSP KisPaintLayer::createMask() {
+    if (hasMask())
+        return m_tqmask;
+
+    kdDebug() << k_funcinfo << endl;
+    // Grey8 nicely fits our needs of being intuitively comparable to other apps'
+    // tqmask layer interfaces. It does have an alpha component though, which is a bit
+    // less appropriate in this context.
+    m_tqmask = new KisPaintDevice(KisMetaRegistry::instance()->csRegistry()
+            ->getColorSpace(KisID("GRAYA"), 0));
+
+    genericMaskCreationHelper();
+
+    return m_tqmask;
+}
+
+// FIXME If from is a paint device is not grey8!!
+void KisPaintLayer::createMaskFromPaintDevice(KisPaintDeviceSP from) {
+    if (hasMask())
+        return; // Or overwrite? XXX
+
+    kdDebug() << k_funcinfo << endl;
+    m_tqmask = from; // KisPaintDevice(*from); XXX
+
+    genericMaskCreationHelper();
+}
+
+void KisPaintLayer::createMaskFromSelection(KisSelectionSP from) {
+    kdDebug() << k_funcinfo << endl;
+    m_tqmask = new KisPaintDevice(KisMetaRegistry::instance()->csRegistry()
+            ->getColorSpace(KisID("GRAYA"), 0));
+    m_tqmask->setParentLayer(this);
+
+    m_tqmaskAsSelection = new KisSelection(); // Anonymous selection is good enough
+
+    // Default pixel is opaque white == don't tqmask?
+    TQ_UINT8 const defPixel[] = { 255, 255 };
+    m_tqmask->dataManager()->setDefaultPixel(defPixel);
+
+    if (from) {
+        TQRect r(extent());
+
+        int w = r.width();
+        int h = r.height();
+        for (int y = r.y(); y < h; y++) {
+            KisHLineIteratorPixel srcIt = from->createHLineIterator(r.x(), y, w, false);
+            KisHLineIteratorPixel dstIt = m_tqmask->createHLineIterator(r.x(), y, w, true);
+
+            while(!dstIt.isDone()) {
+                // XXX same remark as in convertMaskToSelection
+                *dstIt.rawData() = *srcIt.rawData();
+                ++srcIt;
+                ++dstIt;
+            }
+        }
+    }
+
+    convertMaskToSelection(extent());
+    m_paintdev->deselect();
+
+    setDirty();
+    emit sigMaskInfoChanged();
+}
+
+KisPaintDeviceSP KisPaintLayer::getMask() {
+    createMask();
+    kdDebug() << k_funcinfo << endl;
+    return m_tqmask;
+}
+
+KisSelectionSP KisPaintLayer::getMaskAsSelection() {
+    createMask();
+    kdDebug() << k_funcinfo << endl;
+    return m_tqmaskAsSelection;
+}
+
+void KisPaintLayer::setEditMask(bool b) {
+    m_editMask = b;
+    emit sigMaskInfoChanged();
+}
+
+void KisPaintLayer::setRenderMask(bool b) {
+    m_renderMask = b;
+
+    if (hasMask())
+        setDirty();
+
+    emit sigMaskInfoChanged();
+}
+
+void KisPaintLayer::convertMaskToSelection(const TQRect& r) {
+    KisRectIteratorPixel srcIt = m_tqmask->createRectIterator(r.x(), r.y(),
+            r.width(), r.height(), false);
+    KisRectIteratorPixel dstIt = m_tqmaskAsSelection->createRectIterator(r.x(), r.y(),
+            r.width(), r.height(), true);
+
+    while(!dstIt.isDone()) {
+        // src is grey8 (grey + alpha), dst is alpha8. We convert the grey value to
+        // alpha8 manually and ignore the alpha (that's why we don't convert using default
+        // functions, and interpret the data raw!) [ XXX ]
+        *dstIt.rawData() = *srcIt.rawData();
+        ++srcIt;
+        ++dstIt;
+    }
+}
+
+void KisPaintLayer::genericMaskCreationHelper() {
+    m_tqmask->setParentLayer(this);
+
+    m_tqmaskAsSelection = new KisSelection(); // Anonymous selection is good enough
+
+    // Default pixel is opaque white == don't tqmask?
+    TQ_UINT8 const defPixel[] = { 255, 255 };
+    m_tqmask->dataManager()->setDefaultPixel(defPixel);
+
+    setDirty();
+    emit sigMaskInfoChanged();
+}
+
+void KisPaintLayer::setDirty(bool propagate) {
+    if (hasMask())
+        convertMaskToSelection(extent());
+    super::setDirty(propagate);
+}
+
+void KisPaintLayer::setDirty(const TQRect & rect, bool propagate) {
+    if (hasMask())
+        convertMaskToSelection(rect);
+    super::setDirty(rect, propagate);
+}
+
+// Undoable versions code
+namespace {
+    class KisCreateMaskCommand : public KNamedCommand {
+        typedef KNamedCommand super;
+        KisPaintLayerSP m_layer;
+        KisPaintDeviceSP m_tqmask;
+    public:
+        KisCreateMaskCommand(const TQString& name, KisPaintLayer* layer)
+            : super(name), m_layer(layer) {}
+        virtual void execute() {
+            kdDebug() << k_funcinfo << endl;
+            if (!m_tqmask)
+                m_tqmask = m_layer->createMask();
+            else
+                m_layer->createMaskFromPaintDevice(m_tqmask);
+        }
+        virtual void unexecute() {
+            m_layer->removeMask();
+        }
+    };
+
+    class KisMaskFromSelectionCommand : public KNamedCommand {
+        typedef KNamedCommand super;
+        KisPaintLayerSP m_layer;
+        KisPaintDeviceSP m_tqmaskBefore;
+        KisPaintDeviceSP m_tqmaskAfter;
+        KisSelectionSP m_selection;
+    public:
+        KisMaskFromSelectionCommand(const TQString& name, KisPaintLayer* layer)
+            : super(name), m_layer(layer) {
+            if (m_layer->hasMask())
+                m_tqmaskBefore = m_layer->getMask();
+            else
+                m_tqmaskBefore = 0;
+            m_tqmaskAfter = 0;
+            if (m_layer->paintDevice()->hasSelection())
+                m_selection = m_layer->paintDevice()->selection();
+            else
+                m_selection = 0;
+        }
+        virtual void execute() {
+            if (!m_tqmaskAfter) {
+                m_layer->createMaskFromSelection(m_selection);
+                m_tqmaskAfter = m_layer->getMask();
+            } else {
+                m_layer->paintDevice()->deselect();
+                m_layer->createMaskFromPaintDevice(m_tqmaskAfter);
+            }
+        }
+        virtual void unexecute() {
+            m_layer->paintDevice()->setSelection(m_selection);
+            if (m_tqmaskBefore)
+                m_layer->createMaskFromPaintDevice(m_tqmaskBefore);
+            else
+                m_layer->removeMask();
+        }
+    };
+
+    class KisMaskToSelectionCommand : public KNamedCommand {
+        typedef KNamedCommand super;
+        KisPaintLayerSP m_layer;
+        KisPaintDeviceSP m_tqmask;
+        KisSelectionSP m_selection;
+    public:
+        KisMaskToSelectionCommand(const TQString& name, KisPaintLayer* layer)
+            : super(name), m_layer(layer) {
+            m_tqmask = m_layer->getMask();
+            if (m_layer->paintDevice()->hasSelection())
+                m_selection = m_layer->paintDevice()->selection();
+            else
+                m_selection = 0;
+        }
+        virtual void execute() {
+            m_layer->paintDevice()->setSelection(m_layer->getMaskAsSelection());
+            m_layer->removeMask();
+        }
+        virtual void unexecute() {
+            if (m_selection)
+                m_layer->paintDevice()->setSelection(m_selection);
+            else
+                m_layer->paintDevice()->deselect();
+            m_layer->createMaskFromPaintDevice(m_tqmask);
+        }
+    };
+
+    class KisRemoveMaskCommand : public KNamedCommand {
+        typedef KNamedCommand super;
+        KisPaintLayerSP m_layer;
+        KisPaintDeviceSP m_tqmask;
+    public:
+        KisRemoveMaskCommand(const TQString& name, KisPaintLayer* layer)
+            : super(name), m_layer(layer) {
+            m_tqmask = m_layer->getMask();
+        }
+        virtual void execute() {
+            kdDebug() << k_funcinfo << endl;
+            m_layer->removeMask();
+        }
+        virtual void unexecute() {
+            // I hope that if the undo stack unwinds, it will end up here in the right
+            // state again; taking a deep-copy sounds like wasteful to me
+            m_layer->createMaskFromPaintDevice(m_tqmask);
+        }
+    };
+
+    class KisApplyMaskCommand : public KNamedCommand {
+        typedef KNamedCommand super;
+        KisPaintLayerSP m_layer;
+        KisPaintDeviceSP m_tqmask;
+        KisPaintDeviceSP m_original;
+    public:
+        KisApplyMaskCommand(const TQString& name, KisPaintLayer* layer)
+            : super(name), m_layer(layer) {
+            m_tqmask = m_layer->getMask();
+            m_original = new KisPaintDevice(*m_layer->paintDevice());
+        }
+        virtual void execute() {
+            m_layer->applyMask();
+        }
+        virtual void unexecute() {
+                // I hope that if the undo stack unwinds, it will end up here in the right
+                // state again; taking a deep-copy sounds like wasteful to me
+            KisPainter gc(m_layer->paintDevice());
+            int x, y, w, h;
+            m_layer->paintDevice()->extent(x, y, w, h);
+
+            gc.bitBlt(x, y, COMPOSITE_COPY, m_original, OPACITY_OPAQUE, x, y, w, h);
+            gc.end();
+
+            m_layer->createMaskFromPaintDevice(m_tqmask);
+        }
+    };
+}
+
+KNamedCommand* KisPaintLayer::createMaskCommand() {
+    return new KisCreateMaskCommand(i18n("Create Layer Mask"), this);
+}
+
+KNamedCommand* KisPaintLayer::tqmaskFromSelectionCommand() {
+    return new KisMaskFromSelectionCommand(i18n("Mask From Selection"), this);
+}
+
+KNamedCommand* KisPaintLayer::tqmaskToSelectionCommand() {
+    return new KisMaskToSelectionCommand(i18n("Mask to Selection"), this);
+}
+
+
+KNamedCommand* KisPaintLayer::removeMaskCommand() {
+    return new KisRemoveMaskCommand(i18n("Remove Layer Mask"), this);
+}
+
+KNamedCommand* KisPaintLayer::applyMaskCommand() {
+    return new KisApplyMaskCommand(i18n("Apply Layer Mask"), this);
+}
+
+
+#include "kis_paint_layer.moc"
diff --git a/chalk/core/kis_paint_layer.h b/chalk/core/kis_paint_layer.h
new file mode 100644
index 000000000..9e598e7aa
--- /dev/null
+++ b/chalk/core/kis_paint_layer.h
@@ -0,0 +1,157 @@
+/*
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+#ifndef KIS_PAINT_LAYER_H_
+#define KIS_PAINT_LAYER_H_
+
+#include "kis_types.h"
+#include "kis_layer.h"
+#include "kis_paint_device.h"
+#include "kis_colorspace.h"
+/**
+ * This layer is of a type that can be painted on.
+ */
+class KisPaintLayer : public KisLayer, public KisLayerSupportsIndirectPainting {
+    typedef KisLayer super;
+
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    KisPaintLayer(KisImage *img, const TQString& name, TQ_UINT8 opacity, KisPaintDeviceSP dev);
+    KisPaintLayer(KisImage *img, const TQString& name, TQ_UINT8 opacity);
+    KisPaintLayer(KisImage *img, const TQString& name, TQ_UINT8 opacity, KisColorSpace * colorSpace);
+    KisPaintLayer(const KisPaintLayer& rhs);
+    virtual ~KisPaintLayer();
+
+    virtual KisLayerSP clone() const;
+public:
+
+    // Called when the layer is made active
+    virtual void activate() {}
+
+    // Called when another layer is made active
+    virtual void deactivate() {}
+
+    virtual TQ_INT32 x() const;
+    virtual void setX(TQ_INT32 x);
+
+    virtual TQ_INT32 y() const;
+    virtual void setY(TQ_INT32 y);
+
+    virtual TQRect extent() const;
+    virtual TQRect exactBounds() const;
+
+    virtual void paintSelection(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+    virtual void paintSelection(TQImage &img, const TQRect& scaledImageRect, const TQSize& scaledImageSize, const TQSize& imageSize);
+
+    virtual void paintMaskInactiveLayers(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+
+    virtual TQImage createThumbnail(TQ_INT32 w, TQ_INT32 h);
+
+    virtual bool accept(KisLayerVisitor &v)
+        {
+//            kdDebug(41001) << "\tPAINT\t" << name()
+//                    << " dirty: " << dirty() << "\n";
+            return v.visit(this);
+        }
+
+
+    inline KisPaintDeviceSP paintDevice() const { return m_paintdev; }
+
+    /// Returns the paintDevice that accompanies this layer (or tqmask, see editMask)
+    inline KisPaintDeviceSP paintDeviceOrMask() const {
+        if (hasMask() && editMask())
+            return m_tqmask;
+        return m_paintdev;
+    }
+
+    // Mask Layer
+
+    /// Does this layer have a layer tqmask?
+    bool hasMask() const { return m_tqmask != 0; }
+    // XXX TODO: Make these undo-able!
+    /// Create a tqmask if it does not yet exist, and return it
+    KisPaintDeviceSP createMask();
+    /// Convert the from argument to the tqmask
+    void createMaskFromPaintDevice(KisPaintDeviceSP from);
+    /**
+     * Convert the from selection to a paint device (should convert the getMaskAsSelection
+     * result back to the tqmask). Overwrites the current tqmask, if any. Also removes the selection
+     */
+    void createMaskFromSelection(KisSelectionSP from);
+    /// Remove the layer tqmask
+    void removeMask();
+    /// Apply the layer tqmask to the paint device, this removes the tqmask afterwards
+    void applyMask();
+    /// Returns the layer tqmask's device. Creates one if there is currently none
+    KisPaintDeviceSP getMask();
+    /// Returns the layer tqmask's device, converted to a selection. Creates one if there is currently none
+    KisSelectionSP getMaskAsSelection();
+
+    /// Undoable version of createMask
+    KNamedCommand* createMaskCommand();
+    /// Undoable version of createMaskFromSelection
+    KNamedCommand* tqmaskFromSelectionCommand();
+    /// Undoable, removes the current tqmask, but converts it to the current selection
+    KNamedCommand* tqmaskToSelectionCommand();
+    /// Undoable version of removeMask
+    KNamedCommand* removeMaskCommand();
+    /// Undoable version of applyMask
+    KNamedCommand* applyMaskCommand();
+
+    /// Returns true if the tqmasked part of the tqmask will be rendered instead of being transparent
+    bool renderMask() const { return m_renderMask; }
+    /// Set the renderMask property
+    void setRenderMask(bool b);
+
+    /**
+     * When this returns true, the KisPaintDevice returned in paintDevice will actually
+     * be the layer tqmask (if there is one). This is so that tools can draw on the tqmask
+     * without needing to know its existance.
+     */
+    bool editMask() const { return m_editMask; }
+    /// Sets the editMask property
+    void setEditMask(bool b);
+
+    /// Overridden to call the private convertMaskToSelection
+    virtual void setDirty(bool propagate = true);
+    /// Same as above
+    virtual void setDirty(const TQRect & rect, bool propagate = true);
+
+    // KisLayerSupportsIndirectPainting
+    virtual KisLayer* layer() { return this; }
+signals:
+    /// When the tqmask is created/destroyed or the edittqmask or rendertqmask is changed
+    void sigMaskInfoChanged();
+
+private:
+    void convertMaskToSelection(const TQRect& r);
+    void genericMaskCreationHelper();
+    KisPaintDeviceSP m_paintdev;
+    // Layer tqmask related:
+    // XXX It would be nice to merge the next 2 devices...
+    KisPaintDeviceSP m_tqmask; // The tqmask that we can edit and display easily
+    KisSelectionSP m_tqmaskAsSelection; // The tqmask as selection, to apply and render easily
+    bool m_renderMask;
+    bool m_editMask;
+};
+
+typedef KSharedPtr<KisPaintLayer> KisPaintLayerSP;
+
+#endif // KIS_PAINT_LAYER_H_
+
diff --git a/chalk/core/kis_painter.cc b/chalk/core/kis_painter.cc
new file mode 100644
index 000000000..b83539189
--- /dev/null
+++ b/chalk/core/kis_painter.cc
@@ -0,0 +1,928 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *  Copyright (c) 2004 Clarence Dang <dang@kde.org>
+ *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <stdlib.h>
+#include <string.h>
+#include <cfloat>
+#include <cmath>
+#include <climits>
+#include <strings.h>
+
+#include "tqbrush.h"
+#include "tqfontinfo.h"
+#include "tqfontmetrics.h"
+#include "tqpen.h"
+#include "tqregion.h"
+#include "tqwmatrix.h"
+#include <tqimage.h>
+#include <tqmap.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqpointarray.h>
+#include <tqrect.h>
+#include <tqstring.h>
+
+#include <kdebug.h>
+#include <kcommand.h>
+#include <klocale.h>
+
+#include "kis_brush.h"
+#include "kis_debug_areas.h"
+#include "kis_image.h"
+#include "kis_layer.h"
+#include "kis_paint_device.h"
+#include "kis_painter.h"
+#include "kis_pattern.h"
+#include "kis_rect.h"
+#include "kis_colorspace.h"
+#include "kis_transaction.h"
+#include "kis_types.h"
+#include "kis_vec.h"
+#include "kis_iterators_pixel.h"
+#include "kis_paintop.h"
+#include "kis_selection.h"
+#include "kis_fill_painter.h"
+#include "kis_color.h"
+
+// Maximum distance from a Bezier control point to the line through the start
+// and end points for the curve to be considered flat.
+#define BEZIER_FLATNESS_THRESHOLD 0.5
+
+KisPainter::KisPainter()
+{
+    init();
+}
+
+KisPainter::KisPainter(KisPaintDeviceSP device)
+{
+    init();
+    Q_ASSERT(device);
+        begin(device);
+}
+
+void KisPainter::init()
+{
+    m_transaction = 0;
+    m_paintOp = 0;
+    m_filter = 0;
+    m_brush = 0;
+    m_pattern= 0;
+    m_opacity = OPACITY_OPAQUE;
+    m_compositeOp = COMPOSITE_OVER;
+    m_dab = 0;
+    m_fillStyle = FillStyleNone;
+    m_strokeStyle = StrokeStyleBrush;
+    m_pressure = PRESSURE_MIN;
+    m_duplicateHealing = false;
+    m_duplicateHealingRadius = 10;
+    m_duplicatePerspectiveCorrection = false;
+    m_varyBrushSpacingWithPressureWhenDrawingALine = true;
+}
+
+KisPainter::~KisPainter()
+{
+    m_brush = 0;
+    delete m_paintOp;
+    end();
+}
+
+void KisPainter::begin(KisPaintDeviceSP device)
+{
+    if (!device) return;
+
+    if (m_transaction)
+        delete m_transaction;
+
+    m_device = device;
+    m_colorSpace = device->colorSpace();
+    m_pixelSize = device->pixelSize();
+}
+
+KCommand *KisPainter::end()
+{
+    return endTransaction();
+}
+
+void KisPainter::beginTransaction(const TQString& customName)
+{
+    if (m_transaction)
+        delete m_transaction;
+    m_transaction = new KisTransaction(customName, m_device);
+    Q_CHECK_PTR(m_transaction);
+}
+
+void KisPainter::beginTransaction( KisTransaction* command)
+{
+    if (m_transaction)
+        delete m_transaction;
+    m_transaction = command;
+}
+
+
+KCommand *KisPainter::endTransaction()
+{
+    KCommand *command = m_transaction;
+        m_transaction = 0;
+        return command;
+}
+
+
+TQRect KisPainter::dirtyRect() {
+    TQRect r = m_dirtyRect;
+    m_dirtyRect = TQRect();
+    return r;
+}
+
+void KisPainter::bitBlt(TQ_INT32 dx, TQ_INT32 dy,
+                        const KisCompositeOp& op,
+                        KisPaintDeviceSP srcdev,
+                        TQ_UINT8 opacity,
+                        TQ_INT32 sx, TQ_INT32 sy,
+                        TQ_INT32 sw, TQ_INT32 sh)
+{
+    if (srcdev == 0) {
+        return;
+    }
+
+    TQRect srcRect = TQRect(sx, sy, sw, sh);
+
+    if (srcdev->extentIsValid() && op != COMPOSITE_COPY) {
+        srcRect &= srcdev->extent();
+    }
+
+    if (srcRect.isEmpty()) {
+        return;
+    }
+
+    dx += srcRect.x() - sx;
+    dy += srcRect.y() - sy;
+
+    sx = srcRect.x();
+    sy = srcRect.y();
+    sw = srcRect.width();
+    sh = srcRect.height();
+
+    addDirtyRect(TQRect(dx, dy, sw, sh));
+
+    KisColorSpace * srcCs = srcdev->colorSpace();
+
+    TQ_INT32 dstY = dy;
+    TQ_INT32 srcY = sy;
+    TQ_INT32 rowsRemaining = sh;
+
+    while (rowsRemaining > 0) {
+
+        TQ_INT32 dstX = dx;
+        TQ_INT32 srcX = sx;
+        TQ_INT32 columnsRemaining = sw;
+        TQ_INT32 numContiguousDstRows = m_device->numContiguousRows(dstY, dstX, dstX + sw - 1);
+        TQ_INT32 numContiguousSrcRows = srcdev->numContiguousRows(srcY, srcX, srcX + sw - 1);
+
+        TQ_INT32 rows = TQMIN(numContiguousDstRows, numContiguousSrcRows);
+        rows = TQMIN(rows, rowsRemaining);
+
+        while (columnsRemaining > 0) {
+
+            TQ_INT32 numContiguousDstColumns = m_device->numContiguousColumns(dstX, dstY, dstY + rows - 1);
+            TQ_INT32 numContiguousSrcColumns = srcdev->numContiguousColumns(srcX, srcY, srcY + rows - 1);
+
+            TQ_INT32 columns = TQMIN(numContiguousDstColumns, numContiguousSrcColumns);
+            columns = TQMIN(columns, columnsRemaining);
+
+            TQ_INT32 srcRowStride = srcdev->rowStride(srcX, srcY);
+            //const TQ_UINT8 *srcData = srcdev->pixel(srcX, srcY);
+            KisHLineIteratorPixel srcIt = srcdev->createHLineIterator(srcX, srcY, columns, false);
+            const TQ_UINT8 *srcData = srcIt.rawData();
+
+            //TQ_UINT8 *dstData = m_device->writablePixel(dstX, dstY);
+            TQ_INT32 dstRowStride = m_device->rowStride(dstX, dstY);
+            KisHLineIteratorPixel dstIt = m_device->createHLineIterator(dstX, dstY, columns, true);
+            TQ_UINT8 *dstData = dstIt.rawData();
+
+
+            m_colorSpace->bitBlt(dstData,
+                          dstRowStride,
+                          srcCs,
+                          srcData,
+                          srcRowStride,
+                          0,
+                          0,
+                          opacity,
+                          rows,
+                          columns,
+                          op);
+
+            srcX += columns;
+            dstX += columns;
+            columnsRemaining -= columns;
+        }
+
+        srcY += rows;
+        dstY += rows;
+        rowsRemaining -= rows;
+    }
+}
+
+void KisPainter::bltSelection(TQ_INT32 dx, TQ_INT32 dy,
+                  const KisCompositeOp &op,
+                  KisPaintDeviceSP srcdev,
+                  KisSelectionSP seldev,
+                  TQ_UINT8 opacity,
+                  TQ_INT32 sx, TQ_INT32 sy,
+                  TQ_INT32 sw, TQ_INT32 sh)
+{
+    // Better use a probablistic method than a too slow one
+    if (seldev->isProbablyTotallyUnselected(TQRect(dx, dy, sw, sh))) {
+/*
+        kdDebug() << "Blitting outside selection rect\n";
+
+        kdDebug() << "srcdev: " << srcdev << " (" << srcdev->name() << ")"
+        << ", seldev: " << seldev << " (" << seldev->name() << ")"
+        << ". dx, dy " << dx << "," << dy
+        << ". sx, sy : sw, sy " << sx << "," << sy << " : " << sw << "," << sh << endl;
+*/
+        return;
+    }
+    bltMask(dx,dy,op,srcdev,seldev.data(),opacity,sx,sy,sw,sh);
+}
+
+void KisPainter::bltMask(TQ_INT32 dx, TQ_INT32 dy,
+                     const KisCompositeOp &op,
+                     KisPaintDeviceSP srcdev,
+                     KisPaintDeviceSP seldev,
+                     TQ_UINT8 opacity,
+                     TQ_INT32 sx, TQ_INT32 sy,
+                     TQ_INT32 sw, TQ_INT32 sh)
+
+{
+    if (srcdev == 0) return;
+
+    if (seldev == 0) return;
+
+    if (m_device == 0) return;
+
+
+    TQRect srcRect = TQRect(sx, sy, sw, sh);
+
+    if (srcdev->extentIsValid() && op != COMPOSITE_COPY) {
+        srcRect &= srcdev->extent();
+    }
+
+    if (srcRect.isEmpty()) {
+        return;
+    }
+
+    dx += srcRect.x() - sx;
+    dy += srcRect.y() - sy;
+
+    sx = srcRect.x();
+    sy = srcRect.y();
+    sw = srcRect.width();
+    sh = srcRect.height();
+
+    addDirtyRect(TQRect(dx, dy, sw, sh));
+
+    KisColorSpace * srcCs = srcdev->colorSpace();
+
+    TQ_INT32 dstY = dy;
+    TQ_INT32 srcY = sy;
+    TQ_INT32 rowsRemaining = sh;
+
+    while (rowsRemaining > 0) {
+
+        TQ_INT32 dstX = dx;
+        TQ_INT32 srcX = sx;
+        TQ_INT32 columnsRemaining = sw;
+        TQ_INT32 numContiguousDstRows = m_device->numContiguousRows(dstY, dstX, dstX + sw - 1);
+        TQ_INT32 numContiguousSrcRows = srcdev->numContiguousRows(srcY, srcX, srcX + sw - 1);
+        TQ_INT32 numContiguousSelRows = seldev->numContiguousRows(dstY, dstX, dstX + sw - 1);
+
+        TQ_INT32 rows = TQMIN(numContiguousDstRows, numContiguousSrcRows);
+        rows = TQMIN(numContiguousSelRows, rows);
+        rows = TQMIN(rows, rowsRemaining);
+
+        while (columnsRemaining > 0) {
+
+            TQ_INT32 numContiguousDstColumns = m_device->numContiguousColumns(dstX, dstY, dstY + rows - 1);
+            TQ_INT32 numContiguousSrcColumns = srcdev->numContiguousColumns(srcX, srcY, srcY + rows - 1);
+            TQ_INT32 numContiguousSelColumns = seldev->numContiguousColumns(dstX, dstY, dstY + rows - 1);
+
+            TQ_INT32 columns = TQMIN(numContiguousDstColumns, numContiguousSrcColumns);
+            columns = TQMIN(numContiguousSelColumns, columns);
+            columns = TQMIN(columns, columnsRemaining);
+
+            //TQ_UINT8 *dstData = m_device->writablePixel(dstX, dstY);
+            TQ_INT32 dstRowStride = m_device->rowStride(dstX, dstY);
+            KisHLineIteratorPixel dstIt = m_device->createHLineIterator(dstX, dstY, columns, true);
+            TQ_UINT8 *dstData = dstIt.rawData();
+
+            //const TQ_UINT8 *srcData = srcdev->pixel(srcX, srcY);
+            TQ_INT32 srcRowStride = srcdev->rowStride(srcX, srcY);
+            KisHLineIteratorPixel srcIt = srcdev->createHLineIterator(srcX, srcY, columns, false);
+            const TQ_UINT8 *srcData = srcIt.rawData();
+
+            //const TQ_UINT8 *selData = seldev->pixel(dstX, dstY);
+            TQ_INT32 selRowStride = seldev->rowStride(dstX, dstY);
+            KisHLineIteratorPixel selIt = seldev->createHLineIterator(dstX, dstY, columns, false);
+            const TQ_UINT8 *selData = selIt.rawData();
+
+            m_colorSpace->bitBlt(dstData,
+                                   dstRowStride,
+                                   srcCs,
+                                   srcData,
+                                   srcRowStride,
+                                   selData,
+                                   selRowStride,
+                                   opacity,
+                                   rows,
+                                   columns,
+                                   op);
+
+            srcX += columns;
+            dstX += columns;
+            columnsRemaining -= columns;
+        }
+
+        srcY += rows;
+        dstY += rows;
+        rowsRemaining -= rows;
+    }
+}
+
+
+void KisPainter::bltSelection(TQ_INT32 dx, TQ_INT32 dy,
+                  const KisCompositeOp& op,
+                  KisPaintDeviceSP srcdev,
+                  TQ_UINT8 opacity,
+                  TQ_INT32 sx, TQ_INT32 sy,
+                  TQ_INT32 sw, TQ_INT32 sh)
+{
+    if (m_device == 0) return;
+    if (!m_device->hasSelection()) {
+        bitBlt(dx, dy, op, srcdev, opacity, sx, sy, sw, sh);
+    }
+    else
+        bltSelection(dx,dy,op,srcdev, m_device->selection(),opacity,sx,sy,sw,sh);
+}
+
+double KisPainter::paintLine(const KisPoint & pos1,
+                 const double pressure1,
+                 const double xTilt1,
+                 const double yTilt1,
+                 const KisPoint & pos2,
+                 const double pressure2,
+                 const double xTilt2,
+                 const double yTilt2,
+                 const double inSavedDist)
+{
+    if (!m_device) return 0;
+    if (!m_paintOp) return 0;
+    if (!m_brush) return 0;
+
+    double savedDist = inSavedDist;
+    KisVector2D end(pos2);
+    KisVector2D start(pos1);
+
+    KisVector2D dragVec = end - start;
+    KisVector2D movement = dragVec;
+
+    if (savedDist < 0) {
+        m_paintOp->paintAt(pos1, KisPaintInformation(pressure1, xTilt1, yTilt1, movement));
+        savedDist = 0;
+    }
+
+    double xSpacing = 0;
+    double ySpacing = 0;
+
+     if ( m_varyBrushSpacingWithPressureWhenDrawingALine ) {
+        // XXX: The spacing should vary as the pressure changes along the
+        // line.
+        // This is a quick simplification.
+        xSpacing = m_brush->xSpacing((pressure1 + pressure2) / 2);
+        ySpacing = m_brush->ySpacing((pressure1 + pressure2) / 2);
+     }
+     else {
+         xSpacing = m_brush->xSpacing( PRESSURE_DEFAULT );
+         ySpacing = m_brush->ySpacing( PRESSURE_DEFAULT );
+     }
+
+    if (xSpacing < 0.5) {
+        xSpacing = 0.5;
+    }
+    if (ySpacing < 0.5) {
+        ySpacing = 0.5;
+    }
+
+    double xScale = 1;
+    double yScale = 1;
+    double spacing;
+    // Scale x or y so that we effectively have a square brush
+    // and calculate distance in that coordinate space. We reverse this scaling
+    // before drawing the brush. This produces the correct spacing in both
+    // x and y directions, even if the brush's aspect ratio is not 1:1.
+    if (xSpacing > ySpacing) {
+        yScale = xSpacing / ySpacing;
+        spacing = xSpacing;
+    }
+    else {
+        xScale = ySpacing / xSpacing;
+        spacing = ySpacing;
+    }
+
+    dragVec.setX(dragVec.x() * xScale);
+    dragVec.setY(dragVec.y() * yScale);
+
+    double newDist = dragVec.length();
+    double dist = savedDist + newDist;
+    double l_savedDist = savedDist;
+
+    if (dist < spacing) {
+        return dist;
+    }
+
+    dragVec.normalize();
+    KisVector2D step(0, 0);
+
+    while (dist >= spacing) {
+        if (l_savedDist > 0) {
+            step += dragVec * (spacing - l_savedDist);
+            l_savedDist -= spacing;
+        }
+        else {
+            step += dragVec * spacing;
+        }
+
+        KisPoint p(start.x() + (step.x() / xScale), start.y() + (step.y() / yScale));
+
+        double distanceMoved = step.length();
+        double t = 0;
+
+        if (newDist > DBL_EPSILON) {
+            t = distanceMoved / newDist;
+        }
+
+        double pressure = (1 - t) * pressure1 + t * pressure2;
+        double xTilt = (1 - t) * xTilt1 + t * xTilt2;
+        double yTilt = (1 - t) * yTilt1 + t * yTilt2;
+
+        m_paintOp->paintAt(p, KisPaintInformation(pressure, xTilt, yTilt, movement));
+        dist -= spacing;
+    }
+
+    if (dist > 0)
+        return dist;
+    else
+        return 0;
+}
+
+void KisPainter::paintPolyline (const vKisPoint &points,
+                                int index, int numPoints)
+{
+    if (index >= (int) points.count ())
+        return;
+
+    if (numPoints < 0)
+        numPoints = points.count ();
+
+    if (index + numPoints > (int) points.count ())
+        numPoints = points.count () - index;
+
+
+    for (int i = index; i < index + numPoints - 1; i++)
+    {
+        paintLine (points [index], 0/*pressure*/, 0, 0, points [index + 1],
+               0/*pressure*/, 0, 0);
+    }
+}
+
+void KisPainter::getBezierCurvePoints(const KisPoint &pos1,
+                      const KisPoint &control1,
+                      const KisPoint &control2,
+                      const KisPoint &pos2,
+                      vKisPoint& points)
+{
+    double d1 = pointToLineDistance(control1, pos1, pos2);
+    double d2 = pointToLineDistance(control2, pos1, pos2);
+
+    if (d1 < BEZIER_FLATNESS_THRESHOLD && d2 < BEZIER_FLATNESS_THRESHOLD) {
+        points.push_back(pos1);
+    } else {
+        // Midpoint subdivision. See Foley & Van Dam Computer Graphics P.508
+        KisVector2D p1 = pos1;
+        KisVector2D p2 = control1;
+        KisVector2D p3 = control2;
+        KisVector2D p4 = pos2;
+
+        KisVector2D l2 = (p1 + p2) / 2;
+        KisVector2D h = (p2 + p3) / 2;
+        KisVector2D l3 = (l2 + h) / 2;
+        KisVector2D r3 = (p3 + p4) / 2;
+        KisVector2D r2 = (h + r3) / 2;
+        KisVector2D l4 = (l3 + r2) / 2;
+        KisVector2D r1 = l4;
+        KisVector2D l1 = p1;
+        KisVector2D r4 = p4;
+
+        getBezierCurvePoints(l1.toKisPoint(), l2.toKisPoint(), l3.toKisPoint(), l4.toKisPoint(), points);
+        getBezierCurvePoints(r1.toKisPoint(), r2.toKisPoint(), r3.toKisPoint(), r4.toKisPoint(), points);
+    }
+}
+
+double KisPainter::paintBezierCurve(const KisPoint &pos1,
+                    const double pressure1,
+                    const double xTilt1,
+                    const double yTilt1,
+                    const KisPoint &control1,
+                    const KisPoint &control2,
+                    const KisPoint &pos2,
+                    const double pressure2,
+                    const double xTilt2,
+                    const double yTilt2,
+                    const double savedDist)
+{
+    double newDistance;
+    double d1 = pointToLineDistance(control1, pos1, pos2);
+    double d2 = pointToLineDistance(control2, pos1, pos2);
+
+    if (d1 < BEZIER_FLATNESS_THRESHOLD && d2 < BEZIER_FLATNESS_THRESHOLD) {
+        newDistance = paintLine(pos1, pressure1, xTilt1, yTilt1, pos2, pressure2, xTilt2, yTilt2, savedDist);
+    } else {
+        // Midpoint subdivision. See Foley & Van Dam Computer Graphics P.508
+        KisVector2D p1 = pos1;
+        KisVector2D p2 = control1;
+        KisVector2D p3 = control2;
+        KisVector2D p4 = pos2;
+
+        KisVector2D l2 = (p1 + p2) / 2;
+        KisVector2D h = (p2 + p3) / 2;
+        KisVector2D l3 = (l2 + h) / 2;
+        KisVector2D r3 = (p3 + p4) / 2;
+        KisVector2D r2 = (h + r3) / 2;
+        KisVector2D l4 = (l3 + r2) / 2;
+        KisVector2D r1 = l4;
+        KisVector2D l1 = p1;
+        KisVector2D r4 = p4;
+
+        double midPressure = (pressure1 + pressure2) / 2;
+        double midXTilt = (xTilt1 + xTilt2) / 2;
+        double midYTilt = (yTilt1 + yTilt2) / 2;
+
+        newDistance = paintBezierCurve(l1.toKisPoint(), pressure1, xTilt1, yTilt1,
+                           l2.toKisPoint(), l3.toKisPoint(),
+                           l4.toKisPoint(), midPressure, midXTilt, midYTilt,
+                           savedDist);
+        newDistance = paintBezierCurve(r1.toKisPoint(), midPressure, midXTilt, midYTilt,
+                           r2.toKisPoint(),
+                           r3.toKisPoint(),
+                           r4.toKisPoint(), pressure2, xTilt2, yTilt2, newDistance);
+    }
+
+    return newDistance;
+}
+
+void KisPainter::paintRect (const KisPoint &startPoint,
+                            const KisPoint &endPoint,
+                            const double /*pressure*/,
+                const double /*xTilt*/,
+                const double /*yTilt*/)
+{
+    KoRect normalizedRect = KisRect (startPoint, endPoint).normalize ();
+
+    vKisPoint points;
+
+    points.push_back(normalizedRect.topLeft());
+    points.push_back(normalizedRect.bottomLeft());
+    points.push_back(normalizedRect.bottomRight());
+    points.push_back(normalizedRect.topRight());
+
+    paintPolygon(points);
+}
+
+void KisPainter::paintEllipse (const KisPoint &startPoint,
+                               const KisPoint &endPoint,
+                               const double /*pressure*/,
+                   const double /*xTilt*/,
+                   const double /*yTilt*/)
+{
+    KisRect r = KisRect(startPoint, endPoint).normalize();
+
+    // See http://www.whizkidtech.redprince.net/bezier/circle/ for explanation.
+    // kappa = (4/3*(sqrt(2)-1))
+    const double kappa = 0.5522847498;
+    const double lx = (r.width() / 2) * kappa;
+    const double ly = (r.height() / 2) * kappa;
+
+    KisPoint center = r.center();
+
+    KisPoint p0(r.left(), center.y());
+    KisPoint p1(r.left(), center.y() - ly);
+    KisPoint p2(center.x() - lx, r.top());
+    KisPoint p3(center.x(), r.top());
+
+    vKisPoint points;
+
+    getBezierCurvePoints(p0, p1, p2, p3, points);
+
+    KisPoint p4(center.x() + lx, r.top());
+    KisPoint p5(r.right(), center.y() - ly);
+    KisPoint p6(r.right(), center.y());
+
+    getBezierCurvePoints(p3, p4, p5, p6, points);
+
+    KisPoint p7(r.right(), center.y() + ly);
+    KisPoint p8(center.x() + lx, r.bottom());
+    KisPoint p9(center.x(), r.bottom());
+
+    getBezierCurvePoints(p6, p7, p8, p9, points);
+
+    KisPoint p10(center.x() - lx, r.bottom());
+    KisPoint p11(r.left(), center.y() + ly);
+
+    getBezierCurvePoints(p9, p10, p11, p0, points);
+
+    paintPolygon(points);
+}
+
+void KisPainter::paintAt(const KisPoint & pos,
+                         const double pressure,
+                         const double xTilt,
+                         const double yTilt)
+{
+    if (!m_paintOp) return;
+    m_paintOp->paintAt(pos, KisPaintInformation(pressure, xTilt, yTilt, KisVector2D()));
+}
+
+double KisPainter::pointToLineDistance(const KisPoint& p, const KisPoint& l0, const KisPoint& l1)
+{
+    double lineLength = sqrt((l1.x() - l0.x()) * (l1.x() - l0.x()) + (l1.y() - l0.y()) * (l1.y() - l0.y()));
+    double distance = 0;
+
+    if (lineLength > DBL_EPSILON) {
+        distance = ((l0.y() - l1.y()) * p.x() + (l1.x() - l0.x()) * p.y() + l0.x() * l1.y() - l1.x() * l0.y()) / lineLength;
+        distance = fabs(distance);
+    }
+
+    return distance;
+}
+
+/*
+ * Concave Polygon Scan Conversion
+ * by Paul Heckbert
+ * from "Graphics Gems", Academic Press, 1990
+ */
+
+/*
+ * concave: scan convert nvert-sided concave non-simple polygon with vertices at
+ * (point[i].x, point[i].y) for i in [0..nvert-1] within the window win by
+ * calling spanproc for each visible span of pixels.
+ * Polygon can be clockwise or counterclockwise.
+ * Algorithm does uniform point sampling at pixel centers.
+ * Inside-outside test done by Jordan's rule: a point is considered inside if
+ * an emanating ray intersects the polygon an odd number of times.
+ * drawproc should fill in pixels from xl to xr inclusive on scanline y,
+ * e.g:
+ *    drawproc(y, xl, xr)
+ *    int y, xl, xr;
+ *    {
+ *        int x;
+ *        for (x=xl; x<=xr; x++)
+ *        pixel_write(x, y, pixelvalue);
+ *    }
+ *
+ *  Paul Heckbert    30 June 81, 18 Dec 89
+ */
+
+typedef struct {    /* a polygon edge */
+    double x;       /* x coordinate of edge's intersection with current scanline */
+    double dx;      /* change in x with respect to y */
+    int i;            /* edge number: edge i goes from pt[i] to pt[i+1] */
+} Edge;
+
+static int n;            /* number of vertices */
+static const KisPoint *pt;    /* vertices */
+
+static int nact;        /* number of active edges */
+static Edge *active;        /* active edge list:edges crossing scanline y */
+
+/* comparison routines for qsort */
+static int compare_ind(const void *pu, const void *pv)
+{
+    const int *u = static_cast<const int *>(pu);
+    const int *v = static_cast<const int *>(pv);
+
+    return pt[*u].y() <= pt[*v].y() ? -1 : 1;
+}
+
+static int compare_active(const void *pu, const void *pv)
+{
+    const Edge *u = static_cast<const Edge *>(pu);
+    const Edge *v = static_cast<const Edge *>(pv);
+
+    return u->x <= v->x ? -1 : 1;
+}
+
+static void cdelete(int i)        /* remove edge i from active list */
+{
+    int j;
+
+    for (j=0; j<nact && active[j].i!=i; j++);
+    if (j>=nact) return;        /* edge not in active list; happens at win->y0*/
+    nact--;
+    bcopy(&active[j+1], &active[j], (nact-j)*sizeof active[0]);
+}
+
+static void cinsert(int i, int y)        /* append edge i to end of active list */
+{
+    int j;
+    double dx;
+    const KisPoint *p, *q;
+
+    j = i<n-1 ? i+1 : 0;
+    if (pt[i].y() < pt[j].y()) {
+        p = &pt[i]; q = &pt[j];
+    } else {
+        p = &pt[j]; q = &pt[i];
+    }
+    /* initialize x position at intersection of edge with scanline y */
+    active[nact].dx = dx = (q->x()-p->x())/(q->y()-p->y());
+    active[nact].x = dx*(y+.5-p->y())+p->x();
+    active[nact].i = i;
+    nact++;
+}
+
+void KisPainter::fillPolygon(const vKisPoint& points, FillStyle fillStyle)
+{
+    int nvert = points.count();
+    int k, y0, y1, y, i, j, xl, xr;
+    int *ind;        /* list of vertex indices, sorted by pt[ind[j]].y */
+
+    n = nvert;
+    pt = &(points[0]);
+    if (n<3) return;
+    if (fillStyle == FillStyleNone) {
+        return;
+    }
+
+    ind = new int[n];
+    Q_CHECK_PTR(ind);
+    active = new Edge[n];
+    Q_CHECK_PTR(active);
+
+    /* create y-sorted array of indices ind[k] into vertex list */
+    for (k=0; k<n; k++)
+        ind[k] = k;
+    qsort(ind, n, sizeof ind[0], compare_ind);  /* sort ind by pt[ind[k]].y */
+
+    nact = 0;                /* start with empty active list */
+    k = 0;                    /* ind[k] is next vertex to process */
+    y0 = static_cast<int>(ceil(pt[ind[0]].y()-.5));            /* ymin of polygon */
+    y1 = static_cast<int>(floor(pt[ind[n-1]].y()-.5));        /* ymax of polygon */
+
+    int x0 = INT_MAX;
+    int x1 = INT_MIN;
+
+    for (int i = 0; i < nvert; i++) {
+        int pointHighX = static_cast<int>(ceil(points[i].x() - 0.5));
+        int pointLowX = static_cast<int>(floor(points[i].x() - 0.5));
+
+        if (pointLowX < x0) {
+            x0 = pointLowX;
+        }
+        if (pointHighX > x1) {
+            x1 = pointHighX;
+        }
+    }
+
+    // Fill the polygon bounding rectangle with the required contents then we'll
+    // create a tqmask for the actual polygon coverage.
+
+    KisPaintDeviceSP polygon = new KisPaintDevice(m_device->colorSpace(), "polygon");
+    Q_CHECK_PTR(polygon);
+
+    KisFillPainter fillPainter(polygon);
+    TQRect boundingRectangle(x0, y0, x1 - x0 + 1, y1 - y0 + 1);
+
+    // Clip to the image bounds.
+    if (m_device->image()) {
+        boundingRectangle &= m_device->image()->bounds();
+    }
+
+    switch (fillStyle) {
+    default:
+        // Fall through
+    case FillStyleGradient:
+        // Currently unsupported, fall through
+    case FillStyleStrokes:
+        // Currently unsupported, fall through
+        kdWarning(DBG_AREA_CORE) << "Unknown or unsupported fill style in fillPolygon\n";
+    case FillStyleForegroundColor:
+        fillPainter.fillRect(boundingRectangle, paintColor(), OPACITY_OPAQUE);
+        break;
+    case FillStyleBackgroundColor:
+        fillPainter.fillRect(boundingRectangle, backgroundColor(), OPACITY_OPAQUE);
+        break;
+    case FillStylePattern:
+        Q_ASSERT(m_pattern != 0);
+        fillPainter.fillRect(boundingRectangle, m_pattern);
+        break;
+    }
+
+    KisSelectionSP polygonMask = new KisSelection(polygon);
+
+    for (y=y0; y<=y1; y++) {        /* step through scanlines */
+        /* scanline y is at y+.5 in continuous coordinates */
+
+        /* check vertices between previous scanline and current one, if any */
+        for (; k<n && pt[ind[k]].y()<=y+.5; k++) {
+            /* to simplify, if pt.y=y+.5, pretend it's above */
+            /* invariant: y-.5 < pt[i].y <= y+.5 */
+            i = ind[k];
+            /*
+             * insert or delete edges before and after vertex i (i-1 to i,
+             * and i to i+1) from active list if they cross scanline y
+             */
+            j = i>0 ? i-1 : n-1;        /* vertex previous to i */
+            if (pt[j].y() <= y-.5)        /* old edge, remove from active list */
+                cdelete(j);
+            else if (pt[j].y() > y+.5)    /* new edge, add to active list */
+                cinsert(j, y);
+            j = i<n-1 ? i+1 : 0;        /* vertex next after i */
+            if (pt[j].y() <= y-.5)        /* old edge, remove from active list */
+                cdelete(i);
+            else if (pt[j].y() > y+.5)    /* new edge, add to active list */
+                cinsert(i, y);
+        }
+
+        /* sort active edge list by active[j].x */
+        qsort(active, nact, sizeof active[0], compare_active);
+
+        /* draw horizontal segments for scanline y */
+        for (j=0; j<nact; j+=2) {    /* draw horizontal segments */
+            /* span 'tween j & j+1 is inside, span tween j+1 & j+2 is outside */
+            xl = static_cast<int>(ceil(active[j].x-.5));        /* left end of span */
+            xr = static_cast<int>(floor(active[j+1].x-.5));        /* right end of span */
+
+            if (xl<=xr) {
+                KisHLineIterator it = polygonMask->createHLineIterator(xl, y, xr - xl + 1, true);
+
+                while (!it.isDone()) {
+                    // We're using a selection here, that means alpha colorspace, that means one byte.
+                    it.rawData()[0] = MAX_SELECTED;
+                    ++it;
+                }
+            }
+
+            active[j].x += active[j].dx;        /* increment edge coords */
+            active[j+1].x += active[j+1].dx;
+        }
+    }
+    delete [] ind;
+    delete [] active;
+
+    polygon->applySelectionMask(polygonMask);
+
+    TQRect r = polygon->extent();
+
+    // The strokes for the outline may have already added updated the dirtyrect, but it can't hurt,
+    // and if we're painting without outlines, then there will be no dirty rect. Let's do it ourselves...
+    // addDirtyRect( r ); // XXX the bltSelection will add to the dirtyrect
+
+    bltSelection(r.x(), r.y(), compositeOp(), polygon, opacity(), r.x(), r.y(), r.width(), r.height());
+}
+
+void KisPainter::paintPolygon(const vKisPoint& points)
+{
+    if (m_fillStyle != FillStyleNone) {
+        fillPolygon(points, m_fillStyle);
+    }
+
+    if (m_strokeStyle != StrokeStyleNone) {
+        if (points.count() > 1) {
+            double distance = -1;
+
+            for (uint i = 0; i < points.count() - 1; i++) {
+                distance = paintLine(points[i], PRESSURE_DEFAULT, 0, 0, points[i + 1], PRESSURE_DEFAULT, 0, 0, distance);
+            }
+            paintLine(points[points.count() - 1], PRESSURE_DEFAULT, 0, 0, points[0], PRESSURE_DEFAULT, 0, 0, distance);
+        }
+    }
+}
+
diff --git a/chalk/core/kis_painter.h b/chalk/core/kis_painter.h
new file mode 100644
index 000000000..abfd8b17e
--- /dev/null
+++ b/chalk/core/kis_painter.h
@@ -0,0 +1,432 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *  Copyright (c) 2004 Clarence Dang <dang@kde.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_PAINTER_H_
+#define KIS_PAINTER_H_
+
+#include <kcommand.h>
+
+#include "kis_color.h"
+#include "kis_global.h"
+#include "kis_types.h"
+#include "kis_paint_device.h"
+#include "kis_point.h"
+#include "kis_filter.h"
+#include "kis_progress_subject.h"
+#include "kis_paintop.h"
+#include "kis_color.h"
+
+#include <koffice_export.h>
+
+class TQRect;
+class KisTransaction;
+class KisBrush;
+class KisPattern;
+
+/**
+ * KisPainter contains the graphics primitives necessary to draw on a
+ * KisPaintDevice. This is the same kind of abstraction as used in TQt
+ * itself, where you have TQPainter and TQPaintDevice.
+ *
+ * However, KisPainter works on a tiled image and supports different
+ * colour models, and that's a lot more complicated.
+ *
+ * KisPainter supports transactions that can group various paint operations
+ * in one undoable step.
+ *
+ * For more complex operations, you might want to have a look at the subclasses
+ * of KisPainter: KisConvolutionPainter, KisFillPainter and KisGradientPainter
+ */
+class KRITACORE_EXPORT KisPainter : public KisProgressSubject {
+    typedef KisProgressSubject super;
+
+public:
+    /// Construct painter without a device
+    KisPainter();
+    /// Construct a painter, and begin painting on the device
+    KisPainter(KisPaintDeviceSP device);
+    virtual ~KisPainter();
+
+private:
+    // Implement KisProgressSubject
+    virtual void cancel() { m_cancelRequested = true; }
+
+public:
+    /**
+     * Start painting on the specified device. Not undoable.
+     */
+    void begin(KisPaintDeviceSP device);
+
+    /**
+     * Finish painting on the current device
+     */
+    KCommand *end();
+
+    /// Begin an undoable paint operation
+    void beginTransaction(const TQString& customName = TQString());
+
+    /// Finish the undoable paint operation
+    KCommand *endTransaction();
+
+    /// begin a transaction with the given command
+    void beginTransaction( KisTransaction* command);
+
+    /// Return the current transcation
+    KisTransaction  * transaction() { return m_transaction; }
+
+
+    /// Returns the current paint device.
+    KisPaintDeviceSP device() const { return m_device; }
+
+
+    // -----------------------------------------------------------------
+    //  Native paint methods that are undo/redo-able,
+    // use the color strategies and the composite operations.
+
+    /**
+     * Blast the specified region from src onto the current paint device.
+     */
+    void bitBlt(TQ_INT32 dx, TQ_INT32 dy,
+                const KisCompositeOp& op,
+                KisPaintDeviceSP src,
+                TQ_INT32 sx, TQ_INT32 sy,
+                TQ_INT32 sw, TQ_INT32 sh)
+    {
+        bitBlt(dx, dy, op, src, OPACITY_OPAQUE, sx, sy, sw, sh);
+    }
+
+    /**
+     * Overloaded version of the previous, differs in that it is possible to specify
+     * a value for opacity
+     */
+    void bitBlt(TQ_INT32 dx, TQ_INT32 dy,
+                const KisCompositeOp& op,
+                KisPaintDeviceSP src,
+                TQ_UINT8 opacity,
+                TQ_INT32 sx, TQ_INT32 sy,
+                TQ_INT32 sw, TQ_INT32 sh);
+
+    /**
+     * A version of bitBlt that renders using an external tqmask, ignoring
+     * the src device's own selection, if it has one.
+     */
+    void bltMask(TQ_INT32 dx, TQ_INT32 dy,
+                      const KisCompositeOp &op,
+                      KisPaintDeviceSP src,
+                      KisPaintDeviceSP selMask,
+                      TQ_UINT8 opacity,
+                      TQ_INT32 sx, TQ_INT32 sy,
+                      TQ_INT32 sw, TQ_INT32 sh);
+
+    /**
+     * A version of bitBlt that renders using an external selection tqmask, ignoring
+     * the src device's own selection, if it has one.
+     */
+    void bltSelection(TQ_INT32 dx, TQ_INT32 dy,
+                      const KisCompositeOp &op,
+                      KisPaintDeviceSP src,
+                      KisSelectionSP selMask,
+                      TQ_UINT8 opacity,
+                      TQ_INT32 sx, TQ_INT32 sy,
+                      TQ_INT32 sw, TQ_INT32 sh);
+
+
+    /**
+     * A version of bitBlt that renders using the src device's selection tqmask, if it has one.
+     */
+    void bltSelection(TQ_INT32 dx, TQ_INT32 dy,
+                      const KisCompositeOp &op,
+                      KisPaintDeviceSP src,
+                      TQ_UINT8 opacity,
+                      TQ_INT32 sx, TQ_INT32 sy,
+                      TQ_INT32 sw, TQ_INT32 sh);
+
+
+    /**
+     * The methods below are 'higher' level than the above methods. They need brushes, colors
+     * etc. set before they can be called. The methods do not directly tell the image to
+     * update, but you can call dirtyRect() to get the rect that needs to be notified by your
+     * painting code.
+     *
+     * Call will RESET the dirtyRect!
+    */
+    TQRect dirtyRect();
+
+    /**
+     * Add the r to the current dirty rect, and return the dirtyRect after adding r to it.
+     */
+    TQRect addDirtyRect(TQRect r) { m_dirtyRect |= r; return m_dirtyRect; }
+
+
+
+    /**
+     * Paint a line that connects the dots in points
+     */
+    void paintPolyline(const TQValueVector <KisPoint> &points,
+                       int index = 0, int numPoints = -1);
+
+    /**
+     * Draw a line between pos1 and pos2 using the currently set brush and color.
+     * If savedDist is less than zero, the brush is painted at pos1 before being
+     * painted along the line using the spacing setting.
+     * @return the drag distance, that is the remains of the distance between p1 and p2 not covered
+     * because the currenlty set brush has a spacing greater than that distance.
+     */
+    double paintLine(const KisPoint &pos1,
+             const double pressure1,
+             const double xTilt1,
+             const double yTilt1,
+             const KisPoint &pos2,
+             const double pressure2,
+             const double xTilt2,
+             const double yTilt2,
+             const double savedDist = -1);
+
+    /**
+     * Draw a Bezier curve between pos1 and pos2 using control points 1 and 2.
+     * If savedDist is less than zero, the brush is painted at pos1 before being
+     * painted along the curve using the spacing setting.
+     * @return the drag distance, that is the remains of the distance between p1 and p2 not covered
+     * because the currenlty set brush has a spacing greater than that distance.
+     */
+    double paintBezierCurve(const KisPoint &pos1,
+                const double pressure1,
+                const double xTilt1,
+                const double yTilt1,
+                const KisPoint &control1,
+                const KisPoint &control2,
+                const KisPoint &pos2,
+                const double pressure2,
+                const double xTilt2,
+                const double yTilt2,
+                const double savedDist = -1);
+
+    /**
+     * Fill the given vector points with the points needed to draw the Bezier curve between
+     * pos1 and pos2 using control points 1 and 2, excluding the final pos2.
+     */
+    void getBezierCurvePoints(const KisPoint &pos1,
+                  const KisPoint &control1,
+                  const KisPoint &control2,
+                  const KisPoint &pos2,
+                  vKisPoint& points);
+
+
+    /**
+     * Paint the rectangle with given begin and end points
+     */
+    void paintRect(const KisPoint &startPoint,
+               const KisPoint &endPoint,
+               const double pressure,
+               const double xTilt,
+               const double yTilt);
+
+
+    /**
+     * Paint the ellipse with given begin and end points
+     */
+    void paintEllipse(const KisPoint &startPoint,
+                      const KisPoint &endPoint,
+                      const double pressure,
+                      const double /*xTilt*/,
+                      const double /*yTilt*/);
+
+    /**
+     * Paint the polygon with the points given in points. It automatically closes the polygon
+     * by drawing the line from the last point to the first.
+     */
+    void paintPolygon(const vKisPoint& points);
+
+    /** Draw a spot at pos using the currently set paint op, brush and color */
+    void paintAt(const KisPoint &pos,
+             const double pressure,
+             const double /*xTilt*/,
+             const double /*yTilt*/);
+
+
+    // ------------------------------------------------------------------------
+    // Set the parameters for the higher level graphics primitives.
+
+    /// Determines whether the brush spacing should vary when drawing
+    /// lines with the pressure
+    void setVaryBrushSpacingWithPressureWhenDrawingALine( bool varyBrushSpacingWithPressureWhenDrawingALine )
+        { m_varyBrushSpacingWithPressureWhenDrawingALine = varyBrushSpacingWithPressureWhenDrawingALine; }
+    bool varyBrushSpacingWithPressureWhenDrawingALine() {  return m_varyBrushSpacingWithPressureWhenDrawingALine;  }
+
+    /// Set the current brush
+    void setBrush(KisBrush* brush) { m_brush = brush; }
+    /// Returns the currently set brush
+    KisBrush * brush() const { return m_brush; }
+
+    /// Set the current pattern
+    void setPattern(KisPattern * pattern) { m_pattern = pattern; }
+    /// Returns the currently set pattern
+    KisPattern * pattern() const { return m_pattern; }
+
+    /// Set the color that will be used to paint with
+    void setPaintColor(const KisColor& color) { m_paintColor = color;}
+
+    /// Returns the color that will be used to paint with
+    KisColor paintColor() const { return m_paintColor; }
+
+    /// Set the current background color
+    void setBackgroundColor(const KisColor& color) {m_backgroundColor = color; }
+    /// Returns the current background color
+    KisColor backgroundColor() const { return m_backgroundColor; }
+
+    /// Set the current fill color
+    void setFillColor(const KisColor& color) { m_fillColor = color; }
+    /// Returns the current fill color
+    KisColor fillColor() const { return m_fillColor; }
+
+
+    /// This enum contains the styles with which we can fill things like polygons and ellipses
+    enum FillStyle {
+        FillStyleNone,
+        FillStyleForegroundColor,
+        FillStyleBackgroundColor,
+        FillStylePattern,
+        FillStyleGradient,
+        FillStyleStrokes
+    };
+
+    /// Set the current style with which to fill
+    void setFillStyle(FillStyle fillStyle) { m_fillStyle = fillStyle; }
+    /// Returns the current fill style
+    FillStyle fillStyle() const { return m_fillStyle; }
+
+    /// The style of the brush stroke around polygons and so
+    enum StrokeStyle {
+        StrokeStyleNone,
+        StrokeStyleBrush
+    };
+
+    /// Set the current brush stroke style
+    void setStrokeStyle(StrokeStyle strokeStyle) { m_strokeStyle = strokeStyle; }
+    /// Returns the current brush stroke style
+    StrokeStyle strokeStyle() const { return m_strokeStyle; }
+
+    /// Set the opacity which is used in painting (like filling polygons)
+    void setOpacity(TQ_UINT8 opacity) { m_opacity = opacity; }
+    /// Returns the opacity that is used in painting
+    TQ_UINT8 opacity() const { return m_opacity; }
+
+    /**
+     * Sets the current composite operation. Everything painted will be composited on
+     * the destination layer with this composite op.
+     **/
+    void setCompositeOp(const KisCompositeOp& op) { m_compositeOp = op; }
+    /// Returns the current composite operation
+    KisCompositeOp compositeOp() const { return m_compositeOp; }
+
+    /// Sets the current KisFilter, used by the paintops that support it (like KisFilterOp)
+    void setFilter(KisFilterSP filter) { m_filter = filter; }
+    /// Returns the current KisFilter
+    KisFilterSP filter() { return m_filter; }
+
+    /**
+     * The offset for paint operations that use it (like KisDuplicateOp). It will use as source
+     * the part of the layer that is at its paintedPosition - duplicateOffset
+     */
+    // TODO: this is an hack ! it must be fix, the following functions have nothing to do here
+    void setDuplicateOffset(const KisPoint& offset) { m_duplicateOffset = offset; }
+    /// Returns the offset for duplication
+    KisPoint duplicateOffset(){ return m_duplicateOffset; }
+
+    inline void setDuplicateHealing(bool v) { m_duplicateHealing = v; }
+    inline bool duplicateHealing() { return m_duplicateHealing; }
+
+    inline void setDuplicateHealingRadius(int r) { m_duplicateHealingRadius = r; }
+    inline int duplicateHealingRadius() { return m_duplicateHealingRadius; }
+
+    inline void setDuplicatePerspectiveCorrection(bool v) { m_duplicatePerspectiveCorrection = v; }
+    inline bool duplicatePerspectiveCorrection() { return m_duplicatePerspectiveCorrection; }
+
+    void setDuplicateStart(const KisPoint start) { m_duplicateStart = start;}
+    KisPoint duplicateStart() { return m_duplicateStart;}
+
+    /// Sets the current pressure for things that like to use this
+    void setPressure(double pressure) { m_pressure = pressure; }
+    /// Returns the current pressure
+    double pressure() { return m_pressure; }
+
+    /**
+     * Set the current paint operation. This is used for all drawing functions.
+     * The painter will DELETE the paint op itself!!
+     * That means no that you should not delete it yourself (or put it on the stack)
+     */
+    void setPaintOp(KisPaintOp * paintOp) { delete m_paintOp; m_paintOp = paintOp; }
+    /// Returns the current paint operation
+    KisPaintOp * paintOp() const { return m_paintOp; }
+
+    /// Set a current 'dab'. This usually is a paint device containing a rendered brush
+    void setDab(KisPaintDeviceSP dab) { m_dab = dab; }
+    /// Get the currently set dab
+    KisPaintDeviceSP dab() const { return m_dab; }
+
+    /// Is cancel Requested by the KisProgressSubject for this painter
+    bool cancelRequested() const { return m_cancelRequested; }
+
+protected:
+    /// Initialize, set everything to '0' or defaults
+    void init();
+    KisPainter(const KisPainter&);
+    KisPainter& operator=(const KisPainter&);
+
+    /// Calculate the distance that point p is from the line made by connecting l0 and l1
+    static double pointToLineDistance(const KisPoint& p, const KisPoint& l0, const KisPoint& l1);
+
+    /// Fill the polygon defined by points with the fillStyle
+    void fillPolygon(const vKisPoint& points, FillStyle fillStyle);
+
+protected:
+    KisPaintDeviceSP m_device;
+    KisTransaction  *m_transaction;
+
+    TQRect m_dirtyRect;
+
+    KisColor m_paintColor;
+    KisColor m_backgroundColor;
+    KisColor m_fillColor;
+    FillStyle m_fillStyle;
+    StrokeStyle m_strokeStyle;
+    KisBrush *m_brush;
+    KisPattern *m_pattern;
+    KisPoint m_duplicateOffset;
+    KisPoint m_duplicateStart;
+    bool m_duplicateHealing;
+    int m_duplicateHealingRadius;
+    bool m_duplicatePerspectiveCorrection;
+    TQ_UINT8 m_opacity;
+    KisCompositeOp m_compositeOp;
+    KisFilterSP m_filter;
+    KisPaintOp * m_paintOp;
+    double m_pressure;
+    bool m_cancelRequested;
+    TQ_INT32 m_pixelSize;
+    KisColorSpace * m_colorSpace;
+    KisProfile *  m_profile;
+    KisPaintDeviceSP m_dab;
+    bool m_varyBrushSpacingWithPressureWhenDrawingALine;
+
+};
+
+
+#endif // KIS_PAINTER_H_
+
diff --git a/chalk/core/kis_paintop.cc b/chalk/core/kis_paintop.cc
new file mode 100644
index 000000000..71989bd98
--- /dev/null
+++ b/chalk/core/kis_paintop.cc
@@ -0,0 +1,113 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *  Copyright (c) 2004 Clarence Dang <dang@kde.org>
+ *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "tqwidget.h"
+#include "kis_painter.h"
+#include "kis_layer.h"
+#include "kis_types.h"
+#include "kis_paintop.h"
+#include "kis_alpha_mask.h"
+#include "kis_point.h"
+#include "kis_colorspace.h"
+#include "kis_global.h"
+#include "kis_iterators_pixel.h"
+#include "kis_color.h"
+
+KisPaintOp::KisPaintOp(KisPainter * painter) 
+    : m_dab(0)
+{
+    m_painter = painter;
+    setSource(painter->device());
+}
+
+KisPaintOp::~KisPaintOp()
+{
+}
+
+KisPaintDeviceSP KisPaintOp::computeDab(KisAlphaMaskSP tqmask) {
+    return computeDab(tqmask, m_painter->device()->colorSpace());
+}
+
+KisPaintDeviceSP KisPaintOp::computeDab(KisAlphaMaskSP tqmask, KisColorSpace *cs)
+{
+    // XXX: According to the SeaShore source, the Gimp uses a
+    // temporary layer the size of the layer that is being painted
+    // on. This layer is cleared between painting actions. Our
+    // temporary layer, dab, is for every paintAt, composited with
+    // the target layer. We only use a real temporary layer for things
+    // like filter tools.
+
+    if(!m_dab || m_dab->colorSpace() != cs)
+        m_dab = new KisPaintDevice(cs, "dab");
+    Q_CHECK_PTR(m_dab);
+
+    KisColor kc = m_painter->paintColor();
+
+    KisColorSpace * colorSpace = m_dab->colorSpace();
+
+    TQ_INT32 pixelSize = colorSpace->pixelSize();
+
+    TQ_INT32 tqmaskWidth = tqmask->width();
+    TQ_INT32 tqmaskHeight = tqmask->height();
+
+    // Convert the kiscolor to the right colorspace.
+    kc.convertTo(colorSpace);
+
+    KisHLineIteratorPixel hiter = m_dab->createHLineIterator(0, 0, tqmaskWidth, true);
+    for (int y = 0; y < tqmaskHeight; y++)
+    {
+        int x=0;
+        while(! hiter.isDone())
+        {
+            // XXX: Set tqmask
+            colorSpace->setAlpha(kc.data(), tqmask->alphaAt(x++, y), 1);
+            memcpy(hiter.rawData(), kc.data(), pixelSize);
+            ++hiter;
+        }
+        hiter.nextRow();
+    }
+
+    return m_dab;
+}
+
+void KisPaintOp::splitCoordinate(double coordinate, TQ_INT32 *whole, double *fraction)
+{
+    TQ_INT32 i = static_cast<TQ_INT32>(coordinate);
+
+    if (coordinate < 0) {
+        // We always want the fractional part to be positive.
+        // E.g. -1.25 becomes -2 and +0.75
+        i--;
+    }
+
+    double f = coordinate - i;
+
+    *whole = i;
+    *fraction = f;
+}
+
+void KisPaintOp::setSource(KisPaintDeviceSP p) {
+    Q_ASSERT(p);
+    m_source = p;
+}
+
+
+KisPaintOpSettings* KisPaintOpFactory::settings(TQWidget* /*tqparent*/, const KisInputDevice& /*inputDevice*/) { return 0; }
diff --git a/chalk/core/kis_paintop.h b/chalk/core/kis_paintop.h
new file mode 100644
index 000000000..8e8587eab
--- /dev/null
+++ b/chalk/core/kis_paintop.h
@@ -0,0 +1,141 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *  Copyright (c) 2004 Clarence Dang <dang@kde.org>
+ *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
+ *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_PAINTOP_H_
+#define KIS_PAINTOP_H_
+
+#include <tqstring.h>
+
+#include <ksharedptr.h>
+#include <klocale.h>
+
+#include "kis_global.h"
+#include "kis_types.h"
+#include "kis_id.h"
+#include "kis_vec.h"
+#include "kis_colorspace.h"
+
+#include <koffice_export.h>
+
+class KisPoint;
+class KisAlphaMask;
+class KisPainter;
+class KisColorSpace;
+class KisInputDevice;
+class TQWidget;
+
+/**
+ * This class keeps information that can be used in the painting process, for example by
+ * brushes.
+ **/
+class KRITACORE_EXPORT KisPaintInformation {
+public:
+    KisPaintInformation(double pressure = PRESSURE_DEFAULT,
+                        double xTilt = 0.0, double yTilt = 0.0,
+                        KisVector2D movement = KisVector2D())
+        : pressure(pressure), xTilt(xTilt), yTilt(yTilt), movement(movement) {}
+    double pressure;
+    double xTilt;
+    double yTilt;
+    KisVector2D movement;
+};
+
+class KRITACORE_EXPORT KisPaintOp : public KShared
+{
+
+public:
+
+    KisPaintOp(KisPainter * painter);
+    virtual ~KisPaintOp();
+
+    virtual void paintAt(const KisPoint &pos, const KisPaintInformation& info) = 0;
+    void setSource(KisPaintDeviceSP p);
+
+    /**
+     * Whether this paintop wants to deposit paint even when not moving, i.e. the
+     * tool needs to activate its timer.
+     */
+    virtual bool incremental() { return false; }
+
+
+protected:
+
+    virtual KisPaintDeviceSP computeDab(KisAlphaMaskSP tqmask);
+    virtual KisPaintDeviceSP computeDab(KisAlphaMaskSP tqmask, KisColorSpace *cs);
+
+
+    /**
+     * Split the coordinate into whole + fraction, where fraction is always >= 0.
+     */
+    virtual void splitCoordinate(double coordinate, TQ_INT32 *whole, double *fraction);
+
+    KisPainter * m_painter;
+    KisPaintDeviceSP m_source; // use this layer as source layer for the operation
+private:
+    KisPaintDeviceSP m_dab;
+};
+
+class KisPaintOpSettings {
+
+public:
+    KisPaintOpSettings(TQWidget *tqparent) { Q_UNUSED(tqparent); }
+    virtual ~KisPaintOpSettings() {}
+
+    virtual TQWidget *widget() const { return 0; }
+};
+
+/**
+ * The paintop factory is responsible for creating paintops of the specified class.
+ * If there is an optionWidget, the derived paintop itself must support settings,
+ * and it's up to the factory to do that.
+ */
+class KisPaintOpFactory  : public KShared
+{
+
+public:
+    KisPaintOpFactory() {}
+    virtual ~KisPaintOpFactory() {}
+
+    virtual KisPaintOp * createOp(const KisPaintOpSettings *settings, KisPainter * painter) = 0;
+    virtual KisID id() { return KisID("abstractpaintop", i18n("Abstract PaintOp")); }
+
+    /**
+     * The filename of the pixmap we can use to represent this paintop in the ui.
+     */
+    virtual TQString pixmap() { return ""; }
+
+    /**
+     * Whether this paintop is internal to a certain tool or can be used
+     * in various tools. If false, it won't show up in the toolchest.
+     * The KisColorSpace argument can be used when certain paintops only support a specific cs
+     */
+    virtual bool userVisible(KisColorSpace * cs = 0) { return cs->id() != KisID("WET", ""); }
+
+    /**
+     * Create and return an (abstracted) widget with options for this paintop when used with the 
+     * specified input device. Return 0 if there are no settings available for the given
+     * device.
+     */
+    virtual KisPaintOpSettings* settings(TQWidget* tqparent, const KisInputDevice& inputDevice);
+
+};
+#endif // KIS_PAINTOP_H_
diff --git a/chalk/core/kis_paintop_registry.cc b/chalk/core/kis_paintop_registry.cc
new file mode 100644
index 000000000..3651f35da
--- /dev/null
+++ b/chalk/core/kis_paintop_registry.cc
@@ -0,0 +1,139 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <tqpixmap.h>
+#include <tqwidget.h>
+
+#include <kdebug.h>
+#include <kinstance.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kparts/plugin.h>
+#include <kservice.h>
+#include <ktrader.h>
+#include <kparts/componentfactory.h>
+
+#include "kis_generic_registry.h"
+#include "kis_types.h"
+#include "kis_paintop_registry.h"
+#include "kis_paintop.h"
+#include "kis_id.h"
+#include "kis_debug_areas.h"
+#include "kis_colorspace.h"
+
+KisPaintOpRegistry * KisPaintOpRegistry::m_singleton = 0;
+
+KisPaintOpRegistry::KisPaintOpRegistry()
+{
+    Q_ASSERT(KisPaintOpRegistry::m_singleton == 0);
+    KisPaintOpRegistry::m_singleton = this;
+
+    KTrader::OfferList offers = KTrader::self()->query(TQString::tqfromLatin1("Chalk/Paintop"),
+                                                         TQString::tqfromLatin1("(Type == 'Service') and "
+                                                                             "([X-Chalk-Version] == 2)"));
+
+    KTrader::OfferList::ConstIterator iter;
+
+    for(iter = offers.begin(); iter != offers.end(); ++iter)
+    {
+        KService::Ptr service = *iter;
+        int errCode = 0;
+        KParts::Plugin* plugin =
+             KParts::ComponentFactory::createInstanceFromService<KParts::Plugin> ( service, this, 0, TQStringList(), &errCode);
+        if ( plugin )
+            kdDebug(41006) << "found plugin " << service->property("Name").toString() << "\n";
+        else {
+            kdDebug(41006) << "found plugin " << service->property("Name").toString() << ", " << errCode << "\n";
+            if( errCode == KParts::ComponentFactory::ErrNoLibrary)
+            {
+                kdWarning(41006) << " Error loading plugin was : ErrNoLibrary " << KLibLoader::self()->lastErrorMessage() << endl;
+            }
+        }
+
+    }
+
+}
+
+KisPaintOpRegistry::~KisPaintOpRegistry()
+{
+}
+
+KisPaintOpRegistry* KisPaintOpRegistry::instance()
+{
+    if(KisPaintOpRegistry::m_singleton == 0)
+    {
+        KisPaintOpRegistry::m_singleton = new KisPaintOpRegistry();
+        Q_CHECK_PTR(KisPaintOpRegistry::m_singleton);
+    }
+    return KisPaintOpRegistry::m_singleton;
+}
+
+KisPaintOp * KisPaintOpRegistry::paintOp(const KisID & id, const KisPaintOpSettings * settings, KisPainter * painter) const
+{
+    if (painter == 0) {
+        kdWarning() << " KisPaintOpRegistry::paintOp painter is null";
+        return 0;
+    }
+    KisPaintOpFactorySP f = get(id);
+   if (f) {
+        return f->createOp(settings, painter);
+    }
+    else {
+        return 0;
+    }
+}
+
+KisPaintOp * KisPaintOpRegistry::paintOp(const TQString & id, const KisPaintOpSettings * settings, KisPainter * painter) const
+{
+    return paintOp(KisID(id, ""), settings, painter);
+}
+
+KisPaintOpSettings * KisPaintOpRegistry::settings(const KisID& id, TQWidget * tqparent, const KisInputDevice& inputDevice) const
+{
+    KisPaintOpFactory* f = get(id);
+    if (f)
+        return f->settings( tqparent, inputDevice );
+
+    return 0;
+}
+
+bool KisPaintOpRegistry::userVisible(const KisID & id, KisColorSpace* cs) const
+{
+
+    KisPaintOpFactorySP f = get(id);
+    if (!f) {
+        kdDebug(DBG_AREA_REGISTRY) << "No paintop " << id.id() << "\n";
+        return false;
+    }
+    return f->userVisible(cs);
+
+}
+
+TQString KisPaintOpRegistry::pixmap(const KisID & id) const
+{
+    KisPaintOpFactorySP f = get(id);
+
+    if (!f) {
+        kdDebug(DBG_AREA_REGISTRY) << "No paintop " << id.id() << "\n";
+        return "";
+    }
+
+    return f->pixmap();
+}
+
+#include "kis_paintop_registry.moc"
diff --git a/chalk/core/kis_paintop_registry.h b/chalk/core/kis_paintop_registry.h
new file mode 100644
index 000000000..c61105b65
--- /dev/null
+++ b/chalk/core/kis_paintop_registry.h
@@ -0,0 +1,84 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_PAINTOP_REGISTRY_H_
+#define KIS_PAINTOP_REGISTRY_H_
+
+#include <tqobject.h>
+
+#include "kis_types.h"
+#include "kis_generic_registry.h"
+#include <koffice_export.h>
+
+class TQWidget;
+class TQStringList;
+
+class KisPaintOp;
+class KisPaintOpSettings;
+class KisPainter;
+class KisColorSpace;
+class KisInputDevice;
+
+class KRITACORE_EXPORT KisPaintOpRegistry : public TQObject, public KisGenericRegistry<KisPaintOpFactorySP>
+{
+
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    virtual ~KisPaintOpRegistry();
+
+    /**
+     * Return a newly created paintop
+     */
+    KisPaintOp * paintOp(const KisID& id, const KisPaintOpSettings * settings, KisPainter * painter) const;
+
+    /**
+     * Return a newly created paintopd
+     */
+    KisPaintOp * paintOp(const TQString& id, const KisPaintOpSettings * settings, KisPainter * painter) const;
+
+    /**
+     * Create and return an (abstracted) configuration widget
+     * for using the specified paintop with the specified input device,
+     * with the specified tqparent as widget tqparent. Returns 0 if there
+     * are no settings available for the given device.
+     */
+    KisPaintOpSettings * settings(const KisID& id, TQWidget * tqparent, const KisInputDevice& inputDevice) const;
+    
+    // Whether we should show this paintop in the toolchest
+    bool userVisible(const KisID & id, KisColorSpace* cs) const;
+
+    // Get the name of the icon to show in the toolchest
+    TQString pixmap(const KisID & id) const;
+
+
+public:
+    static KisPaintOpRegistry* instance();
+
+private:
+    KisPaintOpRegistry();
+    KisPaintOpRegistry(const KisPaintOpRegistry&);
+    KisPaintOpRegistry operator=(const KisPaintOpRegistry&);
+
+private:
+    static KisPaintOpRegistry *m_singleton;
+};
+
+#endif // KIS_PAINTOP_REGISTRY_H_
+
diff --git a/chalk/core/kis_palette.cc b/chalk/core/kis_palette.cc
new file mode 100644
index 000000000..daf8d84d6
--- /dev/null
+++ b/chalk/core/kis_palette.cc
@@ -0,0 +1,306 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <netinet/in.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <cfloat>
+
+#include <tqimage.h>
+#include <tqpoint.h>
+#include <tqvaluevector.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_debug_areas.h"
+#include "kis_palette.h"
+#include "kis_iterators_pixel.h"
+
+
+namespace {
+    enum enumPaletteType {
+        FORMAT_UNKNOWN,
+        FORMAT_GPL, // Gimp palette
+        FORMAT_PAL, // RIFF palette
+        FORMAT_ACT // Photoshop binary color palette
+    };
+
+}
+
+
+KisPalette::KisPalette(const TQImage * img, TQ_INT32 nColors, const TQString & name)
+    : super(TQString("")),
+      m_name(name)
+{
+    Q_ASSERT(nColors > 0);
+    Q_ASSERT(!img->isNull());
+
+    // XXX: Implement
+
+    m_columns = 0; // Set the default value that the GIMP uses...
+}
+
+KisPalette::KisPalette(const KisPaintDeviceSP device, TQ_INT32 nColors, const TQString & name)
+    : super(TQString("")),
+      m_name(name)
+{
+    Q_ASSERT(nColors > 0);
+    Q_ASSERT(device != 0);
+
+
+    // XXX: Implement
+    m_columns = 0; // Set the default value that the GIMP uses...
+}
+
+
+KisPalette::KisPalette(const KisGradient * gradient, TQ_INT32 nColors, const TQString & name)
+    : super(TQString("")),
+      m_name(name)
+{
+    Q_ASSERT(nColors > 0);
+    Q_ASSERT(gradient != 0);
+
+    double dx, cur_x;
+    TQColor c;
+    TQ_INT32 i;
+    TQ_UINT8 opacity;
+    dx = 1.0 / (nColors - 1);
+
+    KisPaletteEntry e;
+    for (i = 0, cur_x = 0; i < nColors; i++, cur_x += dx) {
+        gradient->colorAt(cur_x, &e.color, &opacity);
+        e.name = "Untitled";
+        add(e);
+    }
+
+    m_columns = 0; // Set the default value that the GIMP uses...
+}
+
+KisPalette::KisPalette(const TQString& filename)
+    : super(filename)
+{
+    // Implemented in super class
+    m_columns = 0; // Set the default value that the GIMP uses...
+}
+
+KisPalette::KisPalette()
+    : super("")
+{
+    m_columns = 0; // Set the default value that the GIMP uses...
+}
+
+/// Create an copied palette
+KisPalette::KisPalette(const KisPalette& rhs)
+    : super("")
+{
+    setFilename(rhs.filename());
+    m_ownData = false;
+    m_img = rhs.m_img;
+    m_name = rhs.m_name;
+    m_comment = rhs.m_comment;
+    m_columns = rhs.m_columns;
+    m_colors = rhs.m_colors;
+    setValid(true);
+}
+
+KisPalette::~KisPalette()
+{
+}
+
+bool KisPalette::load()
+{
+    TQFile file(filename());
+    file.open(IO_ReadOnly);
+    m_data = file.readAll();
+    file.close();
+    return init();
+}
+
+
+bool KisPalette::save()
+{
+    TQFile file(filename());
+    if (!file.open(IO_WriteOnly | IO_Truncate)) {
+        return false;
+    }
+
+    TQTextStream stream(&file);
+    // Header: Magic\nName: <name>\nColumns: <no idea what this means, but default = 0>
+    // In any case, we don't use Columns...
+    stream << "GIMP Palette\nName: " << name() << "\nColumns: " << m_columns << "\n#\n";
+
+    for (uint i = 0; i < m_colors.size(); i++) {
+        const KisPaletteEntry& entry = m_colors.at(i);
+        TQColor c = entry.color;
+        stream << c.red() << " " << c.green() << " " << c.blue() << "\t";
+        if (entry.name.isEmpty())
+            stream << "Untitled\n";
+        else
+            stream << entry.name << "\n";
+    }
+
+    file.close();
+    return true;
+}
+
+TQImage KisPalette::img()
+{
+    return m_img;
+}
+
+TQ_INT32 KisPalette::nColors()
+{
+    return m_colors.count();
+}
+
+bool KisPalette::init()
+{
+    enumPaletteType format = FORMAT_UNKNOWN;
+
+    TQString s = TQString::fromUtf8(m_data.data(), m_data.count());
+
+    if (s.isEmpty() || s.isNull() || s.length() < 50) {
+        kdWarning(DBG_AREA_FILE) << "Illegal Gimp palette file: " << filename() << "\n";
+        return false;
+    }
+
+
+    if (s.startsWith("RIFF") || s.startsWith("PAL data"))
+    {
+       format = FORMAT_PAL;
+    }
+    else if (s.startsWith("GIMP Palette"))
+    {
+        // XXX: No checks for wrong input yet!
+        TQ_UINT32 index = 0;
+
+        TQStringList lines = TQStringList::split("\n", s);
+
+        if (lines.size() < 3) {
+            return false;
+        }
+
+        TQString entry, channel, columns;
+        TQStringList c;
+        TQ_INT32 r, g, b;
+        TQColor color;
+        KisPaletteEntry e;
+
+        format = FORMAT_GPL;
+
+        // Read name
+        if (!lines[1].startsWith("Name: ") || !lines[0].startsWith("GIMP") )
+        {
+            kdWarning(DBG_AREA_FILE) << "Illegal Gimp palette file: " << filename() << "\n";
+            return false;
+        }
+
+        setName(i18n(lines[1].mid(strlen("Name: ")).stripWhiteSpace().ascii()));
+
+        index = 2;
+
+        // Read columns
+        if (lines[index].startsWith("Columns: ")) {
+            columns = lines[index].mid(strlen("Columns: ")).stripWhiteSpace();;
+            m_columns = columns.toInt();
+            index = 3;
+        }
+
+        for (TQ_UINT32 i = index; i < lines.size(); i++) {
+            if (lines[i].startsWith("#")) {
+                m_comment += lines[i].mid(1).stripWhiteSpace() + " ";
+            }
+            else if (!lines[i].isEmpty())
+            {
+                TQStringList a = TQStringList::split(" ", lines[i].tqreplace(TQChar('\t'), " "));
+
+                if (a.count() < 3)
+                {
+                    break;
+                }
+
+                r = a[0].toInt();
+                a.pop_front();
+                g = a[0].toInt();
+                a.pop_front();
+                b = a[0].toInt();
+                a.pop_front();
+
+                if (r < 0 || r > 255 ||
+                    g < 0 || g > 255 ||
+                    b < 0 || b > 255)
+                {
+                    break;
+                }
+
+                color = TQColor(r, g, b);
+                e.color = color;
+
+                TQString name = a.join(" ");
+                e.name = name.isEmpty() ? i18n("Untitled") : name;
+
+                add(e);
+            }
+        }
+        setValid(true);
+        return true;
+    }
+    else if (s.length() == 768) {
+        kdWarning(DBG_AREA_FILE) << "Photoshop format palette file. Not implemented yet\n";
+        format = FORMAT_ACT;
+    }
+    return false;
+}
+
+
+void KisPalette::add(const KisPaletteEntry & c)
+{
+    m_colors.push_back(c);
+}
+
+void KisPalette::remove(const KisPaletteEntry & c)
+{
+    TQValueVector<KisPaletteEntry>::iterator it = m_colors.begin();
+    TQValueVector<KisPaletteEntry>::iterator end = m_colors.end();
+
+    while (it != end) {
+        if ((*it) == c) {
+            m_colors.erase(it);
+            return;
+        }
+        ++it;
+    }
+}
+
+KisPaletteEntry KisPalette::getColor(TQ_UINT32 index)
+{
+    return m_colors[index];
+}
+
+#include "kis_palette.moc"
diff --git a/chalk/core/kis_palette.h b/chalk/core/kis_palette.h
new file mode 100644
index 000000000..ed49849f2
--- /dev/null
+++ b/chalk/core/kis_palette.h
@@ -0,0 +1,113 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_PALETTE_
+#define KIS_PALETTE_
+
+#include <tqimage.h>
+#include <tqcolor.h>
+#include <tqvaluevector.h>
+
+#include <kio/job.h>
+#include <kpalette.h>
+
+#include "kis_types.h"
+#include "kis_resource.h"
+#include "kis_global.h"
+#include "kis_gradient.h"
+#include "kis_alpha_mask.h"
+
+class TQPoint;
+class TQPixmap;
+class KisPaintDevice;
+
+struct KisPaletteEntry {
+    TQColor color;
+    TQString name;
+    bool operator==(const KisPaletteEntry& rhs) const {
+        return color == rhs.color && name == rhs.name;
+    }
+};
+
+/**
+ * Open Gimp, Photoshop or RIFF palette files. This is a straight port
+ * from the Gimp.
+ */
+class KisPalette : public KisResource {
+    typedef KisResource super;
+
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    /**
+     * Create a palette from the colours in an image
+     */
+    KisPalette(const TQImage * img, TQ_INT32 nColors, const TQString & name);
+
+    /**
+     * Create a palette from the colours in a paint device
+     */
+    KisPalette(const KisPaintDeviceSP device, TQ_INT32 nColors, const TQString & name);
+
+    /**
+     * Create a palette from the colours in a gradient
+     */
+    KisPalette(const KisGradient * gradient, TQ_INT32 nColors, const TQString & name);
+
+    /**
+     * Load a palette from a file. This can be a Gimp
+     * palette, a RIFF palette or a Photoshop palette.
+     */
+    KisPalette(const TQString& filename);
+
+    /// Create an empty palette
+    KisPalette();
+
+    /// Explicit copy constructor (KisResource copy constructor is private)
+    KisPalette(const KisPalette& rhs);
+
+    virtual ~KisPalette();
+
+    virtual bool load();
+    virtual bool save();
+    virtual TQImage img();
+
+
+public:
+
+    void add(const KisPaletteEntry &);
+    void remove(const KisPaletteEntry &);
+    KisPaletteEntry getColor(TQ_UINT32 index);
+    TQ_INT32 nColors();
+
+private:
+    bool init();
+
+private:
+
+    TQByteArray m_data;
+    bool m_ownData;
+    TQImage m_img;
+    TQString m_name;
+    TQString m_comment;
+    TQ_INT32 m_columns;
+    TQValueVector<KisPaletteEntry> m_colors;
+
+};
+#endif // KIS_PALETTE_
+
diff --git a/chalk/core/kis_part_layer_iface.h b/chalk/core/kis_part_layer_iface.h
new file mode 100644
index 000000000..1d4f7b995
--- /dev/null
+++ b/chalk/core/kis_part_layer_iface.h
@@ -0,0 +1,36 @@
+/*
+ *  Copyright (c) 2006 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_PART_LAYER_IFACE_
+#define KIS_PART_LAYER_IFACE_
+
+#include <tqdom.h>
+#include "kis_types.h"
+
+/**
+ * An interface for the Part Layer so that we can use it in core/, but can implement it in ui/
+ */
+class KisPartLayer : public KisLayer {
+    typedef KisLayer super;
+public:
+    KisPartLayer(KisImage *img, const TQString &name, TQ_UINT8 opacity)
+        : super(img, name, opacity) {}
+    virtual KisPaintDeviceSP prepareProjection(KisPaintDeviceSP projection, const TQRect& r) = 0;
+    virtual bool saveToXML(TQDomDocument doc, TQDomElement elem) = 0;
+};
+
+#endif // KIS_PART_IFACE_LAYER_IFACE_
diff --git a/chalk/core/kis_pattern.cc b/chalk/core/kis_pattern.cc
new file mode 100644
index 000000000..516d3d8b1
--- /dev/null
+++ b/chalk/core/kis_pattern.cc
@@ -0,0 +1,335 @@
+/*
+ *  kis_pattern.cc - part of Krayon
+ *
+ *  Copyright (c) 2000 Matthias Elter <elter@kde.org>
+ *                2001 John Califf
+ *                2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kis_pattern.h"
+
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#include <limits.h>
+#include <stdlib.h>
+
+#include <tqpoint.h>
+#include <tqsize.h>
+#include <tqimage.h>
+#include <tqvaluevector.h>
+#include <tqmap.h>
+#include <tqfile.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_color.h"
+#include "kis_layer.h"
+#include "kis_paint_device.h"
+
+namespace {
+    struct GimpPatternHeader {
+        TQ_UINT32 header_size;  /*  header_size = sizeof (PatternHeader) + brush name  */
+        TQ_UINT32 version;      /*  pattern file version #  */
+        TQ_UINT32 width;        /*  width of pattern */
+        TQ_UINT32 height;       /*  height of pattern  */
+        TQ_UINT32 bytes;        /*  depth of pattern in bytes : 1, 2, 3 or 4*/
+        TQ_UINT32 magic_number; /*  GIMP brush magic number  */
+    };
+
+    // Yes! This is _NOT_ what my pat.txt file says. It's really not 'GIMP', but 'GPAT'
+    TQ_UINT32 const GimpPatternMagic = (('G' << 24) + ('P' << 16) + ('A' << 8) + ('T' << 0));
+}
+
+KisPattern::KisPattern(const TQString& file) : super(file), m_hasFile(true)
+{
+}
+
+KisPattern::KisPattern(KisPaintDevice* image, int x, int y, int w, int h)
+    : super(""), m_hasFile(false)
+{
+    // Forcefully convert to RGBA8
+    // XXX profile and exposure?
+    setImage(image->convertToTQImage(0, x, y, w, h));
+    setName(image->name());
+}
+
+KisPattern::~KisPattern()
+{
+}
+
+bool KisPattern::load()
+{
+    if (!m_hasFile)
+        return true;
+
+    TQFile file(filename());
+    file.open(IO_ReadOnly);
+    TQByteArray data = file.readAll();
+    if (!data.isEmpty()) {
+        TQ_INT32 startPos = m_data.size();
+
+        m_data.resize(m_data.size() + data.count());
+        memcpy(&m_data[startPos], data.data(), data.count());
+    }
+    file.close();
+    return init();
+}
+
+bool KisPattern::save()
+{
+    TQFile file(filename());
+    file.open(IO_WriteOnly | IO_Truncate);
+
+    TQTextStream stream(&file);
+    // Header: header_size (24+name length),version,width,height,colourdepth of brush,magic,name
+    // depth: 1 = greyscale, 2 = greyscale + A, 3 = RGB, 4 = RGBA
+    // magic = "GPAT", as a single uint32, the docs are wrong here!
+    // name is UTF-8 (\0-terminated! The docs say nothing about this!)
+    // _All_ data in network order, it seems! (not mentioned in gimp-2.2.8/devel-docs/pat.txt!!)
+    // We only save RGBA at the moment
+    // Version is 1 for now...
+
+    GimpPatternHeader ph;
+    TQCString utf8Name = name().utf8();
+    char const* name = utf8Name.data();
+    int nameLength = tqstrlen(name);
+
+    ph.header_size = htonl(sizeof(GimpPatternHeader) + nameLength + 1); // trailing 0
+    ph.version = htonl(1);
+    ph.width = htonl(width());
+    ph.height = htonl(height());
+    ph.bytes = htonl(4);
+    ph.magic_number = htonl(GimpPatternMagic);
+
+    TQByteArray bytes;
+    bytes.setRawData(reinterpret_cast<char*>(&ph), sizeof(GimpPatternHeader));
+    int wrote = file.writeBlock(bytes);
+    bytes.resetRawData(reinterpret_cast<char*>(&ph), sizeof(GimpPatternHeader));
+
+    if (wrote == -1)
+        return false;
+
+    wrote = file.writeBlock(name, nameLength + 1); // Trailing 0 apparantly!
+    if (wrote == -1)
+        return false;
+
+    int k = 0;
+    bytes.resize(width() * height() * 4);
+    for (TQ_INT32 y = 0; y < height(); y++) {
+        for (TQ_INT32 x = 0; x < width(); x++) {
+            // RGBA only
+            TQRgb pixel = m_img.pixel(x,y);
+            bytes[k++] = static_cast<char>(tqRed(pixel));
+            bytes[k++] = static_cast<char>(tqGreen(pixel));
+            bytes[k++] = static_cast<char>(tqBlue(pixel));
+            bytes[k++] = static_cast<char>(tqAlpha(pixel));
+        }
+    }
+
+    wrote = file.writeBlock(bytes);
+    if (wrote == -1)
+        return false;
+
+    file.close();
+
+    return true;
+}
+
+TQImage KisPattern::img()
+{
+    return m_img;
+}
+
+bool KisPattern::init()
+{
+    // load Gimp patterns
+    GimpPatternHeader bh;
+    TQ_INT32 k;
+    TQValueVector<char> name;
+
+    if (sizeof(GimpPatternHeader) > m_data.size()) {
+        return false;
+    }
+
+    memcpy(&bh, &m_data[0], sizeof(GimpPatternHeader));
+    bh.header_size = ntohl(bh.header_size);
+    bh.version = ntohl(bh.version);
+    bh.width = ntohl(bh.width);
+    bh.height = ntohl(bh.height);
+    bh.bytes = ntohl(bh.bytes);
+    bh.magic_number = ntohl(bh.magic_number);
+
+    if (bh.header_size > m_data.size() || bh.header_size == 0) {
+        return false;
+    }
+
+    name.resize(bh.header_size - sizeof(GimpPatternHeader));
+    memcpy(&name[0], &m_data[sizeof(GimpPatternHeader)], name.size());
+
+    if (name[name.size() - 1]) {
+        return false;
+    }
+
+    setName(i18n(&name[0]));
+
+    if (bh.width == 0 || bh.height == 0 || !m_img.create(bh.width, bh.height, 32)) {
+        return false;
+    }
+
+    k = bh.header_size;
+
+    if (bh.bytes == 1) {
+        // Grayscale
+        TQ_INT32 val;
+
+        for (TQ_UINT32 y = 0; y < bh.height; y++) {
+            for (TQ_UINT32 x = 0; x < bh.width; x++, k++) {
+                if (static_cast<TQ_UINT32>(k) > m_data.size()) {
+                    kdDebug(DBG_AREA_FILE) << "failed in gray\n";
+                    return false;
+                }
+
+                val = m_data[k];
+                m_img.setPixel(x, y, tqRgb(val, val, val));
+                m_img.setAlphaBuffer(false);
+            }
+        }
+    } else if (bh.bytes == 2) {
+        // Grayscale + A
+        TQ_INT32 val;
+        TQ_INT32 alpha;
+        for (TQ_UINT32 y = 0; y < bh.height; y++) {
+            for (TQ_UINT32 x = 0; x < bh.width; x++, k++) {
+                if (static_cast<TQ_UINT32>(k + 2) > m_data.size()) {
+                    kdDebug(DBG_AREA_FILE) << "failed in grayA\n";
+                    return false;
+                }
+
+                val = m_data[k];
+                alpha = m_data[k++];
+                m_img.setPixel(x, y, tqRgba(val, val, val, alpha));
+                m_img.setAlphaBuffer(true);
+            }
+        }
+    } else if (bh.bytes == 3) {
+        // RGB without alpha
+        for (TQ_UINT32 y = 0; y < bh.height; y++) {
+            for (TQ_UINT32 x = 0; x < bh.width; x++) {
+                if (static_cast<TQ_UINT32>(k + 3) > m_data.size()) {
+                    kdDebug(DBG_AREA_FILE) << "failed in RGB\n";
+                    return false;
+                }
+
+                m_img.setPixel(x, y, tqRgb(m_data[k],
+                              m_data[k + 1],
+                              m_data[k + 2]));
+                k += 3;
+                m_img.setAlphaBuffer(false);
+            }
+        }
+    } else if (bh.bytes == 4) {
+        // Has alpha
+        for (TQ_UINT32 y = 0; y < bh.height; y++) {
+            for (TQ_UINT32 x = 0; x < bh.width; x++) {
+                if (static_cast<TQ_UINT32>(k + 4) > m_data.size()) {
+                    kdDebug(DBG_AREA_FILE) << "failed in RGBA\n";
+                    return false;
+                }
+
+                m_img.setPixel(x, y, tqRgba(m_data[k],
+                               m_data[k + 1],
+                               m_data[k + 2],
+                               m_data[k + 3]));
+                k += 4;
+                m_img.setAlphaBuffer(true);
+            }
+        }
+    } else {
+        return false;
+    }
+
+    if (m_img.isNull()) {
+        return false;
+    }
+
+    setWidth(m_img.width());
+    setHeight(m_img.height());
+
+    setValid(true);
+
+    return true;
+}
+
+KisPaintDeviceSP KisPattern::image(KisColorSpace * colorSpace) {
+    // Check if there's already a pattern prepared for this colorspace
+    TQMap<TQString, KisPaintDeviceSP>::const_iterator it = m_colorspaces.tqfind(colorSpace->id().id());
+    if (it != m_colorspaces.end())
+        return (*it);
+
+    // If not, create one
+    KisPaintDeviceSP layer = new KisPaintDevice(colorSpace, "pattern");
+
+    Q_CHECK_PTR(layer);
+
+    layer->convertFromTQImage(m_img,"");
+
+    m_colorspaces[colorSpace->id().id()] = layer;
+    return layer;
+}
+
+TQ_INT32 KisPattern::width() const
+{
+    return m_width;
+}
+
+void KisPattern::setWidth(TQ_INT32 w)
+{
+    m_width = w;
+}
+
+TQ_INT32 KisPattern::height() const
+{
+    return m_height;
+}
+
+void KisPattern::setHeight(TQ_INT32 h)
+{
+    m_height = h;
+}
+
+void KisPattern::setImage(const TQImage& img)
+{
+    m_hasFile = false;
+    m_img = img;
+    m_img.detach();
+
+    setWidth(img.width());
+    setHeight(img.height());
+
+    setValid(true);
+}
+
+KisPattern* KisPattern::clone() const
+{
+    KisPattern* pattern = new KisPattern("");
+    pattern->setImage(m_img);
+    pattern->setName(name());
+    return pattern;
+}
+
+#include "kis_pattern.moc"
diff --git a/chalk/core/kis_pattern.h b/chalk/core/kis_pattern.h
new file mode 100644
index 000000000..7d18f1f33
--- /dev/null
+++ b/chalk/core/kis_pattern.h
@@ -0,0 +1,80 @@
+/*
+ *  kis_pattern.h - part of Krayon
+ *
+ *  Copyright (c) 2000 Matthias Elter  <elter@kde.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __kis_pattern_h__
+#define __kis_pattern_h__
+
+#include <kio/job.h>
+
+#include "kis_debug_areas.h"
+#include "kis_resource.h"
+#include "kis_types.h"
+
+class TQPoint;
+class TQImage;
+class KisColorSpace;
+class KisPaintDevice;
+
+class KisPattern : public KisResource {
+    typedef KisResource super;
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+    KisPattern(const TQString& file);
+    KisPattern(KisPaintDevice* image, int x, int y, int w, int h);
+    virtual ~KisPattern();
+
+    virtual bool load();
+    virtual bool save();
+    virtual TQImage img();
+
+    /**
+     * returns a KisPaintDeviceSP made with colorSpace as the ColorSpace strategy
+     * for use in the fill painter.
+     **/
+    KisPaintDeviceSP image(KisColorSpace * colorSpace);
+
+    TQ_INT32 width() const;
+    TQ_INT32 height() const;
+
+    void setImage(const TQImage& img);
+
+    KisPattern* clone() const;
+
+protected:
+    void setWidth(TQ_INT32 w);
+    void setHeight(TQ_INT32 h);
+
+private:
+    bool init();
+
+private:
+    TQByteArray m_data;
+    TQImage m_img;
+    TQMap<TQString, KisPaintDeviceSP> m_colorspaces;
+    bool m_hasFile;
+
+    TQ_INT32 m_width;
+    TQ_INT32 m_height;
+};
+
+#endif
+
diff --git a/chalk/core/kis_perspective_grid.cpp b/chalk/core/kis_perspective_grid.cpp
new file mode 100644
index 000000000..6eb5fbe8d
--- /dev/null
+++ b/chalk/core/kis_perspective_grid.cpp
@@ -0,0 +1,100 @@
+/*
+ * This file is part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_perspective_grid.h"
+
+int KisSubPerspectiveGrid::s_lastIndex = 0;
+
+KisSubPerspectiveGrid::KisSubPerspectiveGrid(KisPerspectiveGridNodeSP topLeft, KisPerspectiveGridNodeSP topRight, KisPerspectiveGridNodeSP bottomRight, KisPerspectiveGridNodeSP bottomLeft) : m_topLeft(topLeft), m_topRight(topRight), m_bottomRight(bottomRight), m_bottomLeft(bottomLeft), m_subdivisions(5), m_leftGrid(0), m_rightGrid(0), m_topGrid(0), m_bottomGrid(0), m_index(++s_lastIndex)
+{
+    
+}
+
+bool KisSubPerspectiveGrid::tqcontains(const KisPoint p) const
+{
+    return true;
+    KisPerspectiveMath::LineEquation d1 = KisPerspectiveMath::computeLineEquation( topLeft(), topRight() );
+    kdDebug() << p.y() << " " << (p.x() * d1.a + d1.b) << endl;
+    if( p.y() >= p.x() * d1.a + d1.b)
+    {
+        d1 = KisPerspectiveMath::computeLineEquation( topRight(), bottomRight() );
+        kdDebug() << p.y() << " " << (p.x() * d1.a + d1.b) << endl;
+        if( p.y() >= p.x() * d1.a + d1.b)
+        {
+            d1 = KisPerspectiveMath::computeLineEquation( bottomRight(), bottomLeft() );
+            kdDebug() << p.y() << " " << (p.x() * d1.a + d1.b) << endl;
+            if( p.y() <= p.x() * d1.a + d1.b)
+            {
+                d1 = KisPerspectiveMath::computeLineEquation( bottomLeft(), topLeft() );
+                kdDebug() << p.y() << " " << (p.x() * d1.a + d1.b) << endl;
+                if( p.y() <= p.x() * d1.a + d1.b)
+                {
+                    return true;
+                }
+            }
+        }
+    }
+    return false;
+}
+
+
+KisPerspectiveGrid::KisPerspectiveGrid()
+{
+}
+
+
+KisPerspectiveGrid::~KisPerspectiveGrid()
+{
+    clearSubGrids( );
+}
+
+bool KisPerspectiveGrid::addNewSubGrid( KisSubPerspectiveGrid* ng )
+{
+    if(hasSubGrids() && !ng->topGrid() && !ng->bottomGrid() && !ng->leftGrid() && !ng->rightGrid() )
+    {
+        kdError() << "sub grids need a neighbourgh if they are not the first grid to be added" << endl;
+        return false;
+    }
+    m_subGrids.push_back(ng);
+    return true;
+}
+
+
+void KisPerspectiveGrid::clearSubGrids( )
+{
+    for( TQValueList<KisSubPerspectiveGrid*>::const_iterator it = begin(); it != end(); ++it)
+    {
+        delete *it;
+    }
+    m_subGrids.clear();
+}
+
+KisSubPerspectiveGrid* KisPerspectiveGrid::gridAt(KisPoint p)
+{
+    for( TQValueList<KisSubPerspectiveGrid*>::const_iterator it = begin(); it != end(); ++it)
+    {
+        if( (*it)->tqcontains(p) )
+        {
+            return *it;
+        }
+    }
+    return 0;
+}
+
diff --git a/chalk/core/kis_perspective_grid.h b/chalk/core/kis_perspective_grid.h
new file mode 100644
index 000000000..4bd228154
--- /dev/null
+++ b/chalk/core/kis_perspective_grid.h
@@ -0,0 +1,107 @@
+/*
+ * This file is part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_PERSPECTIVE_GRID_H
+#define KIS_PERSPECTIVE_GRID_H
+
+#include <tqvaluelist.h>
+
+#include <kis_perspective_math.h>
+#include <kis_point.h>
+#include <ksharedptr.h>
+
+class KisPerspectiveGridNode : public KisPoint, public KShared {
+    public:
+        inline KisPerspectiveGridNode(double x, double y) : KisPoint(x,y)  { }
+        inline KisPerspectiveGridNode(KisPoint p) : KisPoint(p)  { }
+};
+typedef KSharedPtr<KisPerspectiveGridNode> KisPerspectiveGridNodeSP;
+
+class KisSubPerspectiveGrid {
+    public:
+        KisSubPerspectiveGrid(KisPerspectiveGridNodeSP topLeft, KisPerspectiveGridNodeSP topRight, KisPerspectiveGridNodeSP bottomRight, KisPerspectiveGridNodeSP bottomLeft);
+        
+        inline KisPoint topBottomVanishingPoint() { return computeVanishingPoint( topLeft(), topRight(), bottomLeft(), bottomRight() ); };
+        inline KisPoint leftRightVanishingPoint() { return computeVanishingPoint( topLeft(), bottomLeft(), topRight(), bottomRight() ); };
+        
+        inline KisSubPerspectiveGrid* leftGrid() { return m_leftGrid; }
+        inline void setLeftGrid(KisSubPerspectiveGrid* g) { Q_ASSERT(m_leftGrid==0); m_leftGrid = g; }
+        inline KisSubPerspectiveGrid* rightGrid() { return m_rightGrid; }
+        inline void setRightGrid(KisSubPerspectiveGrid* g) { Q_ASSERT(m_rightGrid==0); m_rightGrid = g; }
+        inline KisSubPerspectiveGrid* topGrid() { return m_topGrid; }
+        inline void setTopGrid(KisSubPerspectiveGrid* g) { Q_ASSERT(m_topGrid==0); m_topGrid = g; }
+        inline KisSubPerspectiveGrid* bottomGrid() { return m_bottomGrid; }
+        inline void setBottomGrid(KisSubPerspectiveGrid* g) { Q_ASSERT(m_bottomGrid==0); m_bottomGrid = g; }
+        inline const KisPerspectiveGridNodeSP topLeft() const { return m_topLeft; }
+        inline KisPerspectiveGridNodeSP topLeft() { return m_topLeft; }
+        inline const KisPerspectiveGridNodeSP topRight() const { return m_topRight; }
+        inline KisPerspectiveGridNodeSP topRight() { return m_topRight; }
+        inline const KisPerspectiveGridNodeSP bottomLeft() const { return m_bottomLeft; }
+        inline KisPerspectiveGridNodeSP bottomLeft() { return m_bottomLeft; }
+        inline const KisPerspectiveGridNodeSP bottomRight() const { return m_bottomRight; }
+        inline KisPerspectiveGridNodeSP bottomRight() { return m_bottomRight; }
+        inline int subdivisions() const { return m_subdivisions; }
+        /**
+         * Return the index of the subgrid, the value is automaticaly set when the KisSubPerspectiveGrid, it is usefull for
+         * drawing the perspective grid, to avoid drawing twice the same border, or points
+         */
+        inline int index() const { return m_index; }
+
+        /**
+         * @return true if the point p is contain by the grid
+         */
+        bool tqcontains(const KisPoint p) const;
+    private:
+        inline KisPoint computeVanishingPoint(KisPerspectiveGridNodeSP p11, KisPerspectiveGridNodeSP p12, KisPerspectiveGridNodeSP p21, KisPerspectiveGridNodeSP p22)
+        {
+            KisPerspectiveMath::LineEquation d1 = KisPerspectiveMath::computeLineEquation( p11, p12 );
+            KisPerspectiveMath::LineEquation d2 = KisPerspectiveMath::computeLineEquation( p21, p22 );
+            return KisPerspectiveMath::computeIntersection(d1,d2);
+        }
+    private:
+        KisPerspectiveGridNodeSP m_topLeft, m_topRight, m_bottomLeft, m_bottomRight;
+        KisSubPerspectiveGrid *m_leftGrid, *m_rightGrid, *m_topGrid, *m_bottomGrid;
+        int m_subdivisions;
+        int m_index;
+        static int s_lastIndex;
+};
+
+class KisPerspectiveGrid {
+    public:
+        KisPerspectiveGrid();
+        ~KisPerspectiveGrid();
+        /**
+         * @return false if the grid wasn't added, note that subgrids must be attached to an other grid, except if it's the first grid
+         */
+        bool addNewSubGrid( KisSubPerspectiveGrid* ng );
+        inline TQValueList<KisSubPerspectiveGrid*>::const_iterator begin() const { return m_subGrids.begin(); }
+        inline TQValueList<KisSubPerspectiveGrid*>::const_iterator end() const { return m_subGrids.end(); }
+        inline bool hasSubGrids() const { return !m_subGrids.isEmpty(); }
+        void clearSubGrids();
+        inline int countSubGrids() const { return m_subGrids.size(); }
+        /**
+         * @return the first grid hit by the point p
+         */
+        KisSubPerspectiveGrid* gridAt(KisPoint p);
+    private:
+        TQValueList<KisSubPerspectiveGrid*> m_subGrids;
+};
+
+#endif
diff --git a/chalk/core/kis_perspective_math.cpp b/chalk/core/kis_perspective_math.cpp
new file mode 100644
index 000000000..a4e2124e6
--- /dev/null
+++ b/chalk/core/kis_perspective_math.cpp
@@ -0,0 +1,546 @@
+/*
+ * This file is part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_perspective_math.h"
+
+#include <tqrect.h>
+
+#if 1
+
+#include <iostream>
+#include <stdlib.h>
+#include <math.h>
+//#define NDEBUG // uncomment to remove checking of assert()
+#include <assert.h>
+#define DEFAULT_ALLOC 2
+
+namespace math { // TODO: use eigen
+
+template <class ElType> class matrix;
+
+template <class ElType>
+        class vector
+{
+    public:
+        friend class matrix<ElType>;
+        ElType * data;
+        int len;
+        int length()const;
+        vector();
+        vector(int n);
+        ~vector(){ delete [] data;}
+     //Copy operator
+        vector(const vector<ElType>& v) ;
+     //assignment operator
+        vector<ElType>& operator =(const vector<ElType> &original);
+        ElType& operator[](int i)const  ;
+        void zero();
+        vector<ElType> operator+(const vector<ElType>& v);
+        vector<ElType> operator-(const vector<ElType>&v);
+        void  rprint()const;  //print entries on a single line
+        void resize(int n);
+        int operator==(const vector<ElType>& v)const;
+        friend vector<ElType> operator* (ElType c,vector<ElType>& v );
+        friend vector<ElType> operator*(vector<ElType>& v,ElType c );
+        friend std::ostream& operator<<(std::ostream& s,vector<ElType>& v);
+};
+template <class ElType>
+        void vector<ElType>::zero()
+{
+    for(int i=0;i<len;i++) data[i]=(ElType)0;
+}
+template <class ElType>
+        int vector<ElType>::length()const
+{
+    return len;
+}
+template <class ElType>
+        ElType& vector<ElType>::operator[](int i)const
+{
+    assert(i>=0 && i < len);
+    return data[i];
+}
+
+template <class ElType>
+        vector<ElType>::vector()
+{
+    data=new ElType[ DEFAULT_ALLOC];
+    assert(data!=0);
+    len=  DEFAULT_ALLOC;
+}
+template <class ElType>
+        vector<ElType>::vector(int n)
+{
+    data = new ElType[len=n];
+    assert(data!=0);
+}
+template <class ElType>
+        vector<ElType>::vector(const vector<ElType>& v)
+{
+    data=new ElType[len=v.len];
+    assert(data!=0);
+    for(int i=0;i<len;i++) data[i]=v.data[i];
+}
+template <class ElType>
+        vector<ElType>& vector<ElType>::operator =(const vector<ElType> &original)
+{
+    if(this != &original)
+    {
+        delete [] data;
+        data= new ElType[len=original.len];
+        assert(data!=0);
+        for(int i=0;i<len;i++) data[i]=original.data[i];
+    }
+    return *this;
+}
+template <class ElType>
+        vector<ElType> vector<ElType>::operator+(const vector<ElType>& v)
+{
+    vector<ElType> sum(len);
+    for(int i=0;i<len;i++) sum[i] = data[i]+v.data[i];
+    return sum;
+
+}
+template <class ElType>
+        vector<ElType> vector<ElType>::operator-(const vector<ElType>& v)
+{
+    vector<ElType> sum(len);
+    for(int i=0;i<len;i++) sum[i] = data[i]-v.data[i];
+    return sum;
+}
+template <class ElType>
+        void  vector<ElType>::rprint()const  //print entries on a single line
+{
+    int i;
+    std::cout << "VECTOR: ";
+    std::cout << "(";
+    for(i=0;i<len-1;i++) std::cout << data[i] << ",";
+    std::cout << data[len-1] << ")" << std::endl;
+    return;
+}
+template <class ElType>
+        void vector<ElType>::resize(int n)
+{
+    delete[]data;
+    data = new ElType[len=n];
+    assert(data !=0);
+}
+template <class ElType>
+        int vector<ElType>::operator==(const vector<ElType>& v)const
+{
+    if(len != v.len) return 0;
+    for(int i=0;i<len;i++) if(data[i]!=v.data[i]) return 0;
+    return 1;
+}
+template <class ElType>
+        vector<ElType> operator*(ElType c,vector<ElType>& v )
+{
+    vector<ElType> ans(v.len);
+    for(int i=0;i<v.len;i++) ans[i]=c*v[i];
+    return ans;
+}
+template <class ElType>
+        vector<ElType> operator*(vector<ElType>& v,ElType c )
+{
+    vector<ElType> ans(v.len);
+    for(int i=0;i<v.len;i++) ans[i]=c*v[i];
+    return ans;
+}
+template <class ElType>
+        std::ostream& operator<<(std::ostream& s,vector<ElType>& v)
+{
+    s << "(";
+    for(int i=0;i<v.len-1;i++) s << v.data[i] << ", ";
+    s << v.data[v.len-1]<<")"<<endl;
+    return s;
+}
+
+template <class ElType>
+        class matrix
+{
+    public:
+        vector<ElType> *m;
+        int rows,cols;
+        matrix();
+        matrix( int r, int c);
+        matrix(const matrix<ElType> &s);
+        ~matrix();
+        matrix& operator =(const matrix<ElType>& s);
+        vector<ElType>& operator[](const int i);
+        vector<ElType> operator*(const vector<ElType>&);
+        friend matrix<ElType>  operator*(const ElType&, const matrix<ElType>&);
+        friend matrix<ElType> operator*(const matrix<ElType>&, const ElType&);
+        matrix<ElType> operator*(const matrix<ElType>& a);
+        matrix<ElType> operator+(const matrix<ElType>& a);
+        matrix<ElType> operator-(const matrix<ElType>& a);
+        matrix<ElType> transpose();
+    //matrix<ElType> inverse();
+        friend std::ostream& operator<<(std::ostream& s,matrix<ElType>& m);
+        friend void ludcmp(matrix<ElType>& a,vector<int>& indx,double &d);
+        friend void lubksb(matrix<ElType>&a,vector<int>& indx,vector<ElType>&b);
+};
+template <class ElType>
+        matrix<ElType>::matrix()
+{
+    m = new vector<ElType>[DEFAULT_ALLOC];
+    assert(m !=0);
+    rows=cols=DEFAULT_ALLOC;
+    for(int i=0;i<rows;i++)
+    {
+        vector<ElType> v;
+        m[i]= v;
+    }
+}
+
+template <class ElType>
+        matrix<ElType>::matrix(int r, int c)
+{
+    m= new vector<ElType>[r];
+    assert(m != 0);
+    rows=r;
+    cols=c;
+    for(int i=0;i<r;i++)
+    {
+        vector<ElType> v(cols);
+        m[i]=v;
+    }
+}
+template <class ElType>
+        matrix<ElType>::matrix(const matrix<ElType> &s)
+{
+    int i;
+    rows=s.rows;
+    m = new vector<ElType>[rows];
+    assert(m!=0);
+    cols =s.cols;
+    for(i=0;i<rows;i++)
+    {
+        m[i]=s.m[i];
+    }
+}
+template <class ElType>
+        matrix<ElType>::~matrix()
+{
+    delete [] m;
+}
+
+template <class ElType>
+        matrix<ElType>& matrix<ElType>::operator =(const matrix<ElType> &s)
+{
+    if(this != &s)
+    {
+        delete []m;
+        rows= s.rows;
+        cols=s.cols;
+        m = new vector<ElType>[rows];
+        assert(m !=0);
+        for(int i=0;i<rows;i++) m[i]=s.m[i];
+    }
+    return *this;
+}
+template <class ElType>
+        vector<ElType>& matrix<ElType>::operator[](const int i)
+{
+    assert(i>=0 && i < rows);
+    return m[i];
+}
+template <class ElType>
+        vector<ElType> matrix<ElType>::operator*(const vector<ElType>& v)
+{
+    int i,j;
+    assert(cols == v.len);
+    vector<ElType> ans(rows);
+    for(i=0;i<rows;i++)
+    {
+        ans.data[i]=0.0;
+        for(j=0;j<cols;j++) ans.data[i] += m[i][j]*v.data[j];
+    }
+    return ans;
+}
+template <class ElType>
+        matrix<ElType> operator*(const ElType& x,const matrix<ElType>& s)
+{
+    matrix<ElType> ans(s.rows,s.cols);
+    for(int i=0;i<ans.rows;i++)
+    {
+        ans.m[i]= x*s.m[i];
+    }
+    return ans;
+}
+template <class ElType>
+        matrix<ElType> matrix<ElType>::transpose()
+{
+    matrix<ElType> ans(cols,rows);
+    for(int i=0;i<rows;i++)
+    {
+        for(int j=0;j<cols;j++) ans[j][i]=m[i][j];
+    }
+    return ans;
+}
+template <class ElType>
+        matrix<ElType> operator*(const matrix<ElType>& s,const ElType& x)
+{
+    matrix<ElType> ans(s.rows,s.cols);
+    for(int i=0;i<ans.rows;i++)
+    {
+        ans.m[i]= x*s.m[i];
+    }
+    return ans;
+}
+template <class ElType>
+        matrix<ElType>  matrix<ElType> ::operator*(const matrix<ElType>&  a)
+{
+
+    assert(cols == a.rows);
+
+    matrix<ElType>  ans(rows,a.cols);
+    for(int i=0;i<rows;i++)
+    {
+        for(int j=0;j<a.cols;j++)
+        {
+            ans.m[i][j]=0.0;
+            for(int k=0;k<cols;k++)
+            {
+                ans.m[i][j] += m[i][k]*a.m[k][j];
+            }
+        }
+    }
+    return ans;
+}
+template <class ElType>
+        matrix<ElType>  matrix<ElType> ::operator+(const matrix<ElType> & a)
+{
+    int i,j;
+
+    assert(rows== a.rows);
+    assert(cols== a.cols);
+
+    matrix<ElType>  ans(a.rows,a.cols);
+    for(i=0;i<a.rows;i++)
+    {
+        for(j=0;j<a.cols;j++)
+        {
+            ans.m[i][j] = m[i][j] + a.m[i][j];  //faster than assigning vectors?
+        }
+    }
+    return ans;
+}
+template <class ElType>
+        matrix<ElType> matrix<ElType>::operator-(const matrix<ElType>& a)
+{
+    int i,j;
+    assert(rows == a.rows);
+    assert(cols == a.cols);
+    matrix ans(rows,cols);
+    for(i=0;i<rows;i++)
+    {
+        for(j=0;j<cols;j++)
+            ans.m[i][j] = m[i][j] - a.m[i][j];
+    }
+    return ans;
+}
+template <class ElType>
+        std::ostream& operator<<(std::ostream& s,matrix<ElType>& m)
+{
+    for(int i=0; i<m.rows;i++) s << m[i];
+    return s;
+}
+
+#define TINY 1.0e-20;
+//we assume fabs(ElType) is defined
+//assignment of doubles to ElType is defined
+template <class ElType>
+void ludcmp(matrix<ElType>& a, vector<int>& indx,double& d)
+{
+    int i,imax,j,k;
+    ElType  big,dum,sum,temp;
+    int n=a.rows;
+    vector<ElType> vv(n);
+    assert(a.rows == a.cols);
+    d=1.0;
+    for (i=0;i<n;i++)
+    {
+        big=0.0;
+//         kdDebug() << "new search" << endl;
+        for (j=0;j<n;j++) { if ((temp=fabs(a[i][j])) > big) big=temp;
+/*            kdDebug() << temp << " " << fabs(a[i][j]) << " "<< big <<endl; */}
+            if (big == 0.0) { std::cerr << "Singular matrix in routine LUDCMP" << std::endl; big = TINY;}
+            vv[i]=1.0/big;
+    }
+    for (j=0;j<n;j++)
+    {
+        for (i=0;i<j;i++)
+        {
+            sum=a[i][j];
+            for (k=0;k<i;k++) sum -= a[i][k]*a[k][j];
+            a[i][j]=sum;
+        }
+        big=0.0;
+        for (i=j;i<n;i++)
+        {
+            sum=a[i][j];
+            for (k=0;k<j;k++) sum -= a[i][k]*a[k][j];
+            a[i][j]=sum;
+            if ( (dum=vv[i]*fabs(sum)) >= big)
+            {
+                big=dum;
+                imax=i;
+            }
+        }
+        if (j != imax)
+        {
+            for (k=0;k<n;k++)
+            {
+                dum=a[imax][k];
+                a[imax][k]=a[j][k];
+                a[j][k]=dum;
+            }
+            d = -(d);
+            vv[imax]=vv[j];
+        }
+        indx[j]=imax;
+        if (a[j][j] == 0.0) a[j][j]=TINY;
+        if (j != n-1) {
+            dum=1.0/(a[j][j]);
+            for (i=j+1;i<n;i++) a[i][j] *= dum;
+        }
+    }
+}
+#undef TINY
+template <class ElType>
+void lubksb(matrix<ElType>& a,vector<int>& indx,vector<ElType>& b)
+{
+    int i,ip,j;
+    ElType sum;
+    int n=a.rows;
+    for (i=0;i<n;i++)
+    {
+        ip=indx[i];
+        sum=b[ip];
+        b[ip]=b[i];
+        for (j=0;j<=i-1;j++) sum -= a[i][j]*b[j];
+        b[i]=sum;
+    }
+    for (i=n-1;i>=0;i--)
+    {
+        sum=b[i];
+        for (j=i+1;j<n;j++) sum -= a[i][j]*b[j];
+        b[i]=sum/a[i][i];
+    }
+}
+
+
+
+}
+#endif
+
+double* KisPerspectiveMath::computeMatrixTransfo( const KisPoint& topLeft1, const KisPoint& topRight1, const KisPoint& bottomLeft1, const KisPoint& bottomRight1 , const KisPoint& topLeft2, const KisPoint& topRight2, const KisPoint& bottomLeft2, const KisPoint& bottomRight2)
+{
+    double* matrix = new double[9];
+
+    math::matrix<double> a(10,10);
+    math::vector<double> b(10);
+    math::vector<int> indx(10);
+    double d = 0.;
+    for(int i = 0; i <= 9; i++)
+    {
+        for(int j = 0; j <= 9; j++)
+        {
+            a[i][j] = 0.;
+        }
+        b[i] = 0.;
+        indx[i] = 0;
+    }
+
+        // topLeft
+    a[0][0] = topLeft1.x();
+    a[0][1] = topLeft1.y();
+    a[0][2] = 1;
+    a[0][6] = -topLeft2.x() * topLeft1.x();
+    a[0][7] = -topLeft2.x() * topLeft1.y();
+    a[0][8] = -topLeft2.x();
+    a[1][3] = topLeft1.x();
+    a[1][4] = topLeft1.y();
+    a[1][5] = 1;
+    a[1][6] = -topLeft2.y() * topLeft1.x();
+    a[1][7] = -topLeft2.y() * topLeft1.y();
+    a[1][8] = -topLeft2.y();
+        // topRight
+    a[2][0] = topRight1.x();
+    a[2][1] = topRight1.y();
+    a[2][2] = 1;
+    a[2][6] = -topRight2.x() * topRight1.x();
+    a[2][7] = -topRight2.x() * topRight1.y();
+    a[2][8] = -topRight2.x();
+    a[3][3] = topRight1.x();
+    a[3][4] = topRight1.y();
+    a[3][5] = 1;
+    a[3][6] = -topRight2.y() * topRight1.x();
+    a[3][7] = -topRight2.y() * topRight1.y();
+    a[3][8] = -topRight2.y();
+        // bottomLeft1
+    a[4][0] = bottomLeft1.x();
+    a[4][1] = bottomLeft1.y();
+    a[4][2] = 1;
+    a[4][6] = -bottomLeft2.x() * bottomLeft1.x();
+    a[4][7] = -bottomLeft2.x() * bottomLeft1.y();
+    a[4][8] = -bottomLeft2.x();
+    a[5][3] = bottomLeft1.x();
+    a[5][4] = bottomLeft1.y();
+    a[5][5] = 1;
+    a[5][6] = -bottomLeft2.y() * bottomLeft1.x();
+    a[5][7] = -bottomLeft2.y() * bottomLeft1.y();
+    a[5][8] = -bottomLeft2.y();
+        // bottomRight
+    a[6][0] = bottomRight1.x();
+    a[6][1] = bottomRight1.y();
+    a[6][2] = 1;
+    a[6][6] = -bottomRight2.x() * bottomRight1.x();
+    a[6][7] = -bottomRight2.x() * bottomRight1.y();
+    a[6][8] = -bottomRight2.x();
+    a[7][3] = bottomRight1.x();
+    a[7][4] = bottomRight1.y();
+    a[7][5] = 1;
+    a[7][6] = -bottomRight2.y() * bottomRight1.x();
+    a[7][7] = -bottomRight2.y() * bottomRight1.y();
+    a[7][8] = -bottomRight2.y();
+    a[8][8] = 1;
+    b[8] = 1;
+//     kdDebug() << " a := { { " << a[0][0] << " , " << a[0][1] << " , " << a[0][2] << " , " << a[0][3] << " , " << a[0][4] << " , " << a[0][5] << " , " << a[0][6] << " , " << a[0][7] << " , " << a[0][8] << " } , { " << a[1][0] << " , " << a[1][1] << " , " << a[1][2] << " , " << a[1][3] << " , " << a[1][4] << " , " << a[1][5] << " , " << a[1][6] << " , " << a[1][7] << " , " << a[1][8] << " } , { " << a[2][0] << " , " << a[2][1] << " , " << a[2][2] << " , " << a[2][3] << " , " << a[2][4] << " , " << a[2][5] << " , " << a[2][6] << " , " << a[2][7] << " , " << a[2][8] << " } , { " << a[3][0] << " , " << a[3][1] << " , " << a[3][2] << " , " << a[3][3] << " , " << a[3][4] << " , " << a[3][5] << " , " << a[3][6] << " , " << a[3][7] << " , " << a[3][8] << " } , { " << a[4][0] << " , " << a[4][1] << " , " << a[4][2] << " , " << a[4][3] << " , " << a[4][4] << " , " << a[4][5] << " , " << a[4][6] << " , " << a[4][7] << " , " << a[4][8] << " } , { " << a[5][0] << " , " << a[5][1] << " , " << a[5][2] << " , " << a[5][3] << " , " << a[5][4] << " , " << a[5][5] << " , " << a[5][6] << " , " << a[5][7] << " , " << a[5][8] << " } , { " << a[6][0] << " , " << a[6][1] << " , " << a[6][2] << " , " << a[6][3] << " , " << a[6][4] << " , " << a[6][5] << " , " << a[6][6] << " , " << a[6][7] << " , " << a[6][8] << " } , { "<< a[7][0] << " , " << a[7][1] << " , " << a[7][2] << " , " << a[7][3] << " , " << a[7][4] << " , " << a[7][5] << " , " << a[7][6] << " , " << a[7][7] << " , " << a[7][8] << " } , { "<< a[8][0] << " , " << a[8][1] << " , " << a[8][2] << " , " << a[8][3] << " , " << a[8][4] << " , " << a[8][5] << " , " << a[8][6] << " , " << a[8][7] << " , " << a[8][8] << " } }; " << endl;
+    math::ludcmp<double>(a,indx,d);
+    math::lubksb<double>(a,indx,b);
+
+    for(int i = 0; i < 9; i++)
+    {
+        matrix[i] = b[i];
+    }
+    return matrix;
+}
+
+double* KisPerspectiveMath::computeMatrixTransfoToPerspective(const KisPoint& topLeft, const KisPoint& topRight, const KisPoint& bottomLeft, const KisPoint& bottomRight, const TQRect& r)
+{
+    return KisPerspectiveMath::computeMatrixTransfo(topLeft, topRight, bottomLeft, bottomRight, KisPoint(r.topLeft()), KisPoint(r.topRight()), KisPoint(r.bottomLeft()), KisPoint(r.bottomRight()));
+}
+
+double* KisPerspectiveMath::computeMatrixTransfoFromPerspective(const TQRect& r, const KisPoint& topLeft, const KisPoint& topRight, const KisPoint& bottomLeft, const KisPoint& bottomRight)
+{
+    return KisPerspectiveMath::computeMatrixTransfo(KisPoint(r.topLeft()), KisPoint(r.topRight()), KisPoint(r.bottomLeft()), KisPoint(r.bottomRight()), topLeft, topRight, bottomLeft, bottomRight);
+}
+
diff --git a/chalk/core/kis_perspective_math.h b/chalk/core/kis_perspective_math.h
new file mode 100644
index 000000000..7cb237709
--- /dev/null
+++ b/chalk/core/kis_perspective_math.h
@@ -0,0 +1,70 @@
+/*
+ * This file is part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _KIS_PERSPECTVE_MATH_H_
+#define _KIS_PERSPECTVE_MATH_H_
+
+#include "kis_point.h"
+
+class TQRect;
+
+class KisPerspectiveMath {
+    private:
+        KisPerspectiveMath() { }
+    public:
+        static double* computeMatrixTransfo( const KisPoint& topLeft1, const KisPoint& topRight1, const KisPoint& bottomLeft1, const KisPoint& bottomRight1 , const KisPoint& topLeft2, const KisPoint& topRight2, const KisPoint& bottomLeft2, const KisPoint& bottomRight2);
+      static double* computeMatrixTransfoToPerspective(const KisPoint& topLeft, const KisPoint& topRight, const KisPoint& bottomLeft, const KisPoint& bottomRight, const TQRect& r);
+      static double* computeMatrixTransfoFromPerspective(const TQRect& r, const KisPoint& topLeft, const KisPoint& topRight, const KisPoint& bottomLeft, const KisPoint& bottomRight);
+      struct LineEquation {
+            // y = a*x + b
+      double a, b;
+    };
+    /// TODO: get ride of this in 2.0
+    inline static KisPoint matProd(const double (&m)[3][3], const KisPoint& p)
+    {
+        double s = ( p.x() * m[2][0] + p.y() * m[2][1] + 1.0);
+        s = (s == 0.) ? 1. : 1./s;
+        return KisPoint( (p.x() * m[0][0] + p.y() * m[0][1] + m[0][2] ) * s,
+                         (p.x() * m[1][0] + p.y() * m[1][1] + m[1][2] ) * s );
+    }
+    static inline LineEquation computeLineEquation(const KisPoint* p1, const KisPoint* p2)
+    {
+      LineEquation eq;
+      double x1 = p1->x(); double x2 = p2->x();
+      if( fabs(x1 - x2) < 0.000001 )
+      {
+        x1 += 0.0001; // Introduce a small perturbation
+      }
+      eq.a = (p2->y() - p1->y()) / (double)( x2 - x1 );
+      eq.b = -eq.a * x1 + p1->y();
+      return eq;
+    }
+    static inline KisPoint computeIntersection(const LineEquation& d1, const LineEquation& d2)
+    {
+      double a1 = d1.a; double a2 = d2.a;
+      if( fabs(a1 - a2) < 0.000001 )
+      {
+        a1 += 0.0001; // Introduce a small perturbation
+      }
+      double x = (d1.b - d2.b) / (a2 - a1);
+      return KisPoint(x, a2 * x + d2.b);
+    }
+};
+
+#endif
diff --git a/chalk/core/kis_perspectivetransform_worker.cpp b/chalk/core/kis_perspectivetransform_worker.cpp
new file mode 100644
index 000000000..637a61dee
--- /dev/null
+++ b/chalk/core/kis_perspectivetransform_worker.cpp
@@ -0,0 +1,121 @@
+/*
+ * This file is part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_perspectivetransform_worker.h"
+
+#include "kis_iterators_pixel.h"
+#include "kis_paint_device.h"
+#include "kis_perspective_math.h"
+#include "kis_progress_display_interface.h"
+#include "kis_random_sub_accessor.h"
+#include "kis_selection.h"
+
+KisPerspectiveTransformWorker::KisPerspectiveTransformWorker(KisPaintDeviceSP dev, const KisPoint& topLeft, const KisPoint& topRight, const KisPoint& bottomLeft, const KisPoint& bottomRight, KisProgressDisplayInterface *progress)
+    : KisProgressSubject(), m_dev(dev), m_cancelRequested(false), m_progress(progress)
+
+{
+    TQRect m_r;
+    if(m_dev->hasSelection())
+        m_r = m_dev->selection()->selectedExactRect();
+    else
+        m_r = m_dev->exactBounds();
+/*    if(m_dev->hasSelection())
+        m_dev->selection()->clear();*/
+    kdDebug() << "r = " << m_r << endl;
+
+    double* b = KisPerspectiveMath::computeMatrixTransfoToPerspective(topLeft, topRight, bottomLeft, bottomRight, m_r);
+    for(int i = 0; i < 3; i++)
+    {
+        for(int j = 0; j < 3; j++)
+        {
+            kdDebug() << "sol[" << 3*i+j << "]=" << b[3*i+j] << endl;
+            m_matrix[i][j] = b[3*i+j];
+        }
+    }
+    delete b;
+}
+
+
+KisPerspectiveTransformWorker::~KisPerspectiveTransformWorker()
+{
+}
+
+double norm2(const KisPoint& p)
+{
+    return sqrt(p.x() * p.x() + p.y() * p.y() );
+}
+
+void KisPerspectiveTransformWorker::run()
+{
+    kdDebug() << "r = " << m_r << endl;
+
+    //TODO: understand why my caching of the rect didn't work...
+    if(m_dev->hasSelection())
+    {
+        m_r = m_dev->selection()->selectedExactRect();
+    }
+    else
+    {
+        m_r = m_dev->exactBounds();
+    }
+//    KisColorSpace * cs = m_dev->colorSpace();
+
+    kdDebug() << "r = " << m_r << endl;
+    KisRectIteratorPixel dstIt = m_dev->createRectIterator(m_r.x(), m_r.y(), m_r.width(), m_r.height(), true);
+    KisPaintDeviceSP srcdev = new KisPaintDevice(*m_dev.data());
+    { // ensure that the random sub accessor is deleted first
+        KisRandomSubAccessorPixel srcAcc = srcdev->createRandomSubAccessor();
+        // Initialise progress
+        if(m_progress)
+            m_progress->setSubject(this, true, true);
+        m_lastProgressReport = 0;
+        m_progressStep = 0;
+        m_progressTotalSteps = m_r.width() * m_r.height();
+        //Action
+        while(!dstIt.isDone())
+        {
+            if(dstIt.isSelected())
+            {
+                KisPoint p;
+                double sf = ( dstIt.x() * m_matrix[2][0] + dstIt.y() * m_matrix[2][1] + 1.0);
+                sf = (sf == 0.) ? 1. : 1./sf;
+                p.setX( ( dstIt.x() * m_matrix[0][0] + dstIt.y() * m_matrix[0][1] + m_matrix[0][2] ) * sf );
+                p.setY( ( dstIt.x() * m_matrix[1][0] + dstIt.y() * m_matrix[1][1] + m_matrix[1][2] ) * sf );
+
+                srcAcc.moveTo( p );
+                srcAcc.sampledOldRawData( dstIt.rawData() );
+
+                // TODO: Should set alpha = alpha*(1-selectedness)
+//                 cs->setAlpha( dstIt.rawData(), 255, 1);
+            } else {
+//                 cs->setAlpha( dstIt.rawData(), 0, 1);
+            }
+            m_progressStep ++;
+            if(m_lastProgressReport != (m_progressStep * 100) / m_progressTotalSteps)
+            {
+                m_lastProgressReport = (m_progressStep * 100) / m_progressTotalSteps;
+                emit notifyProgress(m_lastProgressReport);
+            }
+            if (m_cancelRequested) {
+                break;
+            }
+            ++dstIt;
+        }
+    }
+}
diff --git a/chalk/core/kis_perspectivetransform_worker.h b/chalk/core/kis_perspectivetransform_worker.h
new file mode 100644
index 000000000..f81515cf0
--- /dev/null
+++ b/chalk/core/kis_perspectivetransform_worker.h
@@ -0,0 +1,52 @@
+/*
+ * This file is part of Chalk
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_PERSPECTIVETRANSFORM_WORKER_H
+#define KIS_PERSPECTIVETRANSFORM_WORKER_H
+
+#include "kis_types.h"
+#include "kis_progress_subject.h"
+
+class KisPoint;
+class KisProgressDisplayInterface;
+
+class KisPerspectiveTransformWorker : public KisProgressSubject
+{
+    public:
+        KisPerspectiveTransformWorker(KisPaintDeviceSP dev, const KisPoint& topLeft, const KisPoint& topRight, const KisPoint& bottomLeft, const KisPoint& bottomRight, KisProgressDisplayInterface *progress);
+    
+        ~KisPerspectiveTransformWorker();
+        
+        void run();
+        bool isCanceled() { return m_cancelRequested; };
+    private:
+        virtual void cancel() { m_cancelRequested = true; }
+    private:
+        TQ_INT32 m_progressTotalSteps;
+        TQ_INT32 m_lastProgressReport;
+        TQ_INT32 m_progressStep;
+        double m_xcenter, m_ycenter, m_p, m_q;
+        KisPaintDeviceSP m_dev;
+        bool m_cancelRequested;
+        KisProgressDisplayInterface *m_progress;
+        double m_matrix[3][3];
+        TQRect m_r;
+};
+
+#endif
diff --git a/chalk/core/kis_point.h b/chalk/core/kis_point.h
new file mode 100644
index 000000000..3c576cb55
--- /dev/null
+++ b/chalk/core/kis_point.h
@@ -0,0 +1,48 @@
+/*
+ *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_POINT_H_
+#define KIS_POINT_H_
+
+#include <tqvaluevector.h>
+#include <KoPoint.h>
+
+/**
+ * A double-based point class that can return it's coordinates
+ * approximated to integers.
+ */
+class KisPoint : public KoPoint {
+    typedef KoPoint super;
+public:
+    KisPoint() {}
+    KisPoint(double x, double y) : super(x, y) {}
+    KisPoint(const TQPoint& pt) : super(pt) {}
+    KisPoint(const KoPoint& pt) : super(pt) {}
+
+    int floorX() const { return static_cast<int>(x()); }
+    int floorY() const { return static_cast<int>(y()); }
+    int roundX() const { return tqRound(x()); }
+    int roundY() const { return tqRound(y()); }
+
+    TQPoint floorTQPoint() const { return TQPoint(static_cast<int>(x()), static_cast<int>(y())); }
+    TQPoint roundTQPoint() const { return TQPoint(tqRound(x()), tqRound(y())); }
+};
+
+typedef TQValueVector<KisPoint> vKisPoint;
+
+#endif // KIS_POINT_H_
+
diff --git a/chalk/core/kis_random_accessor.cpp b/chalk/core/kis_random_accessor.cpp
new file mode 100644
index 000000000..cfa8ecabe
--- /dev/null
+++ b/chalk/core/kis_random_accessor.cpp
@@ -0,0 +1,58 @@
+/*
+ * This file is part of the Chalk project
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_random_accessor.h"
+
+#include "kis_tiled_random_accessor.h"
+
+KisRandomAccessor::KisRandomAccessor(KisTiledDataManager *ktm, TQ_INT32 x, TQ_INT32 y, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable) : m_offsetx(offsetx), m_offsety(offsety)
+{
+    m_accessor = new KisTiledRandomAccessor(ktm, x, y, writable);
+}
+
+KisRandomAccessor::KisRandomAccessor(const KisRandomAccessor& rhs) {
+    m_accessor = rhs.m_accessor;
+}
+
+KisRandomAccessor::~KisRandomAccessor()
+{
+    
+}
+
+void KisRandomAccessor::moveTo(TQ_INT32 x, TQ_INT32 y)
+{
+    m_accessor->moveTo(x - m_offsetx, y  - m_offsety);
+}
+
+TQ_UINT8* KisRandomAccessor::rawData() const
+{
+    return m_accessor->rawData();
+}
+
+const TQ_UINT8* KisRandomAccessor::oldRawData() const
+{
+    return m_accessor->oldRawData();
+}
+
+KisRandomAccessorPixel::KisRandomAccessorPixel(KisTiledDataManager *ktm, KisTiledDataManager *ktmselect, TQ_INT32 x, TQ_INT32 y, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable) :
+        KisRandomAccessor( ktm, x, y, offsetx, offsety, writable),
+        KisRandomAccessorPixelTrait( this, (ktmselect) ? new KisRandomAccessor(ktm, x, y, offsetx, offsety, false) : 0 )
+{
+    
+}
diff --git a/chalk/core/kis_random_accessor.h b/chalk/core/kis_random_accessor.h
new file mode 100644
index 000000000..6e2e10ad9
--- /dev/null
+++ b/chalk/core/kis_random_accessor.h
@@ -0,0 +1,95 @@
+/*
+ * This file is part of the Chalk project
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_RANDOM_ACCESSOR_H
+#define KIS_RANDOM_ACCESSOR_H
+
+#include <ksharedptr.h>
+
+#include <kis_global.h>
+
+class KisTiledRandomAccessor;
+typedef KSharedPtr<KisTiledRandomAccessor> KisTiledRandomAccessorSP;
+
+class KisTiledDataManager;
+
+class KisRandomAccessor{
+    public:
+        KisRandomAccessor(KisTiledDataManager *ktm, TQ_INT32 x, TQ_INT32 y, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable);
+        KisRandomAccessor(const KisRandomAccessor& rhs);
+        ~KisRandomAccessor();
+    public:
+        /// Move to a given x,y position, fetch tiles and data
+        void moveTo(TQ_INT32 x, TQ_INT32 y);
+        TQ_UINT8* rawData() const;
+        const TQ_UINT8* oldRawData() const;
+    private:
+        KisTiledRandomAccessorSP m_accessor;
+        TQ_INT32 m_offsetx, m_offsety;
+};
+
+class KisRandomAccessorPixelTrait {
+    public:
+        inline KisRandomAccessorPixelTrait(KisRandomAccessor* underlyingAccessor, KisRandomAccessor* selectionAccessor) : m_underlyingAccessor(underlyingAccessor), m_selectionAccessor(selectionAccessor)
+        {
+        }
+	~KisRandomAccessorPixelTrait() {
+		if(m_selectionAccessor)
+			delete m_selectionAccessor;
+	}
+        inline bool isSelected() const
+        {
+            return (m_selectionAccessor) ? *(m_selectionAccessor->rawData()) > SELECTION_THRESHOLD : true;
+        };
+        inline TQ_UINT8 operator[](int index) const
+        { return m_underlyingAccessor->rawData()[index]; };
+        /**
+         * Returns the degree of selectedness of the pixel.
+         */
+        inline TQ_UINT8 selectedness() const
+        {
+            return (m_selectionAccessor) ? *(m_selectionAccessor->rawData()) : MAX_SELECTED;
+        };
+
+        /**
+         * Returns the selectiontqmask from the current point; this is guaranteed
+         * to have the same number of consecutive pixels that the iterator has
+         * at a given point. It return a 0 if there is no selection.
+         */
+        inline TQ_UINT8 * selectionMask() const
+        {
+            return ( m_selectionAccessor ) ? m_selectionAccessor->rawData() : 0;
+        }
+
+        inline void moveTo(TQ_INT32 x, TQ_INT32 y) { if(m_selectionAccessor) m_selectionAccessor->moveTo(x,y); }
+        
+    private:
+        KisRandomAccessor* m_underlyingAccessor;
+        KisRandomAccessor* m_selectionAccessor;
+};
+
+class KisRandomAccessorPixel : public KisRandomAccessor, public KisRandomAccessorPixelTrait {
+    public:
+        KisRandomAccessorPixel(KisTiledDataManager *ktm, KisTiledDataManager *ktmselect, TQ_INT32 x, TQ_INT32 y, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable);
+    public:
+        inline void moveTo(TQ_INT32 x, TQ_INT32 y) { KisRandomAccessor::moveTo(x,y); KisRandomAccessorPixelTrait::moveTo(x,y); }
+};
+
+
+#endif
diff --git a/chalk/core/kis_random_sub_accessor.cpp b/chalk/core/kis_random_sub_accessor.cpp
new file mode 100644
index 000000000..a1ce8aa45
--- /dev/null
+++ b/chalk/core/kis_random_sub_accessor.cpp
@@ -0,0 +1,84 @@
+/*
+ *  This file is part of the KDE project
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include "kis_random_sub_accessor.h"
+
+#include "kis_paint_device.h"
+
+KisRandomSubAccessorPixel::KisRandomSubAccessorPixel(KisPaintDeviceSP device) :
+    m_device(device), m_currentPoint( 0, 0 ), m_randomAccessor(device->createRandomAccessor(0,0, false))
+{
+}
+
+
+KisRandomSubAccessorPixel::~KisRandomSubAccessorPixel()
+{
+}
+
+
+void KisRandomSubAccessorPixel::sampledOldRawData(TQ_UINT8* dst)
+{
+    const TQ_UINT8* pixels[4];
+    TQ_UINT8 weights[4];
+    int x = (int)floor(m_currentPoint.x());
+    int y = (int)floor(m_currentPoint.y());
+    double hsub = m_currentPoint.x() - x;
+    if(hsub < 0.0 ) hsub = 1.0 + hsub;
+    double vsub = m_currentPoint.y() - y;
+    if(vsub < 0.0 ) vsub = 1.0 + vsub;
+    weights[0] = (int)tqRound( ( 1.0 - hsub) * ( 1.0 - vsub) * 255 );
+    m_randomAccessor.moveTo(x, y);
+    pixels[0] = m_randomAccessor.oldRawData();
+    weights[1] = (int)tqRound( ( 1.0 - vsub) * hsub * 255 );
+    m_randomAccessor.moveTo(x+1, y);
+    pixels[1] = m_randomAccessor.oldRawData();
+    weights[2] = (int)tqRound( vsub * ( 1.0 - hsub) * 255 );
+    m_randomAccessor.moveTo(x, y+1);
+    pixels[2] = m_randomAccessor.oldRawData();
+    weights[3] = (int)tqRound( hsub * vsub * 255 );
+    m_randomAccessor.moveTo(x+1, y+1);
+    pixels[3] = m_randomAccessor.oldRawData();
+    m_device->colorSpace()->mixColors(pixels, weights, 4, dst);
+}
+
+void KisRandomSubAccessorPixel::sampledRawData(TQ_UINT8* dst)
+{
+    const TQ_UINT8* pixels[4];
+    TQ_UINT8 weights[4];
+    int x = (int)floor(m_currentPoint.x());
+    int y = (int)floor(m_currentPoint.y());
+    double hsub = m_currentPoint.x() - x;
+    if(hsub < 0.0 ) hsub = 1.0 + hsub;
+    double vsub = m_currentPoint.y() - y;
+    if(vsub < 0.0 ) vsub = 1.0 + vsub;
+    weights[0] = (int)tqRound( ( 1.0 - hsub) * ( 1.0 - vsub) * 255 );
+    m_randomAccessor.moveTo(x, y);
+    pixels[0] = m_randomAccessor.rawData();
+    weights[1] = (int)tqRound( ( 1.0 - vsub) * hsub * 255 );
+    m_randomAccessor.moveTo(x+1, y);
+    pixels[1] = m_randomAccessor.rawData();
+    weights[2] = (int)tqRound( vsub * ( 1.0 - hsub) * 255 );
+    m_randomAccessor.moveTo(x, y+1);
+    pixels[2] = m_randomAccessor.rawData();
+    weights[3] = (int)tqRound( hsub * vsub * 255 );
+    m_randomAccessor.moveTo(x+1, y+1);
+    pixels[3] = m_randomAccessor.rawData();
+    m_device->colorSpace()->mixColors(pixels, weights, 4, dst);
+}
+
diff --git a/chalk/core/kis_random_sub_accessor.h b/chalk/core/kis_random_sub_accessor.h
new file mode 100644
index 000000000..6ceb83458
--- /dev/null
+++ b/chalk/core/kis_random_sub_accessor.h
@@ -0,0 +1,45 @@
+/*
+ *  This file is part of the KDE project
+ *
+ *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KIS_CURVE_ITERATOR_H
+#define KIS_CURVE_ITERATOR_H
+
+#include "kis_point.h"
+#include "kis_random_accessor.h"
+#include "kis_types.h"
+
+class KisRandomSubAccessorPixel{
+    public:
+        KisRandomSubAccessorPixel(KisPaintDeviceSP device);
+        ~KisRandomSubAccessorPixel();
+        /**
+         * Copy the sampled old value to destination
+         */
+        void sampledOldRawData(TQ_UINT8* dst);
+        void sampledRawData(TQ_UINT8* dst);
+        inline void moveTo(double x, double y) { m_currentPoint.setX(x); m_currentPoint.setY(y); }
+        inline void moveTo(const KisPoint& p ) { m_currentPoint = p; }
+    private:
+        KisPaintDeviceSP m_device;
+        int m_position, m_end;
+        KisPoint m_currentPoint;
+        KisRandomAccessorPixel m_randomAccessor;
+};
+
+#endif
diff --git a/chalk/core/kis_rect.cc b/chalk/core/kis_rect.cc
new file mode 100644
index 000000000..175a07a97
--- /dev/null
+++ b/chalk/core/kis_rect.cc
@@ -0,0 +1,28 @@
+/*
+ *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <cmath>
+#include <cfloat>
+
+#include "kis_rect.h"
+
+TQRect KisRect::qRect() const
+{
+    return TQRect(static_cast<int>(floor(left())), static_cast<int>(floor(top())), static_cast<int>(ceil(right()) - floor(left())), static_cast<int>(ceil(bottom()) - floor(top())));
+}
+
diff --git a/chalk/core/kis_rect.h b/chalk/core/kis_rect.h
new file mode 100644
index 000000000..30a729c81
--- /dev/null
+++ b/chalk/core/kis_rect.h
@@ -0,0 +1,50 @@
+/*
+ *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_RECT_H_
+#define KIS_RECT_H_
+
+#include <tqrect.h>
+#include <KoRect.h>
+#include "kis_point.h"
+
+/**
+ * A double-based rect class that can return a TQRect that encloses the KisRect.
+ */
+class KisRect : public KoRect
+{
+    typedef KoRect super;
+public:
+    KisRect() {}
+    KisRect(double x, double y, double w, double h) : super(x, y, w, h) {}
+    KisRect(const KisPoint& topLeft, const KisPoint& bottomRight) : super(topLeft, bottomRight) {}
+    KisRect(const TQRect& qr) : super(qr.x(), qr.y(), qr.width(), qr.height()) {}
+    KisRect(const KoRect& r) : super(r) {}
+
+    /**
+     * Return the TQRect that encloses this KisRect.
+     */
+    TQRect qRect() const;
+
+private:
+    // Use qRect() which uses ceil() and floor() to return a rectangle 
+    // 'enclosing' the rectangle, whereas toTQRect rounds the points.
+    TQRect toTQRect() const;
+};
+
+#endif // KIS_RECT_H_
+
diff --git a/chalk/core/kis_resource.cc b/chalk/core/kis_resource.cc
new file mode 100644
index 000000000..a856cbb12
--- /dev/null
+++ b/chalk/core/kis_resource.cc
@@ -0,0 +1,62 @@
+/*
+ *  Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kis_resource.h"
+#include "kis_global.h"
+
+KisResource::KisResource(const TQString& filename)
+{
+    m_filename = filename;
+    m_valid = false;
+}
+
+KisResource::~KisResource()
+{
+}
+
+TQString KisResource::filename() const
+{
+    return m_filename;
+}
+
+void KisResource::setFilename(const TQString& filename)
+{
+    m_filename = filename;
+}
+
+TQString KisResource::name() const
+{
+    return m_name;
+}
+
+void KisResource::setName(const TQString& name)
+{
+    m_name = name;
+}
+
+bool KisResource::valid() const
+{
+    return m_valid;
+}
+
+void KisResource::setValid(bool valid)
+{
+    m_valid = valid;
+}
+
+#include "kis_resource.moc"
+
diff --git a/chalk/core/kis_resource.h b/chalk/core/kis_resource.h
new file mode 100644
index 000000000..e07763e36
--- /dev/null
+++ b/chalk/core/kis_resource.h
@@ -0,0 +1,84 @@
+/*
+ *  Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_RESOURCE_H_
+#define KIS_RESOURCE_H_
+
+#include <tqimage.h>
+#include <tqobject.h>
+#include <tqstring.h>
+
+
+/**
+ * The KisResource class provides a representation of Chalk image resources.  This
+ * includes, but not limited to, brushes and patterns.
+ *
+ * This replaces the KisKrayon facility that used to be present in Krayon.
+ */
+class KisResource : public TQObject {
+    typedef TQObject super;
+    Q_OBJECT
+  TQ_OBJECT
+
+public:
+
+    /**
+     * Creates a new KisResource object using @p filename.  No file is opened
+     * in the constructor, you have to call load.
+     *
+     * @param filename the file name to save and load from.
+     */
+    KisResource(const TQString& filename);
+    virtual ~KisResource();
+
+public:
+    /**
+     * Load this resource.
+     */
+    virtual bool load() = 0;
+
+    /**
+     * Save this resource asynchronously.  The signal saveComplete is emitted when
+     * the resource has been saved.
+     */
+    virtual bool save() = 0;
+
+    /**
+     * Returns a TQImage representing this resource.  This image could be null.
+     */
+    virtual TQImage img() = 0;
+
+public:
+    TQString filename() const;
+    void setFilename(const TQString& filename);
+    TQString name() const;
+    void setName(const TQString& name);
+    bool valid() const;
+    void setValid(bool valid);
+
+private:
+    KisResource(const KisResource&);
+    KisResource& operator=(const KisResource&);
+
+private:
+    TQString m_name;
+    TQString m_filename;
+    bool m_valid;
+};
+
+#endif // KIS_RESOURCE_H_
+
diff --git a/chalk/core/kis_rotate_visitor.cc b/chalk/core/kis_rotate_visitor.cc
new file mode 100644
index 000000000..2a8bfd45b
--- /dev/null
+++ b/chalk/core/kis_rotate_visitor.cc
@@ -0,0 +1,406 @@
+/*
+ *  Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <math.h>
+#include <tqapplication.h>
+#include <tqwmatrix.h>
+#include <tqrect.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_paint_device.h"
+#include "kis_rotate_visitor.h"
+#include "kis_progress_display_interface.h"
+#include "kis_iterators_pixel.h"
+#include "kis_selection.h"
+#include "kis_painter.h"
+
+void KisRotateVisitor::rotate(double angle, bool rotateAboutImageCentre, KisProgressDisplayInterface *progress)
+{
+    KisPoint centreOfRotation;
+
+    if (rotateAboutImageCentre) {
+        centreOfRotation = KisPoint(m_dev->image()->width() / 2.0,  m_dev->image()->height() / 2.0);
+    } else {
+        TQRect r = m_dev->exactBounds();
+        centreOfRotation = KisPoint(r.x() + (r.width() / 2.0), r.y() + (r.height() / 2.0));
+    }
+
+    m_progress = progress;
+
+    KisPaintDeviceSP rotated = rotate(m_dev, angle, centreOfRotation);
+
+    if (!m_dev->hasSelection()) {
+        // Clear everything
+        m_dev->clear();
+    } else {
+        // Clear selected pixels
+        m_dev->clearSelection();
+    }
+
+    KisPainter p(m_dev);
+    TQRect r = rotated->extent();
+
+    // OVER ipv COPY
+    p.bitBlt(r.x(), r.y(), COMPOSITE_OVER, rotated, OPACITY_OPAQUE, r.x(), r.y(), r.width(), r.height());
+    p.end();
+}
+
+void KisRotateVisitor::shear(double angleX, double angleY, KisProgressDisplayInterface *progress)
+{
+    const double pi=3.1415926535897932385;
+    double thetaX = angleX * pi / 180;
+    double shearX = tan(thetaX);
+    double thetaY = angleY * pi / 180;
+    double shearY = tan(thetaY);
+
+    TQRect r = m_dev->exactBounds();
+
+    const int xShearSteps = r.height();
+    const int yShearSteps = r.width();
+
+    m_progress = progress;
+    initProgress(xShearSteps + yShearSteps);
+
+
+    KisPaintDeviceSP sheared;
+
+    if (m_dev->hasSelection()) {
+        sheared = new KisPaintDevice(m_dev->colorSpace(), "sheared");
+        KisPainter p1(sheared);
+        p1.bltSelection(r.x(), r.y(), COMPOSITE_OVER, m_dev, OPACITY_OPAQUE, r.x(), r.y(), r.width(), r.height());
+        p1.end();
+         sheared = xShear(sheared, shearX);
+    }
+    else {
+        sheared = xShear(m_dev, shearX);
+    }
+
+     sheared = yShear(sheared, shearY);
+
+     if (!m_dev->hasSelection()) {
+        m_dev->clear();
+     } else {
+         // Clear selected pixels
+         m_dev->clearSelection();
+     }
+
+    KisPainter p2(m_dev);
+    r = sheared->extent();
+
+    p2.bitBlt(r.x(), r.y(), COMPOSITE_OVER, sheared, OPACITY_OPAQUE, r.x(), r.y(), r.width(), r.height());
+    p2.end();
+
+    setProgressDone();
+}
+
+KisPaintDeviceSP KisRotateVisitor::rotateRight90(KisPaintDeviceSP src)
+{
+    KisPaintDeviceSP dst = new KisPaintDevice(src->colorSpace(), "rotateright90");
+    dst->setX(src->getX());
+    dst->setY(src->getY());
+
+    TQ_INT32 pixelSize = src->pixelSize();
+    TQRect r = src->exactBounds();
+    TQ_INT32 x = 0;
+
+    for (TQ_INT32 y = r.bottom(); y >= r.top(); --y) {
+        KisHLineIteratorPixel hit = src->createHLineIterator(r.x(), y, r.width(), false);
+        KisVLineIterator vit = dst->createVLineIterator(-y, r.x(), r.width(), true);
+
+            while (!hit.isDone()) {
+            if (hit.isSelected())  {
+                memcpy(vit.rawData(), hit.rawData(), pixelSize);
+            }
+            ++hit;
+            ++vit;
+        }
+        ++x;
+        incrementProgress();
+    }
+
+    return dst;
+}
+
+KisPaintDeviceSP KisRotateVisitor::rotateLeft90(KisPaintDeviceSP src)
+{
+    KisPaintDeviceSP dst = new KisPaintDevice(src->colorSpace(), "rotateleft90");
+
+    TQ_INT32 pixelSize = src->pixelSize();
+    TQRect r = src->exactBounds();
+    TQ_INT32 x = 0;
+
+    for (TQ_INT32 y = r.top(); y <= r.bottom(); ++y) {
+        // Read the horizontal line from back to front, write onto the vertical column
+        KisHLineIteratorPixel hit = src->createHLineIterator(r.x(), y, r.width(), false);
+        KisVLineIterator vit = dst->createVLineIterator(y, -r.x() - r.width(), r.width(), true);
+
+        hit += r.width() - 1;
+        while (!vit.isDone()) {
+            if (hit.isSelected()) {
+                memcpy(vit.rawData(), hit.rawData(), pixelSize);
+            }
+            --hit;
+            ++vit;
+        }
+        ++x;
+        incrementProgress();
+    }
+
+    return dst;
+}
+
+KisPaintDeviceSP KisRotateVisitor::rotate180(KisPaintDeviceSP src)
+{
+    KisPaintDeviceSP dst = new KisPaintDevice(src->colorSpace(), "rotate180");
+    dst->setX(src->getX());
+    dst->setY(src->getY());
+
+    TQ_INT32 pixelSize = src->pixelSize();
+    TQRect r = src->exactBounds();
+
+    for (TQ_INT32 y = r.top(); y <= r.bottom(); ++y) {
+        KisHLineIteratorPixel srcIt = src->createHLineIterator(r.x(), y, r.width(), false);
+        KisHLineIterator dstIt = dst->createHLineIterator( -r.x() - r.width(), -y, r.width(), true);
+
+        srcIt += r.width() - 1;
+        while (!dstIt.isDone()) {
+            if (srcIt.isSelected())  {
+                memcpy(dstIt.rawData(), srcIt.rawData(), pixelSize);
+            }
+            --srcIt;
+            ++dstIt;
+        }
+        incrementProgress();
+    }
+
+    return dst;
+}
+
+KisPaintDeviceSP KisRotateVisitor::rotate(KisPaintDeviceSP src, double angle, KisPoint centreOfRotation)
+{
+    const double pi = 3.1415926535897932385;
+
+    if (angle >= 315 && angle < 360) {
+        angle = angle - 360;
+    } else if (angle > -360 && angle < -45) {
+        angle = angle + 360;
+    }
+
+    TQRect r = src->exactBounds();
+
+    const int xShearSteps = r.height();
+    const int yShearSteps = r.width();
+    const int fixedRotateSteps = r.height();
+
+    KisPaintDeviceSP dst;
+
+    if (angle == 90) {
+        initProgress(fixedRotateSteps);
+        dst = rotateRight90(src);
+    } else if (angle == 180) {
+        initProgress(fixedRotateSteps);
+        dst = rotate180(src);
+    } else if (angle == 270) {
+        initProgress(fixedRotateSteps);
+        dst = rotateLeft90(src);
+    } else {
+        double theta;
+
+        if (angle >= -45 && angle < 45) {
+
+            theta = angle * pi / 180;
+            dst = src;
+            initProgress(yShearSteps + (2 * xShearSteps));
+        }
+        else if (angle >= 45 && angle < 135) {
+
+            initProgress(fixedRotateSteps + yShearSteps + (2 * xShearSteps));
+            dst = rotateRight90(src);
+            theta = (angle - 90) * pi / 180;
+        }
+        else if (angle >= 135 && angle < 225) {
+
+            initProgress(fixedRotateSteps + yShearSteps + (2 * xShearSteps));
+            dst = rotate180(src);
+            theta = (angle - 180) * pi / 180;
+
+        } else {
+
+            initProgress(fixedRotateSteps + yShearSteps + (2 * xShearSteps));
+            dst = rotateLeft90(src);
+            theta = (angle - 270) * pi / 180;
+        }
+
+        double shearX = tan(theta / 2);
+        double shearY = sin(theta);
+
+        //first perform a shear along the x-axis by tan(theta/2)
+        dst = xShear(dst, shearX);
+        //next perform a shear along the y-axis by sin(theta)
+        dst = yShear(dst, shearY);
+        //again perform a shear along the x-axis by tan(theta/2)
+        dst = xShear(dst, shearX);
+    }
+
+    double sinAngle = sin(angle * pi / 180);
+    double cosAngle = cos(angle * pi / 180);
+
+    KisPoint rotatedCentreOfRotation(
+                                centreOfRotation.x() * cosAngle - centreOfRotation.y() * sinAngle,
+                                centreOfRotation.x() * sinAngle + centreOfRotation.y() * cosAngle);
+
+    dst->setX((TQ_INT32)(dst->getX() + centreOfRotation.x() - rotatedCentreOfRotation.x()));
+    dst->setY((TQ_INT32)(dst->getY() + centreOfRotation.y() - rotatedCentreOfRotation.y()));
+
+    setProgressDone();
+
+    return dst;
+}
+
+KisPaintDeviceSP KisRotateVisitor::xShear(KisPaintDeviceSP src, double shearX)
+{
+    KisPaintDeviceSP dst = new KisPaintDevice(src->colorSpace(), "xShear");
+    dst->setX(src->getX());
+    dst->setY(src->getY());
+
+    TQRect r = src->exactBounds();
+
+        double displacement;
+        TQ_INT32 displacementInt;
+        double weight;
+
+    for (TQ_INT32 y = r.top(); y <= r.bottom(); y++) {
+
+        //calculate displacement
+        displacement = -y * shearX;
+
+        displacementInt = (TQ_INT32)(floor(displacement));
+        weight = displacement - displacementInt;
+
+        TQ_UINT8 pixelWeights[2];
+
+        pixelWeights[0] = static_cast<TQ_UINT8>(weight * 255 + 0.5);
+        pixelWeights[1] = 255 - pixelWeights[0];
+
+        KisHLineIteratorPixel srcIt = src->createHLineIterator(r.x(), y, r.width() + 1, false);
+        KisHLineIteratorPixel leftSrcIt = src->createHLineIterator(r.x() - 1, y, r.width() + 1, false);
+        KisHLineIteratorPixel dstIt = dst->createHLineIterator(r.x() + displacementInt, y, r.width() + 1, true);
+
+        while (!srcIt.isDone()) {
+
+            const TQ_UINT8 *pixelPtrs[2];
+
+            pixelPtrs[0] = leftSrcIt.rawData();
+            pixelPtrs[1] = srcIt.rawData();
+
+            src->colorSpace()->mixColors(pixelPtrs, pixelWeights, 2, dstIt.rawData());
+
+            ++srcIt;
+            ++leftSrcIt;
+            ++dstIt;
+        }
+        incrementProgress();
+    }
+
+    return dst;
+}
+
+KisPaintDeviceSP KisRotateVisitor::yShear(KisPaintDeviceSP src, double shearY)
+{
+    KisPaintDeviceSP dst = new KisPaintDevice(src->colorSpace(), "yShear");
+    dst->setX(src->getX());
+    dst->setY(src->getY());
+
+    TQRect r = src->exactBounds();
+
+        double displacement;
+        TQ_INT32 displacementInt;
+        double weight;
+
+    for (TQ_INT32 x = r.left(); x <= r.right(); x++) {
+
+        //calculate displacement
+        displacement = x * shearY;
+
+        displacementInt = (TQ_INT32)(floor(displacement));
+        weight = displacement - displacementInt;
+
+        TQ_UINT8 pixelWeights[2];
+
+        pixelWeights[0] = static_cast<TQ_UINT8>(weight * 255 + 0.5);
+        pixelWeights[1] = 255 - pixelWeights[0];
+
+        KisVLineIteratorPixel srcIt = src->createVLineIterator(x, r.y(), r.height() + 1, false);
+        KisVLineIteratorPixel leftSrcIt = src->createVLineIterator(x, r.y() - 1, r.height() + 1, false);
+        KisVLineIteratorPixel dstIt = dst->createVLineIterator(x, r.y() + displacementInt, r.height() + 1, true);
+
+        while (!srcIt.isDone()) {
+
+            const TQ_UINT8 *pixelPtrs[2];
+
+            pixelPtrs[0] = leftSrcIt.rawData();
+            pixelPtrs[1] = srcIt.rawData();
+
+            src->colorSpace()->mixColors(pixelPtrs, pixelWeights, 2, dstIt.rawData());
+
+            ++srcIt;
+            ++leftSrcIt;
+            ++dstIt;
+        }
+        incrementProgress();
+    }
+
+        return dst;
+}
+
+void KisRotateVisitor::initProgress(TQ_INT32 totalSteps)
+{
+    if (!m_progress) return;
+
+    m_progressTotalSteps = totalSteps;
+    m_progressStep = 0;
+    m_lastProgressPerCent = 0;
+
+
+    m_progress->setSubject(this, true, false);
+    emit notifyProgress(0);
+
+}
+
+void KisRotateVisitor::incrementProgress()
+{
+    if (!m_progress) return;
+
+    m_progressStep++;
+    TQ_INT32 progressPerCent = (m_progressStep * 100) / m_progressTotalSteps;
+
+    if (progressPerCent != m_lastProgressPerCent) {
+        m_lastProgressPerCent = progressPerCent;
+        emit notifyProgress(progressPerCent);
+    }
+}
+
+void KisRotateVisitor::setProgressDone()
+{
+    if (!m_progress) return;
+
+    emit notifyProgressDone();
+}
+
+
diff --git a/chalk/core/kis_rotate_visitor.h b/chalk/core/kis_rotate_visitor.h
new file mode 100644
index 000000000..ea23f84f8
--- /dev/null
+++ b/chalk/core/kis_rotate_visitor.h
@@ -0,0 +1,80 @@
+/*
+ *  copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+#ifndef KIS_ROTATE_VISITOR_H_
+#define KIS_ROTATE_VISITOR_H_
+
+#include "kis_types.h"
+#include "kis_progress_subject.h"
+
+class TQRect;
+class KisPaintDevice;
+class KisProgressDisplayInterface;
+
+class KisRotateVisitor : public KisProgressSubject {
+        typedef KisProgressSubject super;  
+        
+        /* Structs for the image rescaling routine */
+    
+public:
+        KisRotateVisitor();
+        ~KisRotateVisitor();
+
+        void visitKisPaintDevice(KisPaintDevice* dev);
+        
+        void rotate(double angle, bool rotateAboutImageCentre, KisProgressDisplayInterface *progress);
+        void shear(double angleX, double angleY, KisProgressDisplayInterface *progress);
+
+private:
+        KisPaintDeviceSP m_dev;
+
+    // Implement KisProgressSubject
+    bool m_cancelRequested;
+    virtual void cancel() { m_cancelRequested = true; }
+
+    void initProgress(TQ_INT32 totalSteps);
+    void incrementProgress();
+    void setProgressDone();
+
+    KisProgressDisplayInterface *m_progress;
+    TQ_INT32 m_progressStep;
+    TQ_INT32 m_progressTotalSteps;
+    TQ_INT32 m_lastProgressPerCent;
+
+    KisPaintDeviceSP rotateRight90(KisPaintDeviceSP src);
+    KisPaintDeviceSP rotateLeft90(KisPaintDeviceSP src);
+    KisPaintDeviceSP rotate180(KisPaintDeviceSP src);
+    KisPaintDeviceSP rotate(KisPaintDeviceSP src, double angle, KisPoint centreOfRotation);
+
+    KisPaintDeviceSP xShear(KisPaintDeviceSP src, double shearX);
+    KisPaintDeviceSP yShear(KisPaintDeviceSP src, double shearY);
+
+};
+
+inline KisRotateVisitor::KisRotateVisitor()
+{
+}
+
+inline KisRotateVisitor::~KisRotateVisitor()
+{
+}
+
+inline void KisRotateVisitor::visitKisPaintDevice(KisPaintDevice* dev)
+{
+        m_dev = dev;
+}
+#endif // KIS_ROTATE_VISITOR_H_
diff --git a/chalk/core/kis_scale_visitor.cc b/chalk/core/kis_scale_visitor.cc
new file mode 100644
index 000000000..25ad47c42
--- /dev/null
+++ b/chalk/core/kis_scale_visitor.cc
@@ -0,0 +1,279 @@
+/*
+ *  Copyright (c) 2004, 2005 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <tqdatetime.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_paint_device.h"
+#include "kis_scale_visitor.h"
+#include "kis_filter_strategy.h"
+
+
+void KisScaleWorker::run()
+{
+    double fwidth = m_filterStrategy->support();
+
+    TQRect rect = m_dev -> exactBounds();
+    TQ_INT32 width = rect.width();
+    TQ_INT32 height =  rect.height();
+    m_pixelSize=m_dev -> pixelSize();
+
+    // compute size of target image
+    if ( m_sx == 1.0F && m_sy == 1.0F ) {
+        return;
+    }
+    TQ_INT32 targetW = TQABS( tqRound( m_sx * width ) );
+    TQ_INT32 targetH = TQABS( tqRound( m_sy * height ) );
+
+    TQ_UINT8* newData = new TQ_UINT8[targetW * targetH * m_pixelSize ];
+    Q_CHECK_PTR(newData);
+
+    double* weight = new double[ m_pixelSize ];    /* filter calculation variables */
+
+    TQ_UINT8* pel = new TQ_UINT8[ m_pixelSize ];
+    Q_CHECK_PTR(pel);
+
+    TQ_UINT8 *pel2 = new TQ_UINT8[ m_pixelSize ];
+    Q_CHECK_PTR(pel2);
+
+    bool* bPelDelta = new bool[ m_pixelSize ];
+    ContribList    *contribX;
+    ContribList    contribY;
+    const TQ_INT32 BLACK_PIXEL=0;
+    const TQ_INT32 WHITE_PIXEL=255;
+
+
+    // create intermediate row to hold vertical dst row zoom
+    TQ_UINT8 * tmp = new TQ_UINT8[ width * m_pixelSize ];
+    Q_CHECK_PTR(tmp);
+
+    //create array of pointers to intermediate rows
+    TQ_UINT8 **tmpRows = new TQ_UINT8*[ height ];
+
+    //create array of pointers to intermediate rows that are actually used simultaneously and allocate memory for the rows
+    TQ_UINT8 **tmpRowsMem;
+    if(m_sy < 1.0)
+    {
+        tmpRowsMem = new TQ_UINT8*[ (int)(fwidth / m_sy * 2 + 1) ];
+        for(int i = 0; i < (int)(fwidth / m_sy * 2 + 1); i++)
+        {
+             tmpRowsMem[i] = new TQ_UINT8[ width * m_pixelSize ];
+             Q_CHECK_PTR(tmpRowsMem[i]);
+        }
+    }
+    else
+    {
+        tmpRowsMem = new TQ_UINT8*[ (int)(fwidth * 2 + 1) ];
+        for(int i = 0; i < (int)(fwidth * 2 + 1); i++)
+        {
+            tmpRowsMem[i] = new TQ_UINT8[ width * m_pixelSize ];
+            Q_CHECK_PTR(tmpRowsMem[i]);
+        }
+    }
+
+    // build x weights
+    contribX = new ContribList[ targetW ];
+    for(int x = 0; x < targetW; x++)
+    {
+        calcContrib(&contribX[x], m_sx, fwidth, width, m_filterStrategy, x);
+    }
+
+    TQTime starttime = TQTime::currentTime ();
+
+    for(int y = 0; y < targetH; y++)
+    {
+        // build y weights
+        calcContrib(&contribY, m_sy, fwidth, height, m_filterStrategy, y);
+
+        //copy pixel data to temporary arrays
+        for(int srcpos = 0; srcpos < contribY.n; srcpos++)
+        {
+            if (!(contribY.p[srcpos].m_pixel < 0 || contribY.p[srcpos].m_pixel >= height))
+            {
+                tmpRows[contribY.p[srcpos].m_pixel] = new TQ_UINT8[ width * m_pixelSize ];
+                //tmpRows[ contribY.p[srcpos].m_pixel ] = tmpRowsMem[ srcpos ];
+                m_dev ->readBytes(tmpRows[contribY.p[srcpos].m_pixel], 0, contribY.p[srcpos].m_pixel, width, 1);
+            }
+        }
+
+        /* Apply vert filter to make dst row in tmp. */
+        for(int x = 0; x < width; x++)
+        {
+            for(int channel = 0; channel < m_pixelSize; channel++){
+                weight[channel] = 0.0;
+                bPelDelta[channel] = FALSE;
+                pel[channel]=tmpRows[contribY.p[0].m_pixel][ x * m_pixelSize + channel ];
+            }
+            for(int srcpos = 0; srcpos < contribY.n; srcpos++)
+            {
+                if (!(contribY.p[srcpos].m_pixel < 0 || contribY.p[srcpos].m_pixel >= height)){
+                    for(int channel = 0; channel < m_pixelSize; channel++)
+                    {
+                        pel2[channel]=tmpRows[contribY.p[srcpos].m_pixel][ x * m_pixelSize + channel ];
+                        if(pel2[channel] != pel[channel]) bPelDelta[channel] = TRUE;
+                            weight[channel] += pel2[channel] * contribY.p[srcpos].m_weight;
+                    }
+                }
+            }
+
+            for(int channel = 0; channel < m_pixelSize; channel++){
+                weight[channel] = bPelDelta[channel] ? static_cast<int>(tqRound(weight[channel])) : pel[channel];
+                        tmp[ x * m_pixelSize + channel ] = static_cast<TQ_UINT8>(CLAMP(weight[channel], BLACK_PIXEL, WHITE_PIXEL));
+            }
+        } /* next row in temp column */
+        delete[] contribY.p;
+
+        for(int x = 0; x < targetW; x++)
+        {
+            for(int channel = 0; channel < m_pixelSize; channel++){
+                weight[channel] = 0.0;
+                bPelDelta[channel] = FALSE;
+                pel[channel] = tmp[ contribX[x].p[0].m_pixel * m_pixelSize + channel ];
+            }
+            for(int srcpos = 0; srcpos < contribX[x].n; srcpos++)
+            {
+                for(int channel = 0; channel < m_pixelSize; channel++){
+                    pel2[channel] = tmp[ contribX[x].p[srcpos].m_pixel * m_pixelSize + channel ];
+                    if(pel2[channel] != pel[channel])
+                        bPelDelta[channel] = TRUE;
+                    weight[channel] += pel2[channel] * contribX[x].p[srcpos].m_weight;
+                }
+            }
+            for(int channel = 0; channel < m_pixelSize; channel++){
+                weight[channel] = bPelDelta[channel] ? static_cast<int>(tqRound(weight[channel])) : pel[channel];
+                int currentPos = (y*targetW+x) * m_pixelSize; // try to be at least a little efficient
+                if (weight[channel]<0)
+                    newData[currentPos + channel] = 0;
+                else if (weight[channel]>255)
+                    newData[currentPos + channel] = 255;
+                else
+                    newData[currentPos + channel] = (uchar)weight[channel];
+             }
+        } /* next dst row */
+    } /* next dst column */
+
+    // XXX: I'm thinking that we should be able to cancel earlier, in the look.
+    if(!isCanceled()){
+        m_dev -> writeBytes( newData, 0, 0, targetW, targetH);
+        m_dev -> crop(0, 0, targetW, targetH);
+    }
+
+    /* free the memory allocated for horizontal filter weights */
+    for(int x = 0; x < targetW; x++)
+        delete[] contribX[x].p;
+    delete[] contribX;
+
+    delete[] newData;
+    delete[] pel;
+    delete[] pel2;
+    delete[] tmp;
+    delete[] weight;
+    delete[] bPelDelta;
+
+    if(m_sy < 1.0)
+    {
+        for(int i = 0; i < (int)(fwidth / m_sy * 2 + 1); i++)
+        {
+            delete[] tmpRowsMem[i];
+        }
+    }
+    else
+    {
+        for(int i = 0; i < (int)(fwidth * 2 + 1); i++)
+        {
+            delete[] tmpRowsMem[i];
+        }
+    }
+
+    TQTime stoptime = TQTime::currentTime ();
+    return;
+}
+
+int KisScaleWorker::calcContrib(ContribList *contrib, double scale, double fwidth, int srcwidth, KisFilterStrategy* filterStrategy, TQ_INT32 i)
+{
+        //ContribList* contribX: receiver of contrib info
+        //double m_sx: horizontal zooming scale
+        //double fwidth: Filter sampling width
+        //int dstwidth: Target bitmap width
+        //int srcwidth: Source bitmap width
+        //double (*filterf)(double): Filter proc
+        //int i: Pixel column in source bitmap being processed
+
+        double width;
+        double fscale;
+        double center, begin, end;
+        double weight;
+        TQ_INT32 k, n;
+
+        if(scale < 1.0)
+        {
+                //Shrinking image
+                width = fwidth / scale;
+                fscale = 1.0 / scale;
+
+                contrib->n = 0;
+                contrib->p = new Contrib[ (int)(width * 2 + 1) ];
+
+                center = (double) i / scale;
+                begin = ceil(center - width);
+                end = floor(center + width);
+                for(int srcpos = (int)begin; srcpos <= end; ++srcpos)
+                {
+                        weight = center - (double) srcpos;
+                        weight = filterStrategy->valueAt(weight / fscale) / fscale;
+                        if(srcpos < 0)
+                                n = -srcpos;
+                        else if(srcpos >= srcwidth)
+                                n = (srcwidth - srcpos) + srcwidth - 1;
+                        else
+                                n = srcpos;
+
+                        k = contrib->n++;
+                        contrib->p[k].m_pixel = n;
+                        contrib->p[k].m_weight = weight;
+                }
+        }
+        else
+        {
+                // Expanding image
+                contrib->n = 0;
+                contrib->p = new Contrib[ (int)(fwidth * 2 + 1) ];
+
+                center = (double) i / scale;
+                begin = ceil(center - fwidth);
+                end = floor(center + fwidth);
+
+                for(int srcpos = (int)begin; srcpos <= end; ++srcpos)
+                {
+                        weight = center - (double) srcpos;
+                        weight = filterStrategy->valueAt(weight);
+                        if(srcpos < 0) {
+                                n = -srcpos;
+                        } else if(srcpos >= srcwidth) {
+                                n = (srcwidth - srcpos) + srcwidth - 1;
+                        } else {
+                                n = srcpos;
+                        }
+                        k = contrib->n++;
+                        contrib->p[k].m_pixel = n;
+                        contrib->p[k].m_weight = weight;
+                }
+        }
+        return 0;
+} /* calc_x_contrib */
diff --git a/chalk/core/kis_scale_visitor.h b/chalk/core/kis_scale_visitor.h
new file mode 100644
index 000000000..afe358ad0
--- /dev/null
+++ b/chalk/core/kis_scale_visitor.h
@@ -0,0 +1,204 @@
+/*
+ *  copyright (c) 2004, 2005 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+
+#ifndef KIS_SCALE_VISITOR_H_
+#define KIS_SCALE_VISITOR_H_
+
+#include "klocale.h"
+
+#include "kis_progress_subject.h"
+#include "kis_progress_display_interface.h"
+#include "kis_thread.h"
+#include "kis_layer_visitor.h"
+#include "kis_types.h"
+#include "kis_layer.h"
+#include "kis_group_layer.h"
+#include "kis_paint_layer.h"
+#include "kis_adjustment_layer.h"
+#include "kis_transaction.h"
+#include "kis_undo_adapter.h"
+#include "kis_selection.h"
+
+class KisProgressDisplayInterface;
+class KisFilterStrategy;
+
+class KisScaleWorker : public KisThread {
+
+    /* Structs for the image rescaling routine */
+    class Contrib {
+    public:
+        TQ_INT32 m_pixel;
+        double m_weight;
+    };
+
+    class ContribList {
+    public:
+        TQ_INT32  n;  //number of contributors
+        Contrib *p; //pointer to list of contributions
+    };
+
+public:
+
+    KisScaleWorker(KisPaintDevice * dev, double sx, double sy,
+                   KisFilterStrategy *filterStrategy)
+        : KisThread()
+        , m_dev(dev)
+        , m_sx(sx)
+        , m_sy(sy)
+        , m_filterStrategy(filterStrategy) {};
+
+    virtual ~KisScaleWorker() {};
+
+    void run();
+
+private:
+    TQ_INT32 m_pixelSize;
+    KisPaintDevice * m_dev;
+    double m_sx, m_sy;
+    KisFilterStrategy * m_filterStrategy;
+
+
+    /**
+     * calc_x_contrib()
+     *
+     * Calculates the filter weights for a single target column.
+     * contribX->p must be freed afterwards.
+     *
+     * Returns -1 if error, 0 otherwise.
+     */
+    int calcContrib(ContribList *contribX, double cale, double fwidth, int srcwidth, KisFilterStrategy *filterStrategy, TQ_INT32 i);
+
+    ContribList * contrib;  //array of contribution lists
+
+
+};
+
+
+class KisScaleVisitor : public KisLayerVisitor, KisProgressSubject {
+
+public:
+
+    KisScaleVisitor(KisImageSP img,
+                    double sx, 
+                    double sy, 
+                    KisProgressDisplayInterface *progress, 
+                    KisFilterStrategy *filterStrategy) 
+        : KisLayerVisitor()
+        , m_img(img)
+        , m_sx(sx)
+        , m_sy(sy)
+        , m_progress(progress)
+        , m_filterStrategy(filterStrategy)
+    {
+        if ( progress )
+            progress -> setSubject(this, true, true);
+        emit notifyProgressStage(i18n("Scaling..."),0);
+    }
+
+    virtual ~KisScaleVisitor()
+    {
+        // Wait for all threads to finish
+        KisThread * t;
+        int threadcount = m_scalethreads.count();
+        int i = 0;
+        for ( t = m_scalethreads.first(); t; t = m_scalethreads.next()) {
+            //progress info
+            if (t) t->wait();
+            emit notifyProgress((100 / threadcount) * i);
+            ++i;
+
+        }
+        emit notifyProgressDone();
+        // Delete all threads
+        m_scalethreads.setAutoDelete(true);
+        m_scalethreads.clear();
+    }
+
+    bool visit(KisPaintLayer *layer) 
+    {
+        // XXX: If all is well, then the image's undoadapter will have started a macro for us
+        //      This will break in a more multi-threaded environment
+        if (m_img->undoAdapter() && m_img->undoAdapter()->undo()) {
+            KisTransaction * cmd = new KisTransaction("", layer->paintDevice());
+            m_img->undoAdapter()->addCommand(cmd);
+        }
+
+        KisScaleWorker * scaleThread = new KisScaleWorker(layer->paintDevice(),
+                                                     m_sx, m_sy, m_filterStrategy);
+        m_scalethreads.append(scaleThread);
+        scaleThread->start();
+        //scaleThread->run();
+        layer->setDirty();
+        return true;
+    }
+
+    bool visit(KisGroupLayer *layer)
+    {
+        //KisScaleVisitor visitor (m_img, m_sx, m_sy, m_progress, m_filterStrategy);
+
+        // XXX: Maybe faster to scale the projection and do something clever to avoid 
+	//      recompositing everything?
+	layer->resetProjection(); 
+       
+
+        KisLayerSP child = layer->firstChild();
+        while (child) {
+            child->accept(*this);
+            child = child->nextSibling();
+        }
+
+        return true;
+    }
+
+    bool visit(KisPartLayer */*layer*/)
+    {
+        return true;
+    }
+
+    virtual bool visit(KisAdjustmentLayer* layer)
+    {
+        KisThread * scaleThread = new KisScaleWorker(layer->selection().data(), m_sx, m_sy, m_filterStrategy);
+        m_scalethreads.append(scaleThread);
+        scaleThread->start();
+        layer->resetCache();
+        layer->setDirty();
+        return true;
+    }
+    
+    
+    // Implement KisProgressSubject
+    virtual void cancel() 
+    {
+        KisThread * t;
+        for ( t = m_scalethreads.first(); t; t = m_scalethreads.next()) {
+            t->cancel();
+        }      
+    }
+    
+
+private:
+
+    TQPtrList<KisThread> m_scalethreads;
+    KisImageSP m_img;
+    double m_sx;
+    double m_sy;
+    KisProgressDisplayInterface * m_progress;
+    KisFilterStrategy * m_filterStrategy;
+};
+
+#endif // KIS_SCALE_VISITOR_H_
diff --git a/chalk/core/kis_selected_transaction.cc b/chalk/core/kis_selected_transaction.cc
new file mode 100644
index 000000000..44eec6976
--- /dev/null
+++ b/chalk/core/kis_selected_transaction.cc
@@ -0,0 +1,73 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kis_types.h"
+#include "kis_global.h"
+#include "kis_selected_transaction.h"
+#include "kis_selection.h"
+
+KisSelectedTransaction::KisSelectedTransaction(const TQString& name, KisPaintDeviceSP device) :
+    KisTransaction(name, device),
+    m_device(device),
+    m_hadSelection(device->hasSelection())
+{
+    m_selTransaction = new KisTransaction(name, device->selection().data());
+    if(! m_hadSelection) {
+        m_device->deselect(); // let us not be the cause of select
+    }
+}
+
+KisSelectedTransaction::~KisSelectedTransaction()
+{
+    delete m_selTransaction;
+}
+
+void KisSelectedTransaction::execute()
+{
+    super::execute();
+    m_selTransaction->execute();
+    if(m_redoHasSelection)
+        m_device->selection();
+    else
+        m_device->deselect();
+    m_device->emitSelectionChanged();
+}
+
+void KisSelectedTransaction::unexecute()
+{
+    m_redoHasSelection = m_device->hasSelection();
+
+    super::unexecute();
+    m_selTransaction->unexecute();
+    if(m_hadSelection)
+        m_device->selection();
+    else
+        m_device->deselect();
+    m_device->emitSelectionChanged();
+}
+
+void KisSelectedTransaction::unexecuteNoUpdate()
+{
+    m_redoHasSelection = m_device->hasSelection();
+
+    super::unexecuteNoUpdate();
+    m_selTransaction->unexecuteNoUpdate();
+    if(m_hadSelection)
+        m_device->selection();
+    else
+        m_device->deselect();
+}
diff --git a/chalk/core/kis_selected_transaction.h b/chalk/core/kis_selected_transaction.h
new file mode 100644
index 000000000..c366f336a
--- /dev/null
+++ b/chalk/core/kis_selected_transaction.h
@@ -0,0 +1,50 @@
+/*
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_SELECTED_TRANSACTION_H_
+#define KIS_SELECTED_TRANSACTION_H_
+
+#include <map>
+#include <tqglobal.h>
+#include <tqstring.h>
+
+#include "kis_transaction.h"
+
+#include "koffice_export.h"
+
+class KRITACORE_EXPORT KisSelectedTransaction : public KisTransaction {
+    typedef KisTransaction super;
+public:
+    KisSelectedTransaction(const TQString& name, KisPaintDeviceSP device);
+    virtual ~KisSelectedTransaction();
+
+public:
+    virtual void execute();
+    virtual void unexecute();
+    virtual void unexecuteNoUpdate();
+
+public:
+
+private:
+    KisPaintDeviceSP m_device;
+    KisTransaction *m_selTransaction;
+    bool m_hadSelection;
+    bool m_redoHasSelection;
+};
+
+#endif // KIS_SELECTED_TRANSACTION_H_
diff --git a/chalk/core/kis_selection.cc b/chalk/core/kis_selection.cc
new file mode 100644
index 000000000..e988eff00
--- /dev/null
+++ b/chalk/core/kis_selection.cc
@@ -0,0 +1,582 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+
+#include <tqimage.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+#include <tqcolor.h>
+
+#include "kis_layer.h"
+#include "kis_debug_areas.h"
+#include "kis_types.h"
+#include "kis_colorspace_factory_registry.h"
+#include "kis_fill_painter.h"
+#include "kis_iterators_pixel.h"
+#include "kis_integer_maths.h"
+#include "kis_image.h"
+#include "kis_datamanager.h"
+#include "kis_fill_painter.h"
+#include "kis_selection.h"
+
+KisSelection::KisSelection(KisPaintDeviceSP dev)
+    : super(dev->tqparentLayer()
+            , KisMetaRegistry::instance()->csRegistry()->getAlpha8()
+            , (TQString("selection for ") + dev->name()).latin1())
+    , m_parentPaintDevice(dev)
+    , m_doCacheExactRect(false)
+    , m_dirty(false)
+{
+    Q_ASSERT(dev);
+}
+
+KisSelection::KisSelection()
+    : super(KisMetaRegistry::instance()->csRegistry()->getAlpha8(), "anonymous selection")
+    , m_parentPaintDevice(0), m_dirty(false)
+{
+}
+
+KisSelection::KisSelection(const KisSelection& rhs)
+    : super(rhs), m_parentPaintDevice(rhs.m_parentPaintDevice), m_doCacheExactRect(rhs.m_doCacheExactRect),
+    m_cachedExactRect(rhs.m_cachedExactRect), m_dirty(rhs.m_dirty)
+{
+}
+
+KisSelection::~KisSelection()
+{
+}
+
+TQ_UINT8 KisSelection::selected(TQ_INT32 x, TQ_INT32 y)
+{
+    KisHLineIteratorPixel iter = createHLineIterator(x, y, 1, false);
+
+    TQ_UINT8 *pix = iter.rawData();
+
+    return *pix;
+}
+
+void KisSelection::setSelected(TQ_INT32 x, TQ_INT32 y, TQ_UINT8 s)
+{
+    KisHLineIteratorPixel iter = createHLineIterator(x, y, 1, true);
+
+    TQ_UINT8 *pix = iter.rawData();
+
+    *pix = s;
+}
+
+TQImage KisSelection::tqmaskImage()
+{
+    // If part of a KisAdjustmentLayer, there may be no tqparent device.
+    TQImage img;
+    TQRect bounds;
+    if (m_parentPaintDevice) {
+
+        bounds = m_parentPaintDevice->exactBounds();
+        bounds = bounds.intersect( m_parentPaintDevice->image()->bounds() );
+        img = TQImage(bounds.width(), bounds.height(), 32);
+    }
+    else {
+        bounds = TQRect( 0, 0, image()->width(), image()->height());
+        img = TQImage(bounds.width(), bounds.height(), 32);
+    }
+
+    KisHLineIteratorPixel it = createHLineIterator(bounds.x(), bounds.y(), bounds.width(), false);
+    for (int y2 = bounds.y(); y2 < bounds.height() - bounds.y(); ++y2) {
+            int x2 = 0;
+            while (!it.isDone()) {
+                    TQ_UINT8 s = MAX_SELECTED - *(it.rawData());
+                    TQ_INT32 c = tqRgb(s, s, s);
+                    img.setPixel(x2, y2, c);
+                    ++x2;
+                    ++it;
+            }
+            it.nextRow();
+    }
+    return img;
+}
+void KisSelection::select(TQRect r)
+{
+    KisFillPainter painter(this);
+    KisColorSpace * cs = KisMetaRegistry::instance()->csRegistry()->getRGB8();
+    painter.fillRect(r, KisColor(TQt::white, cs), MAX_SELECTED);
+    TQ_INT32 x, y, w, h;
+    extent(x, y, w, h);
+}
+
+void KisSelection::clear(TQRect r)
+{
+    KisFillPainter painter(this);
+    KisColorSpace * cs = KisMetaRegistry::instance()->csRegistry()->getRGB8();
+    painter.fillRect(r, KisColor(TQt::white, cs), MIN_SELECTED);
+}
+
+void KisSelection::clear()
+{
+    TQ_UINT8 defPixel = MIN_SELECTED;
+    m_datamanager->setDefaultPixel(&defPixel);
+    m_datamanager->clear();
+}
+
+void KisSelection::invert()
+{
+    TQ_INT32 x,y,w,h;
+
+    extent(x, y, w, h);
+    KisRectIterator it = createRectIterator(x, y, w, h, true);
+    while ( ! it.isDone() )
+    {
+        // CBR this is wrong only first byte is inverted
+        // BSAR: But we have always only one byte in this color model :-).
+        *(it.rawData()) = MAX_SELECTED - *(it.rawData());
+        ++it;
+    }
+    TQ_UINT8 defPixel = MAX_SELECTED - *(m_datamanager->defaultPixel());
+    m_datamanager->setDefaultPixel(&defPixel);
+}
+
+bool KisSelection::isTotallyUnselected(TQRect r)
+{
+    if(*(m_datamanager->defaultPixel()) != MIN_SELECTED)
+        return false;
+    TQRect sr = selectedExactRect();
+    return ! r.intersects(sr);
+}
+
+bool KisSelection::isProbablyTotallyUnselected(TQRect r)
+{
+    if(*(m_datamanager->defaultPixel()) != MIN_SELECTED)
+        return false;
+    TQRect sr = selectedRect();
+    return ! r.intersects(sr);
+}
+
+
+TQRect KisSelection::selectedRect() const
+{
+    if(*(m_datamanager->defaultPixel()) == MIN_SELECTED || !m_parentPaintDevice)
+        return extent();
+    else
+        return extent().unite(m_parentPaintDevice->extent());
+}
+
+TQRect KisSelection::selectedExactRect() const
+{
+    if(m_doCacheExactRect)
+        return m_cachedExactRect;
+    else if(*(m_datamanager->defaultPixel()) == MIN_SELECTED || !m_parentPaintDevice)
+        return exactBounds();
+    else
+        return exactBounds().unite(m_parentPaintDevice->exactBounds());
+}
+
+void KisSelection::stopCachingExactRect()
+{
+    kdDebug() << "stop caching the exact rect" << endl;
+    m_doCacheExactRect = false;
+}
+
+
+void KisSelection::startCachingExactRect()
+{
+    kdDebug() << "start caching the exact rect" << endl;
+    if(*(m_datamanager->defaultPixel()) == MIN_SELECTED || !m_parentPaintDevice)
+        m_cachedExactRect = exactBounds();
+    else
+        m_cachedExactRect = exactBounds().unite(m_parentPaintDevice->exactBounds());
+    m_doCacheExactRect = true;
+}
+
+void KisSelection::paintUniformSelectionRegion(TQImage img, const TQRect& imageRect, const TQRegion& uniformRegion)
+{
+    Q_ASSERT(img.size() == imageRect.size());
+    Q_ASSERT(imageRect.tqcontains(uniformRegion.boundingRect()));
+
+    if (img.isNull() || img.size() != imageRect.size() || !imageRect.tqcontains(uniformRegion.boundingRect())) {
+        return;
+    }
+
+    if (*m_datamanager->defaultPixel() == MIN_SELECTED) {
+
+        TQRegion region = uniformRegion & TQRegion(imageRect);
+
+        if (!region.isEmpty()) {
+            TQMemArray<TQRect> rects = region.tqrects();
+
+            for (unsigned int i = 0; i < rects.count(); i++) {
+                TQRect r = rects[i];
+
+                for (TQ_INT32 y = 0; y < r.height(); ++y) {
+
+                    TQRgb *imagePixel = reinterpret_cast<TQRgb *>(img.scanLine(r.y() - imageRect.y() + y));
+                    imagePixel += r.x() - imageRect.x();
+
+                    TQ_INT32 numPixels = r.width();
+
+                    while (numPixels > 0) {
+
+                        TQRgb srcPixel = *imagePixel;
+                        TQ_UINT8 srcGrey = (tqRed(srcPixel) + tqGreen(srcPixel) + tqBlue(srcPixel)) / 9;
+                        TQ_UINT8 srcAlpha = tqAlpha(srcPixel);
+
+                        srcGrey = UINT8_MULT(srcGrey, srcAlpha);
+                        TQ_UINT8 dstAlpha = TQMAX(srcAlpha, 192);
+
+                        TQRgb dstPixel = tqRgba(128 + srcGrey, 128 + srcGrey, 165 + srcGrey, dstAlpha);
+                        *imagePixel = dstPixel;
+
+                        ++imagePixel;
+                        --numPixels;
+                    }
+                }
+            }
+        }
+    }
+}
+
+void KisSelection::paintSelection(TQImage img, TQ_INT32 imageRectX, TQ_INT32 imageRectY, TQ_INT32 imageRectWidth, TQ_INT32 imageRectHeight)
+{
+    Q_ASSERT(img.size() == TQSize(imageRectWidth, imageRectHeight));
+
+    if (img.isNull() || img.size() != TQSize(imageRectWidth, imageRectHeight)) {
+        return;
+    }
+
+    TQRect imageRect(imageRectX, imageRectY, imageRectWidth, imageRectHeight);
+    TQRect selectionExtent = extent();
+
+    selectionExtent.setLeft(selectionExtent.left() - 1);
+    selectionExtent.setTop(selectionExtent.top() - 1);
+    selectionExtent.setWidth(selectionExtent.width() + 2);
+    selectionExtent.setHeight(selectionExtent.height() + 2);
+
+    TQRegion uniformRegion = TQRegion(imageRect);
+    uniformRegion -= TQRegion(selectionExtent);
+
+    if (!uniformRegion.isEmpty()) {
+        paintUniformSelectionRegion(img, imageRect, uniformRegion);
+    }
+
+    TQRect nonuniformRect = imageRect & selectionExtent;
+
+    if (!nonuniformRect.isEmpty()) {
+
+        const TQ_INT32 imageRectOffsetX = nonuniformRect.x() - imageRectX;
+        const TQ_INT32 imageRectOffsetY = nonuniformRect.y() - imageRectY;
+
+        imageRectX = nonuniformRect.x();
+        imageRectY = nonuniformRect.y();
+        imageRectWidth = nonuniformRect.width();
+        imageRectHeight = nonuniformRect.height();
+
+        const TQ_INT32 NUM_SELECTION_ROWS = 3;
+
+        TQ_UINT8 *selectionRow[NUM_SELECTION_ROWS];
+
+        TQ_INT32 aboveRowIndex = 0;
+        TQ_INT32 centreRowIndex = 1;
+        TQ_INT32 belowRowIndex = 2;
+
+        selectionRow[aboveRowIndex] = new TQ_UINT8[imageRectWidth + 2];
+        selectionRow[centreRowIndex] = new TQ_UINT8[imageRectWidth + 2];
+        selectionRow[belowRowIndex] = new TQ_UINT8[imageRectWidth + 2];
+
+        readBytes(selectionRow[centreRowIndex], imageRectX - 1, imageRectY - 1, imageRectWidth + 2, 1);
+        readBytes(selectionRow[belowRowIndex], imageRectX - 1, imageRectY, imageRectWidth + 2, 1);
+
+        for (TQ_INT32 y = 0; y < imageRectHeight; ++y) {
+
+            TQ_INT32 oldAboveRowIndex = aboveRowIndex;
+            aboveRowIndex = centreRowIndex;
+            centreRowIndex = belowRowIndex;
+            belowRowIndex = oldAboveRowIndex;
+
+            readBytes(selectionRow[belowRowIndex], imageRectX - 1, imageRectY + y + 1, imageRectWidth + 2, 1);
+
+            const TQ_UINT8 *aboveRow = selectionRow[aboveRowIndex] + 1;
+            const TQ_UINT8 *centreRow = selectionRow[centreRowIndex] + 1;
+            const TQ_UINT8 *belowRow = selectionRow[belowRowIndex] + 1;
+
+            TQRgb *imagePixel = reinterpret_cast<TQRgb *>(img.scanLine(imageRectOffsetY + y));
+            imagePixel += imageRectOffsetX;
+
+            for (TQ_INT32 x = 0; x < imageRectWidth; ++x) {
+
+                TQ_UINT8 centre = *centreRow;
+
+                if (centre != MAX_SELECTED) {
+
+                    // this is where we come if the pixels should be blue or bluish
+
+                    TQRgb srcPixel = *imagePixel;
+                    TQ_UINT8 srcGrey = (tqRed(srcPixel) + tqGreen(srcPixel) + tqBlue(srcPixel)) / 9;
+                    TQ_UINT8 srcAlpha = tqAlpha(srcPixel);
+
+                    // Colour influence is proportional to alphaPixel.
+                    srcGrey = UINT8_MULT(srcGrey, srcAlpha);
+
+                    TQRgb dstPixel;
+
+                    if (centre == MIN_SELECTED) {
+                        //this is where we come if the pixels should be blue (or red outline)
+
+                        TQ_UINT8 left = *(centreRow - 1);
+                        TQ_UINT8 right = *(centreRow + 1);
+                        TQ_UINT8 above = *aboveRow;
+                        TQ_UINT8 below = *belowRow;
+
+                        // Stop unselected transparent areas from appearing the same
+                        // as selected transparent areas.
+                        TQ_UINT8 dstAlpha = TQMAX(srcAlpha, 192);
+
+                        // now for a simple outline based on 4-connectivity
+                        if (left != MIN_SELECTED || right != MIN_SELECTED || above != MIN_SELECTED || below != MIN_SELECTED) {
+                            dstPixel = tqRgba(255, 0, 0, dstAlpha);
+                        } else {
+                            dstPixel = tqRgba(128 + srcGrey, 128 + srcGrey, 165 + srcGrey, dstAlpha);
+                        }
+                    } else {
+                        dstPixel = tqRgba(UINT8_BLEND(tqRed(srcPixel), srcGrey + 128, centre),
+                                         UINT8_BLEND(tqGreen(srcPixel), srcGrey + 128, centre),
+                                         UINT8_BLEND(tqBlue(srcPixel), srcGrey + 165, centre),
+                                         srcAlpha);
+                    }
+
+                    *imagePixel = dstPixel;
+                }
+
+                aboveRow++;
+                centreRow++;
+                belowRow++;
+                imagePixel++;
+            }
+        }
+
+        delete [] selectionRow[aboveRowIndex];
+        delete [] selectionRow[centreRowIndex];
+        delete [] selectionRow[belowRowIndex];
+    }
+}
+
+void KisSelection::paintSelection(TQImage img, const TQRect& scaledImageRect, const TQSize& scaledImageSize, const TQSize& imageSize)
+{
+    if (img.isNull() || scaledImageRect.isEmpty() || scaledImageSize.isEmpty() || imageSize.isEmpty()) {
+        return;
+    }
+
+    Q_ASSERT(img.size() == scaledImageRect.size());
+
+    if (img.size() != scaledImageRect.size()) {
+        return;
+    }
+
+    TQ_INT32 imageWidth = imageSize.width();
+    TQ_INT32 imageHeight = imageSize.height();
+
+    TQRect selectionExtent = extent();
+
+    selectionExtent.setLeft(selectionExtent.left() - 1);
+    selectionExtent.setTop(selectionExtent.top() - 1);
+    selectionExtent.setWidth(selectionExtent.width() + 2);
+    selectionExtent.setHeight(selectionExtent.height() + 2);
+
+    double xScale = static_cast<double>(scaledImageSize.width()) / imageWidth;
+    double yScale = static_cast<double>(scaledImageSize.height()) / imageHeight;
+
+    TQRect scaledSelectionExtent;
+
+    scaledSelectionExtent.setLeft(static_cast<int>(selectionExtent.left() * xScale));
+    scaledSelectionExtent.setRight(static_cast<int>(ceil((selectionExtent.right() + 1) * xScale)) - 1);
+    scaledSelectionExtent.setTop(static_cast<int>(selectionExtent.top() * yScale));
+    scaledSelectionExtent.setBottom(static_cast<int>(ceil((selectionExtent.bottom() + 1) * yScale)) - 1);
+
+    TQRegion uniformRegion = TQRegion(scaledImageRect);
+    uniformRegion -= TQRegion(scaledSelectionExtent);
+
+    if (!uniformRegion.isEmpty()) {
+        paintUniformSelectionRegion(img, scaledImageRect, uniformRegion);
+    }
+
+    TQRect nonuniformRect = scaledImageRect & scaledSelectionExtent;
+
+    if (!nonuniformRect.isEmpty()) {
+
+        const TQ_INT32 scaledImageRectXOffset = nonuniformRect.x() - scaledImageRect.x();
+        const TQ_INT32 scaledImageRectYOffset = nonuniformRect.y() - scaledImageRect.y();
+
+        const TQ_INT32 scaledImageRectX = nonuniformRect.x();
+        const TQ_INT32 scaledImageRectY = nonuniformRect.y();
+        const TQ_INT32 scaledImageRectWidth = nonuniformRect.width();
+        const TQ_INT32 scaledImageRectHeight = nonuniformRect.height();
+
+        const TQ_INT32 imageRowLeft = static_cast<TQ_INT32>(scaledImageRectX / xScale);
+        const TQ_INT32 imageRowRight = static_cast<TQ_INT32>((ceil((scaledImageRectX + scaledImageRectWidth - 1 + 1) / xScale)) - 1);
+
+        const TQ_INT32 imageRowWidth = imageRowRight - imageRowLeft + 1;
+        const TQ_INT32 imageRowStride = imageRowWidth + 2;
+
+        const TQ_INT32 NUM_SELECTION_ROWS = 3;
+
+        TQ_INT32 aboveRowIndex = 0;
+        TQ_INT32 centreRowIndex = 1;
+        TQ_INT32 belowRowIndex = 2;
+
+        TQ_INT32 aboveRowSrcY = -3;
+        TQ_INT32 centreRowSrcY = -3;
+        TQ_INT32 belowRowSrcY = -3;
+
+        TQ_UINT8 *selectionRows = new TQ_UINT8[imageRowStride * NUM_SELECTION_ROWS];
+        TQ_UINT8 *selectionRow[NUM_SELECTION_ROWS];
+
+        selectionRow[0] = selectionRows + 1;
+        selectionRow[1] = selectionRow[0] + imageRowStride;
+        selectionRow[2] = selectionRow[0] + (2 * imageRowStride);
+
+        for (TQ_INT32 y = 0; y < scaledImageRectHeight; ++y) {
+
+            TQ_INT32 scaledY = scaledImageRectY + y;
+            TQ_INT32 srcY = (scaledY * imageHeight) / scaledImageSize.height();
+
+            TQ_UINT8 *aboveRow;
+            TQ_UINT8 *centreRow;
+            TQ_UINT8 *belowRow;
+
+            if (srcY - 1 == aboveRowSrcY) {
+                aboveRow = selectionRow[aboveRowIndex];
+                centreRow = selectionRow[centreRowIndex];
+                belowRow = selectionRow[belowRowIndex];
+            } else if (srcY - 1 == centreRowSrcY) {
+
+                TQ_INT32 oldAboveRowIndex = aboveRowIndex;
+
+                aboveRowIndex = centreRowIndex;
+                centreRowIndex = belowRowIndex;
+                belowRowIndex = oldAboveRowIndex;
+
+                aboveRow = selectionRow[aboveRowIndex];
+                centreRow = selectionRow[centreRowIndex];
+                belowRow = selectionRow[belowRowIndex];
+
+                readBytes(belowRow - 1, imageRowLeft - 1, srcY + 1, imageRowStride, 1);
+
+            } else if (srcY - 1 == belowRowSrcY) {
+
+                TQ_INT32 oldAboveRowIndex = aboveRowIndex;
+                TQ_INT32 oldCentreRowIndex = centreRowIndex;
+
+                aboveRowIndex = belowRowIndex;
+                centreRowIndex = oldAboveRowIndex;
+                belowRowIndex = oldCentreRowIndex;
+
+                aboveRow = selectionRow[aboveRowIndex];
+                centreRow = selectionRow[centreRowIndex];
+                belowRow = selectionRow[belowRowIndex];
+
+                if (belowRowIndex == centreRowIndex + 1) {
+                    readBytes(centreRow - 1, imageRowLeft - 1, srcY, imageRowStride, 2);
+                } else {
+                    readBytes(centreRow - 1, imageRowLeft - 1, srcY, imageRowStride, 1);
+                    readBytes(belowRow - 1, imageRowLeft - 1, srcY + 1, imageRowStride, 1);
+                }
+
+            } else {
+
+                aboveRowIndex = 0;
+                centreRowIndex = 1;
+                belowRowIndex = 2;
+
+                aboveRow = selectionRow[aboveRowIndex];
+                centreRow = selectionRow[centreRowIndex];
+                belowRow = selectionRow[belowRowIndex];
+
+                readBytes(selectionRows, imageRowLeft - 1, srcY - 1, imageRowStride, NUM_SELECTION_ROWS);
+            }
+
+            aboveRowSrcY = srcY - 1;
+            centreRowSrcY = aboveRowSrcY + 1;
+            belowRowSrcY = centreRowSrcY + 1;
+
+            TQRgb *imagePixel = reinterpret_cast<TQRgb *>(img.scanLine(scaledImageRectYOffset + y));
+            imagePixel += scaledImageRectXOffset;
+
+            for (TQ_INT32 x = 0; x < scaledImageRectWidth; ++x) {
+
+                TQ_INT32 scaledX = scaledImageRectX + x;
+                TQ_INT32 srcX = (scaledX * imageWidth) / scaledImageSize.width();
+
+                TQ_UINT8 centre = *(centreRow + srcX - imageRowLeft);
+
+                if (centre != MAX_SELECTED) {
+
+                    // this is where we come if the pixels should be blue or bluish
+
+                    TQRgb srcPixel = *imagePixel;
+                    TQ_UINT8 srcGrey = (tqRed(srcPixel) + tqGreen(srcPixel) + tqBlue(srcPixel)) / 9;
+                    TQ_UINT8 srcAlpha = tqAlpha(srcPixel);
+
+                    // Colour influence is proportional to alphaPixel.
+                    srcGrey = UINT8_MULT(srcGrey, srcAlpha);
+
+                    TQRgb dstPixel;
+
+                    if (centre == MIN_SELECTED) {
+                        //this is where we come if the pixels should be blue (or red outline)
+
+                        TQ_UINT8 left = *(centreRow + (srcX - imageRowLeft) - 1);
+                        TQ_UINT8 right = *(centreRow + (srcX - imageRowLeft) + 1);
+                        TQ_UINT8 above = *(aboveRow + (srcX - imageRowLeft));
+                        TQ_UINT8 below = *(belowRow + (srcX - imageRowLeft));
+
+                        // Stop unselected transparent areas from appearing the same
+                        // as selected transparent areas.
+                        TQ_UINT8 dstAlpha = TQMAX(srcAlpha, 192);
+
+                        // now for a simple outline based on 4-connectivity
+                        if (left != MIN_SELECTED || right != MIN_SELECTED || above != MIN_SELECTED || below != MIN_SELECTED) {
+                            dstPixel = tqRgba(255, 0, 0, dstAlpha);
+                        } else {
+                            dstPixel = tqRgba(128 + srcGrey, 128 + srcGrey, 165 + srcGrey, dstAlpha);
+                        }
+                    } else {
+                        dstPixel = tqRgba(UINT8_BLEND(tqRed(srcPixel), srcGrey + 128, centre),
+                                         UINT8_BLEND(tqGreen(srcPixel), srcGrey + 128, centre),
+                                         UINT8_BLEND(tqBlue(srcPixel), srcGrey + 165, centre),
+                                         srcAlpha);
+                    }
+
+                    *imagePixel = dstPixel;
+                }
+
+                imagePixel++;
+            }
+        }
+
+        delete [] selectionRows;
+    }
+}
+
+void KisSelection::setDirty(const TQRect& rc)
+{
+    if (m_dirty)
+        super::setDirty(rc);
+}
+
+void KisSelection::setDirty()
+{
+    if (m_dirty)
+        super::setDirty();
+}
diff --git a/chalk/core/kis_selection.h b/chalk/core/kis_selection.h
new file mode 100644
index 000000000..f41915dae
--- /dev/null
+++ b/chalk/core/kis_selection.h
@@ -0,0 +1,160 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+#ifndef KIS_SELECTION_H_
+#define KIS_SELECTION_H_
+
+#include <tqrect.h>
+
+#include "kis_types.h"
+#include "kis_paint_device.h"
+
+#include <koffice_export.h>
+
+
+enum enumSelectionMode {
+    SELECTION_ADD,
+    SELECTION_SUBTRACT
+};
+
+/**
+ * KisSelection contains a byte-map representation of a layer, where
+ * the value of a byte signifies whether a corresponding pixel is selected, or not.
+ *
+ * NOTE: If you need to manually call emitSelectionChanged on the owner paint device
+ *       of a selection. KisSelection does not emit any signals by itself because
+ *       often you want to combine several actions in to perfom one operation and you
+ *       do not want recomposition to happen all the time.
+ */
+class KRITACORE_EXPORT KisSelection : public KisPaintDevice {
+
+    typedef KisPaintDevice super;
+
+public:
+    /**
+     * Create a new KisSelection
+    * @param dev the tqparent paint device. The selection will never be bigger than the tqparent
+     *              paint device.
+     */
+    KisSelection(KisPaintDeviceSP dev);
+
+    /**
+     * Create a new KisSelection. This selection will not have a tqparent paint device.
+     */
+    KisSelection();
+    
+    /**
+     * Copy the selection
+     */
+    KisSelection(const KisSelection& rhs);
+    
+    virtual ~KisSelection();
+
+    // Returns selectedness, or 0 if invalid coordinates
+    TQ_UINT8 selected(TQ_INT32 x, TQ_INT32 y);
+
+    void setSelected(TQ_INT32 x, TQ_INT32 y, TQ_UINT8 s);
+
+    TQImage tqmaskImage();
+
+    void select(TQRect r);
+
+    void invert();
+
+    void clear(TQRect r);
+
+    void clear();
+
+    /// Tests if the the rect is totally outside the selection
+    bool isTotallyUnselected(TQRect r);
+
+    /**
+     * Tests if the the rect is totally outside the selection, but uses selectedRect
+     * instead of selectedRect, and this is faster (but might deliver false positives!)
+     *
+     * XXX: This comment makes no sense anymore! (BSAR)
+     */
+    bool isProbablyTotallyUnselected(TQRect r);
+
+    /**
+     * Rough, but fastish way of determining the area
+     * of the tiles used by the selection.
+     */
+    TQRect selectedRect() const;
+
+    /**
+     * Slow, but exact way of determining the rectangle
+     * that encloses the selection
+     */
+    TQRect selectedExactRect() const;
+
+    void paintSelection(TQImage img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+    void paintSelection(TQImage img, const TQRect& scaledImageRect, const TQSize& scaledImageSize, const TQSize& imageSize);
+
+    void startCachingExactRect();
+    void stopCachingExactRect();
+
+    // if the tqparent layer is interested in keeping up to date with the dirtyness
+    // of this layer, set to true
+    void setInterestedInDirtyness(bool b) { m_dirty = b; }
+    bool interestedInDirtyness() const { return m_dirty; }
+
+    virtual void setDirty(const TQRect & rc);
+    virtual void setDirty();
+    inline KisPaintDeviceSP tqparentPaintDevice() { return m_parentPaintDevice; }
+private:
+    void paintUniformSelectionRegion(TQImage img, const TQRect& imageRect, const TQRegion& uniformRegion);
+
+private:
+
+    // We don't want these methods to be used on selections:
+    void extent(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const 
+        { 
+            KisPaintDevice::extent(x,y,w,h);
+        }
+    
+    TQRect extent() const { return KisPaintDevice::extent(); }
+    
+    void exactBounds(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const 
+        {
+            return KisPaintDevice::exactBounds(x,y,w,h);
+        }   
+
+    TQRect exactBounds() const
+        {
+            return KisPaintDevice::exactBounds();
+        }
+
+    TQRect exactBoundsOldMethod() const 
+        {
+            return KisPaintDevice::exactBoundsOldMethod();
+        }
+
+    TQRect exactBoundsImprovedOldMethod() const
+        {
+            return KisPaintDevice::exactBoundsImprovedOldMethod();
+        }
+
+
+private:
+    KisPaintDeviceSP m_parentPaintDevice;
+    bool m_doCacheExactRect;
+    TQRect m_cachedExactRect;
+    bool m_dirty;
+};
+
+#endif // KIS_SELECTION_H_
diff --git a/chalk/core/kis_shear_visitor.h b/chalk/core/kis_shear_visitor.h
new file mode 100644
index 000000000..9a48181eb
--- /dev/null
+++ b/chalk/core/kis_shear_visitor.h
@@ -0,0 +1,95 @@
+/*
+ *  Copyright (c) 2006 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_SHEAR_VISITOR_H_
+#define KIS_SHEAR_VISITOR_H_
+
+#include "kis_types.h"
+#include "kis_progress_subject.h"
+#include "kis_layer_visitor.h"
+#include "kis_transform_worker.h"
+#include "kis_filter_strategy.h"
+#include "kis_undo_adapter.h"
+#include "kis_transaction.h"
+#include "kis_rotate_visitor.h"
+
+class KisShearVisitor : public KisLayerVisitor {
+public:
+    KisShearVisitor(double xshear, double yshear, KisProgressDisplayInterface *progress)
+        : m_xshear(xshear), m_yshear(yshear), m_progress(progress), m_strategy(0), m_undo(0) {};
+
+    void setStrategy(KisFilterStrategy* strategy) { m_strategy = strategy; }
+    void setUndoAdapter(KisUndoAdapter* undo) { m_undo = undo; }
+public:
+    virtual bool visit(KisPaintLayer* layer) {
+        KisPaintDeviceSP dev = layer->paintDevice();
+        if(!dev)
+            return true;
+
+        KisFilterStrategy* strategy = 0;
+        if (m_strategy)
+            strategy = m_strategy;
+        else
+            strategy = new KisMitchellFilterStrategy;
+
+        KisTransaction* t = 0;
+
+        if (m_undo && m_undo->undo())
+            t = new KisTransaction("", dev.data());
+
+        //Doesn't do anything, internally transforms x and y shear to 0 each :-///
+        //KisTransformWorker w(dev, 1.0, 1.0, m_xshear, m_yshear, 0, 0, 0, m_progress, strategy);
+        //w.run();
+
+        KisRotateVisitor v;
+        v.visitKisPaintDevice(dev);
+        v.shear(m_xshear, m_yshear, m_progress);
+
+        if (m_undo && m_undo->undo())
+            m_undo->addCommand(t);
+
+        if (!m_strategy)
+            delete strategy;
+
+        layer->setDirty();
+
+        return true;
+    }
+
+    virtual bool visit(KisGroupLayer* layer) {
+        KisLayerSP child = layer->firstChild();
+
+        while(child)
+        {
+            child->accept(*this);
+            child = child->nextSibling();
+        }
+        return true;
+    }
+
+    virtual bool visit(KisPartLayer*) { return true; }
+    virtual bool visit(KisAdjustmentLayer *) { return true; }
+private:
+    double m_xshear;
+    double m_yshear;
+    KisProgressDisplayInterface* m_progress;
+    KisFilterStrategy* m_strategy;
+    KisUndoAdapter* m_undo;
+};
+
+#endif // KIS_SHEAR_VISITOR_H_
diff --git a/chalk/core/kis_strategy_move.cc b/chalk/core/kis_strategy_move.cc
new file mode 100644
index 000000000..7391777c2
--- /dev/null
+++ b/chalk/core/kis_strategy_move.cc
@@ -0,0 +1,148 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <tqpoint.h>
+#include <tqcolor.h>
+
+#include <kaction.h>
+#include <kcommand.h>
+#include <klocale.h>
+#include <kdebug.h>
+
+#include "kis_canvas_controller.h"
+#include "kis_canvas_subject.h"
+#include "kis_image.h"
+#include "kis_layer.h"
+#include "kis_strategy_move.h"
+#include "kis_undo_adapter.h"
+
+KisStrategyMove::KisStrategyMove()
+{
+    reset(0);
+}
+
+KisStrategyMove::KisStrategyMove(KisCanvasSubject *subject)
+{
+    reset(subject);
+}
+
+KisStrategyMove::~KisStrategyMove()
+{
+}
+
+void KisStrategyMove::reset(KisCanvasSubject *subject)
+{
+    m_subject = subject;
+    m_dragging = false;
+
+    if (m_subject) {
+        m_controller = subject->canvasController();
+    } else {
+        m_controller = 0;
+    }
+}
+
+void KisStrategyMove::startDrag(const TQPoint& pos)
+{
+    // pos is the user chosen handle point
+
+    if (m_subject) {
+        KisImageSP img;
+        KisLayerSP dev;
+
+        if (!(img = m_subject->currentImg()))
+            return;
+
+        dev = img->activeLayer();
+
+        if (!dev || !dev->visible())
+            return;
+
+        m_dragging = true;
+        m_dragStart.setX(pos.x());
+        m_dragStart.setY(pos.y());
+        m_layerStart.setX(dev->x());
+        m_layerStart.setY(dev->y());
+        m_layerPosition = m_layerStart;
+    }
+}
+
+void KisStrategyMove::drag(const TQPoint& original)
+{
+    // original is the position of the user chosen handle point
+
+    if (m_subject && m_dragging) {
+        KisImageSP img = m_subject->currentImg();
+        KisLayerSP dev;
+
+        if (img && (dev = img->activeLayer())) {
+            TQPoint pos = original;
+            TQRect rc;
+
+            pos -= m_dragStart; // convert to delta
+            rc = dev->extent();
+            dev->setX(dev->x() + pos.x());
+            dev->setY(dev->y() + pos.y());
+            rc = rc.unite(dev->extent());
+
+            m_layerPosition = TQPoint(dev->x(), dev->y());
+            m_dragStart = original;
+
+            dev->setDirty(rc);
+        }
+    }
+}
+
+void KisStrategyMove::endDrag(const TQPoint& pos, bool undo)
+{
+    if (m_subject && m_dragging) {
+        KisImageSP img = m_subject->currentImg();
+        KisLayerSP dev;
+
+        if (img && (dev = img->activeLayer())) {
+            drag(pos);
+            m_dragging = false;
+
+            if (undo && img->undo()) {
+                KCommand *cmd = dev->moveCommand(m_layerStart, m_layerPosition);
+                Q_CHECK_PTR(cmd);
+                
+                KisUndoAdapter *adapter = img->undoAdapter();
+                if (adapter) {
+                    adapter->addCommand(cmd);
+                } else {
+                    delete cmd;
+                }
+            }
+            img->setModified();
+        }
+    }
+}
+
+void KisStrategyMove::simpleMove(const TQPoint& pt1, const TQPoint& pt2)
+{
+    startDrag(pt1);
+    endDrag(pt2);
+}
+
+void KisStrategyMove::simpleMove(TQ_INT32 x1, TQ_INT32 y1, TQ_INT32 x2, TQ_INT32 y2)
+{
+    startDrag(TQPoint(x1, y1));
+    endDrag(TQPoint(x2, y2));
+}
+
diff --git a/chalk/core/kis_strategy_move.h b/chalk/core/kis_strategy_move.h
new file mode 100644
index 000000000..c3535be99
--- /dev/null
+++ b/chalk/core/kis_strategy_move.h
@@ -0,0 +1,59 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien  <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_STRATEGY_MOVE_H_
+#define KIS_STRATEGY_MOVE_H_
+
+#include <tqpoint.h>
+#include <tqrect.h>
+
+#include <koffice_export.h>
+
+class KisCanvasController;
+class KisCanvasSubject;
+
+class KRITAUI_EXPORT KisStrategyMove {
+public:
+    KisStrategyMove();
+    explicit KisStrategyMove(KisCanvasSubject *subject);
+    virtual ~KisStrategyMove();
+
+public:
+    void reset(KisCanvasSubject *subject);
+    void startDrag(const TQPoint& pos);
+    void drag(const TQPoint& pos);
+    void endDrag(const TQPoint& pos, bool undo = true);
+    void simpleMove(const TQPoint& pt1, const TQPoint& pt2);
+    void simpleMove(TQ_INT32 x1, TQ_INT32 y1, TQ_INT32 x2, TQ_INT32 y2);
+
+private:
+    KisStrategyMove(const KisStrategyMove&);
+    KisStrategyMove& operator=(const KisStrategyMove&);
+
+private:
+    KisCanvasController *m_controller;
+    KisCanvasSubject *m_subject;
+    TQRect m_deviceBounds;
+    TQPoint m_dragStart;
+    TQPoint m_layerStart;
+    TQPoint m_layerPosition;
+    bool m_dragging;
+};
+
+#endif // KIS_STRATEGY_MOVE_H_
+
diff --git a/chalk/core/kis_substrate.h b/chalk/core/kis_substrate.h
new file mode 100644
index 000000000..274f26800
--- /dev/null
+++ b/chalk/core/kis_substrate.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2006 Boudewijn Rempt (boud@valdyas.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_SUBSTRATE_H
+#define KIS_SUBSTRATE_H
+
+#include <tqrect.h>
+#include <ksharedptr.h>
+
+class KisImage;
+
+/// All values are normalized to a range between 0 and 1.
+/// XXX: Do we need more?
+struct KisSubstratePixel {
+    float height;      // absolute height of the current position
+    float smoothness;  // determines how easily the painting tool "slips" over the surface
+    float absorbency;  // determines how much wetness the substrate can absorb. XXX: How about speed of absorbing?
+    float density;     // XXX?
+    TQ_UINT8 r;           //.Red component of reflectivity
+    TQ_UINT8 g;           // Green component of reflectivity
+    TQ_UINT8 b;           // Blue component of reflectivity
+    TQ_UINT8 alpha;     // For composition with the background
+};
+
+/**
+ * This abstract class defines the properties of a substrate -- that is, the simulation
+ * of the paper or canvas for natural media.
+ *
+ * Subclass this interface to define a specific type of substrate: repeating,
+ * or full-size, with specific and cool ways of generating the surface, or
+ * maybe based on scans of real substrates.
+ */
+class KisSubstrate : public KShared {
+
+public:
+
+    KisSubstrate(KisImage * /*img*/) : KShared() {};
+    virtual ~KisSubstrate() {};
+
+
+    /**
+     * Copy the pixel values in the specified rect into an array of Substrate.
+     * Make sure the array is big enough!
+     */ 
+    virtual void getPixels(KisSubstratePixel * substrate, const TQRect & rc) const = 0;
+
+    /**
+     * Copy the specified rect of substrate pixels onto the substrate. Make sure
+     * the array is big enough.
+     */
+    virtual void writePixels(const KisSubstratePixel * substrate, const TQRect & rc) = 0;
+    /**
+     * Read the value at the specified position into the given substrate pixel.
+     */
+    virtual void getPixel(KisSubstratePixel * ksp, int x, int y) const = 0;
+
+    /**
+     * Copy the value of the given substrate pixel to the specified location.
+     */
+    virtual void writePixel(const KisSubstratePixel & ksp, int x, int y) = 0;
+    
+};
+
+#endif
diff --git a/chalk/core/kis_thread.h b/chalk/core/kis_thread.h
new file mode 100644
index 000000000..61feda24d
--- /dev/null
+++ b/chalk/core/kis_thread.h
@@ -0,0 +1,57 @@
+/*
+ *  copyright (c) 2005 Boudewijn Rempt
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+
+#ifndef KIS_THREAD_
+#define KIS_THREAD_
+
+#include <tqthread.h>
+#include <ksharedptr.h>
+
+/**
+ * A KisThread is a TQThread that can be set in the canceled state.
+ * Lengthy operations initiated in run() should regularly read the
+ * canceled state and stop when it's set to true
+ */
+class KisThread : public TQThread {
+    
+public:
+
+    /**
+     * Create a new KisThread with the canceled state set to false
+     */
+    KisThread() : TQThread(), m_canceled(false) {};
+
+    /**
+     * Request the thread to cancel at the first opportunity. Note
+     * that the owner of the thread is responsible for restoring the
+     * previous state of paint devices etc, the thread itself just stops
+     * as soon as possible.
+     */
+    virtual void cancel() { m_canceled = true; }
+    virtual bool isCanceled() { return m_canceled; }
+
+    void runDirectly() { run(); }
+    
+protected:
+    
+    bool m_canceled;
+
+};
+
+
+#endif
diff --git a/chalk/core/kis_thread_pool.cc b/chalk/core/kis_thread_pool.cc
new file mode 100644
index 000000000..e617c8cb2
--- /dev/null
+++ b/chalk/core/kis_thread_pool.cc
@@ -0,0 +1,192 @@
+/*
+ *  copyright (c) 2006 Boudewijn Rempt
+ *
+ *  This program is free software; you can distribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_thread_pool.h"
+#include <kglobal.h>
+#include <kconfig.h>
+#include <kdebug.h>
+
+KisThreadPool * KisThreadPool::m_singleton = 0;
+
+KisThreadPool::KisThreadPool()
+{
+    Q_ASSERT(KisThreadPool::m_singleton == 0);
+
+    KisThreadPool::m_singleton = this;
+
+    KConfig * cfg = KGlobal::config();
+    cfg->setGroup("");
+    m_maxThreads = cfg->readNumEntry("maxthreads",  10);
+    m_numberOfRunningThreads = 0;
+    m_numberOfQueuedThreads = 0;
+    m_wait = 200;
+
+    start();
+}
+
+
+KisThreadPool::~KisThreadPool()
+{
+    m_poolMutex.lock();
+
+    m_canceled = true;
+
+    m_runningThreads.setAutoDelete(true);
+    m_threads.setAutoDelete(true);
+    m_oldThreads.setAutoDelete(true);
+
+    KisThread * t;
+
+    for ( t = m_threads.first(); t; t = m_threads.next()) {
+        if (t) {
+            t->cancel();
+            t->wait();
+            m_threads.remove(t);
+        }
+    }
+
+    for ( t = m_runningThreads.first(); t; t = m_runningThreads.next()) {
+        if (t) {
+            t->cancel();
+            t->wait();
+            m_runningThreads.remove(t);
+        }
+    }
+
+    for ( t = m_oldThreads.first(); t; t = m_oldThreads.next()) {
+        if (t) {
+            t->cancel();
+            t->wait();
+            m_runningThreads.remove(t);
+        }
+    }
+    KisThreadPool::m_singleton = 0;
+    m_poolMutex.unlock();
+
+}
+
+
+KisThreadPool * KisThreadPool::instance()
+{
+    if(KisThreadPool::m_singleton == 0)
+    {
+        KisThreadPool::m_singleton = new KisThreadPool();
+    }
+    else {
+
+        if (KisThreadPool::m_singleton->finished()) {
+            delete KisThreadPool::m_singleton;
+            KisThreadPool::m_singleton = 0;
+            KisThreadPool::m_singleton = new KisThreadPool();
+        }
+    }
+
+    return KisThreadPool::m_singleton;
+}
+
+void KisThreadPool::enqueue(KisThread * thread)
+{
+    m_poolMutex.lock();
+    m_threads.append(thread);
+    m_numberOfQueuedThreads++;
+    m_poolMutex.unlock();
+    m_wait = 200;
+}
+
+
+void KisThreadPool::dequeue(KisThread * thread)
+{
+    KisThread * t = 0;
+
+    m_poolMutex.lock();
+
+    int i = m_threads.tqfindRef(thread);
+    if (i >= 0) {
+        t = m_threads.take(i);
+        m_numberOfQueuedThreads--;
+    } else {
+        i = m_runningThreads.tqfindRef(thread);
+        if (i >= 0) {
+            t = m_runningThreads.take(i);
+            m_numberOfRunningThreads--;
+        }
+        else {
+            i = m_oldThreads.tqfindRef(thread);
+            if (i >= 0) {
+                t = m_oldThreads.take(i);
+            }
+        }
+    }
+
+    m_poolMutex.unlock();
+
+    if (t) {
+        t->cancel();
+        t->wait();
+        delete t;
+    }
+
+}
+
+void KisThreadPool::run()
+{
+    int sleeps = 10;
+
+    while(!m_canceled) {
+        if (m_numberOfQueuedThreads > 0 && m_numberOfRunningThreads < m_maxThreads) {
+            KisThread * thread = 0;
+            m_poolMutex.lock();
+            if (m_threads.count() > 0) {
+                thread = m_threads.take();
+                m_numberOfQueuedThreads--;
+            }
+            if (thread) {
+                thread->start();
+                m_runningThreads.append(thread);
+                m_numberOfRunningThreads++;
+            }
+            m_poolMutex.unlock();
+        }
+        else {
+            msleep(m_wait);
+            m_poolMutex.lock();
+            for ( KisThread * t = m_runningThreads.first(); t; t = m_runningThreads.next()) {
+                if (t) {
+                    if (t->finished()) {
+                        m_runningThreads.remove(t);
+                        m_numberOfRunningThreads--;
+                        m_oldThreads.append(t);
+                    }
+                }
+            }
+            m_poolMutex.unlock();
+            m_poolMutex.lock();
+            if (m_numberOfQueuedThreads == 0 && m_numberOfRunningThreads == 0) {
+                sleeps--;
+                if (sleeps == 0) {
+                    m_poolMutex.unlock();
+                    return;
+                }
+                m_poolMutex.unlock();
+
+            }
+            m_poolMutex.unlock();
+
+        }
+    }
+}
diff --git a/chalk/core/kis_thread_pool.h b/chalk/core/kis_thread_pool.h
new file mode 100644
index 000000000..904606bfa
--- /dev/null
+++ b/chalk/core/kis_thread_pool.h
@@ -0,0 +1,70 @@
+/*
+ *  copyright (c) 2006 Boudewijn Rempt
+ *
+ *  This program is free software; you can distribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_THREAD_POOL_
+#define KIS_THREAD_POOL_
+
+#include <tqthread.h>
+#include <tqptrlist.h>
+#include <tqmutex.h>
+
+#include "kis_thread.h"
+
+/**
+ * A thread pool starts executing threads some time after they are added,
+ * running a maximum number of threads at one time.
+ *
+ * The pool takes ownership of the threads and _deletes_ them once they
+ * have run. This means that you cannot add getters for important data to
+ * threads you feed the threadpool. Instead, post the data using a customevent.
+ */
+class KisThreadPool : public KisThread {
+
+public:
+
+    virtual ~KisThreadPool();
+
+    static KisThreadPool * instance();
+
+    void enqueue(KisThread * thread);
+    void dequeue(KisThread * thread);
+    
+    void run();
+    
+    
+    KisThreadPool();
+
+private:
+
+    KisThreadPool(const KisThreadPool&);
+    KisThreadPool operator=(const KisThreadPool&);
+
+    TQMutex m_poolMutex;
+    int m_numberOfRunningThreads;
+    int m_numberOfQueuedThreads;
+    int m_maxThreads;
+    int m_wait;
+    TQPtrList<KisThread> m_threads;
+    TQPtrList<KisThread> m_runningThreads;
+    TQPtrList<KisThread> m_oldThreads;
+    
+    static KisThreadPool * m_singleton;
+};
+
+
+#endif
diff --git a/chalk/core/kis_transaction.cc b/chalk/core/kis_transaction.cc
new file mode 100644
index 000000000..b755c5978
--- /dev/null
+++ b/chalk/core/kis_transaction.cc
@@ -0,0 +1,94 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kis_types.h"
+#include "kis_global.h"
+#include "kis_tile.h"
+#include "kis_tileddatamanager.h"
+#include "kis_image.h"
+#include "kis_transaction.h"
+#include "kis_memento.h"
+#include "kis_paint_device.h"
+#include "kis_layer.h"
+
+class KisTransactionPrivate {
+public:
+    TQString m_name;
+    KisPaintDeviceSP m_device;
+    KisMementoSP m_memento;
+
+};
+
+KisTransaction::KisTransaction(const TQString& name, KisPaintDeviceSP device)
+{
+    m_private = new KisTransactionPrivate;
+
+    m_private->m_name = name;
+    m_private->m_device = device;
+    m_private->m_memento = device->getMemento();
+}
+
+KisTransaction::~KisTransaction()
+{
+    if (m_private->m_memento) {
+        // For debugging purposes
+        m_private->m_memento->setInvalid();
+    }
+    delete m_private;
+}
+
+void KisTransaction::execute()
+{
+    Q_ASSERT(m_private->m_memento != 0);
+
+    m_private->m_device->rollforward(m_private->m_memento);
+
+    TQRect rc;
+    TQ_INT32 x, y, width, height;
+    m_private->m_memento->extent(x,y,width,height);
+    rc.setRect(x + m_private->m_device->getX(), y + m_private->m_device->getY(), width, height);
+
+    KisLayerSP l = m_private->m_device->tqparentLayer();
+    if (l) l->setDirty(rc);
+}
+
+void KisTransaction::unexecute()
+{
+    Q_ASSERT(m_private->m_memento != 0);
+    m_private->m_device->rollback(m_private->m_memento);
+
+    TQRect rc;
+    TQ_INT32 x, y, width, height;
+    m_private->m_memento->extent(x,y,width,height);
+    rc.setRect(x + m_private->m_device->getX(), y + m_private->m_device->getY(), width, height);
+
+    KisLayerSP l = m_private->m_device->tqparentLayer();
+    if (l) l->setDirty(rc);
+
+}
+
+void KisTransaction::unexecuteNoUpdate()
+{
+    Q_ASSERT(m_private->m_memento != 0);
+
+    m_private->m_device->rollback(m_private->m_memento);
+}
+
+TQString KisTransaction::name() const
+{
+    return m_private->m_name;
+}
diff --git a/chalk/core/kis_transaction.h b/chalk/core/kis_transaction.h
new file mode 100644
index 000000000..521b0204d
--- /dev/null
+++ b/chalk/core/kis_transaction.h
@@ -0,0 +1,46 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_TILE_COMMAND_H_
+#define KIS_TILE_COMMAND_H_
+
+#include <tqstring.h>
+
+#include <kcommand.h>
+
+#include "kis_types.h"
+
+class TQRect;
+class KisTransactionPrivate;
+
+class KisTransaction : public KCommand {
+public:
+    KisTransaction(const TQString& name, KisPaintDeviceSP device);
+    virtual ~KisTransaction();
+
+public:
+    virtual void execute();
+    virtual void unexecute();
+    virtual void unexecuteNoUpdate();
+    virtual TQString name() const;
+private:
+    KisTransactionPrivate * m_private;
+};
+
+#endif // KIS_TILE_COMMAND_H_
+
diff --git a/chalk/core/kis_transform_visitor.h b/chalk/core/kis_transform_visitor.h
new file mode 100644
index 000000000..9e6f51c0f
--- /dev/null
+++ b/chalk/core/kis_transform_visitor.h
@@ -0,0 +1,137 @@
+/*
+ *  Copyright (c) 2006 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_TRANSFORM_VISITOR_H_
+#define KIS_TRANSFORM_VISITOR_H_
+
+#include "tqrect.h"
+
+#include "klocale.h"
+
+#include "kis_layer_visitor.h"
+#include "kis_types.h"
+#include "kis_layer.h"
+#include "kis_group_layer.h"
+#include "kis_paint_layer.h"
+#include "kis_adjustment_layer.h"
+#include "kis_transaction.h"
+#include "kis_transform_worker.h"
+#include <kis_selected_transaction.h>
+
+class KisProgressDisplayInterface;
+class KisFilterStrategy;
+
+class KisTransformVisitor : public KisLayerVisitor {
+
+public:
+
+    KisTransformVisitor(KisImageSP img, double  xscale, double  yscale,
+        double  /*xshear*/, double  /*yshear*/, double angle,
+        TQ_INT32  tx, TQ_INT32  ty, KisProgressDisplayInterface *progress, KisFilterStrategy *filter) 
+        : KisLayerVisitor()
+        , m_sx(xscale)
+        , m_sy(yscale)
+        , m_tx(tx)
+        , m_ty(ty)
+        , m_filter(filter)
+        , m_angle(angle)
+        , m_progress(progress)
+        , m_img(img)
+    {
+    }
+
+    virtual ~KisTransformVisitor()
+    {
+    }
+
+    /**
+     * Crops the specified layer and adds the undo information to the undo adapter of the
+     * layer's image.
+     */
+    bool visit(KisPaintLayer *layer) 
+    {
+        KisPaintDeviceSP dev = layer->paintDevice();
+
+        KisTransaction * t = 0;
+        if (m_img->undo()) {
+            t = new KisTransaction(i18n("Rotate Layer"), dev);
+            Q_CHECK_PTR(t);
+	}
+
+        KisTransformWorker tw(dev, m_sx, m_sy, 0.0, 0.0, m_angle, m_tx, m_ty, m_progress, m_filter, true);
+        tw.run();
+
+        if (m_img->undo()) {
+            m_img->undoAdapter()->addCommand(t);
+	}
+        layer->setDirty();
+        return true;
+    };
+
+    bool visit(KisGroupLayer *layer)
+    {
+	layer->resetProjection();
+
+        KisLayerSP child = layer->firstChild();
+        while (child) {
+            child->accept(*this);
+            child = child->nextSibling();
+        }
+        layer->setDirty();
+        return true;
+    };
+
+    bool visit(KisPartLayer */*layer*/)
+    {
+        return true;
+    };
+
+    virtual bool visit(KisAdjustmentLayer* layer)
+    {
+        KisPaintDeviceSP dev = layer->selection().data();
+        
+        KisTransaction * t = 0;
+
+        if (m_img->undo()) {
+            t = new KisTransaction(i18n("Rotate Layer"), dev);
+            Q_CHECK_PTR(t);
+        }
+
+        KisTransformWorker tw(dev, m_sx, m_sy, 0.0, 0.0, m_angle, m_tx, m_ty, m_progress, m_filter, true);
+        tw.run();
+
+        if (m_img->undo()) {
+            m_img->undoAdapter()->addCommand(t);
+        }
+        layer->setDirty();
+        
+        layer->resetCache();
+        return true;
+    }
+    
+
+private:
+    double m_sx, m_sy;
+    TQ_INT32 m_tx, m_ty;
+    KisFilterStrategy *m_filter;
+    double m_angle;
+    KisProgressDisplayInterface *m_progress;
+    KisImageSP m_img;
+};
+
+
+#endif
diff --git a/chalk/core/kis_transform_worker.cc b/chalk/core/kis_transform_worker.cc
new file mode 100644
index 000000000..fbc952eaa
--- /dev/null
+++ b/chalk/core/kis_transform_worker.cc
@@ -0,0 +1,676 @@
+/*
+ *  Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de> filters
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org> right angle rotators
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kis_debug_areas.h"
+#include "kis_paint_device.h"
+#include "kis_selection.h"
+#include "kis_transform_worker.h"
+#include "kis_progress_display_interface.h"
+#include "kis_iterators_pixel.h"
+#include "kis_filter_strategy.h"
+#include "kis_layer.h"
+#include "kis_painter.h"
+
+KisTransformWorker::KisTransformWorker(KisPaintDeviceSP dev, double xscale, double yscale,
+                    double xshear, double yshear, double rotation,
+                    TQ_INT32 xtranslate, TQ_INT32 ytranslate,
+                    KisProgressDisplayInterface *progress, KisFilterStrategy *filter, bool fixBorderAlpha)
+{
+    m_dev= dev;
+    m_xscale = xscale;
+    m_yscale = yscale;
+    m_xshear = xshear;
+    m_yshear = yshear;
+    m_rotation = rotation,
+    m_xtranslate = xtranslate;
+    m_ytranslate = ytranslate;
+    m_progress = progress;
+    m_filter = filter;
+    m_fixBorderAlpha = fixBorderAlpha;
+}
+
+void KisTransformWorker::rotateNone(KisPaintDeviceSP src, KisPaintDeviceSP dst)
+{
+    KisSelectionSP dstSelection;
+    TQ_INT32 pixelSize = src->pixelSize();
+    TQRect r;
+    KisColorSpace *cs = src->colorSpace();
+
+    if(src->hasSelection())
+    {
+        r = src->selection()->selectedExactRect();
+        dstSelection = dst->selection();
+    }
+    else
+    {
+        r = src->exactBounds();
+        dstSelection = new KisSelection(dst); // essentially a dummy to be deleted
+    }
+
+    KisHLineIteratorPixel hit = src->createHLineIterator(r.x(), r.top(), r.width(), true);
+    KisHLineIterator vit = dst->createHLineIterator(r.x(), r.top(), r.width(), true);
+    KisHLineIterator dstSelIt = dstSelection->createHLineIterator(r.x(), r.top(), r.width(), true);
+    for (TQ_INT32 i = 0; i < r.height(); ++i) {
+            while (!hit.isDone()) {
+            if (hit.isSelected())  {
+                memcpy(vit.rawData(), hit.rawData(), pixelSize);
+
+                // XXX: Should set alpha = alpha*(1-selectedness)
+                cs->setAlpha(hit.rawData(), 0, 1);
+            }
+            *(dstSelIt.rawData()) = hit.selectedness();
+            ++hit;
+            ++vit;
+            ++dstSelIt;
+        }
+        hit.nextRow();
+        vit.nextRow();
+        dstSelIt.nextRow();
+
+        //progress info
+        m_progressStep += r.width();
+        if(m_lastProgressReport != (m_progressStep * 100) / m_progressTotalSteps)
+        {
+            m_lastProgressReport = (m_progressStep * 100) / m_progressTotalSteps;
+            emit notifyProgress(m_lastProgressReport);
+        }
+        if (m_cancelRequested) {
+            break;
+        }
+    }
+}
+
+void KisTransformWorker::rotateRight90(KisPaintDeviceSP src, KisPaintDeviceSP dst)
+{
+    KisSelectionSP dstSelection;
+    TQ_INT32 pixelSize = src->pixelSize();
+    TQRect r;
+    KisColorSpace *cs = src->colorSpace();
+
+    if(src->hasSelection())
+    {
+        r = src->selection()->selectedExactRect();
+        dstSelection = dst->selection();
+    }
+    else
+    {
+        r = src->exactBounds();
+        dstSelection = new KisSelection(dst); // essentially a dummy to be deleted
+    }
+
+    for (TQ_INT32 y = r.bottom(); y >= r.top(); --y) {
+        KisHLineIteratorPixel hit = src->createHLineIterator(r.x(), y, r.width(), true);
+        KisVLineIterator vit = dst->createVLineIterator(-y, r.x(), r.width(), true);
+        KisVLineIterator dstSelIt = dstSelection->createVLineIterator(-y, r.x(), r.width(), true);
+
+            while (!hit.isDone()) {
+            if (hit.isSelected())  {
+                memcpy(vit.rawData(), hit.rawData(), pixelSize);
+
+                // XXX: Should set alpha = alpha*(1-selectedness)
+                cs->setAlpha(hit.rawData(), 0, 1);
+            }
+            *(dstSelIt.rawData()) = hit.selectedness();
+            ++hit;
+            ++vit;
+            ++dstSelIt;
+        }
+
+        //progress info
+        m_progressStep += r.width();
+        if(m_lastProgressReport != (m_progressStep * 100) / m_progressTotalSteps)
+        {
+            m_lastProgressReport = (m_progressStep * 100) / m_progressTotalSteps;
+            emit notifyProgress(m_lastProgressReport);
+        }
+        if (m_cancelRequested) {
+            break;
+        }
+    }
+}
+
+void KisTransformWorker::rotateLeft90(KisPaintDeviceSP src, KisPaintDeviceSP dst)
+{
+    kdDebug() << "rotateLeft90 called\n";
+    KisSelectionSP dstSelection;
+    TQ_INT32 pixelSize = src->pixelSize();
+    TQRect r;
+    KisColorSpace *cs = src->colorSpace();
+
+    if(src->hasSelection())
+    {
+        r = src->selection()->selectedExactRect();
+        dstSelection = dst->selection();
+    }
+    else
+    {
+        r = src->exactBounds();
+        dstSelection = new KisSelection(dst); // essentially a dummy to be deleted
+    }
+    TQ_INT32 x = 0;
+
+    for (TQ_INT32 y = r.top(); y <= r.bottom(); ++y) {
+        // Read the horizontal line from back to front, write onto the vertical column
+        KisHLineIteratorPixel hit = src->createHLineIterator(r.x(), y, r.width(), true);
+        KisVLineIterator vit = dst->createVLineIterator(y, -r.x() - r.width(), r.width(), true);
+        KisVLineIterator dstSelIt = dstSelection->createVLineIterator(y, -r.x() - r.width(), r.width(), true);
+
+        hit += r.width() - 1;
+        while (!vit.isDone()) {
+            if (hit.isSelected()) {
+                memcpy(vit.rawData(), hit.rawData(), pixelSize);
+
+                // XXX: Should set alpha = alpha*(1-selectedness)
+                cs->setAlpha(hit.rawData(), 0, 1);
+            }
+            *(dstSelIt.rawData()) = hit.selectedness();
+            --hit;
+            ++vit;
+            ++dstSelIt;
+        }
+        ++x;
+
+        //progress info
+        m_progressStep += r.width();
+        if(m_lastProgressReport != (m_progressStep * 100) / m_progressTotalSteps)
+        {
+            m_lastProgressReport = (m_progressStep * 100) / m_progressTotalSteps;
+            emit notifyProgress(m_lastProgressReport);
+        }
+        if (m_cancelRequested) {
+            break;
+        }
+    }
+}
+
+void KisTransformWorker::rotate180(KisPaintDeviceSP src, KisPaintDeviceSP dst)
+{
+    kdDebug() << "Rotating 180\n";
+    KisSelectionSP dstSelection;
+    TQ_INT32 pixelSize = src->pixelSize();
+    TQRect r;
+    KisColorSpace *cs = src->colorSpace();
+
+    if(src->hasSelection())
+    {
+        r = src->selection()->selectedExactRect();
+        dstSelection = dst->selection();
+    }
+    else
+    {
+        r = src->exactBounds();
+        dstSelection = new KisSelection(dst); // essentially a dummy to be deleted
+    }
+
+    for (TQ_INT32 y = r.top(); y <= r.bottom(); ++y) {
+        KisHLineIteratorPixel srcIt = src->createHLineIterator(r.x(), y, r.width(), true);
+        KisHLineIterator dstIt = dst->createHLineIterator(-r.x() - r.width(), -y, r.width(), true);
+        KisHLineIterator dstSelIt = dstSelection->createHLineIterator(-r.x() - r.width(), -y, r.width(), true);
+
+        srcIt += r.width() - 1;
+        while (!dstIt.isDone()) {
+            if (srcIt.isSelected())  {
+                memcpy(dstIt.rawData(), srcIt.rawData(), pixelSize);
+
+                // XXX: Should set alpha = alpha*(1-selectedness)
+                cs->setAlpha(srcIt.rawData(), 0, 1);
+            }
+            *(dstSelIt.rawData()) = srcIt.selectedness();
+            --srcIt;
+            ++dstIt;
+            ++dstSelIt;
+        }
+
+        //progress info
+        m_progressStep += r.width();
+        if(m_lastProgressReport != (m_progressStep * 100) / m_progressTotalSteps)
+        {
+            m_lastProgressReport = (m_progressStep * 100) / m_progressTotalSteps;
+            emit notifyProgress(m_lastProgressReport);
+        }
+        if (m_cancelRequested) {
+            break;
+        }
+    }
+}
+
+template <class iter> iter createIterator(KisPaintDevice *dev, TQ_INT32 start, TQ_INT32 lineNum, TQ_INT32 len);
+
+template <> KisHLineIteratorPixel createIterator <KisHLineIteratorPixel>
+(KisPaintDevice *dev, TQ_INT32 start, TQ_INT32 lineNum, TQ_INT32 len)
+{
+    return dev->createHLineIterator(start, lineNum, len, true);
+}
+
+template <> KisVLineIteratorPixel createIterator <KisVLineIteratorPixel>
+(KisPaintDevice *dev, TQ_INT32 start, TQ_INT32 lineNum, TQ_INT32 len)
+{
+    return dev->createVLineIterator(lineNum, start, len, true);
+}
+
+template <class iter> void calcDimensions (KisPaintDevice *dev, TQ_INT32 &srcStart, TQ_INT32 &srcLen, TQ_INT32 &firstLine, TQ_INT32 &numLines);
+
+template <> void calcDimensions <KisHLineIteratorPixel>
+(KisPaintDevice *dev, TQ_INT32 &srcStart, TQ_INT32 &srcLen, TQ_INT32 &firstLine, TQ_INT32 &numLines)
+{
+    if(dev->hasSelection())
+    {
+        TQRect r = dev->selection()->selectedExactRect();
+        r.rect(&srcStart, &firstLine, &srcLen, &numLines);
+    }
+    else
+        dev->exactBounds(srcStart, firstLine, srcLen, numLines);
+}
+
+template <> void calcDimensions <KisVLineIteratorPixel>
+(KisPaintDevice *dev, TQ_INT32 &srcStart, TQ_INT32 &srcLen, TQ_INT32 &firstLine, TQ_INT32 &numLines)
+{
+    if(dev->hasSelection())
+    {
+        TQRect r = dev->selection()->selectedExactRect();
+        r.rect(&firstLine, &srcStart, &numLines, &srcLen);
+    }
+    else
+        dev->exactBounds(firstLine, srcStart, numLines, srcLen);
+}
+
+struct FilterValues
+{
+    TQ_UINT8 numWeights;
+    TQ_UINT8 *weight;
+    ~FilterValues() {delete [] weight;}
+};
+
+template <class T> void KisTransformWorker::transformPass(KisPaintDevice *src, KisPaintDevice *dst, double floatscale, double shear, TQ_INT32 dx, KisFilterStrategy *filterStrategy, bool fixBorderAlpha)
+{
+    TQ_INT32 lineNum,srcStart,firstLine,srcLen,numLines;
+    TQ_INT32 center, begin, end;    /* filter calculation variables */
+    TQ_UINT8 *data;
+    TQ_UINT8 pixelSize = src->pixelSize();
+    KisSelectionSP dstSelection;
+    KisColorSpace * cs = src->colorSpace();
+    TQ_INT32 scale;
+    TQ_INT32 scaleDenom;
+    TQ_INT32 shearFracOffset;
+
+    if(src->hasSelection())
+        dstSelection = dst->selection();
+    else
+        dstSelection = new KisSelection(dst); // essentially a dummy to be deleted
+
+    calcDimensions <T>(src, srcStart, srcLen, firstLine, numLines);
+
+    scale = int(floatscale*srcLen);
+    scaleDenom = srcLen;
+
+    if(scaleDenom == 0)
+        return;
+
+    TQ_INT32 support = filterStrategy->intSupport();
+    TQ_INT32 dstLen, dstStart;
+    TQ_INT32 invfscale = 256;
+
+    // handle magnification/minification
+    if(abs(scale) < scaleDenom)
+    {
+        support *= scaleDenom;
+        support /= scale;
+
+        invfscale *= scale;
+        invfscale /= scaleDenom;
+        if(scale < 0) // handle mirroring
+        {
+            support = -support;
+            invfscale = -invfscale;
+        }
+    }
+
+    // handle mirroring
+    if(scale < 0)
+        dstLen = - scale;
+    else
+        dstLen = scale;
+
+    // Calculate extra length (in each side) needed due to shear
+    TQ_INT32 extraLen = (support+256)>>8 + 1;
+
+    TQ_UINT8 *tmpLine = new TQ_UINT8[(srcLen +2*extraLen)* pixelSize];
+    Q_CHECK_PTR(tmpLine);
+
+    TQ_UINT8 *tmpSel = new TQ_UINT8[srcLen+2*extraLen];
+    Q_CHECK_PTR(tmpSel);
+
+    //allocate space for colors
+    const TQ_UINT8 **colors = new const TQ_UINT8 *[2*support+1];
+
+    // Precalculate weights
+    FilterValues *filterWeights = new FilterValues[256];
+
+    for(int center = 0; center<256; ++center)
+    {
+        TQ_INT32 begin = (255 + center - support)>>8; // takes ceiling by adding 255
+        TQ_INT32 span = ((center + support)>>8) - begin + 1; // takes floor to get end. Subtracts begin to get span
+        TQ_INT32 t = (((begin<<8) - center) * invfscale)>>8;
+        TQ_INT32 dt = invfscale;
+        filterWeights[center].weight = new TQ_UINT8[span];
+//printf("%d (",center);
+        TQ_UINT32 sum=0;
+        for(int num = 0; num<span; ++num)
+        {
+            TQ_UINT32 tmpw = filterStrategy->intValueAt(t) * invfscale;
+
+            tmpw >>=8;
+            filterWeights[center].weight[num] = tmpw;
+//printf(" %d=%d,%d",t,filterWeights[center].weight[num],tmpw);
+            t += dt;
+            sum+=tmpw;
+        }
+//printf(" )%d sum =%d",span,sum);
+        if(sum!=255)
+        {
+            double fixfactor= 255.0/sum;
+            sum=0;
+            for(int num = 0; num<span; ++num)
+            {
+                filterWeights[center].weight[num] = int(filterWeights[center].weight[num] * fixfactor);
+                sum+=filterWeights[center].weight[num];
+            }
+        }
+
+//printf("  sum2 =%d",sum);
+        int num = 0; 
+        while(sum<255 && num*2<span)
+        {
+            filterWeights[center].weight[span/2 + num]++;
+            ++sum;
+            if(sum<255 && num<span/2)
+            {
+                filterWeights[center].weight[span/2 - num - 1]++;
+                ++sum;
+            }
+            ++num;
+        }
+//printf("  sum3 =%d\n",sum);
+
+        filterWeights[center].numWeights = span;
+    }
+
+    for(lineNum = firstLine; lineNum < firstLine+numLines; lineNum++)
+    {
+        if(scale < 0)
+            dstStart = srcStart * scale / scaleDenom - dstLen + dx;
+        else
+            dstStart = (srcStart) * scale / scaleDenom + dx;
+
+        shearFracOffset = -int( 256 * (lineNum * shear - floor(lineNum * shear)));
+        dstStart += int(floor(lineNum * shear));
+
+        // Build a temporary line
+        T srcIt = createIterator <T>(src, srcStart - extraLen, lineNum, srcLen+2*extraLen);
+        TQ_INT32 i = 0;
+        while(!srcIt.isDone())
+        {
+            TQ_UINT8 *data;
+
+            data = srcIt.rawData();
+            memcpy(&tmpLine[i*pixelSize], data, pixelSize);
+
+            if(srcIt.isSelected())
+            {
+                // XXX: Should set alpha = alpha*(1-selectedness)
+                cs->setAlpha(data, 0, 1);
+                tmpSel[i] = 255;
+            }
+            else {
+                tmpSel[i] = 0;
+            }
+            ++srcIt;
+            i++;
+        }
+
+        T dstIt = createIterator <T>(dst, dstStart, lineNum, dstLen);
+        T dstSelIt = createIterator <T>(dstSelection, dstStart, lineNum, dstLen);
+
+        i=0;
+        while(!dstIt.isDone())
+        {
+            if(scaleDenom<2500)
+                center = ((i<<8) * scaleDenom) / scale;
+            else
+            {
+                if(scaleDenom<46000) // real limit is actually 46340 pixels
+                    center = ((i * scaleDenom) / scale)<<8;
+                else
+                    center = ((i<<8)/scale * scaleDenom) / scale; // XXX fails for sizes over 2^23 pixels src width
+            }
+
+            if(scale < 0)
+                center += srcLen<<8;
+
+            center += 128*scaleDenom/scale;//xxx doesn't work for scale<0;
+            center += (extraLen<<8) + shearFracOffset;
+
+            // find contributing pixels
+            begin = (255 + center - support)>>8; // takes ceiling by adding 255
+            end = (center + support)>>8; // takes floor
+
+////printf("sup=%d begin=%d end=%d",support,begin,end);
+            TQ_UINT8 selectedness = tmpSel[center>>8];
+            if(selectedness)
+            {
+                int num=0;
+                for(int srcpos = begin; srcpos <= end; ++srcpos)
+                {
+                    colors[num] = &tmpLine[srcpos*pixelSize];
+                    num++;
+                }
+                data = dstIt.rawData();
+                cs->mixColors(colors, filterWeights[center&255].weight, filterWeights[center&255].numWeights, data);
+
+                //possibly fix the alpha of the border if user wants it
+                if(fixBorderAlpha && (i==0 || i==dstLen-1))
+                    cs->setAlpha(data, cs->getAlpha(&tmpLine[(center>>8)*pixelSize]), 1);
+
+                data = dstSelIt.rawData();
+                *data = selectedness;
+            }
+
+            ++dstSelIt;
+            ++dstIt;
+            i++;
+        }
+
+        //progress info
+        m_progressStep += dstLen;
+        if(m_lastProgressReport != (m_progressStep * 100) / m_progressTotalSteps)
+        {
+            m_lastProgressReport = (m_progressStep * 100) / m_progressTotalSteps;
+            emit notifyProgress(m_lastProgressReport);
+        }
+        if (m_cancelRequested) {
+            break;
+        }
+    }
+    delete [] colors;
+    delete [] tmpLine;
+    delete [] tmpSel;
+    delete [] filterWeights;
+}
+
+bool KisTransformWorker::run()
+{
+    //progress info
+    m_cancelRequested = false;
+    if(m_progress)
+        m_progress->setSubject(this, true, true);
+    m_progressTotalSteps = 0;
+    m_progressStep = 0;
+    TQRect r;
+    if(m_dev->hasSelection())
+        r = m_dev->selection()->selectedExactRect();
+    else
+        r = m_dev->exactBounds();
+
+    KisPaintDeviceSP tmpdev1 = new KisPaintDevice(m_dev->colorSpace(),"transform_tmpdev1");;
+    KisPaintDeviceSP tmpdev2 = new KisPaintDevice(m_dev->colorSpace(),"transform_tmpdev2");;
+    KisPaintDeviceSP tmpdev3 = new KisPaintDevice(m_dev->colorSpace(),"transform_tmpdev2");;
+    KisPaintDeviceSP srcdev = m_dev;
+
+    double xscale = m_xscale;
+    double yscale = m_yscale;
+    double xshear = m_xshear;
+    double yshear = m_yshear;
+    double rotation = m_rotation;
+    TQ_INT32 xtranslate = m_xtranslate;
+    TQ_INT32 ytranslate = m_ytranslate;
+
+    if(rotation < 0.0)
+        rotation = -fmod(-rotation, 2*M_PI) + 2*M_PI;
+    else
+        rotation = fmod(rotation, 2*M_PI);
+    int rotQuadrant = int(rotation /(M_PI/2) + 0.5) & 3;
+
+    // Figure out how we will do the initial right angle rotations
+    double tmp;
+    switch(rotQuadrant)
+    {
+        default: // just to shut up the compiler
+        case 0:
+            m_progressTotalSteps = 0;
+            break;
+        case 1:
+            rotation -= M_PI/2;
+            tmp = xscale;
+            xscale=yscale;
+            yscale=tmp;
+            m_progressTotalSteps = r.width() * r.height();
+            break;
+        case 2:
+            rotation -= M_PI;
+            m_progressTotalSteps = r.width() * r.height();
+            break;
+        case 3:
+            rotation -= -M_PI/2 + 2*M_PI;
+            tmp = xscale;
+            xscale = yscale;
+            yscale = tmp;
+            m_progressTotalSteps = r.width() * r.height();
+            break;
+    }
+
+    // Calculate some auxillary values
+    yshear = sin(rotation);
+    xshear = -tan(rotation/2);
+    xtranslate -= int(xshear*ytranslate);
+
+    // Calculate progress steps
+    m_progressTotalSteps += int(yscale * r.width() * r.height());
+    m_progressTotalSteps += int(xscale * r.width() * (r.height() * yscale + r.width()*yshear));
+
+    m_lastProgressReport=0;
+
+    // Now that we have everything in place it's time to do the actual right angle rotations
+    switch(rotQuadrant)
+    {
+        default: // just to shut up the compiler
+        case 0:
+            break;
+        case 1:
+            rotateRight90(srcdev, tmpdev1);
+            srcdev = tmpdev1;
+            break;
+        case 2:
+            rotate180(srcdev, tmpdev1);
+            srcdev = tmpdev1;
+            break;
+        case 3:
+            rotateLeft90(srcdev, tmpdev1);
+            srcdev = tmpdev1;
+            break;
+    }
+
+    // Handle simple move case possibly with rotation of 90,180,270
+    if(rotation == 0.0 && xscale == 1.0 && yscale == 1.0)
+    {
+        if(rotQuadrant==0)
+        {
+            // Though not nessesay in the general case because we make several passes
+            // We need to move (not just copy) the data to a temp dev so we can move them back
+            rotateNone(srcdev, tmpdev1);
+            srcdev = tmpdev1;
+        }
+        if(m_dev->hasSelection())
+            m_dev->selection()->clear();
+
+        srcdev->move(srcdev->getX() + xtranslate, srcdev->getY() + ytranslate);
+        rotateNone(srcdev, m_dev);
+
+        //progress info
+        emit notifyProgressDone();
+        m_dev->emitSelectionChanged();
+
+        return m_cancelRequested;
+    }
+
+    if ( m_cancelRequested) {
+        emit notifyProgressDone();
+        return false;
+    }
+
+    transformPass <KisHLineIteratorPixel>(srcdev, tmpdev2, xscale, yscale*xshear, 0, m_filter, m_fixBorderAlpha);
+    if(m_dev->hasSelection())
+        m_dev->selection()->clear();
+
+    if ( m_cancelRequested) {
+        emit notifyProgressDone();
+        return false;
+    }
+
+    // Now do the second pass
+    transformPass <KisVLineIteratorPixel>(tmpdev2.data(), tmpdev3.data(), yscale, yshear, ytranslate, m_filter, m_fixBorderAlpha);
+
+    if(m_dev->hasSelection())
+        m_dev->selection()->clear();
+
+    if ( m_cancelRequested) {
+        emit notifyProgressDone();
+        return false;
+    }
+
+    if (xshear != 0.0)
+        transformPass <KisHLineIteratorPixel>(tmpdev3, m_dev, 1.0, xshear, xtranslate, m_filter, m_fixBorderAlpha);
+    else
+    {
+        // No need to filter again when we are only scaling
+        tmpdev3->move(tmpdev3->getX() + xtranslate, tmpdev3->getY());
+        rotateNone(tmpdev3, m_dev);
+    }
+
+    if (m_dev->tqparentLayer()) {
+        m_dev->tqparentLayer()->setDirty();
+    }
+    //progress info
+    emit notifyProgressDone();
+    m_dev->emitSelectionChanged();
+
+    return m_cancelRequested;
+}
diff --git a/chalk/core/kis_transform_worker.h b/chalk/core/kis_transform_worker.h
new file mode 100644
index 000000000..a48b85896
--- /dev/null
+++ b/chalk/core/kis_transform_worker.h
@@ -0,0 +1,79 @@
+/*
+ *  Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_TRANSFORM_WORKER_H_
+#define KIS_TRANSFORM_WORKER_H_
+
+#include "kis_types.h"
+#include "kis_progress_subject.h"
+
+class KisPaintDevice;
+class KisProgressDisplayInterface;
+class KisHLineIteratorPixel;
+class KisVLineIteratorPixel;
+class KisFilterStrategy;
+
+class KisTransformWorker : public KisProgressSubject {
+    typedef KisProgressSubject super;
+
+public:
+    KisTransformWorker(KisPaintDeviceSP dev, double  xscale, double  yscale,
+        double  xshear, double  yshear, double rotation,
+        TQ_INT32  xtranslate, TQ_INT32  ytranslate,
+        KisProgressDisplayInterface *progress, KisFilterStrategy *filter, bool fixBorderAlpha=false);
+    ~KisTransformWorker();
+
+public:
+    bool isCanceled() { return m_cancelRequested;};
+
+    bool run();
+
+private:    
+    // XXX (BSAR): Why didn't we use the shared-pointer versions of the paint device classes?
+    template <class T> void transformPass(KisPaintDevice *src, KisPaintDevice *dst, double xscale, double  shear, TQ_INT32 dx,   KisFilterStrategy *filterStrategy, bool fixBorderAlpha);
+    
+public:    
+    void rotateNone(KisPaintDeviceSP src, KisPaintDeviceSP dst);
+    void rotateRight90(KisPaintDeviceSP src, KisPaintDeviceSP dst);
+    void rotateLeft90(KisPaintDeviceSP src, KisPaintDeviceSP dst);
+    void rotate180(KisPaintDeviceSP src, KisPaintDeviceSP dst);
+
+private:
+    KisPaintDeviceSP m_dev;
+    double  m_xscale, m_yscale;
+    double  m_xshear, m_yshear, m_rotation;
+    TQ_INT32  m_xtranslate, m_ytranslate;
+    KisProgressDisplayInterface *m_progress;
+    KisFilterStrategy *m_filter;
+    // Implement KisProgressSubject
+    bool m_cancelRequested;
+    virtual void cancel() { m_cancelRequested = true; }
+    TQ_INT32 m_progressTotalSteps;
+    TQ_INT32 m_progressStep;
+    TQ_INT32 m_progressScaler;
+    TQ_INT32 m_lastProgressReport;
+    bool m_fixBorderAlpha;
+};
+
+
+inline KisTransformWorker::~KisTransformWorker()
+{
+}
+
+#endif // KIS_TRANSFORM_VISITOR_H_
diff --git a/chalk/core/kis_types.h b/chalk/core/kis_types.h
new file mode 100644
index 000000000..b789fdd4b
--- /dev/null
+++ b/chalk/core/kis_types.h
@@ -0,0 +1,90 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KISTYPES_H_
+#define KISTYPES_H_
+
+#include <tqvaluevector.h>
+#include <tqmap.h>
+#include <tqpoint.h>
+
+#include <ksharedptr.h>
+
+#include "kis_shared_ptr_vector.h"
+
+/**
+ * Define lots of shared pointer versions of Chalk classes.
+ * Shared pointer classes have the advantage of near automatic
+ * memory management (but take care of circular references)
+ * and the disadvantage that inheritiance relations are no longer
+ * recognizable
+ */
+
+class KisImage;
+typedef KSharedPtr<KisImage> KisImageSP;
+
+class KisPaintDevice;
+typedef KSharedPtr<KisPaintDevice> KisPaintDeviceSP;
+typedef KisSharedPtrVector<KisPaintDevice> vKisPaintDeviceSP;
+typedef vKisPaintDeviceSP::iterator vKisPaintDeviceSP_it;
+typedef vKisPaintDeviceSP::const_iterator vKisPaintDeviceSP_cit;
+
+class KisLayer;
+typedef KSharedPtr<KisLayer> KisLayerSP;
+typedef KisSharedPtrVector<KisLayer> vKisLayerSP;
+typedef vKisLayerSP::iterator vKisLayerSP_it;
+typedef vKisLayerSP::const_iterator vKisLayerSP_cit;
+
+class KisPartLayer;
+typedef KSharedPtr<KisPartLayer> KisPartLayerSP;
+
+class KisPaintLayer;
+typedef KSharedPtr<KisPaintLayer> KisPaintLayerSP;
+
+class KisAdjustmentLayer;
+typedef KSharedPtr<KisAdjustmentLayer> KisAdjustmentLayerSP;
+
+class KisGroupLayer;
+typedef KSharedPtr<KisGroupLayer> KisGroupLayerSP;
+
+class KisSelection;
+typedef KSharedPtr<KisSelection> KisSelectionSP;
+
+class KisBackground;
+typedef KSharedPtr<KisBackground> KisBackgroundSP;
+
+class KisSubstrate;
+typedef KSharedPtr<KisSubstrate> KisSubstrateSP;
+
+class KisHistogram;
+typedef KSharedPtr<KisHistogram> KisHistogramSP;
+
+class KisPaintOpFactory;
+typedef KSharedPtr<KisPaintOpFactory> KisPaintOpFactorySP;
+
+typedef TQValueVector<TQPoint> vKisSegments;
+
+//class KisGuide;
+//typedef KSharedPtr<KisGuide> KisGuideSP;
+
+class KisAlphaMask;
+typedef KSharedPtr<KisAlphaMask> KisAlphaMaskSP;
+
+class KisFilter;
+typedef KSharedPtr<KisFilter> KisFilterSP;
+
+#endif // KISTYPES_H_
diff --git a/chalk/core/kis_vec.cc b/chalk/core/kis_vec.cc
new file mode 100644
index 000000000..fa54e1f90
--- /dev/null
+++ b/chalk/core/kis_vec.cc
@@ -0,0 +1,67 @@
+/*
+ *  kis_vec.cc - part of KImageShop
+ *
+ *  Copyright (c) 1999 Matthias Elter <me@kde.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_vec.h"
+
+KisVector2D& KisVector2D::normalize()
+{
+    double length, ilength;
+  
+    length = m_x*m_x + m_y*m_y;
+    length = sqrt (length);
+  
+    if (length > epsilon)
+    {
+        ilength = 1/length;
+        m_x *= ilength;
+        m_y *= ilength;
+    }
+    return *this;
+}
+
+KisVector3D& KisVector3D::normalize()
+{
+    double length, ilength;
+  
+    length = m_x*m_x + m_y*m_y + m_z*m_z;
+    length = sqrt (length);
+  
+    if (length > epsilon)
+    {
+        ilength = 1/length;
+        m_x *= ilength;
+        m_y *= ilength;
+        m_z *= ilength;
+    }
+    return *this;
+}
+
+KisVector3D& KisVector3D::crossProduct(const KisVector3D &v)
+{
+    double x,y,z;
+  
+    x = m_y*v.m_z - m_z*v.m_y;
+    y = m_z*v.m_x - m_x*v.m_z;
+    z = m_x*v.m_y - m_y*v.m_x;
+    m_x=x; m_y=y; m_z=z;
+  
+    return *this;
+}
+
diff --git a/chalk/core/kis_vec.h b/chalk/core/kis_vec.h
new file mode 100644
index 000000000..08b9c5412
--- /dev/null
+++ b/chalk/core/kis_vec.h
@@ -0,0 +1,405 @@
+/*
+ *  kis_vec.h - part of KImageShop
+ *
+ *  Copyright (c) 1999 Matthias Elter <me@kde.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __kis_vec_h__
+#define __kis_vec_h__
+
+#include <math.h>
+#include <cfloat>
+#include <tqpoint.h>
+#include "kis_point.h"
+
+/*
+ * vector classes
+ */
+const double epsilon = DBL_EPSILON;
+
+class KisVector2D
+{
+public:
+    KisVector2D();
+    KisVector2D(double x, double y);
+    KisVector2D(const TQPoint& p);
+    KisVector2D(const KisPoint& p);
+
+    bool isNull()    const;
+
+    double length() const;
+
+    double     x() const;
+    double     y() const;
+    void   setX(double);
+    void   setY(double);
+
+    KisVector2D &normalize();
+    double  dotProduct(const KisVector2D &) const;
+
+    KisVector2D &operator+=(const KisVector2D &);
+    KisVector2D &operator-=(const KisVector2D &);
+    KisVector2D &operator*=(int);
+    KisVector2D &operator*=(long);
+    KisVector2D &operator*=(double);
+    KisVector2D &operator/=(int);
+    KisVector2D &operator/=(long);
+    KisVector2D &operator/=(double);
+
+    friend inline bool operator==(const KisVector2D &, const KisVector2D &);
+    friend inline bool operator!=(const KisVector2D &, const KisVector2D &);
+    friend inline KisVector2D operator+(const KisVector2D &, const KisVector2D &);
+    friend inline KisVector2D operator-(const KisVector2D &, const KisVector2D &);
+    friend inline KisVector2D operator*(const KisVector2D &, int);
+    friend inline KisVector2D operator*(int, const KisVector2D &);
+    friend inline KisVector2D operator*(const KisVector2D &, long);
+    friend inline KisVector2D operator*(long, const KisVector2D &);
+    friend inline KisVector2D operator*(const KisVector2D &, double);
+    friend inline KisVector2D operator*(double, const KisVector2D &);
+    friend inline KisVector2D operator-(const KisVector2D &);
+    friend inline KisVector2D operator/(const KisVector2D &, int);
+    friend inline KisVector2D operator/(const KisVector2D &, long);
+    friend inline KisVector2D operator/(const KisVector2D &, double);
+
+    KisPoint toKisPoint() const;
+
+private:
+    double m_x;
+    double m_y;
+};
+
+inline KisVector2D::KisVector2D()
+{ m_x=0; m_y=0; }
+
+inline KisVector2D::KisVector2D(double x, double y)
+{ m_x=x; m_y=y; }
+
+inline KisVector2D::KisVector2D(const TQPoint& p)
+{
+    m_x=p.x(); m_y=p.y();
+}
+
+inline KisVector2D::KisVector2D(const KisPoint& p)
+{
+    m_x=p.x(); m_y=p.y();
+}
+
+inline bool KisVector2D::isNull() const
+{ return fabs(m_x) < epsilon && fabs(m_y) < epsilon; }
+
+inline double KisVector2D::length() const
+{  return (sqrt(m_x*m_x + m_y*m_y)); }
+
+inline double KisVector2D::dotProduct(const KisVector2D &v) const
+{ return m_x*v.m_x + m_y*v.m_y; }
+
+inline double KisVector2D::x() const
+{ return m_x; }
+
+inline double KisVector2D::y() const
+{ return m_y; }
+
+inline void KisVector2D::setX(double x)
+{ m_x=x; }
+
+inline void KisVector2D::setY(double y)
+{ m_y=y; }
+
+inline KisVector2D &KisVector2D::operator+=(const KisVector2D &v)
+{ m_x+=v.m_x; m_y+=v.m_y; return *this; }
+
+inline KisVector2D &KisVector2D::operator-=(const KisVector2D &v)
+{ m_x-=v.m_x; m_y-=v.m_y; return *this; }
+
+inline KisVector2D &KisVector2D::operator*=(int c)
+{ m_x*=c; m_y*=c; return *this; }
+
+inline KisVector2D &KisVector2D::operator*=(long c)
+{ m_x*=c; m_y*=c; return *this; }
+
+inline KisVector2D &KisVector2D::operator*=(double c)
+{ m_x*=c; m_y*=c; return *this; }
+
+inline bool operator==(const KisVector2D &v1, const KisVector2D &v2)
+{ return fabs(v1.m_x - v2.m_x) < epsilon && fabs(v1.m_y - v2.m_y) < epsilon; }
+
+inline bool operator!=(const KisVector2D &v1, const KisVector2D &v2)
+{ return !(v1 == v2); }
+
+inline KisVector2D operator+(const KisVector2D &v1, const KisVector2D &v2)
+{ return KisVector2D(v1.m_x+v2.m_x, v1.m_y+v2.m_y); }
+
+inline KisVector2D operator-(const KisVector2D &v1, const KisVector2D &v2)
+{ return KisVector2D(v1.m_x-v2.m_x, v1.m_y-v2.m_y); }
+
+inline KisVector2D operator*(const KisVector2D &v, int c)
+{ return KisVector2D((v.m_x*c), (v.m_y*c)); }
+
+inline KisVector2D operator*(int c, const KisVector2D &v)
+{ return KisVector2D((v.m_x*c), (v.m_y*c)); }
+
+inline KisVector2D operator*(const KisVector2D &v, long c)
+{ return KisVector2D((v.m_x*c), (v.m_y*c)); }
+
+inline KisVector2D operator*(long c, const KisVector2D &v)
+{ return KisVector2D((v.m_x*c), (v.m_y*c)); }
+
+inline KisVector2D operator*(const KisVector2D &v, double c)
+{ return KisVector2D(v.m_x*c, v.m_y*c); }
+
+inline KisVector2D operator*(double c, const KisVector2D &v)
+{ return KisVector2D(v.m_x*c, v.m_y*c); }
+
+inline KisVector2D operator-(const KisVector2D &v)
+{ return KisVector2D(-v.m_x, -v.m_y); }
+
+inline KisVector2D operator/(const KisVector2D &v, int c)
+{
+    if (c != 0) {
+        return KisVector2D(v.x() / c, v.y() / c);
+    } else {
+        return v;
+    }
+}
+
+inline KisVector2D operator/(const KisVector2D &v, long c)
+{
+    if (c != 0) {
+        return KisVector2D(v.x() / c, v.y() / c);
+    } else {
+        return v;
+    }
+}
+
+inline KisVector2D operator/(const KisVector2D &v, double c)
+{
+    if (c > DBL_EPSILON || c < -DBL_EPSILON) {
+        return KisVector2D(v.x() / c, v.y() / c);
+    } else {
+        return v;
+    }
+}
+
+inline KisVector2D &KisVector2D::operator/=(int c)
+{
+    if (!c == 0)
+    {
+        m_x/=c;
+        m_y/=c;
+    }
+    return *this;
+}
+
+inline KisVector2D &KisVector2D::operator/=(long c)
+{
+    if (!c == 0)
+    {
+        m_x/=c;
+        m_y/=c;
+    }
+    return *this;
+}
+
+inline KisVector2D &KisVector2D::operator/=(double c)
+{
+    if (!c == 0)
+    {
+        m_x/=c;
+        m_y/=c;
+    }
+    return *this;
+}
+
+inline KisPoint KisVector2D::toKisPoint() const
+{
+    return KisPoint(m_x, m_y);
+}
+
+class KisVector3D
+{
+public:
+    KisVector3D();
+    KisVector3D(double x, double y, double z = 0);
+    KisVector3D(int x, int y, int z = 0);
+    KisVector3D(long x, long y, long z = 0);
+
+    bool isNull()    const;
+
+    double length() const;
+
+    double     x() const;
+    double     y() const;
+    double     z() const;
+    void   setX(double);
+    void   setY(double);
+    void   setZ(double);
+
+    KisVector3D &normalize();
+    KisVector3D &crossProduct(const KisVector3D &);
+    double  dotProduct(const KisVector3D &) const;
+
+    KisVector3D &operator+=(const KisVector3D &);
+    KisVector3D &operator-=(const KisVector3D &);
+    KisVector3D &operator*=(int);
+    KisVector3D &operator*=(long);
+    KisVector3D &operator*=(double);
+    KisVector3D &operator/=(int);
+    KisVector3D &operator/=(long);
+    KisVector3D &operator/=(double);
+
+    friend inline bool operator==(const KisVector3D &, const KisVector3D &);
+    friend inline bool operator!=(const KisVector3D &, const KisVector3D &);
+    friend inline KisVector3D operator+(const KisVector3D &, const KisVector3D &);
+    friend inline KisVector3D operator-(const KisVector3D &, const KisVector3D &);
+    friend inline KisVector3D operator*(const KisVector3D &, int);
+    friend inline KisVector3D operator*(int, const KisVector3D &);
+    friend inline KisVector3D operator*(const KisVector3D &, long);
+    friend inline KisVector3D operator*(long, const KisVector3D &);
+    friend inline KisVector3D operator*(const KisVector3D &, double);
+    friend inline KisVector3D operator*(double, const KisVector3D &);
+    friend inline KisVector3D operator-(const KisVector3D &);
+    friend inline KisVector3D operator/(const KisVector3D &, int);
+    friend inline KisVector3D operator/(const KisVector3D &, long);
+    friend inline KisVector3D operator/(const KisVector3D &, double);
+
+private:
+    double m_x;
+    double m_y;
+    double m_z;
+};
+
+inline KisVector3D::KisVector3D()
+{ m_x=0; m_y=0; m_z=0; }
+
+inline KisVector3D::KisVector3D(double x, double y, double z)
+{ m_x=x; m_y=y; m_z=z; }
+
+inline KisVector3D::KisVector3D(int x, int y, int z)
+{ m_x=static_cast<double>(x); m_y=static_cast<double>(y); m_z=static_cast<double>(z); }
+
+inline KisVector3D::KisVector3D(long x, long y, long z)
+{ m_x=static_cast<double>(x); m_y=static_cast<double>(y); m_z=static_cast<double>(z); }
+
+inline bool KisVector3D::isNull() const
+{ return fabs(m_x) < epsilon && fabs(m_y) < epsilon && fabs(m_z) < epsilon; }
+
+inline double KisVector3D::length() const
+{  return (sqrt(m_x*m_x + m_y*m_y + m_z*m_z)); }
+
+inline double KisVector3D::dotProduct(const KisVector3D &v) const
+{ return m_x*v.m_x + m_y*v.m_y + m_z*v.m_z; }
+
+inline double KisVector3D::x() const
+{ return m_x; }
+
+inline double KisVector3D::y() const
+{ return m_y; }
+
+inline double KisVector3D::z() const
+{ return m_z; }
+
+inline void KisVector3D::setX(double x)
+{ m_x=x; }
+
+inline void KisVector3D::setY(double y)
+{ m_y=y; }
+
+inline void KisVector3D::setZ(double z)
+{ m_z=z; }
+
+inline KisVector3D &KisVector3D::operator+=(const KisVector3D &v)
+{ m_x+=v.m_x; m_y+=v.m_y; m_z+=v.m_z; return *this; }
+
+inline KisVector3D &KisVector3D::operator-=(const KisVector3D &v)
+{ m_x-=v.m_x; m_y-=v.m_y; m_z-=v.m_z; return *this; }
+
+inline KisVector3D &KisVector3D::operator*=(int c)
+{ m_x*=c; m_y*=c; m_z*=c; return *this; }
+
+inline KisVector3D &KisVector3D::operator*=(long c)
+{ m_x*=c; m_y*=c; m_z*=c; return *this; }
+
+inline KisVector3D &KisVector3D::operator*=(double c)
+{ m_x*=c; m_y*=c; m_z*=c; return *this; }
+
+inline bool operator==(const KisVector3D &v1, const KisVector3D &v2)
+{ return fabs(v1.m_x - v2.m_x) < epsilon && fabs(v1.m_y - v2.m_y) < epsilon && fabs(v1.m_z - v2.m_z) < epsilon; }
+
+inline bool operator!=(const KisVector3D &v1, const KisVector3D &v2)
+{ return !(v1 == v2); }
+
+inline KisVector3D operator+(const KisVector3D &v1, const KisVector3D &v2)
+{ return KisVector3D(v1.m_x+v2.m_x, v1.m_y+v2.m_y, v1.m_z+v2.m_z); }
+
+inline KisVector3D operator-(const KisVector3D &v1, const KisVector3D &v2)
+{ return KisVector3D(v1.m_x-v2.m_x, v1.m_y-v2.m_y, v1.m_z-v2.m_z); }
+
+inline KisVector3D operator*(const KisVector3D &v, int c)
+{ return KisVector3D((v.m_x*c), (v.m_y*c), (v.m_z*c)); }
+
+inline KisVector3D operator*(int c, const KisVector3D &v)
+{ return KisVector3D((v.m_x*c), (v.m_y*c), (v.m_z*c)); }
+
+inline KisVector3D operator*(const KisVector3D &v, long c)
+{ return KisVector3D((v.m_x*c), (v.m_y*c), (v.m_z*c)); }
+
+inline KisVector3D operator*(long c, const KisVector3D &v)
+{ return KisVector3D((v.m_x*c), (v.m_y*c), (v.m_z*c)); }
+
+inline KisVector3D operator*(const KisVector3D &v, double c)
+{ return KisVector3D(v.m_x*c, v.m_y*c, v.m_z*c); }
+
+inline KisVector3D operator*(double c, const KisVector3D &v)
+{ return KisVector3D(v.m_x*c, v.m_y*c, v.m_z*c); }
+
+inline KisVector3D operator-(const KisVector3D &v)
+{ return KisVector3D(-v.m_x, -v.m_y, -v.m_z); }
+
+inline KisVector3D &KisVector3D::operator/=(int c)
+{
+    if (!c == 0)
+    {
+        m_x/=c;
+        m_y/=c;
+        m_z/=c;
+    }
+    return *this;
+}
+
+inline KisVector3D &KisVector3D::operator/=(long c)
+{
+    if (!c == 0)
+    {
+        m_x/=c;
+        m_y/=c;
+        m_z/=c;
+    }
+    return *this;
+}
+
+inline KisVector3D &KisVector3D::operator/=(double c)
+{
+    if (!c == 0)
+    {
+        m_x/=c;
+        m_y/=c;
+        m_z/=c;
+    }
+    return *this;
+}
+
+#endif
diff --git a/chalk/core/tests/Makefile.am b/chalk/core/tests/Makefile.am
new file mode 100644
index 000000000..239c1ba66
--- /dev/null
+++ b/chalk/core/tests/Makefile.am
@@ -0,0 +1,30 @@
+AM_CPPFLAGS = \
+	-I$(srcdir)/../ \
+	-I$(srcdir)/../tiles \
+	-I$(srcdir)/../../sdk \
+	-I$(srcdir)/../../chalkcolor \
+	-I$(srcdir)/../../colorspaces/rgb_u8 \
+	$(KOFFICE_INCLUDES) \
+	$(KOPAINTER_INCLUDES) \
+	$(all_includes)
+
+# The check_ target makes sure we don't install the modules,
+# $(KDE_CHECK_PLUGIN) assures a shared library is created.
+check_LTLIBRARIES = kunittest_kis_integer_maths_tester.la kunittest_kis_image_tester.la kunittest_kis_filter_configuration_tester.la
+
+kunittest_kis_integer_maths_tester_la_SOURCES = kis_integer_maths_tester.cpp
+kunittest_kis_integer_maths_tester_la_LIBADD = -lkunittest ../../libchalkcommon.la
+kunittest_kis_integer_maths_tester_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+kunittest_kis_image_tester_la_SOURCES = kis_image_tester.cpp
+kunittest_kis_image_tester_la_LIBADD = -lkunittest ../../libchalkcommon.la
+kunittest_kis_image_tester_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+
+kunittest_kis_filter_configuration_tester_la_SOURCES = kis_filter_configuration_tester.cc
+kunittest_kis_filter_configuration_tester_la_LIBADD = -lkunittest ../../libchalkcommon.la
+kunittest_kis_filter_configuration_tester_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+
+check-local: kunittest_kis_integer_maths_tester.la kunittest_kis_image_tester.la kunittest_kis_filter_configuration_tester.la
+	kunittestmodrunner
diff --git a/chalk/core/tests/kis_filter_configuration_tester.cc b/chalk/core/tests/kis_filter_configuration_tester.cc
new file mode 100644
index 000000000..6a4a26313
--- /dev/null
+++ b/chalk/core/tests/kis_filter_configuration_tester.cc
@@ -0,0 +1,67 @@
+/*
+ *  Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <tqapplication.h>
+
+#include <kdebug.h>
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "kis_filter_configuration_tester.h"
+#include "../kis_filter_configuration.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE(kunittest_kis_filter_configuration_tester, "KisFilterConfiguration Tester");
+KUNITTEST_MODULE_REGISTER_TESTER(KisFilterConfigurationTester);
+
+void KisFilterConfigurationTester::allTests()
+{
+    testCreation();
+    testSetGetProperty();
+    testRoundTrip();
+}
+
+void KisFilterConfigurationTester::testCreation()
+{
+    KisFilterConfiguration * kfc = new KisFilterConfiguration("test", 1);
+    if ( kfc == 0 ) failure("Could not create test filter configuration");
+    CHECK(kfc->version(), 1);
+    CHECK(kfc->name(), TQString("test"));
+
+    delete kfc;
+    success("testCreation success");
+}
+
+void KisFilterConfigurationTester::testRoundTrip()
+{
+    KisFilterConfiguration * kfc = new KisFilterConfiguration("test", 1);
+    CHECK(kfc->version(), 1);
+    CHECK(kfc->name(), TQString("test"));
+    TQString s = kfc->toString();
+    delete kfc;
+    kfc = new KisFilterConfiguration(s);
+    CHECK(kfc->version(), 1);
+    CHECK(kfc->name(), TQString("test"));
+    delete kfc;
+    success("testDeserializaton success");
+}
+
+void KisFilterConfigurationTester::testSetGetProperty()
+{
+}
diff --git a/chalk/core/tests/kis_filter_configuration_tester.h b/chalk/core/tests/kis_filter_configuration_tester.h
new file mode 100644
index 000000000..6e1ca2e58
--- /dev/null
+++ b/chalk/core/tests/kis_filter_configuration_tester.h
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_FILTER_CONFIGURATION_TESTER_H
+#define KIS_FILTER_CONFIGURATION_TESTER_H
+
+#include <kunittest/tester.h>
+
+class KisFilterConfigurationTester : public KUnitTest::Tester
+{
+public:
+    void allTests();
+    void testCreation();
+    void testRoundTrip();
+    void testSetGetProperty();
+};
+
+#endif
+
diff --git a/chalk/core/tests/kis_image_tester.cpp b/chalk/core/tests/kis_image_tester.cpp
new file mode 100644
index 000000000..f660f3945
--- /dev/null
+++ b/chalk/core/tests/kis_image_tester.cpp
@@ -0,0 +1,88 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <tqapplication.h>
+
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "kis_image_tester.h"
+#include "kis_image.h"
+#include "kis_meta_registry.h"
+#include "kis_rgb_colorspace.h"
+#include "kis_colorspace_factory_registry.h"
+#include "kis_color.h"
+#include "kis_paint_layer.h"
+#include "kis_group_layer.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE(kunittest_kis_image_tester, "KisImage Tester");
+KUNITTEST_MODULE_REGISTER_TESTER(KisImageTester);
+
+void KisImageTester::allTests()
+{
+    mergeTests();
+}
+
+#define IMAGE_WIDTH 1
+#define IMAGE_HEIGHT 1
+
+void KisImageTester::mergeTests()
+{
+    KisColorSpace * colorSpace = KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("RGBA", ""), "");
+
+    KisImageSP image = new KisImage(0, IMAGE_WIDTH, IMAGE_HEIGHT, colorSpace, "merge test");
+
+    KisColor mergedPixel = image->mergedPixel(0, 0);
+
+    TQColor colour;
+    TQ_UINT8 opacity;
+
+    mergedPixel.toTQColor(&colour, &opacity);
+
+    CHECK(opacity, OPACITY_TRANSPARENT);
+
+    KisPaintLayer * layer = new KisPaintLayer(image, "layer 1", OPACITY_OPAQUE);
+    image->addLayer(layer, image->rootLayer(), 0);
+
+    layer->paintDevice()->setPixel(0, 0, TQColor(255, 128, 64), OPACITY_OPAQUE);
+
+    mergedPixel = image->mergedPixel(0, 0);
+    mergedPixel.toTQColor(&colour, &opacity);
+
+    CHECK(opacity, OPACITY_OPAQUE);
+    CHECK(colour.red(), 255);
+    CHECK(colour.green(), 128);
+    CHECK(colour.blue(), 64);
+
+    KisPaintLayer * layer2 = new KisPaintLayer(image, "layer 2", OPACITY_OPAQUE / 2);
+    image->addLayer(layer2, image->rootLayer(), layer);
+
+    layer2->paintDevice()->setPixel(0, 0, TQColor(255, 255, 255), OPACITY_OPAQUE);
+
+    mergedPixel = image->mergedPixel(0, 0);
+    mergedPixel.toTQColor(&colour, &opacity);
+
+    CHECK(opacity, OPACITY_OPAQUE);
+    CHECK(colour.red(), 255);
+    CHECK(colour.green(), 128 + ((255 - 128) / 2));
+    CHECK(colour.blue(), 64 + ((255 - 64) / 2));
+}
+
+
diff --git a/chalk/core/tests/kis_image_tester.h b/chalk/core/tests/kis_image_tester.h
new file mode 100644
index 000000000..4e6768386
--- /dev/null
+++ b/chalk/core/tests/kis_image_tester.h
@@ -0,0 +1,32 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_IMAGE_TESTER_H
+#define KIS_IMAGE_TESTER_H
+
+#include <kunittest/tester.h>
+
+class KisImageTester : public KUnitTest::Tester
+{
+public:
+    void allTests();
+    void mergeTests();
+};
+
+#endif
+
diff --git a/chalk/core/tests/kis_integer_maths_tester.cpp b/chalk/core/tests/kis_integer_maths_tester.cpp
new file mode 100644
index 000000000..1878731b5
--- /dev/null
+++ b/chalk/core/tests/kis_integer_maths_tester.cpp
@@ -0,0 +1,93 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "kis_integer_maths_tester.h"
+#include "kis_integer_maths.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE(kunittest_kis_integer_maths_tester, "Integer Maths Tester");
+KUNITTEST_MODULE_REGISTER_TESTER(KisIntegerMathsTester);
+
+void KisIntegerMathsTester::allTests()
+{
+    UINT8Tests();
+    UINT16Tests();
+    conversionTests();
+}
+
+void KisIntegerMathsTester::UINT8Tests()
+{
+    CHECK((int)UINT8_MULT(0, 255), 0);
+    CHECK((int)UINT8_MULT(255, 255), 255);
+
+    CHECK((int)UINT8_MULT(128, 255), 128);
+    CHECK((int)UINT8_MULT(255, 128), 128);
+
+    CHECK((int)UINT8_MULT(1, 255), 1);
+    CHECK((int)UINT8_MULT(1, 127), 0);
+    CHECK((int)UINT8_MULT(64, 128), 32);
+
+    CHECK((int)UINT8_DIVIDE(255, 255), 255);
+    CHECK((int)UINT8_DIVIDE(64, 128), 128);
+    CHECK((int)UINT8_DIVIDE(1, 64), 4);
+    CHECK((int)UINT8_DIVIDE(0, 1), 0);
+
+    CHECK((int)UINT8_BLEND(255, 0, 0), 0);
+    CHECK((int)UINT8_BLEND(255, 0, 128), 128);
+    CHECK((int)UINT8_BLEND(255, 128, 128), 192);
+    CHECK((int)UINT8_BLEND(128, 64, 255), 128);
+}
+
+void KisIntegerMathsTester::UINT16Tests()
+{
+    CHECK((int)UINT16_MULT(0, 65535), 0);
+    CHECK((int)UINT16_MULT(65535, 65535), 65535);
+
+    CHECK((int)UINT16_MULT(32768, 65535), 32768);
+    CHECK((int)UINT16_MULT(65535, 32768), 32768);
+
+    CHECK((int)UINT16_MULT(1, 65535), 1);
+    CHECK((int)UINT16_MULT(1, 32767), 0);
+    CHECK((int)UINT16_MULT(16384, 32768), 8192);
+
+    CHECK((int)UINT16_DIVIDE(65535, 65535), 65535);
+    CHECK((int)UINT16_DIVIDE(16384, 32768), 32768);
+    CHECK((int)UINT16_DIVIDE(1, 16384), 4);
+    CHECK((int)UINT16_DIVIDE(0, 1), 0);
+
+    CHECK((int)UINT16_BLEND(65535, 0, 0), 0);
+    CHECK((int)UINT16_BLEND(65535, 0, 32768), 32768);
+    CHECK((int)UINT16_BLEND(65535, 32768, 32768), 49152);
+    CHECK((int)UINT16_BLEND(32768, 16384, 65535), 32768);
+}
+
+void KisIntegerMathsTester::conversionTests()
+{
+    CHECK((int)UINT8_TO_UINT16(255), 65535);
+    CHECK((int)UINT8_TO_UINT16(0), 0);
+    CHECK((int)UINT8_TO_UINT16(128), 128 * 257);
+
+    CHECK((int)UINT16_TO_UINT8(65535), 255);
+    CHECK((int)UINT16_TO_UINT8(0), 0);
+    CHECK((int)UINT16_TO_UINT8(128 * 257), 128);
+}
+
diff --git a/chalk/core/tests/kis_integer_maths_tester.h b/chalk/core/tests/kis_integer_maths_tester.h
new file mode 100644
index 000000000..2a9a9a20f
--- /dev/null
+++ b/chalk/core/tests/kis_integer_maths_tester.h
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_INTEGER_MATHS_TESTER_H
+#define KIS_INTEGER_MATHS_TESTER_H
+
+#include <kunittest/tester.h>
+
+class KisIntegerMathsTester : public KUnitTest::Tester
+{
+public:
+        void allTests();
+    void UINT8Tests();
+    void UINT16Tests();
+    void conversionTests();
+};
+
+#endif
+
diff --git a/chalk/core/tiles/Makefile.am b/chalk/core/tiles/Makefile.am
new file mode 100644
index 000000000..1e334ab47
--- /dev/null
+++ b/chalk/core/tiles/Makefile.am
@@ -0,0 +1,23 @@
+if include_kunittest_tests
+TESTSDIR = tests
+endif
+
+SUBDIRS = . $(TESTSDIR)
+
+INCLUDES  = -I$(srcdir)/../ \
+	-I$(srcdir)/../../sdk \
+    $(KOFFICE_INCLUDES) \
+	-I$(interfacedir) \
+	$(all_includes)
+
+noinst_LTLIBRARIES = libchalktile.la
+
+libchalktile_la_SOURCES = kis_tiledvlineiterator.cc kis_tiledhlineiterator.cc \
+		kis_tileddatamanager.cc kis_tile.cc kis_tilediterator.cc kis_tiledrectiterator.cc \
+		kis_memento.cc kis_tilemanager.cc kis_tiled_random_accessor.cc 
+
+libchalktile_la_METASOURCES = AUTO
+
+include_HEADERS = \
+    kis_tileddatamanager.h
+noinst_HEADERS = kis_tiled_random_accessor.h
diff --git a/chalk/core/tiles/kis_memento.cc b/chalk/core/tiles/kis_memento.cc
new file mode 100644
index 000000000..aaec37242
--- /dev/null
+++ b/chalk/core/tiles/kis_memento.cc
@@ -0,0 +1,154 @@
+/*
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kis_global.h"
+#include "kis_memento.h"
+#include "kis_tile.h"
+#include "kis_tile_global.h"
+
+KisMemento::KisMemento(TQ_UINT32 pixelSize) : KShared()
+{
+    m_hashTable = new KisTile * [1024];
+    Q_CHECK_PTR(m_hashTable);
+
+    m_redoHashTable = new KisTile * [1024];
+    Q_CHECK_PTR(m_redoHashTable);
+
+    for(int i = 0; i < 1024; i++)
+    {
+        m_hashTable [i] = 0;
+        m_redoHashTable [i] = 0;
+    }
+    m_numTiles = 0;
+    m_defPixel = new TQ_UINT8[pixelSize];
+    m_redoDefPixel = new TQ_UINT8[pixelSize];
+    m_valid = true;
+}
+
+KisMemento::~KisMemento()
+{
+    // Deep delete every tile
+    for(int i = 0; i < 1024; i++)
+    {
+        deleteAll(m_hashTable[i]);
+        deleteAll(m_redoHashTable[i]);
+    }
+    delete [] m_hashTable;
+    delete [] m_redoHashTable;
+
+    // Delete defPixel arrays;
+    delete [] m_defPixel;
+    delete [] m_redoDefPixel;
+}
+
+KisMemento::DeletedTileList::~DeletedTileList()
+{
+    clear();
+}
+
+void KisMemento::DeletedTileList::clear()
+{
+    // They are not tiles just references. The actual tiles have already been deleted,
+    // so just delete the references.
+
+    const DeletedTile *deletedTile = m_firstDeletedTile;
+
+    while (deletedTile)
+    {
+        const DeletedTile *d = deletedTile;
+        deletedTile = deletedTile->next();
+        delete d;
+    }
+
+    m_firstDeletedTile = 0;
+}
+
+void KisMemento::deleteAll(KisTile *tile)
+{
+    while(tile)
+    {
+        KisTile *deltile = tile;
+        tile = tile->getNext();
+        delete deltile;
+    }
+}
+
+void KisMemento::extent(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const
+{
+    TQ_INT32 maxX = TQ_INT32_MIN;
+    TQ_INT32 maxY = TQ_INT32_MIN;
+    x = TQ_INT32_MAX;
+    y = TQ_INT32_MAX;
+
+    for(int i = 0; i < 1024; i++)
+    {
+        KisTile *tile = m_hashTable[i];
+
+        while(tile)
+        {
+            if(x > tile->getCol() * KisTile::WIDTH)
+                x = tile->getCol() * KisTile::WIDTH;
+            if(maxX < (tile->getCol() + 1) * KisTile::WIDTH - 1)
+                maxX = (tile->getCol() + 1) * KisTile::WIDTH - 1;
+            if(y > tile->getRow() * KisTile::HEIGHT)
+                y = tile->getRow() * KisTile::HEIGHT;
+            if(maxY < (tile->getRow() +1) * KisTile::HEIGHT - 1)
+                maxY = (tile->getRow() +1) * KisTile::HEIGHT - 1;
+
+            tile = tile->getNext();
+        }
+    }
+
+    if(maxX < x)
+        w = 0;
+    else
+        w = maxX - x +1;
+
+    if(maxY < y)
+        h = 0;
+    else
+        h = maxY - y +1;
+}
+
+TQRect KisMemento::extent() const
+{
+    TQ_INT32 x;
+    TQ_INT32 y;
+    TQ_INT32 w;
+    TQ_INT32 h;
+
+    extent(x, y, w, h);
+
+    return TQRect(x, y, w, h);
+}
+
+bool KisMemento::containsTile(TQ_INT32 col, TQ_INT32 row, TQ_UINT32 tileHash) const
+{
+    const KisTile *tile = m_hashTable[tileHash];
+
+    while (tile != 0)
+    {
+        if (tile->getRow() == row && tile->getCol() == col) {
+            return true;
+        }
+
+        tile = tile->getNext();
+    }
+
+    return false;
+}
+
diff --git a/chalk/core/tiles/kis_memento.h b/chalk/core/tiles/kis_memento.h
new file mode 100644
index 000000000..5942dc445
--- /dev/null
+++ b/chalk/core/tiles/kis_memento.h
@@ -0,0 +1,147 @@
+/*
+ *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_MEMENTO_H_
+#define KIS_MEMENTO_H_
+
+#include <tqglobal.h>
+#include <tqrect.h>
+
+#include <ksharedptr.h>
+
+class KisTile;
+class KisTiledDataManager;
+
+class KisMemento;
+typedef KSharedPtr<KisMemento> KisMementoSP;
+
+class KisMemento : public KShared
+{
+public:
+    KisMemento(TQ_UINT32 pixelSize);
+    ~KisMemento();
+/*
+    // For consolidating transactions
+    virtual KisTransaction &operator+=(const KisTransaction &) = 0;
+    // For consolidating transactions
+    virtual KisTransaction &operator+(const KisTransaction &,
+                  const KisTransaction &) = 0;
+*/
+    void extent(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const;
+    TQRect extent() const;
+
+    bool containsTile(TQ_INT32 col, TQ_INT32 row, TQ_UINT32 tileHash) const;
+
+    // For debugging use
+    bool valid() const { return m_valid; }
+    void setInvalid() { m_valid = false; }
+
+private:
+
+    class DeletedTile {
+    public:
+        DeletedTile(TQ_INT32 col, TQ_INT32 row, const DeletedTile *next)
+            : m_col(col),
+              m_row(row),
+              m_next(next)
+        {
+        }
+
+        TQ_INT32 col() const { return m_col; }
+        TQ_INT32 row() const { return m_row; }
+        const DeletedTile *next() const { return m_next; }
+
+    private:
+        TQ_INT32 m_col;
+        TQ_INT32 m_row;
+        const DeletedTile *m_next;
+    };
+
+    class DeletedTileList {
+    public:
+        DeletedTileList()
+            : m_firstDeletedTile(0)
+        {
+        }
+
+        ~DeletedTileList();
+
+        void addTile(TQ_INT32 col, TQ_INT32 row)
+        {
+            DeletedTile *d = new DeletedTile(col, row, m_firstDeletedTile);
+            Q_CHECK_PTR(d);
+
+            m_firstDeletedTile = d;
+        }
+
+        DeletedTile *firstTile() const
+        {
+            return m_firstDeletedTile;
+        }
+
+        void clear();
+
+    private:
+        DeletedTile *m_firstDeletedTile;
+    };
+
+    void addTileToDeleteOnRedo(TQ_INT32 col, TQ_INT32 row)
+    {
+        m_redoDelTilesList.addTile(col, row);
+    }
+
+    DeletedTile *tileListToDeleteOnRedo()
+    {
+        return m_redoDelTilesList.firstTile();
+    }
+
+    void clearTilesToDeleteOnRedo()
+    {
+        m_redoDelTilesList.clear();
+    }
+
+    void addTileToDeleteOnUndo(TQ_INT32 col, TQ_INT32 row)
+    {
+        m_undoDelTilesList.addTile(col, row);
+    }
+
+    DeletedTile *tileListToDeleteOnUndo()
+    {
+        return m_undoDelTilesList.firstTile();
+    }
+
+    void clearTilesToDeleteOnUndo()
+    {
+        m_undoDelTilesList.clear();
+    }
+
+    friend class KisTiledDataManager;
+    KisTiledDataManager *originator;
+    KisTile **m_hashTable;
+    TQ_UINT32 m_numTiles;
+    KisTile **m_redoHashTable;
+    DeletedTileList m_redoDelTilesList;
+    DeletedTileList m_undoDelTilesList;
+    TQ_UINT8 *m_defPixel;
+    TQ_UINT8 *m_redoDefPixel;
+    void deleteAll(KisTile *tile);
+
+    bool m_valid;
+};
+
+#endif // KIS_MEMENTO_H_
diff --git a/chalk/core/tiles/kis_tile.cc b/chalk/core/tiles/kis_tile.cc
new file mode 100644
index 000000000..86d55128f
--- /dev/null
+++ b/chalk/core/tiles/kis_tile.cc
@@ -0,0 +1,152 @@
+/*
+ *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include <assert.h>
+#include <kdebug.h>
+
+#include "kis_tile_global.h"
+#include "kis_tile.h"
+#include "kis_tileddatamanager.h"
+#include "kis_tilemanager.h"
+
+const TQ_INT32 KisTile::WIDTH = 64;
+const TQ_INT32 KisTile::HEIGHT = 64;
+
+
+KisTile::KisTile(TQ_INT32 pixelSize, TQ_INT32 col, TQ_INT32 row, const TQ_UINT8 *defPixel)
+{
+    m_pixelSize = pixelSize;
+    m_data = 0;
+    m_nextTile = 0;
+    m_col = col;
+    m_row = row;
+    m_nReadlock = 0;
+
+    allocate();
+
+    KisTileManager::instance()->registerTile(this);
+
+    setData(defPixel);
+}
+
+KisTile::KisTile(const KisTile& rhs, TQ_INT32 col, TQ_INT32 row)
+{
+    if (this != &rhs) {
+        m_pixelSize = rhs.m_pixelSize;
+        m_data = 0;
+        m_nextTile = 0;
+        m_nReadlock = 0;
+
+        allocate();
+
+        // Assure we have data to copy
+        rhs.addReader();
+        memcpy(m_data, rhs.m_data, WIDTH * HEIGHT * m_pixelSize * sizeof(TQ_UINT8));
+        rhs.removeReader();
+
+        m_col = col;
+        m_row = row;
+
+        KisTileManager::instance()->registerTile(this);
+    }
+}
+
+KisTile::KisTile(const KisTile& rhs)
+{
+    if (this != &rhs) {
+        m_pixelSize = rhs.m_pixelSize;
+        m_col = rhs.m_col;
+        m_row = rhs.m_row;
+        m_data = 0;
+        m_nextTile = 0;
+        m_nReadlock = 0;
+
+        allocate();
+
+        rhs.addReader();
+        memcpy(m_data, rhs.m_data, WIDTH * HEIGHT * m_pixelSize * sizeof(TQ_UINT8));
+        rhs.removeReader();
+
+        KisTileManager::instance()->registerTile(this);
+    }
+}
+
+KisTile::~KisTile()
+{
+    KisTileManager::instance()->deregisterTile(this); // goes before the deleting of m_data!
+
+    if (m_data) {
+//        delete[] m_data;
+        KisTileManager::instance()->dontNeedTileData(m_data, m_pixelSize);
+        m_data = 0;
+    }
+    assert( !readers() );
+}
+
+void KisTile::allocate()
+{
+    if (m_data == 0) {
+        assert (!readers());
+        m_data = KisTileManager::instance()->requestTileData(m_pixelSize);
+        Q_CHECK_PTR(m_data);
+    }
+}
+
+void KisTile::setNext(KisTile *n)
+{
+    m_nextTile = n;
+}
+
+TQ_UINT8 *KisTile::data(TQ_INT32 x, TQ_INT32 y ) const
+{
+    addReader();
+    removeReader();
+
+    Q_ASSERT(m_data != 0);
+    if (m_data == 0) return 0;
+
+    return m_data + m_pixelSize * ( y * WIDTH + x );
+}
+
+void KisTile::setData(const TQ_UINT8 *pixel)
+{
+    addReader();
+    TQ_UINT8 *dst = m_data;
+    for(int i=0; i <WIDTH * HEIGHT;i++)
+    {
+        memcpy(dst, pixel, m_pixelSize);
+        dst+=m_pixelSize;
+    }
+    removeReader();
+}
+
+void KisTile::addReader() const
+{
+    if (m_nReadlock++ == 0)
+        KisTileManager::instance()->ensureTileLoaded(this);
+    else if (m_nReadlock < 0) {
+        kdDebug(41000) << m_nReadlock << endl;
+        assert(0);
+    }
+    assert(m_data);
+}
+
+void KisTile::removeReader() const
+{
+    if (--m_nReadlock == 0)
+        KisTileManager::instance()->maySwapTile(this);
+}
diff --git a/chalk/core/tiles/kis_tile.h b/chalk/core/tiles/kis_tile.h
new file mode 100644
index 000000000..f2d6f1e9a
--- /dev/null
+++ b/chalk/core/tiles/kis_tile.h
@@ -0,0 +1,87 @@
+/*
+ *  Copyright (c) 2004 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_TILE_H_
+#define KIS_TILE_H_
+
+#include <tqglobal.h>
+#include <tqrect.h>
+
+class KisTiledDataManager;
+class KisTiledIterator;
+
+/**
+ * Provides abstraction to a tile.  A tile tqcontains
+ * a part of a PaintDevice, but only the individual pixels
+ * are accesable and that only via iterators.
+ */
+class KisTile  {
+public:
+    KisTile(TQ_INT32 pixelSize, TQ_INT32 col, TQ_INT32 row, const TQ_UINT8 *defPixel);
+    KisTile(const KisTile& rhs, TQ_INT32 col, TQ_INT32 row);
+    KisTile(const KisTile& rhs);
+    ~KisTile();
+
+public:
+    void release();
+    void allocate();
+
+    TQ_UINT8 *data(TQ_INT32 xoff, TQ_INT32 yoff) const;
+    TQ_UINT8 *data() const { return m_data; }
+
+    void setData(const TQ_UINT8 *pixel);
+
+    TQ_INT32 refCount() const;
+    void ref();
+
+    TQ_INT32 getRow() const { return m_row; }
+    TQ_INT32 getCol() const { return m_col; }
+
+    TQRect extent() const { return TQRect(m_col * WIDTH, m_row * HEIGHT, WIDTH, HEIGHT); }
+
+    void setNext(KisTile *);
+    KisTile *getNext() const { return m_nextTile; }
+
+    // These are const because they don't change the external data the tile represents,
+    // although they do change internal representations. We need to be able to request
+    // access to a tile in a const enviroment (like copyconstructor and so)!
+    void addReader() const;
+    void removeReader() const;
+    TQ_INT32 readers() { return m_nReadlock; }
+
+    friend class KisTiledIterator;
+    friend class KisTiledDataManager;
+    friend class KisMemento;
+    friend class KisTileManager;
+private:
+    KisTile& operator=(const KisTile&);
+
+private:
+    TQ_UINT8 *m_data;
+    mutable TQ_INT32 m_nReadlock;
+    TQ_INT32 m_row;
+    TQ_INT32 m_col;
+    TQ_INT32 m_pixelSize;
+    KisTile *m_nextTile;
+
+public:
+    static const TQ_INT32 WIDTH;
+    static const TQ_INT32 HEIGHT;
+};
+
+#endif // KIS_TILE_H_
+
diff --git a/chalk/core/tiles/kis_tile_global.h b/chalk/core/tiles/kis_tile_global.h
new file mode 100644
index 000000000..93052a4f6
--- /dev/null
+++ b/chalk/core/tiles/kis_tile_global.h
@@ -0,0 +1,23 @@
+/*
+ *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_TILE_GLOBAL_H_
+#define KIS_TILE_GLOBAL_H_
+
+#define DBG_AREA_TILES 41000
+
+#endif
diff --git a/chalk/core/tiles/kis_tiled_random_accessor.cc b/chalk/core/tiles/kis_tiled_random_accessor.cc
new file mode 100644
index 000000000..159faf18c
--- /dev/null
+++ b/chalk/core/tiles/kis_tiled_random_accessor.cc
@@ -0,0 +1,115 @@
+/*
+ *  copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+#include "kis_tiled_random_accessor.h"
+
+
+const TQ_UINT32 KisTiledRandomAccessor::CACHESIZE = 4; // Define the number of tiles we keep in cache
+
+KisTiledRandomAccessor::KisTiledRandomAccessor(KisTiledDataManager *ktm, TQ_INT32 x, TQ_INT32 y, bool writable) : m_ktm(ktm), m_tilesCache(new KisTileInfo*[4]), m_tilesCacheSize(0), m_pixelSize (m_ktm->pixelSize()), m_writable(writable)
+{
+    Q_ASSERT(ktm != 0);
+    moveTo(x, y);
+}
+
+KisTiledRandomAccessor::~KisTiledRandomAccessor()
+{
+    for( uint i = 0; i < m_tilesCacheSize; i++)
+    {
+        m_tilesCache[i]->tile->removeReader();
+        m_tilesCache[i]->oldtile->removeReader();
+        delete m_tilesCache[i];
+    }
+    delete m_tilesCache;
+}
+
+void KisTiledRandomAccessor::moveTo(TQ_INT32 x, TQ_INT32 y)
+{
+    // Look in the cache if the tile if the data is available
+    for( uint i = 0; i < m_tilesCacheSize; i++)
+    {
+        if( x >= m_tilesCache[i]->area_x1 && x <= m_tilesCache[i]->area_x2 &&
+            y >= m_tilesCache[i]->area_y1 && y <= m_tilesCache[i]->area_y2 )
+        {
+            KisTileInfo* kti = m_tilesCache[i];
+            TQ_UINT32 offset = x - kti->area_x1 + (y -kti->area_y1) * KisTile::WIDTH;
+            offset *= m_pixelSize;
+            m_data = kti->data + offset;
+            m_oldData = kti->oldData + offset;
+            if(i > 0)
+            {
+                memmove(m_tilesCache+1,m_tilesCache, i * sizeof(KisTileInfo*));
+                m_tilesCache[0] = kti;
+            }
+            return;
+        }
+    }
+    // The tile wasn't in cache
+    if(m_tilesCacheSize == KisTiledRandomAccessor::CACHESIZE )
+    { // Remove last element of cache
+        m_tilesCache[CACHESIZE-1]->tile->removeReader();
+        m_tilesCache[CACHESIZE-1]->oldtile->removeReader();
+        delete m_tilesCache[CACHESIZE-1];
+    } else {
+        m_tilesCacheSize++;
+    }
+    TQ_UINT32 col = xToCol( x );
+    TQ_UINT32 row = yToRow( y );
+    KisTileInfo* kti = fetchTileData(col, row);
+    TQ_UINT32 offset = x - kti->area_x1 + (y - kti->area_y1) * KisTile::WIDTH;
+    offset *= m_pixelSize;
+    m_data = kti->data + offset;
+    m_oldData = kti->oldData + offset;
+    memmove(m_tilesCache+1,m_tilesCache, (KisTiledRandomAccessor::CACHESIZE-1) * sizeof(KisTileInfo*));
+    m_tilesCache[0] = kti;
+}
+
+
+TQ_UINT8 * KisTiledRandomAccessor::rawData() const
+{
+    return m_data;
+}
+
+
+const TQ_UINT8 * KisTiledRandomAccessor::oldRawData() const
+{
+#ifdef DEBUG
+    kdWarning(!m_ktm->hasCurrentMemento(), DBG_AREA_TILES) << "Accessing oldRawData() when no transaction is in progress.\n";
+#endif
+    return m_oldData;
+}
+
+KisTiledRandomAccessor::KisTileInfo* KisTiledRandomAccessor::fetchTileData(TQ_INT32 col, TQ_INT32 row)
+{
+    KisTileInfo* kti = new KisTileInfo;
+    kti->tile = m_ktm->getTile(col, row, m_writable);
+    
+    kti->tile->addReader();
+
+    kti->data = kti->tile->data();
+    
+    kti->area_x1 = col * KisTile::HEIGHT;
+    kti->area_y1 = row * KisTile::WIDTH;
+    kti->area_x2 = kti->area_x1 + KisTile::HEIGHT - 2;
+    kti->area_y2 = kti->area_y1 + KisTile::WIDTH - 2;
+
+    // set old data
+    kti->oldtile = m_ktm->getOldTile(col, row, kti->tile);
+    kti->oldtile->addReader();
+    kti->oldData = kti->oldtile->data();
+    return kti;
+}
diff --git a/chalk/core/tiles/kis_tiled_random_accessor.h b/chalk/core/tiles/kis_tiled_random_accessor.h
new file mode 100644
index 000000000..23768ee64
--- /dev/null
+++ b/chalk/core/tiles/kis_tiled_random_accessor.h
@@ -0,0 +1,66 @@
+/*
+ *  copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
+ *
+ *  this program is free software; you can redistribute it and/or modify
+ *  it under the terms of the gnu general public license as published by
+ *  the free software foundation; either version 2 of the license, or
+ *  (at your option) any later version.
+ *
+ *  this program is distributed in the hope that it will be useful,
+ *  but without any warranty; without even the implied warranty of
+ *  merchantability or fitness for a particular purpose.  see the
+ *  gnu general public license for more details.
+ *
+ *  you should have received a copy of the gnu general public license
+ *  along with this program; if not, write to the free software
+ *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
+ */
+#ifndef KIS_TILED_RANDOM_ACCESSOR_H
+#define KIS_TILED_RANDOM_ACCESSOR_H
+
+#include <tqrect.h>
+#include <tqvaluelist.h>
+
+#include <ksharedptr.h>
+
+#include <kis_tileddatamanager.h>
+
+class KisTile;
+
+class KisTiledRandomAccessor : public KShared {
+    struct KisTileInfo {
+        KisTile* tile;
+        KisTile* oldtile;
+        TQ_UINT8* data;
+        const TQ_UINT8* oldData;
+        TQ_INT32 area_x1, area_y1, area_x2, area_y2;
+    };
+    public:
+        KisTiledRandomAccessor(KisTiledDataManager *ktm, TQ_INT32 x, TQ_INT32 y, bool writable);
+        ~KisTiledRandomAccessor();
+
+
+    private:
+        inline TQ_UINT32 xToCol(TQ_UINT32 x) const { if (m_ktm) return m_ktm->xToCol(x); else return 0; };
+        inline TQ_UINT32 yToRow(TQ_UINT32 y) const { if (m_ktm) return m_ktm->yToRow(y); else return 0; };
+        KisTileInfo* fetchTileData(TQ_INT32 col, TQ_INT32 row);
+
+    public:
+        /// Move to a given x,y position, fetch tiles and data
+        void moveTo(TQ_INT32 x, TQ_INT32 y);
+        TQ_UINT8* rawData() const;
+        const TQ_UINT8* oldRawData() const;
+
+    private:
+        KisTiledDataManager *m_ktm;
+        KisTileInfo** m_tilesCache;
+        TQ_UINT32 m_tilesCacheSize;
+        TQ_INT32 m_pixelSize;
+        TQ_UINT8* m_data;
+        const TQ_UINT8* m_oldData;
+        bool m_writable;
+        static const TQ_UINT32 CACHESIZE; // Define the number of tiles we keep in cache
+
+};
+
+#endif
diff --git a/chalk/core/tiles/kis_tileddatamanager.cc b/chalk/core/tiles/kis_tileddatamanager.cc
new file mode 100644
index 000000000..629b1b382
--- /dev/null
+++ b/chalk/core/tiles/kis_tileddatamanager.cc
@@ -0,0 +1,1044 @@
+/*
+ *  Copyright (c) 2004 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <tqvaluevector.h>
+
+#include <kdebug.h>
+
+#include <KoStore.h>
+
+#include "kis_global.h"
+#include "kis_debug_areas.h"
+#include "kis_tileddatamanager.h"
+#include "kis_tilediterator.h"
+#include "kis_tile.h"
+#include "kis_memento.h"
+#include "kis_tilemanager.h"
+
+/* The data area is divided into tiles each say 64x64 pixels (defined at compiletime)
+ * The tiles are laid out in a matrix that can have negative indexes.
+ * The matrix grows automatically if needed (a call for writeacces to a tile outside the current extent)
+ *  Even though the matrix has grown it may still not contain tiles at specific positions. They are created on demand
+ */
+
+KisTiledDataManager::KisTiledDataManager(TQ_UINT32 pixelSize, const TQ_UINT8 *defPixel)
+{
+    m_pixelSize = pixelSize;
+
+    m_defPixel = new TQ_UINT8[m_pixelSize];
+    Q_CHECK_PTR(m_defPixel);
+    memcpy(m_defPixel, defPixel, m_pixelSize);
+
+    m_defaultTile = new KisTile(pixelSize,0,0, m_defPixel);
+    Q_CHECK_PTR(m_defaultTile);
+
+    m_hashTable = new KisTile * [1024];
+    Q_CHECK_PTR(m_hashTable);
+
+    for(int i = 0; i < 1024; i++)
+        m_hashTable [i] = 0;
+    m_numTiles = 0;
+    m_currentMemento = 0;
+    m_extentMinX = TQ_INT32_MAX;
+    m_extentMinY = TQ_INT32_MAX;
+    m_extentMaxX = TQ_INT32_MIN;
+    m_extentMaxY = TQ_INT32_MIN;
+}
+
+KisTiledDataManager::KisTiledDataManager(const KisTiledDataManager & dm)
+    : KShared()
+{
+    m_pixelSize = dm.m_pixelSize;
+
+    m_defPixel = new TQ_UINT8[m_pixelSize];
+    Q_CHECK_PTR(m_defPixel);
+    memcpy(m_defPixel, dm.m_defPixel, m_pixelSize);
+
+    m_defaultTile = new KisTile(*dm.m_defaultTile, dm.m_defaultTile->getCol(), dm.m_defaultTile->getRow());
+    Q_CHECK_PTR(m_defaultTile);
+
+    m_hashTable = new KisTile * [1024];
+    Q_CHECK_PTR(m_hashTable);
+
+    m_numTiles = 0;
+    m_currentMemento = 0;
+    m_extentMinX = dm.m_extentMinX;
+    m_extentMinY = dm.m_extentMinY;
+    m_extentMaxX = dm.m_extentMaxX;
+    m_extentMaxY = dm.m_extentMaxY;
+
+    // Deep copy every tile. XXX: Make this copy-on-write!
+    for(int i = 0; i < 1024; i++)
+    {
+        const KisTile *tile = dm.m_hashTable[i];
+
+        m_hashTable[i] = 0;
+
+        while(tile)
+        {
+            KisTile *newtile = new KisTile(*tile, tile->getCol(), tile->getRow());
+            Q_CHECK_PTR(newtile);
+
+            newtile->setNext(m_hashTable[i]);
+            m_hashTable[i] = newtile;
+            tile = tile->getNext();
+
+            m_numTiles++;
+        }
+    }
+
+}
+
+KisTiledDataManager::~KisTiledDataManager()
+{
+    // Deep delete every tile
+    for(int i = 0; i < 1024; i++)
+    {
+        const KisTile *tile = m_hashTable[i];
+
+        while(tile)
+        {
+            const KisTile *deltile = tile;
+            tile = tile->getNext();
+            delete deltile;
+        }
+    }
+    delete [] m_hashTable;
+    delete m_defaultTile;
+    delete [] m_defPixel;
+}
+
+void KisTiledDataManager::setDefaultPixel(const TQ_UINT8 *defPixel)
+{
+    if (defPixel == 0) return;
+
+    memcpy(m_defPixel, defPixel, m_pixelSize);
+
+    m_defaultTile->setData(m_defPixel);
+}
+
+bool KisTiledDataManager::write(KoStore *store)
+{
+
+    if (store == 0) return false;
+    //Q_ASSERT(store != 0);
+
+    char str[80];
+
+    sprintf(str, "%d\n", m_numTiles);
+    store->write(str,strlen(str));
+
+    for(int i = 0; i < 1024; i++)
+    {
+        const KisTile *tile = m_hashTable[i];
+
+        while(tile)
+        {
+            sprintf(str, "%d,%d,%d,%d\n", tile->getCol() * KisTile::WIDTH,
+                            tile->getRow() * KisTile::HEIGHT,
+                            KisTile::WIDTH, KisTile::HEIGHT);
+            store->write(str,strlen(str));
+
+            tile->addReader();
+            store->write((char *)tile->m_data, KisTile::HEIGHT * KisTile::WIDTH * m_pixelSize);
+            tile->removeReader();
+
+            tile = tile->getNext();
+        }
+    }
+
+    return true;
+}
+bool KisTiledDataManager::read(KoStore *store)
+{
+    if (store == 0) return false;
+    //Q_ASSERT(store != 0);
+
+    char str[80];
+    TQ_INT32 x,y,w,h;
+
+    TQIODevice *stream = store->device();
+    if (stream == 0) return false;
+    //Q_ASSERT(stream != 0);
+
+    stream->readLine(str, 79);
+
+    sscanf(str,"%u",&m_numTiles);
+
+    for(TQ_UINT32 i = 0; i < m_numTiles; i++)
+    {
+        stream->readLine(str, 79);
+        sscanf(str,"%d,%d,%d,%d",&x,&y,&w,&h);
+
+        // the following is only correct as long as tile size is not changed
+        // The first time we change tilesize the dimensions just read needs to be respected
+        // but for now we just assume that tiles are the same size as ever.
+        TQ_INT32 row = yToRow(y);
+        TQ_INT32 col = xToCol(x);
+        TQ_UINT32 tileHash = calcTileHash(col, row);
+
+        KisTile *tile = new KisTile(m_pixelSize, col, row, m_defPixel);
+        Q_CHECK_PTR(tile);
+
+        updateExtent(col,row);
+
+        tile->addReader();
+        store->read((char *)tile->m_data, KisTile::HEIGHT * KisTile::WIDTH * m_pixelSize);
+        tile->removeReader();
+
+        tile->setNext(m_hashTable[tileHash]);
+        m_hashTable[tileHash] = tile;
+    }
+    return true;
+}
+
+void KisTiledDataManager::extent(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const
+{
+    x = m_extentMinX;
+    y = m_extentMinY;
+
+    if (m_extentMaxX >= m_extentMinX) {
+        w = m_extentMaxX - m_extentMinX + 1;
+    } else {
+        w = 0;
+    }
+
+    if (m_extentMaxY >= m_extentMinY) {
+        h = m_extentMaxY - m_extentMinY + 1;
+    } else {
+        h = 0;
+    }
+}
+
+TQRect KisTiledDataManager::extent() const
+{
+    TQ_INT32 x;
+    TQ_INT32 y;
+    TQ_INT32 w;
+    TQ_INT32 h;
+
+    extent(x, y, w, h);
+
+    return TQRect(x, y, w, h);
+}
+
+void KisTiledDataManager::setExtent(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h)
+{
+    TQRect newRect = TQRect(x, y, w, h).normalize();
+    //printRect("newRect", newRect);
+    TQRect oldRect = TQRect(m_extentMinX, m_extentMinY, m_extentMaxX - m_extentMinX + 1, m_extentMaxY - m_extentMinY + 1).normalize();
+    //printRect("oldRect", oldRect);
+
+    // Do nothing if the desired size is bigger than we currently are: that is handled by the autoextending automatically
+    if (newRect.tqcontains(oldRect)) return;
+
+    // Loop through all tiles, if a tile is wholly outside the extent, add to the memento, then delete it,
+    // if the tile is partially outside the extent, clear the outside pixels to the default pixel.
+    for(int tileHash = 0; tileHash < 1024; tileHash++)
+    {
+        KisTile *tile = m_hashTable[tileHash];
+        KisTile *previousTile = 0;
+
+        while(tile)
+        {
+            TQRect tileRect = TQRect(tile->getCol() * KisTile::WIDTH, tile->getRow() * KisTile::HEIGHT, KisTile::WIDTH, KisTile::HEIGHT);
+            //printRect("tileRect", tileRect);
+
+            if (newRect.tqcontains(tileRect)) {
+                // Completely inside, do nothing
+                previousTile = tile;
+                tile = tile->getNext();
+            }
+            else {
+                ensureTileMementoed(tile->getCol(), tile->getRow(), tileHash, tile);
+
+                if (newRect.intersects(tileRect)) {
+
+                    // Create the intersection of the tile and new rect
+                    TQRect intersection = newRect.intersect(tileRect);
+                    //printRect("intersection", intersection);
+                    intersection.setRect(intersection.x() - tileRect.x(), intersection.y() - tileRect.y(), intersection.width(), intersection.height());
+
+                    // This can be done a lot more efficiently, no doubt, by clearing runs of pixels to the left and the right of
+                    // the intersecting line.
+                    tile->addReader();
+                    for (int y = 0; y < KisTile::HEIGHT; ++y) {
+                        for (int x = 0; x < KisTile::WIDTH; ++x) {
+                            if (!intersection.tqcontains(x,y)) {
+                                TQ_UINT8 * ptr = tile->data(x, y);
+                                memcpy(ptr, m_defPixel, m_pixelSize);
+                            }
+                        }
+                    }
+                    tile->removeReader();
+                    previousTile = tile;
+                    tile = tile->getNext();
+                }
+                else {
+                    KisTile *deltile = tile;
+                    tile = tile->getNext();
+
+                    m_numTiles--;
+
+                    if (previousTile)
+                        previousTile->setNext(tile);
+                    else
+                        m_hashTable[tileHash] = tile;
+                    delete deltile;
+                }
+            }
+        }
+    }
+
+    // Set the extent correctly
+    m_extentMinX = x;
+    m_extentMinY = y;
+    m_extentMaxX = x + w - 1;
+    m_extentMaxY = y + h - 1;
+}
+
+void KisTiledDataManager::recalculateExtent()
+{
+    m_extentMinX = TQ_INT32_MAX;
+    m_extentMinY = TQ_INT32_MAX;
+    m_extentMaxX = TQ_INT32_MIN;
+    m_extentMaxY = TQ_INT32_MIN;
+
+    // Loop through all tiles.
+    for (int tileHash = 0; tileHash < 1024; tileHash++)
+    {
+        const KisTile *tile = m_hashTable[tileHash];
+
+        while (tile)
+        {
+            updateExtent(tile->getCol(), tile->getRow());
+            tile = tile->getNext();
+        }
+    }
+}
+
+void KisTiledDataManager::clear(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, TQ_UINT8 clearValue)
+{
+    if (w < 1 || h < 1) {
+        return;
+    }
+
+    TQ_INT32 firstColumn = xToCol(x);
+    TQ_INT32 lastColumn = xToCol(x + w - 1);
+
+    TQ_INT32 firstRow = yToRow(y);
+    TQ_INT32 lastRow = yToRow(y + h - 1);
+
+    TQRect clearRect(x, y, w, h);
+
+    const TQ_UINT32 rowStride = KisTile::WIDTH * m_pixelSize;
+
+    for (TQ_INT32 row = firstRow; row <= lastRow; ++row) {
+        for (TQ_INT32 column = firstColumn; column <= lastColumn; ++column) {
+
+            KisTile *tile = getTile(column, row, true);
+            TQRect tileRect = tile->extent();
+
+            TQRect clearTileRect = clearRect & tileRect;
+
+            tile->addReader();
+            if (clearTileRect == tileRect) {
+                // Clear whole tile
+                memset(tile->data(), clearValue, KisTile::WIDTH * KisTile::HEIGHT * m_pixelSize);
+            } else {
+
+                TQ_UINT32 rowsRemaining = clearTileRect.height();
+                TQ_UINT8 *dst = tile->data(clearTileRect.x() - tileRect.x(), clearTileRect.y() - tileRect.y());
+
+                while (rowsRemaining > 0) {
+                    memset(dst, clearValue, clearTileRect.width() * m_pixelSize);
+                    dst += rowStride;
+                    --rowsRemaining;
+                }
+            }
+            tile->removeReader();
+        }
+    }
+}
+
+void KisTiledDataManager::clear(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, const TQ_UINT8 *clearPixel)
+{
+    Q_ASSERT(clearPixel != 0);
+
+    if (clearPixel == 0 || w < 1 || h < 1) {
+        return;
+    }
+
+    bool pixelBytesAreTheSame = true;
+
+    for (TQ_UINT32 i = 0; i < m_pixelSize; ++i) {
+        if (clearPixel[i] != clearPixel[0]) {
+            pixelBytesAreTheSame = false;
+            break;
+        }
+    }
+
+    if (pixelBytesAreTheSame) {
+        clear(x, y, w, h, clearPixel[0]);
+    } else {
+
+        TQ_INT32 firstColumn = xToCol(x);
+        TQ_INT32 lastColumn = xToCol(x + w - 1);
+
+        TQ_INT32 firstRow = yToRow(y);
+        TQ_INT32 lastRow = yToRow(y + h - 1);
+
+        TQRect clearRect(x, y, w, h);
+
+        const TQ_UINT32 rowStride = KisTile::WIDTH * m_pixelSize;
+
+        TQ_UINT8 *clearPixelData = 0;
+
+        if (w >= KisTile::WIDTH && h >= KisTile::HEIGHT) {
+
+            // There might be a whole tile to be cleared so generate a cleared tile.
+            clearPixelData = new TQ_UINT8[KisTile::WIDTH * KisTile::HEIGHT * m_pixelSize];
+
+            TQ_UINT8 *dst = clearPixelData;
+            TQ_UINT32 pixelsRemaining = KisTile::WIDTH;
+
+            // Generate one row
+            while (pixelsRemaining > 0) {
+                memcpy(dst, clearPixel, m_pixelSize);
+                dst += m_pixelSize;
+                --pixelsRemaining;
+            }
+
+            TQ_UINT32 rowsRemaining = KisTile::HEIGHT - 1;
+
+            // Copy to the rest of the rows.
+            while (rowsRemaining > 0) {
+                memcpy(dst, clearPixelData, rowStride);
+                dst += rowStride;
+                --rowsRemaining;
+            }
+
+        } else {
+
+            // Generate one row
+            TQ_UINT32 maxRunLength = TQMIN(w, KisTile::WIDTH);
+
+            clearPixelData = new TQ_UINT8[maxRunLength * m_pixelSize];
+
+            TQ_UINT8 *dst = clearPixelData;
+            TQ_UINT32 pixelsRemaining = maxRunLength;
+
+            while (pixelsRemaining > 0) {
+                memcpy(dst, clearPixel, m_pixelSize);
+                dst += m_pixelSize;
+                --pixelsRemaining;
+            }
+        }
+
+        for (TQ_INT32 row = firstRow; row <= lastRow; ++row) {
+            for (TQ_INT32 column = firstColumn; column <= lastColumn; ++column) {
+
+                KisTile *tile = getTile(column, row, true);
+                TQRect tileRect = tile->extent();
+
+                TQRect clearTileRect = clearRect & tileRect;
+
+                if (clearTileRect == tileRect) {
+
+                    // Clear whole tile
+                    tile->addReader();
+                    memcpy(tile->data(), clearPixelData, KisTile::WIDTH * KisTile::HEIGHT * m_pixelSize);
+                    tile->removeReader();
+                } else {
+
+                    TQ_UINT32 rowsRemaining = clearTileRect.height();
+                    tile->addReader();
+                    TQ_UINT8 *dst = tile->data(clearTileRect.x() - tileRect.x(), clearTileRect.y() - tileRect.y());
+
+                    while (rowsRemaining > 0) {
+                        memcpy(dst, clearPixelData, clearTileRect.width() * m_pixelSize);
+                        dst += rowStride;
+                        --rowsRemaining;
+                    }
+                    tile->removeReader();
+                }
+            }
+        }
+
+        delete [] clearPixelData;
+    }
+}
+
+void KisTiledDataManager::clear()
+{
+    // Loop through all tiles, add to the memento, then delete it,
+    for(int tileHash = 0; tileHash < 1024; tileHash++)
+    {
+        const KisTile *tile = m_hashTable[tileHash];
+
+        while(tile)
+        {
+            ensureTileMementoed(tile->getCol(), tile->getRow(), tileHash, tile);
+
+            const KisTile *deltile = tile;
+            tile = tile->getNext();
+
+            delete deltile;
+        }
+        m_hashTable[tileHash] = 0;
+    }
+
+    m_numTiles = 0;
+
+    // Set the extent correctly
+    m_extentMinX = TQ_INT32_MAX;
+    m_extentMinY = TQ_INT32_MAX;
+    m_extentMaxX = TQ_INT32_MIN;
+    m_extentMaxY = TQ_INT32_MIN;
+}
+
+void KisTiledDataManager::paste(KisDataManagerSP data,  TQ_INT32 sx, TQ_INT32 sy, TQ_INT32 dx, TQ_INT32 dy,
+             TQ_INT32 w, TQ_INT32 h)
+{
+    //CBR_MISSING
+    sx=sy=dx=dy=w=h;data=0;
+}
+
+
+TQ_UINT32 KisTiledDataManager::calcTileHash(TQ_INT32 col, TQ_INT32 row)
+{
+    return ((row << 5) + (col & 0x1F)) & 0x3FF;
+}
+
+KisMementoSP KisTiledDataManager::getMemento()
+{
+    m_currentMemento = new KisMemento(m_pixelSize);
+    Q_CHECK_PTR(m_currentMemento);
+
+    memcpy(m_currentMemento->m_defPixel, m_defPixel, m_pixelSize);
+
+    return m_currentMemento;
+}
+
+void KisTiledDataManager::rollback(KisMementoSP memento)
+{
+    if (memento == 0) return;
+    //Q_ASSERT(memento != 0);
+
+    if (m_currentMemento != 0) {
+        // Undo means our current memento is no longer valid so remove it.
+        m_currentMemento = 0;
+    }
+
+    // Rollback means restoring all of the tiles in the memento to our hashtable.
+
+    // But first clear the memento redo hashtable.
+    // This is nessesary as new changes might have been done since last rollback (automatic filters)
+    for(int i = 0; i < 1024; i++)
+    {
+        memento->deleteAll(memento->m_redoHashTable[i]);
+        memento->m_redoHashTable[i]=0;
+    }
+
+    // Also clear the table of deleted tiles
+    memento->clearTilesToDeleteOnRedo();
+
+    // Now on to the real rollback
+
+    memcpy(memento->m_redoDefPixel, m_defPixel, m_pixelSize);
+    setDefaultPixel(memento->m_defPixel);
+
+    for(int i = 0; i < 1024; i++)
+    {
+        KisTile *tile = memento->m_hashTable[i];
+
+        while(tile)
+        {
+            // The memento has a tile stored that we need to roll back
+            // Now find the corresponding one in our hashtable
+            KisTile *curTile = m_hashTable[i];
+            KisTile *preTile = 0;
+            while(curTile)
+            {
+                if(curTile->getRow() == tile->getRow() && curTile->getCol() == tile->getCol())
+                {
+                    break;
+                }
+                preTile = curTile;
+                curTile = curTile->getNext();
+            }
+
+            if(curTile)
+            {
+                // Remove it from our hashtable
+                if(preTile)
+                    preTile->setNext(curTile->getNext());
+                else
+                    m_hashTable[i]= curTile->getNext();
+
+                m_numTiles--;
+
+                // And put it in the redo hashtable of the memento
+                curTile->setNext(memento->m_redoHashTable[i]);
+                memento->m_redoHashTable[i] = curTile;
+            }
+            else
+            {
+                memento->addTileToDeleteOnRedo(tile->getCol(), tile->getRow());
+                // As we are pratically adding a new tile we need to update the extent
+                updateExtent(tile->getCol(), tile->getRow());
+            }
+
+            // Put a copy of the memento tile into our hashtable
+            curTile = new KisTile(*tile);
+            Q_CHECK_PTR(curTile);
+            m_numTiles++;
+
+            curTile->setNext(m_hashTable[i]);
+            m_hashTable[i] = curTile;
+
+            tile = tile->getNext();
+        }
+    }
+
+    if (memento->tileListToDeleteOnUndo() != 0) {
+        // XXX: We currently add these tiles above, only to delete them again here.
+        deleteTiles(memento->tileListToDeleteOnUndo());
+    }
+}
+
+void KisTiledDataManager::rollforward(KisMementoSP memento)
+{
+    if (memento == 0) return;
+    //Q_ASSERT(memento != 0);
+
+    if (m_currentMemento != 0) {
+        // Redo means our current memento is no longer valid so remove it.
+        m_currentMemento = 0;
+    }
+
+    // Rollforward means restoring all of the tiles in the memento's redo to our hashtable.
+
+    setDefaultPixel(memento->m_redoDefPixel);
+
+    for(int i = 0; i < 1024; i++)
+    {
+        KisTile *tile = memento->m_redoHashTable[i];
+
+        while(tile)
+        {
+            // The memento has a tile stored that we need to roll forward
+            // Now find the corresponding one in our hashtable
+            KisTile *curTile = m_hashTable[i];
+            KisTile *preTile = 0;
+            while(curTile)
+            {
+                if(curTile->getRow() == tile->getRow() && curTile->getCol() == tile->getCol())
+                {
+                    break;
+                }
+                preTile = curTile;
+                curTile = curTile->getNext();
+            }
+
+            if (curTile)
+            {
+                // Remove it from our hashtable
+                if(preTile)
+                    preTile->setNext(curTile->getNext());
+                else
+                    m_hashTable[i]= curTile->getNext();
+
+                // And delete it (it's equal to the one stored in the memento's undo)
+                m_numTiles--;
+                delete curTile;
+            }
+
+            // Put a copy of the memento tile into our hashtable
+            curTile = new KisTile(*tile);
+            Q_CHECK_PTR(curTile);
+
+            curTile->setNext(m_hashTable[i]);
+            m_hashTable[i] = curTile;
+            m_numTiles++;
+            updateExtent(curTile->getCol(), curTile->getRow());
+
+            tile = tile->getNext();
+        }
+    }
+
+    // Roll forward also means re-deleting the tiles that was deleted but restored by the undo
+    if (memento->tileListToDeleteOnRedo() != 0) {
+        deleteTiles(memento->tileListToDeleteOnRedo());
+    }
+}
+
+void KisTiledDataManager::deleteTiles(const KisMemento::DeletedTile *d)
+{
+    while (d)
+    {
+        TQ_UINT32 tileHash = calcTileHash(d->col(), d->row());
+        KisTile *curTile = m_hashTable[tileHash];
+        KisTile *preTile = 0;
+        while(curTile)
+        {
+            if(curTile->getRow() == d->row() && curTile->getCol() == d->col())
+            {
+                break;
+            }
+            preTile = curTile;
+            curTile = curTile->getNext();
+        }
+        if (curTile) {
+            // Remove it from our hashtable
+            if(preTile)
+                preTile->setNext(curTile->getNext());
+            else
+                m_hashTable[tileHash] = curTile->getNext();
+    
+            // And delete it (it's equal to the one stored in the memento's undo)
+            m_numTiles--;
+            delete curTile;
+        }
+        d = d->next();
+    }
+
+    recalculateExtent();
+}
+
+void KisTiledDataManager::ensureTileMementoed(TQ_INT32 col, TQ_INT32 row, TQ_UINT32 tileHash, const KisTile *refTile)
+{
+    if (refTile == 0) return;
+    //Q_ASSERT(refTile != 0);
+
+    // Basically we search for the tile in the current memento, and if it's already there we do nothing, otherwise
+    //  we make a copy of the tile and put it in the current memento
+
+    if(!m_currentMemento)
+        return;
+
+    KisTile *tile = m_currentMemento->m_hashTable[tileHash];
+    while(tile != 0)
+    {
+        if(tile->getRow() == row && tile->getCol() == col)
+            break;
+
+        tile = tile->getNext();
+    }
+    if(tile)
+        return; // it has allready been stored
+
+    tile = new KisTile(*refTile);
+    Q_CHECK_PTR(tile);
+
+    tile->setNext(m_currentMemento->m_hashTable[tileHash]);
+    m_currentMemento->m_hashTable[tileHash] = tile;
+    m_currentMemento->m_numTiles++;
+}
+
+void KisTiledDataManager::updateExtent(TQ_INT32 col, TQ_INT32 row)
+{
+    if(m_extentMinX > col * KisTile::WIDTH)
+        m_extentMinX = col * KisTile::WIDTH;
+    if(m_extentMaxX < (col+1) * KisTile::WIDTH - 1)
+        m_extentMaxX = (col+1) * KisTile::WIDTH - 1;
+    if(m_extentMinY > row * KisTile::HEIGHT)
+        m_extentMinY = row * KisTile::HEIGHT;
+    if(m_extentMaxY < (row+1) * KisTile::HEIGHT - 1)
+        m_extentMaxY = (row+1) * KisTile::HEIGHT - 1;
+}
+
+KisTile *KisTiledDataManager::getTile(TQ_INT32 col, TQ_INT32 row, bool writeAccess)
+{
+    TQ_UINT32 tileHash = calcTileHash(col, row);
+
+    // Lookup tile in hash table
+    KisTile *tile = m_hashTable[tileHash];
+    while(tile != 0)
+    {
+        if(tile->getRow() == row && tile->getCol() == col)
+            break;
+
+        tile = tile->getNext();
+    }
+
+    // Might not have been created yet
+    if(!tile)
+    {
+        if(writeAccess)
+        {
+            // Create a new tile
+            tile = new KisTile(*m_defaultTile, col, row);
+            Q_CHECK_PTR(tile);
+
+            tile->setNext(m_hashTable[tileHash]);
+            m_hashTable[tileHash] = tile;
+            m_numTiles++;
+            updateExtent(col, row);
+
+            if (m_currentMemento && !m_currentMemento->containsTile(col, row, tileHash)) {
+                m_currentMemento->addTileToDeleteOnUndo(col, row);
+            }
+        }
+        else
+            // If only read access then it's enough to share a default tile
+            tile = m_defaultTile;
+    }
+
+    if(writeAccess)
+        ensureTileMementoed(col, row, tileHash, tile);
+
+    return tile;
+}
+
+KisTile *KisTiledDataManager::getOldTile(TQ_INT32 col, TQ_INT32 row, KisTile *def)
+{
+    KisTile *tile = 0;
+
+    // Lookup tile in hash table of current memento
+    if (m_currentMemento)
+    {
+        if (!m_currentMemento->valid()) return def;
+        //Q_ASSERT(m_currentMemento->valid());
+
+        TQ_UINT32 tileHash = calcTileHash(col, row);
+        tile = m_currentMemento->m_hashTable[tileHash];
+        while (tile != 0)
+        {
+            if (tile->getRow() == row && tile->getCol() == col)
+                break;
+
+            tile = tile->getNext();
+        }
+    }
+
+    if (!tile)
+        tile = def;
+
+    return tile;
+}
+
+TQ_UINT8* KisTiledDataManager::pixelPtr(TQ_INT32 x, TQ_INT32 y, bool writable)
+{
+    // Ahem, this is a bit not as good. The point is, this function needs the tile data,
+    // but it might be swapped out. This code swaps it in, but at function exit it might
+    // be swapped out again! THIS MAKES THE RETURNED POINTER TQUITE VOLATILE
+    return pixelPtrSafe(x, y, writable) -> data();
+}
+
+KisTileDataWrapperSP KisTiledDataManager::pixelPtrSafe(TQ_INT32 x, TQ_INT32 y, bool writable) {
+    TQ_INT32 row = yToRow(y);
+    TQ_INT32 col = xToCol(x);
+
+    // calc limits within the tile
+    TQ_INT32 yInTile = y - row * KisTile::HEIGHT;
+    TQ_INT32 xInTile = x - col * KisTile::WIDTH;
+    TQ_INT32 offset = m_pixelSize * (yInTile * KisTile::WIDTH + xInTile);
+
+    KisTile *tile = getTile(col, row, writable);
+
+    return new KisTileDataWrapper(tile, offset);
+}
+
+const TQ_UINT8* KisTiledDataManager::pixel(TQ_INT32 x, TQ_INT32 y)
+{
+    return pixelPtr(x, y, false);
+}
+
+TQ_UINT8* KisTiledDataManager::writablePixel(TQ_INT32 x, TQ_INT32 y)
+{
+    return pixelPtr(x, y, true);
+}
+
+void KisTiledDataManager::setPixel(TQ_INT32 x, TQ_INT32 y, const TQ_UINT8 * data)
+{
+    TQ_UINT8 *pixel = pixelPtr(x, y, true);
+    memcpy(pixel, data, m_pixelSize);
+}
+
+
+void KisTiledDataManager::readBytes(TQ_UINT8 * data,
+                    TQ_INT32 x, TQ_INT32 y,
+                    TQ_INT32 w, TQ_INT32 h)
+{
+    if (data == 0) return;
+    //Q_ASSERT(data != 0);
+     if (w < 0)
+         w = 0;
+
+     if (h < 0)
+        h = 0;
+
+    TQ_INT32 dstY = 0;
+    TQ_INT32 srcY = y;
+    TQ_INT32 rowsRemaining = h;
+
+    while (rowsRemaining > 0) {
+
+        TQ_INT32 dstX = 0;
+        TQ_INT32 srcX = x;
+        TQ_INT32 columnsRemaining = w;
+        TQ_INT32 numContiguousSrcRows = numContiguousRows(srcY, srcX, srcX + w - 1);
+
+        TQ_INT32 rows = TQMIN(numContiguousSrcRows, rowsRemaining);
+
+        while (columnsRemaining > 0) {
+
+            TQ_INT32 numContiguousSrcColumns = numContiguousColumns(srcX, srcY, srcY + rows - 1);
+
+            TQ_INT32 columns = TQMIN(numContiguousSrcColumns, columnsRemaining);
+
+            KisTileDataWrapperSP tileData = pixelPtrSafe(srcX, srcY, false);
+            const TQ_UINT8 *srcData = tileData -> data();
+            TQ_INT32 srcRowStride = rowStride(srcX, srcY);
+
+            TQ_UINT8 *dstData = data + ((dstX + (dstY * w)) * m_pixelSize);
+            TQ_INT32 dstRowStride = w * m_pixelSize;
+
+            for (TQ_INT32 row = 0; row < rows; row++) {
+                memcpy(dstData, srcData, columns * m_pixelSize);
+                dstData += dstRowStride;
+                srcData += srcRowStride;
+            }
+
+            srcX += columns;
+            dstX += columns;
+            columnsRemaining -= columns;
+        }
+
+        srcY += rows;
+        dstY += rows;
+        rowsRemaining -= rows;
+    }
+
+}
+
+
+void KisTiledDataManager::writeBytes(const TQ_UINT8 * bytes,
+                     TQ_INT32 x, TQ_INT32 y,
+                     TQ_INT32 w, TQ_INT32 h)
+{
+    if (bytes == 0) return;
+    //Q_ASSERT(bytes != 0);
+
+    // XXX: Is this correct?
+    if (w < 0)
+        w = 0;
+
+    if (h < 0)
+        h = 0;
+
+    TQ_INT32 srcY = 0;
+    TQ_INT32 dstY = y;
+    TQ_INT32 rowsRemaining = h;
+
+    while (rowsRemaining > 0) {
+
+        TQ_INT32 srcX = 0;
+        TQ_INT32 dstX = x;
+        TQ_INT32 columnsRemaining = w;
+        TQ_INT32 numContiguousdstRows = numContiguousRows(dstY, dstX, dstX + w - 1);
+
+        TQ_INT32 rows = TQMIN(numContiguousdstRows, rowsRemaining);
+
+        while (columnsRemaining > 0) {
+
+            TQ_INT32 numContiguousdstColumns = numContiguousColumns(dstX, dstY, dstY + rows - 1);
+
+            TQ_INT32 columns = TQMIN(numContiguousdstColumns, columnsRemaining);
+
+            //TQ_UINT8 *dstData = writablePixel(dstX, dstY);
+            KisTileDataWrapperSP tileData = pixelPtrSafe(dstX, dstY, true);
+            TQ_UINT8 *dstData = tileData->data();
+            TQ_INT32 dstRowStride = rowStride(dstX, dstY);
+
+            const TQ_UINT8 *srcData = bytes + ((srcX + (srcY * w)) * m_pixelSize);
+            TQ_INT32 srcRowStride = w * m_pixelSize;
+
+            for (TQ_INT32 row = 0; row < rows; row++) {
+                memcpy(dstData, srcData, columns * m_pixelSize);
+                srcData += srcRowStride;
+                dstData += dstRowStride;
+            }
+
+            dstX += columns;
+            srcX += columns;
+            columnsRemaining -= columns;
+        }
+
+        dstY += rows;
+        srcY += rows;
+        rowsRemaining -= rows;
+    }
+}
+
+TQ_INT32 KisTiledDataManager::numContiguousColumns(TQ_INT32 x, TQ_INT32 minY, TQ_INT32 maxY)
+{
+    TQ_INT32 numColumns;
+
+    Q_UNUSED(minY);
+    Q_UNUSED(maxY);
+
+    if (x >= 0) {
+        numColumns = KisTile::WIDTH - (x % KisTile::WIDTH);
+    } else {
+        numColumns = ((-x - 1) % KisTile::WIDTH) + 1;
+    }
+
+    return numColumns;
+}
+
+TQ_INT32 KisTiledDataManager::numContiguousRows(TQ_INT32 y, TQ_INT32 minX, TQ_INT32 maxX)
+{
+    TQ_INT32 numRows;
+
+    Q_UNUSED(minX);
+    Q_UNUSED(maxX);
+
+    if (y >= 0) {
+        numRows = KisTile::HEIGHT - (y % KisTile::HEIGHT);
+    } else {
+        numRows = ((-y - 1) % KisTile::HEIGHT) + 1;
+    }
+
+    return numRows;
+}
+
+TQ_INT32 KisTiledDataManager::rowStride(TQ_INT32 x, TQ_INT32 y)
+{
+    Q_UNUSED(x);
+    Q_UNUSED(y);
+
+    return KisTile::WIDTH * m_pixelSize;
+}
+
+TQ_INT32 KisTiledDataManager::numTiles(void) const
+{
+    return m_numTiles;
+}
+
+KisTileDataWrapper::KisTileDataWrapper(KisTile* tile, TQ_INT32 offset)
+    : m_tile(tile), m_offset(offset)
+{
+    m_tile->addReader();
+}
+
+KisTileDataWrapper::~KisTileDataWrapper()
+{
+    m_tile->removeReader();
+}
diff --git a/chalk/core/tiles/kis_tileddatamanager.h b/chalk/core/tiles/kis_tileddatamanager.h
new file mode 100644
index 000000000..20d780855
--- /dev/null
+++ b/chalk/core/tiles/kis_tileddatamanager.h
@@ -0,0 +1,233 @@
+/*
+ *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_TILEDDATAMANAGER_H_
+#define KIS_TILEDDATAMANAGER_H_
+
+#include <tqglobal.h>
+#include <tqvaluevector.h>
+
+#include <ksharedptr.h>
+
+#include "kis_tile_global.h"
+#include "kis_tile.h"
+#include "kis_memento.h"
+
+class KisTiledDataManager;
+typedef KSharedPtr<KisTiledDataManager> KisTiledDataManagerSP;
+
+class KisDataManager;
+typedef KSharedPtr<KisDataManager> KisDataManagerSP;
+
+class KisTiledIterator;
+class KisTiledRandomAccessor;
+class KoStore;
+
+class KisTileDataWrapper : public KShared {
+    KisTile* m_tile;
+    TQ_INT32 m_offset;
+public:
+    KisTileDataWrapper(KisTile* tile, TQ_INT32 offset);
+    virtual ~KisTileDataWrapper();
+    TQ_UINT8* data() const { return m_tile->data() + m_offset; }
+};
+
+typedef KSharedPtr<KisTileDataWrapper> KisTileDataWrapperSP;
+
+/**
+ * KisTiledDataManager implements the interface that KisDataManager defines
+ *
+ * The interface definition is enforced by KisDataManager calling all the methods
+ * which must also be defined in KisTiledDataManager. It is not allowed to change the interface
+ * as other datamangers may also rely on the same interface.
+ *
+ * * Storing undo/redo data
+ * * Offering ordered and unordered iterators over rects of pixels
+ * * (eventually) efficiently loading and saving data in a format
+ * that may allow deferred loading.
+ *
+ * A datamanager knows nothing about the type of pixel data except
+ * how many TQ_UINT8's a single pixel takes.
+ */
+
+class KisTiledDataManager : public KShared {
+
+protected:
+    KisTiledDataManager(TQ_UINT32 pixelSize, const TQ_UINT8 *defPixel);
+    ~KisTiledDataManager();
+    KisTiledDataManager(const KisTiledDataManager &dm);
+    KisTiledDataManager & operator=(const KisTiledDataManager &dm);
+
+
+protected:
+    // Allow the baseclass of iterators acces to the interior
+    // derived iterator classes must go through KisTiledIterator
+    friend class KisTiledIterator;
+    friend class KisTiledRandomAccessor;
+
+protected:
+
+    void setDefaultPixel(const TQ_UINT8 *defPixel);
+    const TQ_UINT8 * defaultPixel() const { return m_defPixel;};
+
+    KisMementoSP getMemento();
+    void rollback(KisMementoSP memento);
+    void rollforward(KisMementoSP memento);
+
+    // For debugging use.
+    bool hasCurrentMemento() const { return m_currentMemento != 0; }
+
+protected:
+    /**
+     * Reads and writes the tiles from/onto a KoStore (which is simply a file within a zip file)
+     *
+     */
+    bool write(KoStore *store);
+    bool read(KoStore *store);
+
+protected:
+
+    TQ_UINT32 pixelSize();
+
+    void extent(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const;
+    TQRect extent() const;
+
+    void setExtent(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
+
+protected:
+
+    void clear(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, TQ_UINT8 clearValue);
+    void clear(TQ_INT32 x, TQ_INT32 y,  TQ_INT32 w, TQ_INT32 h, const TQ_UINT8 *clearPixel);
+    void clear();
+
+
+protected:
+
+    void paste(KisDataManagerSP data,  TQ_INT32 sx, TQ_INT32 sy, TQ_INT32 dx, TQ_INT32 dy,
+                TQ_INT32 w, TQ_INT32 h);
+
+
+protected:
+
+
+    /**
+     * Get a read-only pointer to pixel (x, y).
+     */
+    const TQ_UINT8* pixel(TQ_INT32 x, TQ_INT32 y);
+
+    /**
+     * Get a read-write pointer to pixel (x, y).
+     */
+    TQ_UINT8* writablePixel(TQ_INT32 x, TQ_INT32 y);
+
+    /**
+     * write the specified data to x, y. There is no checking on pixelSize!
+     */
+    void setPixel(TQ_INT32 x, TQ_INT32 y, const TQ_UINT8 * data);
+
+
+    /**
+     * Copy the bytes in the specified rect to a vector. The caller is responsible
+     * for managing the vector.
+     */
+    void readBytes(TQ_UINT8 * bytes,
+               TQ_INT32 x, TQ_INT32 y,
+               TQ_INT32 w, TQ_INT32 h);
+    /**
+     * Copy the bytes in the vector to the specified rect. If there are bytes left
+     * in the vector after filling the rect, they will be ignored. If there are
+     * not enough bytes, the rest of the rect will be filled with the default value
+     * given (by default, 0);
+     */
+    void writeBytes(const TQ_UINT8 * bytes,
+            TQ_INT32 x, TQ_INT32 y,
+            TQ_INT32 w, TQ_INT32 h);
+
+    /// Get the number of contiguous columns starting at x, valid for all values
+    /// of y between minY and maxY.
+    TQ_INT32 numContiguousColumns(TQ_INT32 x, TQ_INT32 minY, TQ_INT32 maxY);
+
+    /// Get the number of contiguous rows starting at y, valid for all values
+    /// of x between minX and maxX.
+    TQ_INT32 numContiguousRows(TQ_INT32 y, TQ_INT32 minX, TQ_INT32 maxX);
+
+    /// Get the row stride at pixel (x, y). This is the number of bytes to add to a
+    /// pointer to pixel (x, y) to access (x, y + 1).
+    TQ_INT32 rowStride(TQ_INT32 x, TQ_INT32 y);
+
+    // For debugging use
+    TQ_INT32 numTiles() const;
+
+private:
+
+    TQ_UINT32 m_pixelSize;
+    TQ_UINT32 m_numTiles;
+    KisTile *m_defaultTile;
+    KisTile **m_hashTable;
+    KisMementoSP m_currentMemento;
+    TQ_INT32 m_extentMinX;
+    TQ_INT32 m_extentMinY;
+    TQ_INT32 m_extentMaxX;
+    TQ_INT32 m_extentMaxY;
+    TQ_UINT8 *m_defPixel;
+
+private:
+
+    void ensureTileMementoed(TQ_INT32 col, TQ_INT32 row, TQ_UINT32 tileHash, const KisTile *refTile);
+    KisTile *getOldTile(TQ_INT32 col, TQ_INT32 row, KisTile *def);
+    KisTile *getTile(TQ_INT32 col, TQ_INT32 row, bool writeAccess);
+    TQ_UINT32 calcTileHash(TQ_INT32 col, TQ_INT32 row);
+    void updateExtent(TQ_INT32 col, TQ_INT32 row);
+    void recalculateExtent();
+    void deleteTiles(const KisMemento::DeletedTile *deletedTileList);
+    TQ_INT32 xToCol(TQ_INT32 x) const;
+    TQ_INT32 yToRow(TQ_INT32 y) const;
+    void getContiguousColumnsAndRows(TQ_INT32 x, TQ_INT32 y, TQ_INT32 *columns, TQ_INT32 *rows);
+    TQ_UINT8* pixelPtr(TQ_INT32 x, TQ_INT32 y, bool writable);
+    KisTileDataWrapperSP pixelPtrSafe(TQ_INT32 x, TQ_INT32 y, bool writable);
+};
+
+
+inline TQ_UINT32 KisTiledDataManager::pixelSize()
+{
+    return m_pixelSize;
+}
+
+inline TQ_INT32 KisTiledDataManager::xToCol(TQ_INT32 x) const
+{
+    if (x >= 0) {
+        return x / KisTile::WIDTH;
+    } else {
+        return -(((-x - 1) / KisTile::WIDTH) + 1);
+    }
+}
+
+inline TQ_INT32 KisTiledDataManager::yToRow(TQ_INT32 y) const
+{
+    if (y >= 0) {
+        return y / KisTile::HEIGHT;
+    } else {
+        return -(((-y - 1) / KisTile::HEIGHT) + 1);
+    }
+}
+
+// during development the following line helps to check the interface is correct
+// it should be safe to keep it here even during normal compilation
+#include "kis_datamanager.h"
+
+#endif // KIS_TILEDDATAMANAGER_H_
+
diff --git a/chalk/core/tiles/kis_tiledhlineiterator.cc b/chalk/core/tiles/kis_tiledhlineiterator.cc
new file mode 100644
index 000000000..cf023c1ed
--- /dev/null
+++ b/chalk/core/tiles/kis_tiledhlineiterator.cc
@@ -0,0 +1,213 @@
+/*
+ * This file is part of the KDE project
+ *
+ * Copyright (c) 2004 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#include <kdebug.h>
+
+#include "kis_tile_global.h"
+#include "kis_tilediterator.h"
+
+KisTiledHLineIterator::KisTiledHLineIterator( KisTiledDataManager *ndevice,  TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, bool writable) :
+    KisTiledIterator(ndevice),
+    m_right(x+w-1), m_left(x)
+{
+    Q_ASSERT(ndevice != 0);
+
+    m_writable = writable;
+    m_x = x;
+    m_y = y;
+
+    // Find tile row,col matching x,y
+    m_row = yToRow(m_y);
+    m_leftCol = xToCol(m_x);
+    m_rightCol = xToCol(m_right);
+    m_col = m_leftCol;
+
+    // calc limits within the tile
+    m_yInTile = m_y - m_row * KisTile::HEIGHT;
+    m_leftInTile = m_x - m_leftCol * KisTile::WIDTH;
+
+    if(m_col == m_rightCol)
+        m_rightInTile = m_right - m_rightCol * KisTile::WIDTH;
+    else
+        m_rightInTile = KisTile::WIDTH - 1;
+
+    m_xInTile = m_leftInTile;
+
+    fetchTileData(m_col, m_row);
+    m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+}
+
+KisTiledHLineIterator::KisTiledHLineIterator(const KisTiledHLineIterator& rhs)
+    : KisTiledIterator(rhs)
+{
+    if (this != &rhs) {
+        m_right = rhs.m_right;
+        m_left = rhs.m_left;
+        m_leftCol = rhs.m_leftCol;
+        m_rightCol = rhs.m_rightCol;
+        m_xInTile = rhs.m_xInTile;
+        m_yInTile = rhs.m_yInTile;
+        m_leftInTile = rhs.m_leftInTile;
+        m_rightInTile = rhs.m_rightInTile;
+    }
+}
+
+KisTiledHLineIterator& KisTiledHLineIterator::operator=(const KisTiledHLineIterator& rhs)
+{
+    if (this != &rhs) {
+        KisTiledIterator::operator=(rhs);
+        m_right = rhs.m_right;
+        m_left = rhs.m_left;
+        m_leftCol = rhs.m_leftCol;
+        m_rightCol = rhs.m_rightCol;
+        m_xInTile = rhs.m_xInTile;
+        m_yInTile = rhs.m_yInTile;
+        m_leftInTile = rhs.m_leftInTile;
+        m_rightInTile = rhs.m_rightInTile;
+    }
+    return *this;
+}
+
+KisTiledHLineIterator::~KisTiledHLineIterator( )
+{
+}
+
+KisTiledHLineIterator & KisTiledHLineIterator::operator ++ ()
+{
+    if(m_xInTile >= m_rightInTile)
+    {
+        nextTile();
+        fetchTileData(m_col, m_row);
+        m_xInTile =m_leftInTile;
+        m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+    }
+    else
+    {
+        m_xInTile++;
+        m_offset += m_pixelSize;
+    }
+    m_x++;
+
+    return *this;
+}
+
+void KisTiledHLineIterator::nextTile()
+{
+    if(m_col < m_rightCol)
+    {
+        m_col++;
+        m_leftInTile = 0;
+
+        if(m_col == m_rightCol)
+            m_rightInTile = m_right - m_rightCol * KisTile::WIDTH;
+        else
+            m_rightInTile = KisTile::WIDTH - 1;
+    }
+}
+
+void KisTiledHLineIterator::prevTile()
+{
+    if(m_col > m_leftCol)
+    {
+        m_col--;
+
+        if(m_col == m_leftCol) {
+            m_leftInTile = m_left - m_leftCol * KisTile::WIDTH;
+        } else {
+            m_leftInTile = 0;
+        }
+        // the only place this doesn't apply, is if we're in rightCol, and we can't go there
+        m_rightInTile = KisTile::WIDTH - 1;
+    }
+}
+
+TQ_INT32 KisTiledHLineIterator::nConseqHPixels() const
+{
+    return m_rightInTile - m_xInTile + 1;
+}
+
+KisTiledHLineIterator & KisTiledHLineIterator::operator+=(int n)
+{
+    // XXX what if outside the valid range of this iterator?
+    if(m_xInTile + n > m_rightInTile)
+    {
+        m_x += n;
+        m_col = xToCol(m_x);
+        m_xInTile = m_x - m_col * KisTile::WIDTH;
+        m_leftInTile = 0;
+
+        if(m_col == m_rightCol)
+            m_rightInTile = m_right - m_rightCol * KisTile::WIDTH;
+        else
+            m_rightInTile = KisTile::WIDTH - 1;
+
+        fetchTileData(m_col, m_row);
+    }
+    else
+    {
+        m_xInTile += n;
+        m_x += n;
+    }
+    m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+
+    return *this;
+}
+
+KisTiledHLineIterator & KisTiledHLineIterator::operator -- ()
+{
+    if(m_xInTile <= 0)
+    {
+        prevTile();
+        fetchTileData(m_col, m_row);
+        m_xInTile = KisTile::WIDTH - 1;
+        m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+    }
+    else
+    {
+        m_xInTile--;
+        m_offset -= m_pixelSize;
+    }
+    m_x--;
+
+    return *this;
+}
+
+void KisTiledHLineIterator::nextRow()
+{
+    m_y++;
+    m_yInTile++;
+    m_x = m_left;
+    m_leftInTile = m_x - m_leftCol * KisTile::WIDTH;
+    m_xInTile = m_leftInTile;
+    if( m_yInTile >= KisTile::HEIGHT )
+    { // Need a new row
+        m_yInTile = 0;
+        m_row++;
+        m_col = m_leftCol;
+        fetchTileData(m_col, m_row);
+    } else if( m_leftCol != m_col ) {
+        m_col = m_leftCol;
+        fetchTileData(m_col, m_row);
+    }
+    if(m_col == m_rightCol)
+        m_rightInTile = m_right - m_rightCol * KisTile::WIDTH;
+    else
+        m_rightInTile = KisTile::WIDTH - 1;
+    m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+}
diff --git a/chalk/core/tiles/kis_tilediterator.cc b/chalk/core/tiles/kis_tilediterator.cc
new file mode 100644
index 000000000..d6205f5a1
--- /dev/null
+++ b/chalk/core/tiles/kis_tilediterator.cc
@@ -0,0 +1,131 @@
+/*
+ * This file is part of the Chalk
+ *
+ * Copyright (c) 2004 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#include <kdebug.h>
+
+#include "kis_tile_global.h"
+#include "kis_tilediterator.h"
+
+KisTiledIterator::KisTiledIterator( KisTiledDataManager *ndevice)
+{
+    Q_ASSERT(ndevice != 0);
+    m_ktm = ndevice;
+    m_x = 0;
+    m_y = 0;
+    m_row = 0;
+    m_col = 0;
+    m_pixelSize = m_ktm->pixelSize();
+    m_tile = 0;
+    m_oldTile = 0;
+}
+
+KisTiledIterator::~KisTiledIterator( )
+{
+    if (m_tile)
+        m_tile->removeReader();
+    if (m_oldTile)
+        m_oldTile->removeReader();
+}
+
+KisTiledIterator::KisTiledIterator(const KisTiledIterator& rhs)
+    : KShared()
+{
+    if (this != &rhs) {
+        m_ktm = rhs.m_ktm;
+        m_pixelSize = rhs.m_pixelSize;
+        m_x = rhs.m_x;
+        m_y = rhs.m_y;
+        m_row = rhs.m_row;
+        m_col = rhs.m_col;
+        m_data = rhs.m_data;
+        m_oldData = rhs.m_oldData;
+        m_offset = rhs.m_offset;
+        m_tile = rhs.m_tile;
+        m_oldTile = rhs.m_oldTile;
+        m_writable = rhs.m_writable;
+        if (m_tile)
+            m_tile->addReader();
+    }
+}
+
+KisTiledIterator& KisTiledIterator::operator=(const KisTiledIterator& rhs)
+{
+    if (this != &rhs) {
+        if (m_tile)
+            m_tile->removeReader();
+        if (m_oldTile)
+            m_oldTile->removeReader();
+        m_ktm = rhs.m_ktm;
+        m_pixelSize = rhs.m_pixelSize;
+        m_x = rhs.m_x;
+        m_y = rhs.m_y;
+        m_row = rhs.m_row;
+        m_col = rhs.m_col;
+        m_data = rhs.m_data;
+        m_oldData = rhs.m_oldData;
+        m_offset = rhs.m_offset;
+        m_tile = rhs.m_tile;
+        m_oldTile = rhs.m_oldTile;
+        m_writable = rhs.m_writable;
+        if (m_tile)
+            m_tile->addReader();
+    }
+    return *this;
+}
+
+TQ_UINT8 * KisTiledIterator::rawData() const
+{
+    return m_data + m_offset;
+}
+
+
+const TQ_UINT8 * KisTiledIterator::oldRawData() const
+{
+#ifdef DEBUG
+    // Warn if we're misusing oldRawData(). If there's no memento, oldRawData is the same
+    // as rawData().
+    kdWarning(!m_ktm->hasCurrentMemento(), DBG_AREA_TILES) << "Accessing oldRawData() when no transaction is in progress.\n";
+#endif
+    return m_oldData + m_offset;
+}
+
+void KisTiledIterator::fetchTileData(TQ_INT32 col, TQ_INT32 row)
+{
+    if (m_tile)
+        m_tile->removeReader();
+    if (m_oldTile)
+        m_oldTile->removeReader();
+    m_oldTile = 0;
+
+    m_tile = m_ktm->getTile(col, row, m_writable);
+
+    if (m_tile == 0) return;
+    //Q_ASSERT(m_tile != 0);
+    m_tile->addReader();
+
+    m_data = m_tile->data();
+    if (m_data == 0) return;
+
+    //Q_ASSERT(m_data != 0);
+
+    // set old data but default to current value
+    m_oldTile = m_ktm->getOldTile(col, row, m_tile);
+    m_oldTile->addReader(); // Double locking in case m_oldTile==m_tile is no problem
+    m_oldData = m_oldTile->data();
+}
diff --git a/chalk/core/tiles/kis_tilediterator.h b/chalk/core/tiles/kis_tilediterator.h
new file mode 100644
index 000000000..958876cd4
--- /dev/null
+++ b/chalk/core/tiles/kis_tilediterator.h
@@ -0,0 +1,213 @@
+/* This file is part of the KDE project
+ *   Copyright (c) 2004 Casper Boemann <cbr@boemann.dkt>
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KIS_TILED_ITERATOR_H_
+#define KIS_TILED_ITERATOR_H_
+
+#include <tqglobal.h>
+
+#include <ksharedptr.h>
+
+#include <kis_tile.h>
+#include <kis_tileddatamanager.h>
+#include <koffice_export.h>
+/**
+ * The KisIterator class iterates through the pixels of a KisPaintDevice hiding the tile structure
+ */
+class KRITACORE_EXPORT KisTiledIterator : public KShared {
+
+protected:
+    KisTiledDataManager *m_ktm;
+    TQ_INT32 m_pixelSize;        // bytes per pixel
+    TQ_INT32 m_x;        // current x position
+    TQ_INT32 m_y;        // cirrent y position
+    TQ_INT32 m_row;    // row in tilemgr
+    TQ_INT32 m_col;    // col in tilemgr
+    TQ_UINT8 *m_data;
+    TQ_UINT8 *m_oldData;
+    TQ_INT32 m_offset;
+    KisTile *m_tile;
+    KisTile* m_oldTile;
+    bool m_writable;
+
+protected:
+    inline TQ_UINT32 xToCol(TQ_UINT32 x) const { if (m_ktm) return m_ktm->xToCol(x); else return 0; };
+    inline TQ_UINT32 yToRow(TQ_UINT32 y) const { if (m_ktm) return m_ktm->yToRow(y); else return 0; };
+    void fetchTileData(TQ_INT32 col, TQ_INT32 row);
+
+public:
+    KisTiledIterator( KisTiledDataManager *ktm);
+    KisTiledIterator(const KisTiledIterator&);
+    KisTiledIterator& operator=(const KisTiledIterator&);
+    ~KisTiledIterator();
+
+public:
+    // current x position
+    TQ_INT32 x() const { return m_x; };
+
+    // cirrent y position
+    TQ_INT32 y() const { return m_y; };
+
+    /// Returns a pointer to the pixel data. Do NOT interpret the data - leave that to a colorstrategy
+    TQ_UINT8 *rawData() const;
+
+    /// Returns a pointer to the pixel data as it was at the moment tof he last memento creation.
+    const TQ_UINT8 * oldRawData() const;
+};
+
+/**
+ * The KisRectIterator class iterates through the pixels of a rect in a KisPaintDevice hiding the
+ * tile structure
+ */
+class KRITACORE_EXPORT KisTiledRectIterator : public KisTiledIterator
+{
+
+public:
+    /// do not call constructor directly use factory method in KisDataManager instead.
+    KisTiledRectIterator( KisTiledDataManager *dm, TQ_INT32  x, TQ_INT32  y, TQ_INT32  w, TQ_INT32  h, bool writable);
+    KisTiledRectIterator(const KisTiledRectIterator&);
+    KisTiledRectIterator& operator=(const KisTiledRectIterator&);
+    ~KisTiledRectIterator();
+
+public:
+    TQ_INT32 nConseqPixels() const;
+    
+    /// Advances a number of pixels until it reaches the end of the rect
+    KisTiledRectIterator & operator+=(int n);
+    
+    /// Advances one pixel. Going to the beginning of the next line when it reaches the end of a line
+    KisTiledRectIterator & operator++();
+
+    /// Goes back one pixel. Going to the end of the line above when it reaches the beginning of a line
+    //KisTiledRectIterator & operator--();
+
+    /// returns true when the iterator has reached the end
+    inline bool isDone() const { return m_beyondEnd; }
+
+
+protected:
+     TQ_INT32 m_left;
+     TQ_INT32 m_top;
+     TQ_INT32 m_w;
+     TQ_INT32 m_h;
+     TQ_INT32 m_topRow;
+     TQ_INT32 m_bottomRow;
+     TQ_INT32 m_leftCol;
+     TQ_INT32 m_rightCol;
+     TQ_INT32 m_xInTile;
+     TQ_INT32 m_yInTile;
+     TQ_INT32 m_leftInTile;
+     TQ_INT32 m_rightInTile;
+     TQ_INT32 m_topInTile;
+     TQ_INT32 m_bottomInTile;
+     bool m_beyondEnd;
+
+private:
+     void nextTile();
+};
+
+/**
+ * The KisHLineIterator class iterates through the pixels of a horizontal line in a KisPaintDevice hiding the
+ * tile structure
+ */
+class KRITACORE_EXPORT KisTiledHLineIterator : public KisTiledIterator
+{
+
+public:
+    /// do not call constructor directly use factory method in KisDataManager instead.
+    KisTiledHLineIterator( KisTiledDataManager *dm, TQ_INT32  x, TQ_INT32  y, TQ_INT32 w, bool writable);
+    KisTiledHLineIterator(const KisTiledHLineIterator&);
+    KisTiledHLineIterator& operator=(const KisTiledHLineIterator&);
+    ~KisTiledHLineIterator();
+
+public:
+    /// Advances one pixel. Going to the beginning of the next line when it reaches the end of a line
+    KisTiledHLineIterator & operator++();
+
+    /// Returns the number of consequtive horizontal pixels that we point at
+    /// This is useful for optimizing
+    TQ_INT32 nConseqHPixels() const;
+
+    /// Advances a number of pixels until it reaches the end of the line
+    KisTiledHLineIterator & operator+=(int);
+
+    /// Goes back one pixel. Going to the end of the line above when it reaches the beginning of a line
+    KisTiledHLineIterator & operator--();
+
+    /// returns true when the iterator has reached the end
+    bool isDone() const { return m_x > m_right; }
+
+    /// increment to the next row and rewind to the begining
+    void nextRow();
+
+protected:
+     TQ_INT32 m_right;
+     TQ_INT32 m_left;
+     TQ_INT32 m_leftCol;
+     TQ_INT32 m_rightCol;
+     TQ_INT32 m_xInTile;
+     TQ_INT32 m_yInTile;
+     TQ_INT32 m_leftInTile;
+     TQ_INT32 m_rightInTile;
+
+private:
+     void nextTile();
+     void prevTile();
+};
+
+/**
+ * The KisVLineIterator class iterates through the pixels of a vertical line in a KisPaintDevice hiding the
+ * tile structure
+ */
+class KRITACORE_EXPORT KisTiledVLineIterator : public KisTiledIterator
+{
+
+public:
+    /// do not call constructor directly use factory method in KisDataManager instead.
+    KisTiledVLineIterator( KisTiledDataManager *dm, TQ_INT32  x, TQ_INT32 y, TQ_INT32 h, bool writable);
+    KisTiledVLineIterator(const KisTiledVLineIterator&);
+    KisTiledVLineIterator& operator=(const KisTiledVLineIterator&);
+    ~KisTiledVLineIterator();
+
+public:
+    /// Advances one pixel. Going to the beginning of the next line when it reaches the end of a line
+    KisTiledVLineIterator & operator++();
+
+    /// Goes back one pixel. Going to the end of the line above when it reaches the beginning of a line
+    //KisTiledVLineIterator & operator--();
+
+    /// returns true when the iterator has reached the end
+    bool isDone() const { return m_y > m_bottom; }
+
+    /// increment to the next column and rewind to the begining
+    void nextCol();
+
+protected:
+    TQ_INT32 m_top;
+    TQ_INT32 m_bottom;
+    TQ_INT32 m_topRow;
+    TQ_INT32 m_bottomRow;
+    TQ_INT32 m_xInTile;
+    TQ_INT32 m_yInTile;
+    TQ_INT32 m_topInTile;
+    TQ_INT32 m_bottomInTile;
+
+private:
+     void nextTile();
+};
+
+#endif // KIS_TILED_ITERATOR_H_
diff --git a/chalk/core/tiles/kis_tiledrectiterator.cc b/chalk/core/tiles/kis_tiledrectiterator.cc
new file mode 100644
index 000000000..8f0f7ed1d
--- /dev/null
+++ b/chalk/core/tiles/kis_tiledrectiterator.cc
@@ -0,0 +1,242 @@
+/*
+ * This file is part of the KDE project
+ *
+ *  Copyright (c) 2004 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#include <kdebug.h>
+
+#include "kis_tile_global.h"
+#include "kis_tilediterator.h"
+
+KisTiledRectIterator::KisTiledRectIterator( KisTiledDataManager *ndevice,  TQ_INT32 nleft,
+                        TQ_INT32 ntop, TQ_INT32 nw, TQ_INT32 nh, bool writable) :
+    KisTiledIterator(ndevice),
+    m_left(nleft),
+    m_top(ntop),
+    m_w(nw),
+    m_h(nh)
+{
+
+    Q_ASSERT(ndevice != 0);
+
+    m_writable = writable;
+    m_x = nleft;
+    m_y  = ntop;
+    m_beyondEnd = (m_w == 0) || (m_h == 0);
+
+    // Find tile row,col matching x,y
+    m_topRow = yToRow(m_y);
+    m_bottomRow = yToRow(m_y + m_h - 1);
+    m_leftCol = xToCol(m_x);
+    m_rightCol = xToCol(m_x + m_w - 1);
+    m_row = m_topRow;
+    m_col = m_leftCol;
+
+    // calc limits within the tile
+    m_topInTile = m_top - m_topRow * KisTile::HEIGHT;
+
+    if(m_row == m_bottomRow)
+        m_bottomInTile = m_top + m_h - 1 - m_bottomRow * KisTile::HEIGHT;
+    else
+        m_bottomInTile = KisTile::HEIGHT - 1;
+
+    m_leftInTile = m_left - m_leftCol * KisTile::WIDTH;
+
+    if(m_col == m_rightCol)
+        m_rightInTile = m_left + m_w - 1 - m_rightCol * KisTile::WIDTH;
+    else
+        m_rightInTile = KisTile::WIDTH - 1;
+
+    m_xInTile = m_leftInTile;
+    m_yInTile = m_topInTile;
+
+    if( ! m_beyondEnd)
+        fetchTileData(m_col, m_row);
+    m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+}
+
+KisTiledRectIterator::KisTiledRectIterator(const KisTiledRectIterator& rhs)
+    : KisTiledIterator(rhs)
+{
+    if (this != &rhs) {
+        m_left = rhs.m_left;
+        m_top = rhs.m_top;
+        m_w = rhs.m_w;
+        m_h = rhs.m_h;
+        m_topRow = rhs.m_topRow;
+        m_bottomRow = rhs.m_bottomRow;
+        m_leftCol = rhs.m_leftCol;
+        m_rightCol = rhs.m_rightCol;
+        m_xInTile = rhs.m_xInTile;
+        m_yInTile = rhs.m_yInTile;
+        m_leftInTile = rhs.m_leftInTile;
+        m_rightInTile = rhs.m_rightInTile;
+        m_topInTile = rhs.m_topInTile;
+        m_bottomInTile = rhs.m_bottomInTile;
+        m_beyondEnd = rhs.m_beyondEnd;
+    }
+}
+
+KisTiledRectIterator& KisTiledRectIterator::operator=(const KisTiledRectIterator& rhs)
+{
+    if (this != &rhs) {
+        KisTiledIterator::operator=(rhs);
+        m_left = rhs.m_left;
+        m_top = rhs.m_top;
+        m_w = rhs.m_w;
+        m_h = rhs.m_h;
+        m_topRow = rhs.m_topRow;
+        m_bottomRow = rhs.m_bottomRow;
+        m_leftCol = rhs.m_leftCol;
+        m_rightCol = rhs.m_rightCol;
+        m_xInTile = rhs.m_xInTile;
+        m_yInTile = rhs.m_yInTile;
+        m_leftInTile = rhs.m_leftInTile;
+        m_rightInTile = rhs.m_rightInTile;
+        m_topInTile = rhs.m_topInTile;
+        m_bottomInTile = rhs.m_bottomInTile;
+        m_beyondEnd = rhs.m_beyondEnd;
+    }
+    return *this;
+}
+
+KisTiledRectIterator::~KisTiledRectIterator( )
+{
+}
+
+TQ_INT32 KisTiledRectIterator::nConseqPixels() const
+{
+    if(m_leftInTile || (m_rightInTile != KisTile::WIDTH - 1))
+        return m_rightInTile - m_xInTile + 1;
+    else
+        return KisTile::WIDTH * (m_bottomInTile - m_yInTile + 1) - m_xInTile;
+}
+
+KisTiledRectIterator & KisTiledRectIterator::operator+=(int n)
+{
+    int remainInTile;
+
+    remainInTile= (m_bottomInTile - m_yInTile) * (m_rightInTile - m_leftInTile + 1);
+    remainInTile += m_rightInTile - m_xInTile + 1;
+
+    // This while loop may not bet the fastest, but usually it's not entered more than once.
+    while(n >= remainInTile)
+    {
+        n -= remainInTile;
+        nextTile();
+        if(m_beyondEnd)
+            return *this;
+        m_yInTile = m_topInTile;
+        m_xInTile = m_leftInTile;
+        remainInTile= (m_bottomInTile - m_yInTile) * (m_rightInTile - m_leftInTile + 1);
+        remainInTile += m_rightInTile - m_xInTile + 1;
+    }
+
+    int lWidth = m_rightInTile - m_leftInTile + 1;
+    while(n >= lWidth)
+    {
+        n -= lWidth;
+        m_yInTile++;
+    }
+    m_xInTile += n;
+    m_x = m_col * KisTile::WIDTH + m_xInTile;
+    m_y = m_row * KisTile::HEIGHT + m_yInTile;
+    fetchTileData(m_col, m_row);
+    m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+
+    return *this;
+}
+
+
+KisTiledRectIterator & KisTiledRectIterator::operator ++ ()
+{
+    // advance through rect completing each tile before moving on
+    // as per excellent suggestion by Cyrille, avoiding excessive tile switching
+    if(m_xInTile >= m_rightInTile)
+    {
+        if (m_yInTile >= m_bottomInTile)
+        {
+            nextTile();
+            if(m_beyondEnd)
+                return *this;
+            m_yInTile = m_topInTile;
+            m_x = m_col * KisTile::WIDTH + m_leftInTile;
+            m_y = m_row * KisTile::HEIGHT + m_topInTile;
+            fetchTileData(m_col, m_row);
+        }
+        else
+        {
+            m_x -= m_rightInTile - m_leftInTile;
+            m_y++;
+            m_yInTile++;
+        }
+        m_xInTile =m_leftInTile;
+        m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+    }
+    else
+    {
+        m_x++;
+        m_xInTile++;
+        m_offset += m_pixelSize;
+    }
+    return *this;
+}
+
+void KisTiledRectIterator::nextTile()
+{
+    if(m_col >= m_rightCol)
+    {
+        // needs to switch row
+        if(m_row >= m_bottomRow)
+            m_beyondEnd = true;
+        else
+        {
+            m_col = m_leftCol;
+            m_row++;
+            // The row has now changed, so recalc vertical limits
+            if(m_row == m_topRow)
+                m_topInTile = m_top - m_topRow * KisTile::HEIGHT;
+            else
+                m_topInTile = 0;
+
+            if(m_row == m_bottomRow)
+                m_bottomInTile = m_top + m_h - 1 - m_bottomRow * KisTile::HEIGHT;
+            else
+                m_bottomInTile = KisTile::HEIGHT - 1;
+        }
+    }
+    else
+        m_col++;
+
+    // No matter what the column has now changed, so recalc horizontal limits
+    if(m_col == m_leftCol)
+        m_leftInTile = m_left - m_leftCol * KisTile::WIDTH;
+    else
+        m_leftInTile = 0;
+
+    if(m_col == m_rightCol)
+        m_rightInTile = m_left + m_w - 1 - m_rightCol * KisTile::WIDTH;
+    else
+        m_rightInTile = KisTile::WIDTH - 1;
+}
+
+/*
+KisTiledRectIterator & KisTiledRectIterator::operator -- ()
+{
+    return *this;
+}
+*/
diff --git a/chalk/core/tiles/kis_tiledvlineiterator.cc b/chalk/core/tiles/kis_tiledvlineiterator.cc
new file mode 100644
index 000000000..0fe8514f8
--- /dev/null
+++ b/chalk/core/tiles/kis_tiledvlineiterator.cc
@@ -0,0 +1,154 @@
+/*
+ * This file is part of the Chalk
+ *
+ * Copyright (c) 2004 Casper Boemann <cbr@boemann.dk>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#include <kdebug.h>
+
+#include "kis_tile_global.h"
+#include "kis_tilediterator.h"
+
+KisTiledVLineIterator::KisTiledVLineIterator( KisTiledDataManager *ndevice,  TQ_INT32 x,  TQ_INT32 y, TQ_INT32 h, bool writable) :
+    KisTiledIterator(ndevice),
+    m_bottom(y + h - 1)
+{
+    m_writable = writable;
+    m_top = y;
+    m_x = x;
+    m_y = y;
+
+    // Find tile row,col matching x,y
+    m_col = xToCol(m_x);
+    m_topRow = yToRow(m_y);
+    m_bottomRow = yToRow(m_bottom);
+    m_row = m_topRow;
+
+    // calc limits within the tile
+    m_xInTile = m_x - m_col * KisTile::WIDTH;
+    m_topInTile = m_y - m_topRow * KisTile::HEIGHT;
+
+    if(m_row == m_bottomRow)
+        m_bottomInTile = m_bottom - m_bottomRow * KisTile::HEIGHT;
+    else
+        m_bottomInTile = KisTile::HEIGHT - 1;
+
+    m_yInTile = m_topInTile;
+
+    fetchTileData(m_col, m_row);
+    m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+}
+
+KisTiledVLineIterator::KisTiledVLineIterator(const KisTiledVLineIterator& rhs)
+    : KisTiledIterator(rhs)
+{
+    if (this != &rhs) {
+        m_top = rhs.m_top;
+        m_bottom = rhs.m_bottom;
+        m_topRow = rhs.m_topRow;
+        m_bottomRow = rhs.m_bottomRow;
+        m_xInTile = rhs.m_xInTile;
+        m_yInTile = rhs.m_yInTile;
+        m_topInTile = rhs.m_topInTile;
+        m_bottomInTile = rhs.m_bottomInTile;
+    }
+}
+
+KisTiledVLineIterator& KisTiledVLineIterator::operator=(const KisTiledVLineIterator& rhs)
+{
+    if (this != &rhs) {
+        KisTiledIterator::operator=(rhs);
+
+        m_top = rhs.m_top;
+        m_bottom = rhs.m_bottom;
+        m_topRow = rhs.m_topRow;
+        m_bottomRow = rhs.m_bottomRow;
+        m_xInTile = rhs.m_xInTile;
+        m_yInTile = rhs.m_yInTile;
+        m_topInTile = rhs.m_topInTile;
+        m_bottomInTile = rhs.m_bottomInTile;
+    }
+    return *this;
+}
+
+KisTiledVLineIterator::~KisTiledVLineIterator( )
+{
+}
+
+KisTiledVLineIterator & KisTiledVLineIterator::operator ++ ()
+{
+    if(m_yInTile >= m_bottomInTile)
+    {
+        nextTile();
+        fetchTileData(m_col, m_row);
+        m_yInTile =m_topInTile;
+        m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+    }
+    else
+    {
+        m_yInTile++;
+        m_offset += m_pixelSize * KisTile::WIDTH;
+    }
+    m_y++;
+
+    return *this;
+}
+
+void KisTiledVLineIterator::nextTile()
+{
+    if(m_row < m_bottomRow)
+    {
+        m_row++;
+        m_topInTile = 0;
+
+        if(m_row == m_bottomRow)
+            m_bottomInTile = m_bottom - m_bottomRow * KisTile::HEIGHT;
+        else
+            m_bottomInTile = KisTile::HEIGHT - 1;
+    }
+}
+
+void KisTiledVLineIterator::nextCol()
+{
+    m_x++;
+    m_xInTile++;
+    m_y = m_top;
+    m_topInTile = m_y - m_topRow * KisTile::HEIGHT;
+    m_yInTile = m_topInTile;
+    if( m_xInTile >= KisTile::WIDTH )
+    { // Need a new row
+        m_xInTile = 0;
+        m_col++;
+        m_row = m_topRow;
+        fetchTileData(m_col, m_row);
+    } else if( m_topRow != m_row ) {
+        m_row = m_topRow;
+        fetchTileData(m_col, m_row);
+    }
+    if(m_row == m_bottomRow)
+        m_bottomInTile = m_bottom - m_bottomRow * KisTile::HEIGHT;
+    else
+        m_bottomInTile = KisTile::HEIGHT - 1;
+
+    m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+}
+
+/*
+KisTiledVLineIterator & KisTiledVLineIterator::operator -- ()
+{
+    return *this;
+}
+*/
diff --git a/chalk/core/tiles/kis_tilemanager.cc b/chalk/core/tiles/kis_tilemanager.cc
new file mode 100644
index 000000000..dc9811e9b
--- /dev/null
+++ b/chalk/core/tiles/kis_tilemanager.cc
@@ -0,0 +1,578 @@
+/*
+ *  Copyright (c) 2005-2006 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kdebug.h>
+
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+
+#include <tqmutex.h>
+#include <tqthread.h>
+#include <tqfile.h>
+
+#include <kstaticdeleter.h>
+#include <kglobal.h>
+#include <kconfig.h>
+
+#include "kis_tileddatamanager.h"
+#include "kis_tile.h"
+#include "kis_tilemanager.h"
+
+// Note: the cache file doesn't get deleted when we crash and so :(
+
+KisTileManager* KisTileManager::m_singleton = 0;
+
+static KStaticDeleter<KisTileManager> staticDeleter;
+
+KisTileManager::KisTileManager() {
+
+    Q_ASSERT(KisTileManager::m_singleton == 0);
+    KisTileManager::m_singleton = this;
+    m_bytesInMem = 0;
+    m_bytesTotal = 0;
+    m_swapForbidden = false;
+
+    // Hardcoded (at the moment only?): 4 pools of 1000 tiles each
+    m_tilesPerPool = 1000;
+
+    m_pools = new TQ_UINT8*[4];
+    m_poolPixelSizes = new TQ_INT32[4];
+    m_poolFreeList = new PoolFreeList[4];
+    for (int i = 0; i < 4; i++) {
+        m_pools[i] = 0;
+        m_poolPixelSizes[i] = 0;
+        m_poolFreeList[i] = PoolFreeList();
+    }
+    m_currentInMem = 0;
+
+    KConfig * cfg = KGlobal::config();
+    cfg->setGroup("");
+    m_maxInMem = cfg->readNumEntry("maxtilesinmem",  4000);
+    m_swappiness = cfg->readNumEntry("swappiness", 100);
+
+    m_tileSize = KisTile::WIDTH * KisTile::HEIGHT;
+    m_freeLists.resize(8);
+
+    counter = 0;
+
+    m_poolMutex = new TQMutex(true);
+    m_swapMutex = new TQMutex(true);
+}
+
+KisTileManager::~KisTileManager() {
+    if (!m_freeLists.empty()) { // See if there are any nonempty freelists
+        FreeListList::iterator listsIt = m_freeLists.begin();
+        FreeListList::iterator listsEnd = m_freeLists.end();
+
+        while(listsIt != listsEnd) {
+            if ( ! (*listsIt).empty() ) {
+                FreeList::iterator it = (*listsIt).begin();
+                FreeList::iterator end = (*listsIt).end();
+
+                while (it != end) {
+                    delete *it;
+                    ++it;
+                }
+                (*listsIt).clear();
+            }
+            ++listsIt;
+        }
+        m_freeLists.clear();
+    }
+
+    for (FileList::iterator it = m_files.begin(); it != m_files.end(); ++it) {
+        (*it).tempFile->close();
+        (*it).tempFile->unlink();
+        delete (*it).tempFile;
+    }
+
+    delete [] m_poolPixelSizes;
+    delete [] m_pools;
+
+    delete m_poolMutex;
+    delete m_swapMutex;
+}
+
+KisTileManager* KisTileManager::instance()
+{
+    if(KisTileManager::m_singleton == 0) {
+        staticDeleter.setObject(KisTileManager::m_singleton, new KisTileManager());
+        Q_CHECK_PTR(KisTileManager::m_singleton);
+    }
+    return KisTileManager::m_singleton;
+}
+
+void KisTileManager::registerTile(KisTile* tile)
+{
+
+    m_swapMutex->lock();
+
+    TileInfo* info = new TileInfo();
+    info->tile = tile;
+    info->inMem = true;
+    info->mmapped = false;
+    info->onFile = false;
+    info->file = 0;
+    info->filePos = 0;
+    info->size = tile->WIDTH * tile->HEIGHT * tile->m_pixelSize;
+    info->fsize = 0; // the size in the file
+    info->validNode = true;
+
+    m_tileMap[tile] = info;
+    m_swappableList.push_back(info);
+    info->node = -- m_swappableList.end();
+
+    m_currentInMem++;
+    m_bytesTotal += info->size;
+    m_bytesInMem += info->size;
+
+    doSwapping();
+
+    if (++counter % 50 == 0)
+        printInfo();
+
+    m_swapMutex->unlock();
+}
+
+void KisTileManager::deregisterTile(KisTile* tile) {
+
+    m_swapMutex->lock();
+
+    if (!m_tileMap.tqcontains(tile)) {
+        m_swapMutex->unlock();
+        return;
+    }
+    // Q_ASSERT(m_tileMap.tqcontains(tile));
+
+    TileInfo* info = m_tileMap[tile];
+
+    if (info->onFile) { // It was once mmapped
+        // To freelist
+        FreeInfo* freeInfo = new FreeInfo();
+        freeInfo->file = info->file;
+        freeInfo->filePos = info->filePos;
+        freeInfo->size = info->fsize;
+        uint pixelSize = (info->size / m_tileSize);
+
+        // It is still mmapped?
+        if (info->mmapped) {
+            // munmap it
+            munmap(info->tile->m_data, info->size);
+            m_bytesInMem -= info->size;
+            m_currentInMem--;
+        }
+
+        if (m_freeLists.capacity() <= pixelSize)
+            m_freeLists.resize(pixelSize + 1);
+        m_freeLists[pixelSize].push_back(freeInfo);
+
+        // the KisTile will attempt to delete its data. This is of course silly when
+        // it was mmapped. So change the m_data to NULL, which is safe to delete
+        tile->m_data = 0;
+    } else {
+        m_bytesInMem -= info->size;
+        m_currentInMem--;
+    }
+
+    if (info->validNode) {
+        m_swappableList.erase(info->node);
+        info->validNode = false;
+    }
+
+    m_bytesTotal -= info->size;
+
+    delete info;
+    m_tileMap.erase(tile);
+
+    doSwapping();
+
+    m_swapMutex->unlock();
+}
+
+void KisTileManager::ensureTileLoaded(const KisTile* tile)
+{
+
+    m_swapMutex->lock();
+
+    TileInfo* info = m_tileMap[tile];
+    if (info->validNode) {
+        m_swappableList.erase(info->node);
+        info->validNode = false;
+    }
+
+    if (!info->inMem) {
+        fromSwap(info);
+    }
+
+    m_swapMutex->unlock();
+}
+
+void KisTileManager::maySwapTile(const KisTile* tile)
+{
+
+    m_swapMutex->lock();
+
+    TileInfo* info = m_tileMap[tile];
+    m_swappableList.push_back(info);
+    info->validNode = true;
+    info->node = -- m_swappableList.end();
+
+    doSwapping();
+
+    m_swapMutex->unlock();
+}
+
+void KisTileManager::fromSwap(TileInfo* info)
+{
+    m_swapMutex->lock();
+
+    if (info->inMem) {
+        m_swapMutex->unlock();
+        return;
+    }
+
+    doSwapping();
+
+    Q_ASSERT(info->onFile);
+    Q_ASSERT(info->file);
+    Q_ASSERT(!info->mmapped);
+
+    if (!chalkMmap(info->tile->m_data, 0, info->size, PROT_READ | PROT_WRITE, MAP_SHARED,
+                   info->file->handle(), info->filePos)) {
+        kdWarning() << "fromSwap failed!" << endl;
+        m_swapMutex->unlock();
+        return;
+    }
+
+    info->inMem = true;
+    info->mmapped = true;
+
+    m_currentInMem++;
+    m_bytesInMem += info->size;
+
+    m_swapMutex->unlock();
+}
+
+void KisTileManager::toSwap(TileInfo* info) {
+    m_swapMutex->lock();
+
+    //Q_ASSERT(info->inMem);
+    if (!info || !info->inMem) {
+        m_swapMutex->unlock();
+        return;
+    }
+
+    KisTile *tile = info->tile;
+
+    if (!info->onFile) {
+        // This tile is not yet in the file. Save it there
+        uint pixelSize = (info->size / m_tileSize);
+        bool foundFree = false;
+
+        if (m_freeLists.capacity() > pixelSize) {
+            if (!m_freeLists[pixelSize].empty()) {
+                // found one
+                FreeList::iterator it = m_freeLists[pixelSize].begin();
+
+                info->file = (*it)->file;
+                info->filePos = (*it)->filePos;
+                info->fsize = (*it)->size;
+
+                delete *it;
+                m_freeLists[pixelSize].erase(it);
+
+                foundFree = true;
+            }
+        }
+
+        if (!foundFree) { // No position found or free, create a new
+            long pagesize = sysconf(_SC_PAGESIZE);
+            TempFile* tfile = 0;
+            if (m_files.empty() || m_files.back().fileSize >= MaxSwapFileSize) {
+                m_files.push_back(TempFile());
+                tfile = &(m_files.back());
+                tfile->tempFile = new KTempFile();
+                tfile->fileSize = 0;
+            } else {
+                tfile = &(m_files.back());
+            }
+            off_t newsize = tfile->fileSize + info->size;
+            newsize = newsize + newsize % pagesize;
+
+            if (ftruncate(tfile->tempFile->handle(), newsize)) {
+                // XXX make these maybe i18n()able and in an error box, but then through
+                // some kind of proxy such that we don't pollute this with GUI code
+                kdWarning(DBG_AREA_TILES) << "Resizing the temporary swapfile failed!" << endl;
+                // Be somewhat pollite and try to figure out why it failed
+                switch (errno) {
+                    case EIO: kdWarning(DBG_AREA_TILES) << "Error was E IO, "
+                            << "possible reason is a disk error!" << endl; break;
+                    case EINVAL: kdWarning(DBG_AREA_TILES) << "Error was E INVAL, "
+                            << "possible reason is that you are using more memory than "
+                            << "the filesystem or disk can handle" << endl; break;
+                    default: kdWarning(DBG_AREA_TILES) << "Errno was: " << errno << endl;
+                }
+                kdWarning(DBG_AREA_TILES) << "The swapfile is: " << tfile->tempFile->name() << endl;
+                kdWarning(DBG_AREA_TILES) << "Will try to avoid using the swap any further" << endl;
+
+                kdDebug(DBG_AREA_TILES) << "Failed ftruncate info: "
+                        << "tried adding " << info->size << " bytes "
+                        << "(rounded to pagesize: " << newsize << ") "
+                        << "from a " << tfile->fileSize << " bytes file" << endl;
+                printInfo();
+
+                m_swapForbidden = true;
+                m_swapMutex->unlock();
+                return;
+            }
+
+            info->file = tfile->tempFile;
+            info->fsize = info->size;
+            info->filePos = tfile->fileSize;
+            tfile->fileSize = newsize;
+        }
+
+        //memcpy(data, tile->m_data, info->size);
+        TQFile* file = info->file->file();
+        if(!file) {
+            kdWarning() << "Opening the file as TQFile failed" << endl;
+            m_swapForbidden = true;
+            m_swapMutex->unlock();
+            return;
+        }
+
+        int fd = file->handle();
+        TQ_UINT8* data = 0;
+        if (!chalkMmap(data, 0, info->size, PROT_READ | PROT_WRITE, MAP_SHARED,
+             fd, info->filePos)) {
+            kdWarning() << "Initial mmap failed" << endl;
+            m_swapForbidden = true;
+            m_swapMutex->unlock();
+            return;
+        }
+
+        memcpy(data, info->tile->m_data, info->size);
+        munmap(data, info->size);
+
+        m_poolMutex->lock();
+        if (isPoolTile(tile->m_data, tile->m_pixelSize))
+            reclaimTileToPool(tile->m_data, tile->m_pixelSize);
+        else
+            delete[] tile->m_data;
+        m_poolMutex->unlock();
+
+        tile->m_data = 0;
+    } else {
+        //madvise(info->tile->m_data, info->fsize, MADV_DONTNEED);
+        Q_ASSERT(info->mmapped);
+
+        // munmap it
+        munmap(tile->m_data, info->size);
+        tile->m_data = 0;
+    }
+
+    info->inMem = false;
+    info->mmapped = false;
+    info->onFile = true;
+
+    m_currentInMem--;
+    m_bytesInMem -= info->size;
+
+    m_swapMutex->unlock();
+}
+
+void KisTileManager::doSwapping()
+{
+    m_swapMutex->lock();
+
+    if (m_swapForbidden || m_currentInMem <= m_maxInMem) {
+        m_swapMutex->unlock();
+        return;
+    }
+
+#if 1 // enable this to enable swapping
+
+    TQ_UINT32 count = TQMIN(m_swappableList.size(), m_swappiness);
+
+    for (TQ_UINT32 i = 0; i < count && !m_swapForbidden; i++) {
+        toSwap(m_swappableList.front());
+        m_swappableList.front()->validNode = false;
+        m_swappableList.pop_front();
+    }
+
+#endif
+
+    m_swapMutex->unlock();
+}
+
+void KisTileManager::printInfo()
+{
+    kdDebug(DBG_AREA_TILES) << m_bytesInMem << " out of " << m_bytesTotal << " bytes in memory\n";
+    kdDebug(DBG_AREA_TILES) << m_currentInMem << " out of " << m_tileMap.size() << " tiles in memory\n";
+    kdDebug(DBG_AREA_TILES) << m_files.size() << " swap files in use" << endl;
+    kdDebug(DBG_AREA_TILES) << m_swappableList.size() << " elements in the swapable list\n";
+    kdDebug(DBG_AREA_TILES) << "Freelists information\n";
+    for (uint i = 0; i < m_freeLists.capacity(); i++) {
+        if ( ! m_freeLists[i].empty() ) {
+            kdDebug(DBG_AREA_TILES) << m_freeLists[i].size()
+                    << " elements in the freelist for pixelsize " << i << "\n";
+        }
+    }
+    kdDebug(DBG_AREA_TILES) << "Pool stats (" <<  m_tilesPerPool << " tiles per pool)" << endl;
+    for (int i = 0; i < 4; i++) {
+        if (m_pools[i]) {
+            kdDebug(DBG_AREA_TILES) << "Pool " << i << ": Freelist count: " << m_poolFreeList[i].count()
+                    << ", pixelSize: " << m_poolPixelSizes[i] << endl;
+        }
+    }
+    if (m_swapForbidden)
+        kdDebug(DBG_AREA_TILES) << "Something was wrong with the swap, see above for details" << endl;
+    kdDebug(DBG_AREA_TILES) << endl;
+}
+
+TQ_UINT8* KisTileManager::requestTileData(TQ_INT32 pixelSize)
+{
+    m_swapMutex->lock();
+
+    TQ_UINT8* data = findTileFor(pixelSize);
+    if ( data ) {
+        m_swapMutex->unlock();
+        return data;
+    }
+    m_swapMutex->unlock();
+    return new TQ_UINT8[m_tileSize * pixelSize];
+}
+
+void KisTileManager::dontNeedTileData(TQ_UINT8* data, TQ_INT32 pixelSize)
+{
+    m_poolMutex->lock();
+    if (isPoolTile(data, pixelSize)) {
+        reclaimTileToPool(data, pixelSize);
+    } else
+        delete[] data;
+    m_poolMutex->unlock();
+}
+
+TQ_UINT8* KisTileManager::findTileFor(TQ_INT32 pixelSize)
+{
+    m_poolMutex->lock();
+
+    for (int i = 0; i < 4; i++) {
+        if (m_poolPixelSizes[i] == pixelSize) {
+            if (!m_poolFreeList[i].isEmpty()) {
+                TQ_UINT8* data = m_poolFreeList[i].front();
+                m_poolFreeList[i].pop_front();
+                m_poolMutex->unlock();
+                return data;
+            }
+        }
+        if (m_pools[i] == 0) {
+            // allocate new pool
+            m_poolPixelSizes[i] = pixelSize;
+            m_pools[i] = new TQ_UINT8[pixelSize * m_tileSize * m_tilesPerPool];
+            // j = 1 because we return the first element, so no need to add it to the freelist
+            for (int j = 1; j < m_tilesPerPool; j++)
+                m_poolFreeList[i].append(&m_pools[i][j * pixelSize * m_tileSize]);
+            m_poolMutex->unlock();
+            return m_pools[i];
+        }
+    }
+
+    m_poolMutex->unlock();
+    return 0;
+}
+
+bool KisTileManager::isPoolTile(TQ_UINT8* data, TQ_INT32 pixelSize) {
+
+    if (data == 0)
+        return false;
+
+    m_poolMutex->lock();
+    for (int i = 0; i < 4; i++) {
+        if (m_poolPixelSizes[i] == pixelSize) {
+            bool b = data >= m_pools[i]
+                     && data < m_pools[i] + pixelSize * m_tileSize * m_tilesPerPool;
+            if (b) {
+                m_poolMutex->unlock();
+                return true;
+            }
+        }
+    }
+    m_poolMutex->unlock();
+    return false;
+}
+
+void KisTileManager::reclaimTileToPool(TQ_UINT8* data, TQ_INT32 pixelSize) {
+    m_poolMutex->lock();
+    for (int i = 0; i < 4; i++) {
+        if (m_poolPixelSizes[i] == pixelSize)
+            if (data >= m_pools[i] && data < m_pools[i] + pixelSize * m_tileSize * m_tilesPerPool) {
+                m_poolFreeList[i].append(data);
+            }
+    }
+    m_poolMutex->unlock();
+}
+
+void KisTileManager::configChanged() {
+    KConfig * cfg = KGlobal::config();
+    cfg->setGroup("");
+    m_maxInMem = cfg->readNumEntry("maxtilesinmem",  4000);
+    m_swappiness = cfg->readNumEntry("swappiness", 100);
+
+    m_swapMutex->lock();
+    doSwapping();
+    m_swapMutex->unlock();
+}
+
+bool KisTileManager::chalkMmap(TQ_UINT8*& result, void *start, size_t length,
+                               int prot, int flags, int fd, off_t offset) {
+    result = (TQ_UINT8*) mmap(start, length, prot, flags, fd, offset);
+
+            // Same here for warning and GUI
+    if (result == (TQ_UINT8*)-1) {
+        kdWarning(DBG_AREA_TILES) << "mmap failed: errno is " << errno << "; we're probably going to crash very soon now...\n";
+
+        // Try to ignore what happened and carry on, but unlikely that we'll get
+        // much further, since the file resizing went OK and this is memory-related...
+        if (errno == ENOMEM) {
+            kdWarning(DBG_AREA_TILES) << "mmap failed with E NOMEM! This means that "
+                    << "either there are no more memory mappings available for Chalk, "
+                    << "or that there is no more memory available!" << endl;
+        }
+
+        kdWarning(DBG_AREA_TILES) << "Trying to continue anyway (no guarantees)" << endl;
+        kdWarning(DBG_AREA_TILES) << "Will try to avoid using the swap any further" << endl;
+        kdDebug(DBG_AREA_TILES) << "Failed mmap info: "
+                << "tried mapping " << length << " bytes" << endl;
+        if (!m_files.empty()) {
+            kdDebug(DBG_AREA_TILES) << "Probably to a " << m_files.back().fileSize << " bytes file" << endl;
+        }
+        printInfo();
+
+        // Be nice
+        result = 0;
+
+        return false;
+    }
+
+    return true;
+}
diff --git a/chalk/core/tiles/kis_tilemanager.h b/chalk/core/tiles/kis_tilemanager.h
new file mode 100644
index 000000000..d6886abe8
--- /dev/null
+++ b/chalk/core/tiles/kis_tilemanager.h
@@ -0,0 +1,139 @@
+/*
+ *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIS_TILEMANAGER_H_
+#define KIS_TILEMANAGER_H_
+
+#include <sys/types.h>
+
+#include <tqglobal.h>
+#include <tqmap.h>
+#include <tqvaluelist.h>
+#include <tqmutex.h>
+
+#include <ktempfile.h>
+
+class KisTile;
+class KisTiledDataManager;
+
+/**
+ * This class keeps has the intention to make certain tile-related operations faster or more
+ * efficient. It does this by keeping lots of info on KisTiles, and manages the way they are
+ * created, used, etc.
+ * It mainly does the following more visible things
+ *  * provide a way to store tiles on disk to a swap file, to reduce memory usage
+ *  * keep a list of previously swapped (but now unused) tiles, to reuse these when we want
+ *    to swap new tiles.
+ *  * tries to preallocate and recycle some tiles to make future allocations faster
+ *    (not done yet)
+ */
+class KisTileManager  {
+public:
+    ~KisTileManager();
+    static KisTileManager* instance();
+
+public: // Tile management
+    void registerTile(KisTile* tile);
+    void deregisterTile(KisTile* tile);
+    // these can change the tile indirectly, though, through the actual swapping!
+    void ensureTileLoaded(const KisTile* tile);
+    void maySwapTile(const KisTile* tile);
+
+public: // Pool management
+    TQ_UINT8* requestTileData(TQ_INT32 pixelSize);
+    void dontNeedTileData(TQ_UINT8* data, TQ_INT32 pixelSize);
+
+public: // Configuration
+    void configChanged();
+
+private:
+    KisTileManager();
+    KisTileManager(KisTileManager&) {}
+    KisTileManager operator=(const KisTileManager&);
+
+private:
+    static KisTileManager *m_singleton;
+
+    // For use when any swap-allocating function failed; the risk of swap allocating failing
+    // again is too big, and we'd clutter the logs with kdWarnings otherwise
+    bool m_swapForbidden;
+
+    // This keeps track of open swap files, and their associated filesizes
+    struct TempFile {
+        KTempFile* tempFile;
+        off_t fileSize;
+    };
+    // validNode says if you can swap it (true) or not (false) mmapped, if this tile
+    // currently is memory mapped. If it is false, but onFile, it is on disk,
+    // but not mmapped, and should be mapped!
+    // filePos is the position inside the file; size is the actual size, fsize is the size
+    // being used in the swap for this tile (may be larger!)
+    // The file points to 0 if it is not swapped, and to the relevant TempFile otherwise
+    struct TileInfo { KisTile *tile; KTempFile* file; off_t filePos; int size; int fsize;
+        TQValueList<TileInfo*>::iterator node;
+        bool inMem; bool onFile; bool mmapped; bool validNode; };
+    typedef struct { KTempFile* file; off_t filePos; int size; } FreeInfo;
+    typedef TQMap<const KisTile*, TileInfo*> TileMap;
+    typedef TQValueList<TileInfo*> TileList;
+    typedef TQValueList<FreeInfo*> FreeList;
+    typedef TQValueVector<FreeList> FreeListList;
+    typedef TQValueList<TQ_UINT8*> PoolFreeList;
+    typedef TQValueList<TempFile> FileList;
+
+
+    TileMap m_tileMap;
+    TileList m_swappableList;
+    FreeListList m_freeLists;
+    FileList m_files;
+    TQ_INT32 m_maxInMem;
+    TQ_INT32 m_currentInMem;
+    TQ_UINT32 m_swappiness;
+    TQ_INT32 m_tileSize; // size of a tile if it used 1 byte per pixel
+    unsigned long m_bytesInMem;
+    unsigned long m_bytesTotal;
+
+    TQ_UINT8 **m_pools;
+    TQ_INT32 *m_poolPixelSizes;
+    TQ_INT32 m_tilesPerPool;
+    PoolFreeList *m_poolFreeList;
+    TQMutex * m_poolMutex;
+    TQMutex * m_swapMutex;
+
+    // This is the constant that we will use to see if we want to add a new tempfile
+    // We use 1<<30 (one gigabyte) because aptqparently 32bit systems don't really like very
+    // large files.
+    static const long MaxSwapFileSize = 1<<30; // For debugging purposes: 1<<20 is a megabyte
+
+    // debug
+    int counter;
+
+private:
+    void fromSwap(TileInfo* info);
+    void toSwap(TileInfo* info);
+    void doSwapping();
+    void printInfo();
+    TQ_UINT8* findTileFor(TQ_INT32 pixelSize);
+    bool isPoolTile(TQ_UINT8* data, TQ_INT32 pixelSize);
+    void reclaimTileToPool(TQ_UINT8* data, TQ_INT32 pixelSize);
+
+    // Mmap wrapper that prints warnings on error. The result is stored in the *& result
+    // the return value is true on succes, false on failure. Other args as in man mmap
+    bool chalkMmap(TQ_UINT8*& result, void *start, size_t length,
+                   int prot, int flags, int fd, off_t offset);
+};
+
+#endif // KIS_TILEMANAGER_H_
diff --git a/chalk/core/tiles/tests/Makefile.am b/chalk/core/tiles/tests/Makefile.am
new file mode 100644
index 000000000..c546d7f51
--- /dev/null
+++ b/chalk/core/tiles/tests/Makefile.am
@@ -0,0 +1,15 @@
+AM_CPPFLAGS = -I$(srcdir)/../ \
+	-I$(srcdir)/../.. \
+	-I$(srcdir)/../../../sdk \
+	$(all_includes)
+
+# The check_ target makes sure we don't install the modules,
+# $(KDE_CHECK_PLUGIN) assures a shared library is created.
+check_LTLIBRARIES = kunittest_kis_tiled_data_tester.la
+kunittest_kis_tiled_data_tester_la_SOURCES = kis_tiled_data_tester.cpp
+kunittest_kis_tiled_data_tester_la_LIBADD = -lkunittest ../../../libchalkcommon.la
+kunittest_kis_tiled_data_tester_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+check-local: kunittest_kis_tiled_data_tester.la
+	kunittestmodrunner
+
diff --git a/chalk/core/tiles/tests/kis_tiled_data_tester.cpp b/chalk/core/tiles/tests/kis_tiled_data_tester.cpp
new file mode 100644
index 000000000..15d3e50b5
--- /dev/null
+++ b/chalk/core/tiles/tests/kis_tiled_data_tester.cpp
@@ -0,0 +1,74 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "kis_tiled_data_tester.h"
+#include "kis_datamanager.h"
+#include "kis_global.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE( kunittest_kis_tiled_data_tester, "Tiled Data Tester" );
+KUNITTEST_MODULE_REGISTER_TESTER( KisTiledDataTester );
+
+#define TEST_PIXEL_SIZE 4
+
+static TQ_UINT8 defaultPixel[TEST_PIXEL_SIZE] = {0, 0, 0, OPACITY_TRANSPARENT};
+
+void KisTiledDataTester::allTests()
+{
+    KisDataManager *dm = new KisDataManager(TEST_PIXEL_SIZE, defaultPixel);
+
+    TQ_INT32 extentX;
+    TQ_INT32 extentY;
+    TQ_INT32 extentWidth;
+    TQ_INT32 extentHeight;
+
+    dm->extent(extentX, extentY, extentWidth, extentHeight);
+    CHECK(extentWidth, 0);
+    CHECK(extentHeight, 0);
+
+    const TQ_UINT8 *readOnlyPixel = dm->pixel(KisTile::WIDTH/2, KisTile::HEIGHT/2);
+    dm->extent(extentX, extentY, extentWidth, extentHeight);
+    CHECK(extentWidth, 0);
+    CHECK(extentHeight, 0);
+
+    TQ_UINT8 *writablePixel = dm->writablePixel(KisTile::WIDTH/2, KisTile::HEIGHT/2);
+    dm->extent(extentX, extentY, extentWidth, extentHeight);
+    CHECK(extentX, 0);
+    CHECK(extentY, 0);
+    CHECK(extentWidth, KisTile::WIDTH);
+    CHECK(extentHeight, KisTile::HEIGHT);
+
+    writablePixel = dm->writablePixel(-KisTile::WIDTH, -KisTile::HEIGHT);
+    dm->extent(extentX, extentY, extentWidth, extentHeight);
+    CHECK(extentX, -KisTile::WIDTH);
+    CHECK(extentY, -KisTile::HEIGHT);
+    CHECK(extentWidth, 2*KisTile::WIDTH);
+    CHECK(extentHeight, 2*KisTile::HEIGHT);
+
+    dm->clear();
+    dm->extent(extentX, extentY, extentWidth, extentHeight);
+    CHECK(extentWidth, 0);
+    CHECK(extentHeight, 0);
+
+    delete dm;
+}
+
diff --git a/chalk/core/tiles/tests/kis_tiled_data_tester.h b/chalk/core/tiles/tests/kis_tiled_data_tester.h
new file mode 100644
index 000000000..8a569d23b
--- /dev/null
+++ b/chalk/core/tiles/tests/kis_tiled_data_tester.h
@@ -0,0 +1,32 @@
+/*
+ *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef KIS_TILED_DATA_TESTER_H
+#define KIS_TILED_DATA_TESTER_H
+
+#include <kunittest/tester.h>
+
+class KisTiledDataTester : public KUnitTest::Tester
+{
+public:
+        void allTests();
+};
+
+#endif
+
diff --git a/chalk/data/Makefile.am b/chalk/data/Makefile.am
new file mode 100644
index 000000000..3c3e4d206
--- /dev/null
+++ b/chalk/data/Makefile.am
@@ -0,0 +1,7 @@
+SUBDIRS = . brushes patterns gradients profiles palettes images
+kde_servicetypes_DATA = \
+    chalk_filter.desktop \
+    chalk_paintop.desktop \
+    chalk_plugin.desktop \
+    chalk_tool.desktop
+    
diff --git a/chalk/data/README b/chalk/data/README
new file mode 100644
index 000000000..572ae1c59
--- /dev/null
+++ b/chalk/data/README
@@ -0,0 +1,13 @@
+Chalk is moving towards compatibility with the Gimp in the area of data
+like patterns, brushes and gradients.  All brushes, patterns etc. here
+are taken from the Gimp CVS.
+
+This is the contents of the original authors file:
+
+This distribution of gimp-data is based on Frederico Mena's
+gimp-data-0.99.11, which was based on Matt Hawkins
+gimp-data-0.99.pre11-3.5, which was based on gimp-data-0.99.9 by Spencer
+Kimball and Peter Mattis.
+
+Adrian Likins
+
diff --git a/chalk/data/brushes/10x10square.gbr b/chalk/data/brushes/10x10square.gbr
new file mode 100644
index 000000000..d680172a4
Binary files /dev/null and b/chalk/data/brushes/10x10square.gbr differ
diff --git a/chalk/data/brushes/10x10squareBlur.gbr b/chalk/data/brushes/10x10squareBlur.gbr
new file mode 100644
index 000000000..9c8efe4e2
Binary files /dev/null and b/chalk/data/brushes/10x10squareBlur.gbr differ
diff --git a/chalk/data/brushes/11circle.gbr b/chalk/data/brushes/11circle.gbr
new file mode 100644
index 000000000..d843b1b13
Binary files /dev/null and b/chalk/data/brushes/11circle.gbr differ
diff --git a/chalk/data/brushes/11fcircle.gbr b/chalk/data/brushes/11fcircle.gbr
new file mode 100644
index 000000000..86bd98536
Binary files /dev/null and b/chalk/data/brushes/11fcircle.gbr differ
diff --git a/chalk/data/brushes/13circle.gbr b/chalk/data/brushes/13circle.gbr
new file mode 100644
index 000000000..ae4269fa8
Binary files /dev/null and b/chalk/data/brushes/13circle.gbr differ
diff --git a/chalk/data/brushes/13fcircle.gbr b/chalk/data/brushes/13fcircle.gbr
new file mode 100644
index 000000000..456d10563
Binary files /dev/null and b/chalk/data/brushes/13fcircle.gbr differ
diff --git a/chalk/data/brushes/15circle.gbr b/chalk/data/brushes/15circle.gbr
new file mode 100644
index 000000000..ce99d36ea
Binary files /dev/null and b/chalk/data/brushes/15circle.gbr differ
diff --git a/chalk/data/brushes/15fcircle.gbr b/chalk/data/brushes/15fcircle.gbr
new file mode 100644
index 000000000..c198ef4e0
Binary files /dev/null and b/chalk/data/brushes/15fcircle.gbr differ
diff --git a/chalk/data/brushes/17circle.gbr b/chalk/data/brushes/17circle.gbr
new file mode 100644
index 000000000..b063f54c9
Binary files /dev/null and b/chalk/data/brushes/17circle.gbr differ
diff --git a/chalk/data/brushes/17fcircle.gbr b/chalk/data/brushes/17fcircle.gbr
new file mode 100644
index 000000000..1a1705602
Binary files /dev/null and b/chalk/data/brushes/17fcircle.gbr differ
diff --git a/chalk/data/brushes/19circle.gbr b/chalk/data/brushes/19circle.gbr
new file mode 100644
index 000000000..a0a581b22
Binary files /dev/null and b/chalk/data/brushes/19circle.gbr differ
diff --git a/chalk/data/brushes/19fcircle.gbr b/chalk/data/brushes/19fcircle.gbr
new file mode 100644
index 000000000..6418446d6
Binary files /dev/null and b/chalk/data/brushes/19fcircle.gbr differ
diff --git a/chalk/data/brushes/1circle.gbr b/chalk/data/brushes/1circle.gbr
new file mode 100644
index 000000000..8c81f6bf2
Binary files /dev/null and b/chalk/data/brushes/1circle.gbr differ
diff --git a/chalk/data/brushes/20x20square.gbr b/chalk/data/brushes/20x20square.gbr
new file mode 100644
index 000000000..011259f06
Binary files /dev/null and b/chalk/data/brushes/20x20square.gbr differ
diff --git a/chalk/data/brushes/20x20squareBlur.gbr b/chalk/data/brushes/20x20squareBlur.gbr
new file mode 100644
index 000000000..fd3df8ed2
Binary files /dev/null and b/chalk/data/brushes/20x20squareBlur.gbr differ
diff --git a/chalk/data/brushes/3circle.gbr b/chalk/data/brushes/3circle.gbr
new file mode 100644
index 000000000..ddddec9fe
Binary files /dev/null and b/chalk/data/brushes/3circle.gbr differ
diff --git a/chalk/data/brushes/3fcircle.gbr b/chalk/data/brushes/3fcircle.gbr
new file mode 100644
index 000000000..7a07a1afa
Binary files /dev/null and b/chalk/data/brushes/3fcircle.gbr differ
diff --git a/chalk/data/brushes/5circle.gbr b/chalk/data/brushes/5circle.gbr
new file mode 100644
index 000000000..c910e2945
Binary files /dev/null and b/chalk/data/brushes/5circle.gbr differ
diff --git a/chalk/data/brushes/5fcircle.gbr b/chalk/data/brushes/5fcircle.gbr
new file mode 100644
index 000000000..83d504238
Binary files /dev/null and b/chalk/data/brushes/5fcircle.gbr differ
diff --git a/chalk/data/brushes/5x5square.gbr b/chalk/data/brushes/5x5square.gbr
new file mode 100644
index 000000000..921b45318
Binary files /dev/null and b/chalk/data/brushes/5x5square.gbr differ
diff --git a/chalk/data/brushes/5x5squareBlur.gbr b/chalk/data/brushes/5x5squareBlur.gbr
new file mode 100644
index 000000000..97ae6a032
Binary files /dev/null and b/chalk/data/brushes/5x5squareBlur.gbr differ
diff --git a/chalk/data/brushes/7circle.gbr b/chalk/data/brushes/7circle.gbr
new file mode 100644
index 000000000..45ea2103d
Binary files /dev/null and b/chalk/data/brushes/7circle.gbr differ
diff --git a/chalk/data/brushes/7fcircle.gbr b/chalk/data/brushes/7fcircle.gbr
new file mode 100644
index 000000000..b069c6f8c
Binary files /dev/null and b/chalk/data/brushes/7fcircle.gbr differ
diff --git a/chalk/data/brushes/9circle.gbr b/chalk/data/brushes/9circle.gbr
new file mode 100644
index 000000000..369d85cc5
Binary files /dev/null and b/chalk/data/brushes/9circle.gbr differ
diff --git a/chalk/data/brushes/9fcircle.gbr b/chalk/data/brushes/9fcircle.gbr
new file mode 100644
index 000000000..6e1c414c0
Binary files /dev/null and b/chalk/data/brushes/9fcircle.gbr differ
diff --git a/chalk/data/brushes/BRUSHES.README b/chalk/data/brushes/BRUSHES.README
new file mode 100644
index 000000000..c7193aac3
--- /dev/null
+++ b/chalk/data/brushes/BRUSHES.README
@@ -0,0 +1,19 @@
+    CURSOR BRUSHES
+    --------------
+    
+    These brushes are for use with The GIMP.
+    
+    Copy them to your ~/.gimp-version/brushes directory to
+    make them available to The GIMP.
+    Click the Refresh button in the Brushes Dialog to make
+    them available without restarting The GIMP.
+    
+    The brushes are licensed under the GNU General Public License
+    as published by the Free Software Foundation; either
+    version 2 of the License, or any later version.
+    
+    For more details see the file COPYING.
+
+    ---------------------------------------------------------
+    
+    Natalie                               nat@switch.demon.nl
diff --git a/chalk/data/brushes/COPYING b/chalk/data/brushes/COPYING
new file mode 100644
index 000000000..c13faf0dd
--- /dev/null
+++ b/chalk/data/brushes/COPYING
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/chalk/data/brushes/DStar11.gbr b/chalk/data/brushes/DStar11.gbr
new file mode 100644
index 000000000..cab5714ab
Binary files /dev/null and b/chalk/data/brushes/DStar11.gbr differ
diff --git a/chalk/data/brushes/DStar17.gbr b/chalk/data/brushes/DStar17.gbr
new file mode 100644
index 000000000..496919cb6
Binary files /dev/null and b/chalk/data/brushes/DStar17.gbr differ
diff --git a/chalk/data/brushes/DStar25.gbr b/chalk/data/brushes/DStar25.gbr
new file mode 100644
index 000000000..29f8fb252
Binary files /dev/null and b/chalk/data/brushes/DStar25.gbr differ
diff --git a/chalk/data/brushes/Makefile.am b/chalk/data/brushes/Makefile.am
new file mode 100644
index 000000000..d65b044e5
--- /dev/null
+++ b/chalk/data/brushes/Makefile.am
@@ -0,0 +1,69 @@
+chalkbrushesdir = $(prefix)/share/apps/chalk/brushes
+    
+chalkbrushes_DATA =  \
+    10x10squareBlur.gbr \
+    10x10square.gbr \
+    11circle.gbr \
+    11fcircle.gbr \
+    13circle.gbr \
+    13fcircle.gbr \
+    15circle.gbr \
+    15fcircle.gbr \
+    17circle.gbr \
+    17fcircle.gbr \
+    19circle.gbr \
+    19fcircle.gbr \
+    1circle.gbr \
+    20x20squareBlur.gbr \
+    20x20square.gbr \
+    3circle.gbr \
+    3fcircle.gbr \
+    5circle.gbr \
+    5fcircle.gbr \
+    5x5squareBlur.gbr \
+    5x5square.gbr \
+    7circle.gbr \
+    7fcircle.gbr \
+    9circle.gbr \
+    9fcircle.gbr \
+    callig1.gbr \
+    callig2.gbr \
+    callig3.gbr \
+    callig4.gbr \
+    confetti.gbr \
+    confetti.gih \
+    cursor_big_lb.gbr \
+    cursor_big_lw.gbr \
+    cursor_big_rb.gbr \
+    cursor_big_rw.gbr \
+    cursor.gbr \
+    cursor_lw.gbr \
+    cursor_resize_diag_1.gbr \
+    cursor_resize_diag_2.gbr \
+    cursor_resize_hor.gbr \
+    cursor_resize_vert.gbr \
+    cursor_rw.gbr \
+    cursor_small_lb.gbr \
+    cursor_small_lw.gbr \
+    cursor_small_rb.gbr \
+    cursor_small_rw.gbr \
+    cursor_tiny_lw.gbr \
+    cursor_tiny_rw.gbr \
+    cursor_up.gbr \
+    DStar11.gbr \
+    DStar17.gbr \
+    DStar25.gbr \
+    dunes.gbr \
+    feltpen.gih \
+    galaxy_big.gbr \
+    galaxy.gbr \
+    galaxy_small.gbr \
+    hsparks.gih \
+    Makefile.am \
+    Makefile.in \
+    pepper.gbr \
+    pixel.gbr \
+    SketchBrush-16.gih \
+    SketchBrush-32.gih \
+    SketchBrush-64.gih \
+    vine.gih 
diff --git a/chalk/data/brushes/SketchBrush-16.gih b/chalk/data/brushes/SketchBrush-16.gih
new file mode 100644
index 000000000..32c76dec6
Binary files /dev/null and b/chalk/data/brushes/SketchBrush-16.gih differ
diff --git a/chalk/data/brushes/SketchBrush-32.gih b/chalk/data/brushes/SketchBrush-32.gih
new file mode 100644
index 000000000..6fae028d0
Binary files /dev/null and b/chalk/data/brushes/SketchBrush-32.gih differ
diff --git a/chalk/data/brushes/SketchBrush-64.gih b/chalk/data/brushes/SketchBrush-64.gih
new file mode 100644
index 000000000..8dbff8fd8
Binary files /dev/null and b/chalk/data/brushes/SketchBrush-64.gih differ
diff --git a/chalk/data/brushes/callig1.gbr b/chalk/data/brushes/callig1.gbr
new file mode 100644
index 000000000..ef3bfa2bb
Binary files /dev/null and b/chalk/data/brushes/callig1.gbr differ
diff --git a/chalk/data/brushes/callig2.gbr b/chalk/data/brushes/callig2.gbr
new file mode 100644
index 000000000..d607dd574
Binary files /dev/null and b/chalk/data/brushes/callig2.gbr differ
diff --git a/chalk/data/brushes/callig3.gbr b/chalk/data/brushes/callig3.gbr
new file mode 100644
index 000000000..d84c256cb
Binary files /dev/null and b/chalk/data/brushes/callig3.gbr differ
diff --git a/chalk/data/brushes/callig4.gbr b/chalk/data/brushes/callig4.gbr
new file mode 100644
index 000000000..8be1bc1df
Binary files /dev/null and b/chalk/data/brushes/callig4.gbr differ
diff --git a/chalk/data/brushes/confetti.gbr b/chalk/data/brushes/confetti.gbr
new file mode 100644
index 000000000..d7ba158e9
Binary files /dev/null and b/chalk/data/brushes/confetti.gbr differ
diff --git a/chalk/data/brushes/confetti.gih b/chalk/data/brushes/confetti.gih
new file mode 100644
index 000000000..dfa9cc880
Binary files /dev/null and b/chalk/data/brushes/confetti.gih differ
diff --git a/chalk/data/brushes/cursor.gbr b/chalk/data/brushes/cursor.gbr
new file mode 100644
index 000000000..80be888ed
Binary files /dev/null and b/chalk/data/brushes/cursor.gbr differ
diff --git a/chalk/data/brushes/cursor_big_lb.gbr b/chalk/data/brushes/cursor_big_lb.gbr
new file mode 100644
index 000000000..be0dab110
Binary files /dev/null and b/chalk/data/brushes/cursor_big_lb.gbr differ
diff --git a/chalk/data/brushes/cursor_big_lw.gbr b/chalk/data/brushes/cursor_big_lw.gbr
new file mode 100644
index 000000000..f92539111
Binary files /dev/null and b/chalk/data/brushes/cursor_big_lw.gbr differ
diff --git a/chalk/data/brushes/cursor_big_rb.gbr b/chalk/data/brushes/cursor_big_rb.gbr
new file mode 100644
index 000000000..09c356ae0
Binary files /dev/null and b/chalk/data/brushes/cursor_big_rb.gbr differ
diff --git a/chalk/data/brushes/cursor_big_rw.gbr b/chalk/data/brushes/cursor_big_rw.gbr
new file mode 100644
index 000000000..53e64f930
Binary files /dev/null and b/chalk/data/brushes/cursor_big_rw.gbr differ
diff --git a/chalk/data/brushes/cursor_lw.gbr b/chalk/data/brushes/cursor_lw.gbr
new file mode 100644
index 000000000..be41e4319
Binary files /dev/null and b/chalk/data/brushes/cursor_lw.gbr differ
diff --git a/chalk/data/brushes/cursor_resize_diag_1.gbr b/chalk/data/brushes/cursor_resize_diag_1.gbr
new file mode 100644
index 000000000..d31101642
Binary files /dev/null and b/chalk/data/brushes/cursor_resize_diag_1.gbr differ
diff --git a/chalk/data/brushes/cursor_resize_diag_2.gbr b/chalk/data/brushes/cursor_resize_diag_2.gbr
new file mode 100644
index 000000000..e4be9425f
Binary files /dev/null and b/chalk/data/brushes/cursor_resize_diag_2.gbr differ
diff --git a/chalk/data/brushes/cursor_resize_hor.gbr b/chalk/data/brushes/cursor_resize_hor.gbr
new file mode 100644
index 000000000..fbbbfed80
Binary files /dev/null and b/chalk/data/brushes/cursor_resize_hor.gbr differ
diff --git a/chalk/data/brushes/cursor_resize_vert.gbr b/chalk/data/brushes/cursor_resize_vert.gbr
new file mode 100644
index 000000000..941eb6154
Binary files /dev/null and b/chalk/data/brushes/cursor_resize_vert.gbr differ
diff --git a/chalk/data/brushes/cursor_rw.gbr b/chalk/data/brushes/cursor_rw.gbr
new file mode 100644
index 000000000..50f2bd1a6
Binary files /dev/null and b/chalk/data/brushes/cursor_rw.gbr differ
diff --git a/chalk/data/brushes/cursor_small_lb.gbr b/chalk/data/brushes/cursor_small_lb.gbr
new file mode 100644
index 000000000..b64e13717
Binary files /dev/null and b/chalk/data/brushes/cursor_small_lb.gbr differ
diff --git a/chalk/data/brushes/cursor_small_lw.gbr b/chalk/data/brushes/cursor_small_lw.gbr
new file mode 100644
index 000000000..abdcaacda
Binary files /dev/null and b/chalk/data/brushes/cursor_small_lw.gbr differ
diff --git a/chalk/data/brushes/cursor_small_rb.gbr b/chalk/data/brushes/cursor_small_rb.gbr
new file mode 100644
index 000000000..900585903
Binary files /dev/null and b/chalk/data/brushes/cursor_small_rb.gbr differ
diff --git a/chalk/data/brushes/cursor_small_rw.gbr b/chalk/data/brushes/cursor_small_rw.gbr
new file mode 100644
index 000000000..5b928fbef
Binary files /dev/null and b/chalk/data/brushes/cursor_small_rw.gbr differ
diff --git a/chalk/data/brushes/cursor_tiny_lw.gbr b/chalk/data/brushes/cursor_tiny_lw.gbr
new file mode 100644
index 000000000..d2b67eb95
Binary files /dev/null and b/chalk/data/brushes/cursor_tiny_lw.gbr differ
diff --git a/chalk/data/brushes/cursor_tiny_rw.gbr b/chalk/data/brushes/cursor_tiny_rw.gbr
new file mode 100644
index 000000000..a8293bf8d
Binary files /dev/null and b/chalk/data/brushes/cursor_tiny_rw.gbr differ
diff --git a/chalk/data/brushes/cursor_up.gbr b/chalk/data/brushes/cursor_up.gbr
new file mode 100644
index 000000000..edb8ebec1
Binary files /dev/null and b/chalk/data/brushes/cursor_up.gbr differ
diff --git a/chalk/data/brushes/dunes.gbr b/chalk/data/brushes/dunes.gbr
new file mode 100644
index 000000000..fc7eed234
Binary files /dev/null and b/chalk/data/brushes/dunes.gbr differ
diff --git a/chalk/data/brushes/feltpen.gih b/chalk/data/brushes/feltpen.gih
new file mode 100644
index 000000000..37d9c771c
Binary files /dev/null and b/chalk/data/brushes/feltpen.gih differ
diff --git a/chalk/data/brushes/galaxy.gbr b/chalk/data/brushes/galaxy.gbr
new file mode 100644
index 000000000..20a13c269
Binary files /dev/null and b/chalk/data/brushes/galaxy.gbr differ
diff --git a/chalk/data/brushes/galaxy_big.gbr b/chalk/data/brushes/galaxy_big.gbr
new file mode 100644
index 000000000..dbcc56891
Binary files /dev/null and b/chalk/data/brushes/galaxy_big.gbr differ
diff --git a/chalk/data/brushes/galaxy_small.gbr b/chalk/data/brushes/galaxy_small.gbr
new file mode 100644
index 000000000..d7f3da57c
Binary files /dev/null and b/chalk/data/brushes/galaxy_small.gbr differ
diff --git a/chalk/data/brushes/hsparks.gih b/chalk/data/brushes/hsparks.gih
new file mode 100644
index 000000000..99f75cd9e
Binary files /dev/null and b/chalk/data/brushes/hsparks.gih differ
diff --git a/chalk/data/brushes/pepper.gbr b/chalk/data/brushes/pepper.gbr
new file mode 100644
index 000000000..34861d148
Binary files /dev/null and b/chalk/data/brushes/pepper.gbr differ
diff --git a/chalk/data/brushes/pixel.gbr b/chalk/data/brushes/pixel.gbr
new file mode 100644
index 000000000..9de22c122
Binary files /dev/null and b/chalk/data/brushes/pixel.gbr differ
diff --git a/chalk/data/brushes/vine.gih b/chalk/data/brushes/vine.gih
new file mode 100644
index 000000000..65acae048
Binary files /dev/null and b/chalk/data/brushes/vine.gih differ
diff --git a/chalk/data/chalk_filter.desktop b/chalk/data/chalk_filter.desktop
new file mode 100644
index 000000000..c865db10e
--- /dev/null
+++ b/chalk/data/chalk_filter.desktop
@@ -0,0 +1,47 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=Chalk/Filter
+Comment=Filter plugin for Chalk
+Comment[bg]=Приставка за филтриране за Chalk
+Comment[ca]=Connector de filtre per a Chalk
+Comment[da]=Plugin med filter for Chalk
+Comment[de]=Filter-Modul für Chalk
+Comment[el]=Πρόσθετο φίλτρου για το Chalk
+Comment[eo]=Filtrilkromaĵo por Chalk
+Comment[es]=Complemento de filtrado para Chalk
+Comment[et]=Chalk filtriplugin
+Comment[eu]=Chalk-ren iragazkia
+Comment[fa]=وصلۀ پالایه برای Chalk
+Comment[fi]=Suodinliitännäinen Chalklle
+Comment[fr]=Module de filtres de Chalk
+Comment[fy]=Filterplugin foar Chalk
+Comment[gl]=Plugin de filtro para Chalk
+Comment[he]=תוסף סינון של Chalk
+Comment[hu]=Szűrőmodul a Kritához
+Comment[is]=Síu íforrit fyrir Chalk
+Comment[it]=Plugin di filtro per Chalk
+Comment[ja]=Chalk フィルタプラグイン
+Comment[km]=កម្មវិធី​ជំនួយ​តម្រង​សម្រាប់ Chalk
+Comment[lv]=Chalk filtra spraudnis
+Comment[ms]=Plugin penapis Chalk
+Comment[nb]=Filter-programtillegg for Chalk
+Comment[nds]=Filtermoduul för Chalk
+Comment[ne]=क्रिताका लागि फिल्टर प्लगइन
+Comment[nl]=Filterplugin voor Chalk
+Comment[nn]=Chalk-programtillegg for filter
+Comment[pl]=Wtyczka filtrów dla Chalk
+Comment[pt]='Plugin' de filtragem do Chalk
+Comment[pt_BR]=Plugin de filtro para o Chalk
+Comment[ru]=Фильтр Chalk
+Comment[sk]=Filter modul pre Chalk
+Comment[sl]=Vstavek za filtriranje za Krito
+Comment[sr]=Филтерски прикључак за Chalk-у
+Comment[sr@Latn]=Filterski priključak za Chalk-u
+Comment[sv]=Insticksprogram med filter för Chalk
+Comment[uk]=Втулок фільтра для Chalk
+Comment[uz]=Chalk uchun filter plagini
+Comment[uz@cyrillic]=Chalk учун филтер плагини
+Comment[zh_CN]=Chalk 过滤器插件
+Comment[zh_TW]=Chalk 的過濾器外掛程式
+[PropertyDef::X-Chalk-Version]
+Type=int
diff --git a/chalk/data/chalk_paintop.desktop b/chalk/data/chalk_paintop.desktop
new file mode 100644
index 000000000..1dd6f0bd8
--- /dev/null
+++ b/chalk/data/chalk_paintop.desktop
@@ -0,0 +1,41 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=Chalk/Paintop
+Comment=Paint operation plugin for Chalk
+Comment[bg]=Приставка за рисуване за Chalk
+Comment[ca]=Connector d'operació de pintura per a Chalk
+Comment[da]=Plugin med malehandlinger for Chalk
+Comment[de]=Maloperation-Modul für Chalk
+Comment[el]=Πρόσθετο λειτουργίας ζωγραφικής για το Chalk
+Comment[eo]=Pentrooperacia kromaĵo por Chalk
+Comment[es]=Complemento de operación de pintura para Chalk
+Comment[et]=Chalk joonistamistoimingute plugin
+Comment[fa]=وصلۀ عمل رنگ‌آمیزی برای Chalk
+Comment[fi]=Chalkn maalaustoimintoliitännäinen
+Comment[fr]=Module d'opération pour Chalk
+Comment[fy]=Ferfhannelingsplugin foar Chalk
+Comment[gl]=Plugin de pintar para Chalk
+Comment[he]=תוסף פעולת צביעה של Chalk
+Comment[hu]=Festőmodul a Kritához
+Comment[is]=Málunar íforrit fyrir Chalk
+Comment[it]=Plugin per l'operazione di disegno per Chalk
+Comment[ja]=Chalk 描画操作プラグイン
+Comment[km]=កម្មវិធី​ជំនួយ​ក្នុង​ការ​គូរ សម្រាប់ Chalk
+Comment[nb]=Chalk-programtillegg for male-handlinger
+Comment[nds]=Maalmoduul för Chalk
+Comment[ne]=क्रिताका लागि पेन्ट अपरेसन प्लगइन
+Comment[nl]=Verfverrichtingplugin voor Chalk
+Comment[pl]=Wtyczka operacji malowania dla Chalk
+Comment[pt]='Plugin' de operações de pintura do Chalk
+Comment[pt_BR]=Plugin de operações de pintura do Chalk
+Comment[ru]=Инструмент рисования Chalk
+Comment[sk]=Kresliaci modul pre Chalk
+Comment[sl]=Vstavek s slikarskim postopkom za Krito
+Comment[sr]=Прикључак за сликарске операције за Chalk-у
+Comment[sr@Latn]=Priključak za slikarske operacije za Chalk-u
+Comment[sv]=Insticksprogram med målningsåtgärder för Chalk
+Comment[uk]=Втулок малювання для Chalk
+Comment[zh_CN]=Chalk 的绘画操作插件
+Comment[zh_TW]=Chalk 的繪畫操作外掛程式
+[PropertyDef::X-Chalk-Version]
+Type=int
diff --git a/chalk/data/chalk_plugin.desktop b/chalk/data/chalk_plugin.desktop
new file mode 100644
index 000000000..def61cbf4
--- /dev/null
+++ b/chalk/data/chalk_plugin.desktop
@@ -0,0 +1,42 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=Chalk/ViewPlugin
+Comment=GUI functionality for Chalk
+Comment[bg]=ГПИ функционалност за Chalk
+Comment[ca]=Funcionalitat d'interfície d'usuari per a Chalk
+Comment[cy]=Swyddogaeth GUI ar gyfer Chalk
+Comment[da]=GUI-funktionalitet for Chalk
+Comment[de]=GUI-Funktionalität für Chalk
+Comment[el]=Άρθρωμα λειτουργικότητας περιβάλλοντος για το Chalk
+Comment[es]=Funcionalidad de GUI para Chalk
+Comment[et]=Chalk GUI funktsioonid
+Comment[fa]=کارآمدی ونک برای Chalk
+Comment[fr]=Interface graphique pour Chalk
+Comment[fy]=Ynterfacefunksjonaliteit foar Chalk
+Comment[gl]=Funcionalidade da GUI de Chalk
+Comment[he]=מודול פונקציונליות בסיסית של Chalk
+Comment[hu]=Grafikus felület a Kritához
+Comment[is]=Gluggavirkni fyrir Chalk
+Comment[it]=Funzionalità d'interfaccia per Chalk
+Comment[ja]=Chalk の GUI 機能
+Comment[km]=មុខងារ​ចំណុចប្រទាក់​អ្នក​ប្រើ សម្រាប់ Chalk
+Comment[nb]=Chalk-modul for GUI-funksjonalitet
+Comment[nds]=Böversietfunkschonen för Chalk
+Comment[ne]=क्रिताका लागि GUI कार्यात्मक
+Comment[nl]=Interfacefunctionaliteit voor Chalk
+Comment[pl]=Graficzny interfejs użytkownika programu Chalk
+Comment[pt]=Funcionalidade gráfica para o Chalk
+Comment[pt_BR]=Funcionalidade de interface gráfica para o Chalk
+Comment[ru]=Интерфейс Chalk
+Comment[sk]=GUI functionalita pre Chalk
+Comment[sl]=Funkcionalnost grafičnega vmesnika za Krito
+Comment[sr]=Функционалност GUI-ја за Chalk-у
+Comment[sr@Latn]=Funkcionalnost GUI-ja za Chalk-u
+Comment[sv]=Grafisk gränssnittsfunktion för Chalk
+Comment[uk]=Функціональність графічного інтерфейсу для Chalk
+Comment[uz]=Chalk grafik interfeysi
+Comment[uz@cyrillic]=Chalk график интерфейси
+Comment[zh_CN]=Chalk 的图形界面模块
+Comment[zh_TW]=Chalk 的 GUI 功能
+[PropertyDef::X-Chalk-Version]
+Type=int
diff --git a/chalk/data/chalk_tool.desktop b/chalk/data/chalk_tool.desktop
new file mode 100644
index 000000000..5508cae3a
--- /dev/null
+++ b/chalk/data/chalk_tool.desktop
@@ -0,0 +1,46 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=Chalk/Tool
+Comment=Tool plugin for Chalk
+Comment[bg]=Приставка за инструмент за Chalk
+Comment[ca]=Connector d'eines per a Chalk
+Comment[da]=Værktøjsplugin for Chalk
+Comment[de]=Werkzeug-Modul für Chalk
+Comment[el]=Πρόσθετο εργαλείων για το Chalk
+Comment[eo]=Ilkromaĵo por Chalk
+Comment[es]=Complemento de herramienta para Chalk
+Comment[et]=Chalk tööriistade plugin
+Comment[eu]=Chalk-ren Tresna plugina
+Comment[fa]=وصله ابزار برای Chalk
+Comment[fi]=Chalkn työkaluliitännäinen
+Comment[fr]=Module d'outils pour Chalk
+Comment[fy]=Arkplugin foar Chalk
+Comment[gl]=Ferramenta de plugin para Chalk
+Comment[he]=תוסף כלים של Chalk
+Comment[hu]=Eszközmodul a Kritához
+Comment[is]=Tóla íforrit fyrir Chalk
+Comment[it]=Plugin per gli strumenti per Chalk
+Comment[ja]=Chalk ツールプラグイン
+Comment[km]=កម្មវិធី​ជំនួយ​ឧបករណ៍ សម្រាប់ Chalk
+Comment[ms]=Plugin alat Chalk
+Comment[nb]=Chalk-programtillegg for verktøy
+Comment[nds]=Warktüüchmoduul för Chalk
+Comment[ne]=क्रिताका लागि उपकरण प्लगइन
+Comment[nl]=Gereedschapsplugin voor Chalk
+Comment[nn]=Chalk-programtillegg for verktøy
+Comment[pl]=Wtyczka narzędzi dla Chalk
+Comment[pt]='Plugin' de ferramentas do Chalk
+Comment[pt_BR]=Plugin de ferramenta para o Chalk
+Comment[ru]=Инструменты Chalk
+Comment[sk]=Modul nástrojov pre Chalk
+Comment[sl]=Vstavek z orodjem za Krito
+Comment[sr]=Алатни прикључак за Chalk-у
+Comment[sr@Latn]=Alatni priključak za Chalk-u
+Comment[sv]=Verktygsinsticksprogram för Chalk
+Comment[uk]=Втулок інструментів для Chalk
+Comment[uz]=Chalk uchun vosita plagini
+Comment[uz@cyrillic]=Chalk учун восита плагини
+Comment[zh_CN]=Chalk 工具插件
+Comment[zh_TW]=Chalk 的工具外掛程式
+[PropertyDef::X-Chalk-Version]
+Type=int
diff --git a/chalk/data/gradients/Abstract_1.ggr b/chalk/data/gradients/Abstract_1.ggr
new file mode 100644
index 000000000..5e681d223
--- /dev/null
+++ b/chalk/data/gradients/Abstract_1.ggr
@@ -0,0 +1,9 @@
+GIMP Gradient
+Name: Abstract 1
+6
+0.000000 0.286311 0.572621 0.269543 0.259267 1.000000 1.000000 0.215635 0.407414 0.984953 1.000000 0 0
+0.572621 0.657763 0.716194 0.215635 0.407414 0.984953 1.000000 0.040368 0.833333 0.619375 1.000000 0 0
+0.716194 0.734558 0.749583 0.040368 0.833333 0.619375 1.000000 0.680490 0.355264 0.977430 1.000000 0 0
+0.749583 0.784641 0.824708 0.680490 0.355264 0.977430 1.000000 0.553909 0.351853 0.977430 1.000000 0 0
+0.824708 0.853088 0.876461 0.553909 0.351853 0.977430 1.000000 1.000000 0.000000 1.000000 1.000000 0 0
+0.876461 0.943172 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 1.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Abstract_2.ggr b/chalk/data/gradients/Abstract_2.ggr
new file mode 100644
index 000000000..913ae0194
--- /dev/null
+++ b/chalk/data/gradients/Abstract_2.ggr
@@ -0,0 +1,9 @@
+GIMP Gradient
+Name: Abstract 2
+6
+0.000000 0.333532 0.570952 1.000000 0.000000 0.055296 1.000000 0.922731 0.452483 0.984953 1.000000 0 0
+0.570952 0.616469 0.664441 0.922731 0.452483 0.984953 1.000000 0.122236 0.319840 0.583333 1.000000 0 0
+0.664441 0.727880 0.756260 0.122236 0.319840 0.583333 1.000000 0.059646 1.000000 0.558369 1.000000 0 0
+0.756260 0.799666 0.843072 0.059646 1.000000 0.558369 1.000000 0.969697 0.948568 0.533333 1.000000 0 0
+0.843072 0.905766 0.949917 0.969697 0.948568 0.533333 1.000000 1.000000 0.490000 1.000000 1.000000 0 0
+0.949917 0.988314 1.000000 1.000000 0.490000 1.000000 1.000000 0.238108 0.191841 1.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Abstract_3.ggr b/chalk/data/gradients/Abstract_3.ggr
new file mode 100644
index 000000000..5052750a0
--- /dev/null
+++ b/chalk/data/gradients/Abstract_3.ggr
@@ -0,0 +1,9 @@
+GIMP Gradient
+Name: Abstract 3
+6
+0.000000 0.050083 0.435726 0.000000 0.424242 0.070751 1.000000 1.000000 0.725647 0.428066 1.000000 0 0
+0.435726 0.490818 0.590985 1.000000 0.725647 0.428066 1.000000 0.115248 0.249315 0.651515 1.000000 0 0
+0.590985 0.660267 0.799666 0.115248 0.249315 0.651515 1.000000 0.552948 0.624658 0.550758 1.000000 0 0
+0.799666 0.879800 0.943239 0.552948 0.624658 0.550758 1.000000 0.990647 1.000000 0.450000 1.000000 0 0
+0.943239 0.961603 0.979967 0.990647 1.000000 0.450000 1.000000 0.317635 0.843781 1.000000 1.000000 0 0
+0.979967 0.989983 1.000000 0.317635 0.843781 1.000000 1.000000 0.000000 1.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Aneurism.ggr b/chalk/data/gradients/Aneurism.ggr
new file mode 100644
index 000000000..092b22923
--- /dev/null
+++ b/chalk/data/gradients/Aneurism.ggr
@@ -0,0 +1,11 @@
+GIMP Gradient
+Name: Aneurism
+8
+0.000000 0.119571 0.235803 0.000000 0.000000 0.000000 0.000000 0.202999 0.003788 0.265152 1.000000 0 0
+0.235803 0.306652 0.377501 0.202999 0.003788 0.265152 1.000000 0.300711 0.001894 0.393939 1.000000 0 0
+0.377501 0.409118 0.437396 0.300711 0.001894 0.393939 1.000000 0.388992 0.000947 0.206459 1.000000 0 0
+0.437396 0.455760 0.474124 0.388992 0.000947 0.206459 1.000000 0.689394 0.000000 0.027414 1.000000 0 0
+0.474124 0.504174 0.534224 0.689394 0.000000 0.027414 1.000000 0.388992 0.000947 0.206459 1.000000 0 0
+0.534224 0.571786 0.609349 0.388992 0.000947 0.206459 1.000000 0.300711 0.001894 0.393939 1.000000 0 0
+0.609349 0.708556 0.770562 0.300711 0.001894 0.393939 1.000000 0.202999 0.003788 0.265152 1.000000 0 0
+0.770562 0.885281 1.000000 0.202999 0.003788 0.265152 1.000000 0.000000 0.000000 0.000000 0.000000 0 0
diff --git a/chalk/data/gradients/Blinds.ggr b/chalk/data/gradients/Blinds.ggr
new file mode 100644
index 000000000..a6bca8256
--- /dev/null
+++ b/chalk/data/gradients/Blinds.ggr
@@ -0,0 +1,12 @@
+GIMP Gradient
+Name: Blinds
+9
+0.000000 0.041667 0.166667 0.000000 0.000000 0.000000 1.000000 0.500000 0.500000 0.500000 1.000000 2 0
+0.166667 0.186978 0.250000 0.500000 0.500000 0.500000 1.000000 1.000000 1.000000 1.000000 1.000000 2 0
+0.250000 0.250000 0.346689 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 2 0
+0.346689 0.425710 0.425710 0.000000 0.000000 0.000000 1.000000 0.500000 0.500000 0.500000 1.000000 2 0
+0.425710 0.541667 0.583333 0.500000 0.500000 0.500000 1.000000 1.000000 1.000000 1.000000 1.000000 2 0
+0.583333 0.583333 0.671119 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 2 0
+0.671119 0.761269 0.835003 0.000000 0.000000 0.000000 1.000000 0.416667 0.416667 0.416667 1.000000 2 0
+0.835003 0.875000 0.916667 0.416667 0.416667 0.416667 1.000000 0.833333 0.833333 0.833333 1.000000 2 0
+0.916667 0.916667 1.000000 0.833333 0.833333 0.833333 1.000000 0.000000 0.000000 0.000000 1.000000 2 0
diff --git a/chalk/data/gradients/Blue_Green.ggr b/chalk/data/gradients/Blue_Green.ggr
new file mode 100644
index 000000000..4b5045764
--- /dev/null
+++ b/chalk/data/gradients/Blue_Green.ggr
@@ -0,0 +1,5 @@
+GIMP Gradient
+Name: Blue Green
+2
+0.000000 0.135225 0.565943 0.000000 0.481711 1.000000 1.000000 0.283820 0.887055 1.000000 1.000000 0 0
+0.565943 0.918197 1.000000 0.283820 0.887055 1.000000 1.000000 0.000000 1.000000 0.631509 1.000000 0 0
diff --git a/chalk/data/gradients/Browns.ggr b/chalk/data/gradients/Browns.ggr
new file mode 100644
index 000000000..7b826a390
--- /dev/null
+++ b/chalk/data/gradients/Browns.ggr
@@ -0,0 +1,14 @@
+GIMP Gradient
+Name: Browns
+11
+0.000000 0.055092 0.116861 0.550000 0.353971 0.192500 1.000000 0.734848 0.461927 0.168587 1.000000 0 0
+0.116861 0.176962 0.253756 0.734848 0.461927 0.168587 1.000000 0.550000 0.328592 0.022000 1.000000 0 0
+0.253756 0.347245 0.404006 0.550000 0.328592 0.022000 1.000000 0.780303 0.457033 0.022095 1.000000 0 0
+0.404006 0.439065 0.507513 0.780303 0.457033 0.022095 1.000000 0.696970 0.330262 0.221382 1.000000 0 0
+0.507513 0.562604 0.592654 0.696970 0.330262 0.221382 1.000000 0.681667 0.487159 0.348063 1.000000 0 0
+0.592654 0.614357 0.644407 0.681667 0.487159 0.348063 1.000000 0.722109 0.527005 0.406758 1.000000 0 0
+0.644407 0.676127 0.706177 0.722109 0.527005 0.406758 1.000000 0.765919 0.570170 0.470341 1.000000 0 0
+0.706177 0.742905 0.782972 0.765919 0.570170 0.470341 1.000000 0.590909 0.402374 0.336818 1.000000 0 0
+0.782972 0.850862 0.883695 0.590909 0.402374 0.336818 1.000000 0.759037 0.555096 0.387109 1.000000 0 0
+0.883695 0.914858 0.934335 0.759037 0.555096 0.387109 1.000000 0.679587 0.523656 0.364325 1.000000 0 0
+0.934335 0.967167 1.000000 0.679587 0.523656 0.364325 1.000000 0.550000 0.353971 0.192500 1.000000 0 0
diff --git a/chalk/data/gradients/Brushed_Aluminium.ggr b/chalk/data/gradients/Brushed_Aluminium.ggr
new file mode 100644
index 000000000..3b2462586
--- /dev/null
+++ b/chalk/data/gradients/Brushed_Aluminium.ggr
@@ -0,0 +1,27 @@
+GIMP Gradient
+Name: Brushed Aluminium
+24
+0.000000 0.031250 0.041736 0.435294 0.447059 0.411765 1.000000 0.498070 0.508364 0.477482 1.000000 0 0
+0.041736 0.066308 0.072621 0.498070 0.508364 0.477482 1.000000 0.529458 0.539017 0.510340 1.000000 0 0
+0.072621 0.081803 0.125000 0.549020 0.556863 0.529412 1.000000 0.560845 0.569669 0.543199 1.000000 0 0
+0.125000 0.130217 0.154946 0.560845 0.569669 0.543199 1.000000 0.623621 0.630974 0.608916 1.000000 0 0
+0.154946 0.186196 0.203255 0.623621 0.630974 0.608916 1.000000 0.686397 0.692279 0.674632 1.000000 0 0
+0.203255 0.278798 0.285476 0.686397 0.692279 0.674632 1.000000 0.749173 0.753585 0.740349 1.000000 0 0
+0.285476 0.320534 0.333890 0.749173 0.753585 0.740349 1.000000 0.811948 0.814890 0.806066 1.000000 4 0
+0.333890 0.333890 0.365609 0.756863 0.756863 0.756863 1.000000 0.843336 0.845542 0.838925 1.000000 0 0
+0.365609 0.393990 0.399833 0.843336 0.845542 0.838925 1.000000 0.800000 0.796078 0.756863 1.000000 0 0
+0.399833 0.485392 0.517529 0.800000 0.796078 0.756863 1.000000 0.937500 0.937500 0.937500 1.000000 3 0
+0.517529 0.531250 0.552483 0.937500 0.937500 0.937500 1.000000 0.772549 0.772549 0.772549 1.000000 4 0
+0.552483 0.563439 0.569282 0.658824 0.658824 0.658824 1.000000 0.784314 0.784314 0.800000 1.000000 3 0
+0.569282 0.577629 0.586394 0.784314 0.784314 0.800000 1.000000 0.823529 0.811765 0.811765 1.000000 0 0
+0.586394 0.618322 0.626043 0.823529 0.811765 0.811765 1.000000 0.726583 0.728537 0.731807 1.000000 0 0
+0.626043 0.641068 0.663606 0.726583 0.728537 0.731807 1.000000 0.737255 0.760784 0.721569 1.000000 0 0
+0.663606 0.675292 0.682805 0.737255 0.760784 0.721569 1.000000 0.621109 0.628462 0.613266 1.000000 0 0
+0.682805 0.703673 0.722473 0.621109 0.628462 0.613266 1.000000 0.529412 0.529412 0.529412 1.000000 4 0
+0.722473 0.746680 0.758765 0.529412 0.529412 0.529412 1.000000 0.498039 0.492157 0.472549 1.000000 4 0
+0.758765 0.763773 0.770451 0.447059 0.443137 0.427451 1.000000 0.560784 0.537255 0.549020 1.000000 0 0
+0.770451 0.799145 0.827838 0.513725 0.517647 0.501961 1.000000 0.486417 0.479213 0.477687 1.000000 4 0
+0.827838 0.833890 0.851419 0.486417 0.479213 0.477687 1.000000 0.477872 0.467187 0.470092 1.000000 3 0
+0.851419 0.876461 0.892321 0.477872 0.467187 0.470092 1.000000 0.469328 0.455162 0.462497 1.000000 0 0
+0.892321 0.934474 0.941569 0.469328 0.455162 0.462497 1.000000 0.478431 0.462745 0.470588 1.000000 4 0
+0.941569 0.965776 1.000000 0.465056 0.449150 0.458699 1.000000 0.556863 0.537255 0.552941 1.000000 0 0
diff --git a/chalk/data/gradients/Burning_Paper.ggr b/chalk/data/gradients/Burning_Paper.ggr
new file mode 100644
index 000000000..df064eb06
--- /dev/null
+++ b/chalk/data/gradients/Burning_Paper.ggr
@@ -0,0 +1,9 @@
+GIMP Gradient
+Name: Burning Paper
+6
+0.000000 0.264608 0.502504 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.502504 0.601002 0.637730 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 1 0
+0.637730 0.700343 0.744574 0.000000 0.000000 0.000000 1.000000 0.890000 0.329199 0.177758 1.000000 0 0
+0.744574 0.767761 0.786311 0.890000 0.329199 0.177758 1.000000 1.000000 1.000000 0.000000 1.000000 0 0
+0.786311 0.829920 0.891486 1.000000 1.000000 0.000000 1.000000 0.910000 0.574437 0.000000 1.000000 0 0
+0.891486 0.944908 1.000000 0.910000 0.574437 0.000000 1.000000 0.727273 0.127938 0.148370 1.000000 0 0
diff --git a/chalk/data/gradients/Burning_Transparency.ggr b/chalk/data/gradients/Burning_Transparency.ggr
new file mode 100644
index 000000000..fccbc4a96
--- /dev/null
+++ b/chalk/data/gradients/Burning_Transparency.ggr
@@ -0,0 +1,9 @@
+GIMP Gradient
+Name: Burning Transparency
+6
+0.000000 0.264608 0.502504 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0 0
+0.502504 0.601002 0.637730 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 1 0
+0.637730 0.700343 0.744574 0.000000 0.000000 0.000000 1.000000 0.890000 0.329199 0.177758 1.000000 0 0
+0.744574 0.767761 0.786311 0.890000 0.329199 0.177758 1.000000 1.000000 1.000000 0.000000 1.000000 0 0
+0.786311 0.829920 0.891486 1.000000 1.000000 0.000000 1.000000 0.910000 0.574437 0.000000 1.000000 0 0
+0.891486 0.944908 1.000000 0.910000 0.574437 0.000000 1.000000 0.727273 0.127938 0.148370 0.000000 0 0
diff --git a/chalk/data/gradients/CD.ggr b/chalk/data/gradients/CD.ggr
new file mode 100644
index 000000000..824df9604
--- /dev/null
+++ b/chalk/data/gradients/CD.ggr
@@ -0,0 +1,21 @@
+GIMP Gradient
+Name: CD
+18
+0.000000 0.010566 0.023372 0.819999 0.820000 0.820000 1.000000 0.879999 0.880000 0.880000 1.000000 0 0
+0.023372 0.045682 0.063439 0.879999 0.880000 0.880000 1.000000 0.999999 1.000000 1.000000 1.000000 0 0
+0.063439 0.082638 0.176962 0.999999 1.000000 1.000000 1.000000 0.909999 0.910000 0.910000 1.000000 0 0
+0.176962 0.205342 0.236227 0.909999 0.910000 0.910000 1.000000 0.819999 0.820000 0.820000 1.000000 0 0
+0.236227 0.267623 0.281302 0.819999 0.820000 0.820000 1.000000 0.903167 1.000000 0.000000 1.000000 0 0
+0.281302 0.296327 0.310518 0.903167 1.000000 0.000000 1.000000 0.000000 0.877893 1.000000 1.000000 0 0
+0.310518 0.321369 0.340568 0.000000 0.877893 1.000000 1.000000 0.384390 1.000000 0.900682 1.000000 0 0
+0.340568 0.357129 0.373957 0.384390 1.000000 0.900682 1.000000 0.819999 0.820000 0.820000 1.000000 0 0
+0.373957 0.434190 0.500000 0.819999 0.820000 0.820000 1.000000 0.879999 0.880000 0.880000 1.000000 0 0
+0.500000 0.510566 0.523372 0.819999 0.820000 0.820000 1.000000 0.879999 0.880000 0.880000 1.000000 0 0
+0.523372 0.545682 0.563439 0.879999 0.880000 0.880000 1.000000 0.999999 1.000000 1.000000 1.000000 0 0
+0.563439 0.582638 0.676962 0.999999 1.000000 1.000000 1.000000 0.909999 0.910000 0.910000 1.000000 0 0
+0.676962 0.705342 0.736227 0.909999 0.910000 0.910000 1.000000 0.819999 0.820000 0.820000 1.000000 0 0
+0.736227 0.767623 0.781302 0.819999 0.820000 0.820000 1.000000 0.903167 1.000000 0.000000 1.000000 0 0
+0.781302 0.796327 0.810518 0.903167 1.000000 0.000000 1.000000 0.000000 0.877893 1.000000 1.000000 0 0
+0.810518 0.821369 0.840568 0.000000 0.877893 1.000000 1.000000 0.384390 1.000000 0.900682 1.000000 0 0
+0.840568 0.857129 0.873957 0.384390 1.000000 0.900682 1.000000 0.819999 0.820000 0.820000 1.000000 0 0
+0.873957 0.934190 1.000000 0.819999 0.820000 0.820000 1.000000 0.879999 0.880000 0.880000 1.000000 0 0
diff --git a/chalk/data/gradients/CD_Half.ggr b/chalk/data/gradients/CD_Half.ggr
new file mode 100644
index 000000000..fdc5dd383
--- /dev/null
+++ b/chalk/data/gradients/CD_Half.ggr
@@ -0,0 +1,12 @@
+GIMP Gradient
+Name: CD Half
+9
+0.000000 0.021131 0.046745 0.819999 0.820000 0.820000 1.000000 0.879999 0.880000 0.880000 1.000000 0 0
+0.046745 0.091364 0.126878 0.879999 0.880000 0.880000 1.000000 0.999999 1.000000 1.000000 1.000000 0 0
+0.126878 0.165275 0.353923 0.999999 1.000000 1.000000 1.000000 0.909999 0.910000 0.910000 1.000000 0 0
+0.353923 0.410684 0.472454 0.909999 0.910000 0.910000 1.000000 0.819999 0.820000 0.820000 1.000000 0 0
+0.472454 0.535246 0.562604 0.819999 0.820000 0.820000 1.000000 0.903167 1.000000 0.000000 1.000000 0 0
+0.562604 0.592654 0.621035 0.903167 1.000000 0.000000 1.000000 0.000000 0.877893 1.000000 1.000000 0 0
+0.621035 0.642738 0.681135 0.000000 0.877893 1.000000 1.000000 0.384390 1.000000 0.900682 1.000000 0 0
+0.681135 0.714259 0.747913 0.384390 1.000000 0.900682 1.000000 0.819999 0.820000 0.820000 1.000000 0 0
+0.747913 0.868381 1.000000 0.819999 0.820000 0.820000 1.000000 0.879999 0.880000 0.880000 1.000000 0 0
diff --git a/chalk/data/gradients/Caribbean_Blues.ggr b/chalk/data/gradients/Caribbean_Blues.ggr
new file mode 100644
index 000000000..232b7b8b4
--- /dev/null
+++ b/chalk/data/gradients/Caribbean_Blues.ggr
@@ -0,0 +1,6 @@
+GIMP Gradient
+Name: Caribbean Blues
+3
+0.000000 0.403766 0.567613 0.000000 0.130219 0.583333 1.000000 0.200000 0.833333 0.726927 1.000000 0 0
+0.567613 0.642738 0.681135 0.200000 0.833333 0.726927 1.000000 1.000000 0.988352 0.860000 1.000000 0 0
+0.681135 0.790397 1.000000 1.000000 0.988352 0.860000 1.000000 0.000000 0.431818 0.000000 1.000000 1 0
diff --git a/chalk/data/gradients/Coffee.ggr b/chalk/data/gradients/Coffee.ggr
new file mode 100644
index 000000000..24baee0ea
--- /dev/null
+++ b/chalk/data/gradients/Coffee.ggr
@@ -0,0 +1,4 @@
+GIMP Gradient
+Name: Coffee
+1
+0.000000 0.949917 1.000000 0.560606 0.435893 0.311332 0.000000 0.300000 0.233262 0.166605 1.000000 4 0
diff --git a/chalk/data/gradients/Cold_Steel.ggr b/chalk/data/gradients/Cold_Steel.ggr
new file mode 100644
index 000000000..f6b27a020
--- /dev/null
+++ b/chalk/data/gradients/Cold_Steel.ggr
@@ -0,0 +1,5 @@
+GIMP Gradient
+Name: Cold Steel
+2
+0.000000 0.208681 0.647746 1.000000 1.000000 1.000000 1.000000 0.047059 0.023529 0.137255 1.000000 0 0
+0.647746 0.669449 1.000000 0.047059 0.023529 0.137255 1.000000 0.364706 0.733333 0.756863 1.000000 0 0
diff --git a/chalk/data/gradients/Cold_Steel_2.ggr b/chalk/data/gradients/Cold_Steel_2.ggr
new file mode 100644
index 000000000..f09dcf89a
--- /dev/null
+++ b/chalk/data/gradients/Cold_Steel_2.ggr
@@ -0,0 +1,6 @@
+GIMP Gradient
+Name: Cold Steel 2
+3
+0.000000 0.068447 0.101836 0.143939 0.013928 0.100000 1.000000 1.000000 1.000000 1.000000 1.000000 1 0
+0.101836 0.501669 0.901503 1.000000 1.000000 1.000000 1.000000 0.088684 0.075143 0.174242 1.000000 1 0
+0.901503 0.929902 1.000000 0.200503 0.169888 0.393939 1.000000 0.047059 0.023529 0.137255 1.000000 1 0
diff --git a/chalk/data/gradients/Crown_molding.ggr b/chalk/data/gradients/Crown_molding.ggr
new file mode 100644
index 000000000..56ffb0135
--- /dev/null
+++ b/chalk/data/gradients/Crown_molding.ggr
@@ -0,0 +1,9 @@
+GIMP Gradient
+Name: Crown molding
+6
+0.000000 0.155120 0.238453 0.000000 0.000000 0.000000 1.000000 0.840000 0.840000 0.840000 1.000000 0 0
+0.238453 0.287145 0.288815 0.840000 0.840000 0.840000 1.000000 0.333333 0.333333 0.333333 1.000000 4 0
+0.288815 0.317195 0.388982 0.333333 0.333333 0.333333 1.000000 0.900000 0.900000 0.900000 1.000000 2 0
+0.388982 0.583333 0.713411 0.900000 0.900000 0.900000 1.000000 0.333333 0.333333 0.333333 1.000000 2 0
+0.713411 0.796745 0.878408 0.333333 0.333333 0.333333 1.000000 1.000000 1.000000 1.000000 1.000000 2 0
+0.878408 0.949917 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Dark_1.ggr b/chalk/data/gradients/Dark_1.ggr
new file mode 100644
index 000000000..52a0f8045
--- /dev/null
+++ b/chalk/data/gradients/Dark_1.ggr
@@ -0,0 +1,6 @@
+GIMP Gradient
+Name: Dark 1
+3
+0.000000 0.315713 0.560935 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
+0.560935 0.677796 0.774624 0.000000 0.000000 0.000000 1.000000 0.636364 0.280000 0.280000 1.000000 0 0
+0.774624 0.923326 1.000000 0.636364 0.280000 0.280000 1.000000 1.000000 0.895652 0.840000 1.000000 0 0
diff --git a/chalk/data/gradients/Deep_Sea.ggr b/chalk/data/gradients/Deep_Sea.ggr
new file mode 100644
index 000000000..c6cfc5fef
--- /dev/null
+++ b/chalk/data/gradients/Deep_Sea.ggr
@@ -0,0 +1,5 @@
+GIMP Gradient
+Name: Deep Sea
+2
+0.000000 0.580968 0.764608 0.000000 0.009040 0.166667 1.000000 0.179032 0.390004 0.621212 1.000000 0 0
+0.764608 0.888147 1.000000 0.179032 0.390004 0.621212 1.000000 0.000000 0.969697 0.969697 1.000000 0 0
diff --git a/chalk/data/gradients/Default.ggr b/chalk/data/gradients/Default.ggr
new file mode 100644
index 000000000..82511f35e
--- /dev/null
+++ b/chalk/data/gradients/Default.ggr
@@ -0,0 +1,4 @@
+GIMP Gradient
+Name: Default
+1
+0.000000 0.500000 1.000000 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Flare_Glow_Angular_1.ggr b/chalk/data/gradients/Flare_Glow_Angular_1.ggr
new file mode 100644
index 000000000..b0e2dc9c0
--- /dev/null
+++ b/chalk/data/gradients/Flare_Glow_Angular_1.ggr
@@ -0,0 +1,49 @@
+GIMP Gradient
+Name: Flare Glow Angular 1
+46
+0.000000 0.006944 0.013889 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.120000 0 0
+0.013889 0.025598 0.038954 1.000000 1.000000 1.000000 0.120000 1.000000 1.000000 1.000000 0.860000 0 0
+0.038954 0.045214 0.057874 1.000000 1.000000 1.000000 0.860000 1.000000 1.000000 1.000000 0.730000 0 0
+0.057874 0.075748 0.087368 1.000000 1.000000 1.000000 0.730000 1.000000 1.000000 1.000000 1.000000 0 0
+0.087368 0.097941 0.108514 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000 0 0
+0.108514 0.117085 0.135678 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.770000 0 0
+0.135678 0.150815 0.172510 1.000000 1.000000 1.000000 0.770000 1.000000 1.000000 1.000000 1.000000 0 0
+0.172510 0.179517 0.187500 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.100000 0 0
+0.187500 0.196995 0.209446 1.000000 1.000000 1.000000 0.100000 1.000000 1.000000 1.000000 0.760000 0 0
+0.209446 0.224645 0.239844 1.000000 1.000000 1.000000 0.760000 1.000000 1.000000 1.000000 0.420000 0 0
+0.239844 0.244922 0.250000 1.000000 1.000000 1.000000 0.420000 1.000000 1.000000 1.000000 1.000000 0 0
+0.250000 0.264853 0.278154 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000 0 0
+0.278154 0.299261 0.312500 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.760000 0 0
+0.312500 0.322917 0.333333 1.000000 1.000000 1.000000 0.760000 1.000000 1.000000 1.000000 1.000000 0 0
+0.333333 0.340278 0.347222 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.240000 0 0
+0.347222 0.358932 0.372287 1.000000 1.000000 1.000000 0.240000 1.000000 1.000000 1.000000 0.860000 0 0
+0.372287 0.380078 0.395833 1.000000 1.000000 1.000000 0.860000 1.000000 1.000000 1.000000 0.730000 0 0
+0.395833 0.408459 0.416667 1.000000 1.000000 1.000000 0.730000 1.000000 1.000000 1.000000 1.000000 0 0
+0.416667 0.429257 0.441848 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.160000 0 0
+0.441848 0.449230 0.465246 1.000000 1.000000 1.000000 0.160000 1.000000 1.000000 1.000000 0.610000 0 0
+0.465246 0.470949 0.491374 1.000000 1.000000 1.000000 0.610000 1.000000 1.000000 1.000000 0.770000 0 0
+0.491374 0.499722 0.511686 1.000000 1.000000 1.000000 0.770000 1.000000 1.000000 1.000000 1.000000 0 0
+0.511686 0.515962 0.526459 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000 0 0
+0.526459 0.536698 0.542780 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.760000 0 0
+0.542780 0.547606 0.563613 1.000000 1.000000 1.000000 0.760000 1.000000 1.000000 1.000000 0.420000 0 0
+0.563613 0.577090 0.590568 1.000000 1.000000 1.000000 0.420000 1.000000 1.000000 1.000000 1.000000 0 0
+0.590568 0.600984 0.611401 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.490000 0 0
+0.611401 0.616671 0.624957 1.000000 1.000000 1.000000 0.490000 1.000000 1.000000 1.000000 0.000000 0 0
+0.624957 0.635417 0.645833 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.760000 0 0
+0.645833 0.656250 0.661937 1.000000 1.000000 1.000000 0.760000 1.000000 1.000000 1.000000 1.000000 0 0
+0.661937 0.673611 0.680556 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.240000 0 0
+0.680556 0.698664 0.705620 1.000000 1.000000 1.000000 0.240000 1.000000 1.000000 1.000000 0.860000 0 0
+0.705620 0.709794 0.729167 1.000000 1.000000 1.000000 0.860000 1.000000 1.000000 1.000000 0.100000 0 0
+0.729167 0.741792 0.750000 1.000000 1.000000 1.000000 0.100000 1.000000 1.000000 1.000000 1.000000 0 0
+0.750000 0.762590 0.775181 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.510000 0 0
+0.775181 0.793795 0.806692 1.000000 1.000000 1.000000 0.510000 1.000000 1.000000 1.000000 0.610000 0 0
+0.806692 0.811352 0.822204 1.000000 1.000000 1.000000 0.610000 1.000000 1.000000 1.000000 0.770000 0 0
+0.822204 0.830219 0.835559 1.000000 1.000000 1.000000 0.770000 1.000000 1.000000 1.000000 1.000000 0 0
+0.835559 0.843072 0.854167 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.110000 0 0
+0.854167 0.870031 0.876113 1.000000 1.000000 1.000000 0.110000 1.000000 1.000000 1.000000 0.760000 0 0
+0.876113 0.886530 0.894164 1.000000 1.000000 1.000000 0.760000 1.000000 1.000000 1.000000 0.420000 0 0
+0.894164 0.904024 0.913884 1.000000 1.000000 1.000000 0.420000 1.000000 1.000000 1.000000 1.000000 0 0
+0.913884 0.927083 0.932303 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.490000 0 0
+0.932303 0.947917 0.959015 1.000000 1.000000 1.000000 0.490000 1.000000 1.000000 1.000000 0.000000 0 0
+0.959015 0.968750 0.979167 1.000000 1.000000 1.000000 0.200000 1.000000 1.000000 1.000000 0.760000 0 0
+0.979167 0.989583 1.000000 1.000000 1.000000 1.000000 0.760000 1.000000 1.000000 1.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Flare_Glow_Radial_1.ggr b/chalk/data/gradients/Flare_Glow_Radial_1.ggr
new file mode 100644
index 000000000..318f43fed
--- /dev/null
+++ b/chalk/data/gradients/Flare_Glow_Radial_1.ggr
@@ -0,0 +1,7 @@
+GIMP Gradient
+Name: Flare Glow Radial 1
+4
+0.000000 0.353923 0.535893 1.000000 1.000000 1.000000 0.940000 0.780303 0.560606 1.000000 0.480000 1 0
+0.535893 0.595400 0.616550 0.780303 0.560606 1.000000 0.480000 0.900000 0.800000 1.000000 0.860000 1 0
+0.616550 0.636956 0.717863 0.900000 0.800000 1.000000 0.860000 0.780303 0.560606 1.000000 0.480000 1 0
+0.717863 0.854758 1.000000 0.780303 0.560606 1.000000 0.480000 0.900000 0.800000 1.000000 0.000000 1 0
diff --git a/chalk/data/gradients/Flare_Glow_Radial_2.ggr b/chalk/data/gradients/Flare_Glow_Radial_2.ggr
new file mode 100644
index 000000000..972825998
--- /dev/null
+++ b/chalk/data/gradients/Flare_Glow_Radial_2.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Flare Glow Radial 2
+5
+0.000000 0.260896 0.530885 0.500000 1.000000 1.000000 0.000000 0.653680 0.728264 0.846320 0.000000 1 2
+0.530885 0.567758 0.646077 0.653680 0.728264 0.846320 0.000000 0.622773 0.921464 0.578536 0.250000 1 2
+0.646077 0.726210 0.766467 0.622773 0.921464 0.578536 0.250000 1.000000 0.500000 0.500000 0.800000 1 2
+0.766467 0.804674 0.888110 1.000000 0.500000 0.500000 0.800000 0.750000 0.500000 1.000000 0.250000 1 2
+0.888110 0.966611 1.000000 0.750000 0.500000 1.000000 0.250000 0.500000 1.000000 1.000000 0.000000 1 2
diff --git a/chalk/data/gradients/Flare_Glow_Radial_3.ggr b/chalk/data/gradients/Flare_Glow_Radial_3.ggr
new file mode 100644
index 000000000..42c24e1a5
--- /dev/null
+++ b/chalk/data/gradients/Flare_Glow_Radial_3.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Flare Glow Radial 3
+5
+0.000000 0.173623 0.350584 1.000000 0.920000 0.920000 0.809524 1.000000 0.737255 0.737255 0.306122 2 0
+0.350584 0.375626 0.400668 1.000000 0.737255 0.737255 0.306122 1.000000 0.636060 0.636060 0.306122 0 0
+0.400668 0.411797 0.421223 1.000000 0.636060 0.636060 0.306122 1.000000 0.517647 0.517647 0.605442 1 0
+0.421223 0.430718 0.440735 1.000000 0.517647 0.517647 0.605442 0.988235 0.501961 0.501961 0.306122 1 0
+0.440735 0.720367 1.000000 0.988235 0.501961 0.501961 0.306122 1.000000 0.000000 0.000000 0.000000 0 0
diff --git a/chalk/data/gradients/Flare_Glow_Radial_4.ggr b/chalk/data/gradients/Flare_Glow_Radial_4.ggr
new file mode 100644
index 000000000..966f85380
--- /dev/null
+++ b/chalk/data/gradients/Flare_Glow_Radial_4.ggr
@@ -0,0 +1,6 @@
+GIMP Gradient
+Name: Flare Glow Radial 4
+3
+0.000000 0.737896 0.878130 1.000000 0.999999 0.999999 0.100000 1.000000 0.755000 0.755000 0.550000 1 0
+0.878130 0.920520 0.943039 1.000000 0.755000 0.755000 0.550000 1.000000 0.510000 0.510000 1.000000 1 0
+0.943039 0.974958 1.000000 1.000000 0.510000 0.510000 1.000000 1.000000 0.632500 0.632500 0.000000 1 0
diff --git a/chalk/data/gradients/Flare_Radial_101.ggr b/chalk/data/gradients/Flare_Radial_101.ggr
new file mode 100644
index 000000000..eff7920fc
--- /dev/null
+++ b/chalk/data/gradients/Flare_Radial_101.ggr
@@ -0,0 +1,10 @@
+GIMP Gradient
+Name: Flare Radial 101
+7
+0.000000 0.050918 0.101836 1.000000 0.999999 0.999999 1.000000 1.000000 0.999999 0.999999 1.000000 0 0
+0.101836 0.151085 0.200334 1.000000 0.999999 0.999999 1.000000 1.000000 0.691315 0.691315 0.650000 0 0
+0.200334 0.250417 0.300501 1.000000 0.691315 0.691315 0.650000 1.000000 0.590658 0.590658 0.357895 0 0
+0.300501 0.350584 0.400668 1.000000 0.590658 0.590658 0.357895 1.000000 0.490000 0.490000 0.200000 0 0
+0.400668 0.455760 0.500000 1.000000 0.490000 0.490000 0.200000 1.000000 0.300000 0.300000 0.800000 4 0
+0.500000 0.511269 0.515860 1.000000 0.300000 0.300000 0.800000 1.000000 0.300000 0.300000 0.800000 3 0
+0.515860 0.601002 1.000000 1.000000 0.300000 0.300000 0.800000 1.000000 1.000000 1.000000 0.000000 3 0
diff --git a/chalk/data/gradients/Flare_Radial_102.ggr b/chalk/data/gradients/Flare_Radial_102.ggr
new file mode 100644
index 000000000..ac50a3c95
--- /dev/null
+++ b/chalk/data/gradients/Flare_Radial_102.ggr
@@ -0,0 +1,9 @@
+GIMP Gradient
+Name: Flare Radial 102
+6
+0.000000 0.024937 0.058431 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.900000 0 0
+0.058431 0.083751 0.105175 1.000000 1.000000 1.000000 0.900000 1.000000 0.490000 0.490000 0.820000 0 0
+0.105175 0.157763 0.208681 1.000000 0.490000 0.490000 0.820000 1.000000 0.250000 0.250000 0.650000 0 0
+0.208681 0.278798 0.405676 1.000000 0.250000 0.250000 0.650000 1.000000 0.250000 0.250000 0.250000 0 0
+0.405676 0.534224 0.799666 1.000000 0.250000 0.250000 0.250000 1.000000 0.250000 0.250000 0.000000 0 0
+0.799666 0.899833 1.000000 1.000000 0.250000 0.250000 0.000000 1.000000 0.250000 0.250000 0.000000 0 0
diff --git a/chalk/data/gradients/Flare_Radial_103.ggr b/chalk/data/gradients/Flare_Radial_103.ggr
new file mode 100644
index 000000000..a73fbe9e6
--- /dev/null
+++ b/chalk/data/gradients/Flare_Radial_103.ggr
@@ -0,0 +1,4 @@
+GIMP Gradient
+Name: Flare Radial 103
+1
+0.000000 0.517529 1.000000 1.000000 1.000000 1.000000 0.490000 1.000000 0.510000 0.510000 1.000000 0 0
diff --git a/chalk/data/gradients/Flare_Rays_Radial_1.ggr b/chalk/data/gradients/Flare_Rays_Radial_1.ggr
new file mode 100644
index 000000000..66a848d56
--- /dev/null
+++ b/chalk/data/gradients/Flare_Rays_Radial_1.ggr
@@ -0,0 +1,5 @@
+GIMP Gradient
+Name: Flare Rays Radial 1
+2
+0.000000 0.514267 0.657763 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.500000 1 0
+0.657763 0.938230 1.000000 1.000000 1.000000 1.000000 0.500000 1.000000 1.000000 1.000000 0.000000 1 0
diff --git a/chalk/data/gradients/Flare_Rays_Radial_2.ggr b/chalk/data/gradients/Flare_Rays_Radial_2.ggr
new file mode 100644
index 000000000..c38e061c4
--- /dev/null
+++ b/chalk/data/gradients/Flare_Rays_Radial_2.ggr
@@ -0,0 +1,5 @@
+GIMP Gradient
+Name: Flare Rays Radial 2
+2
+0.000000 0.181970 0.434057 1.000000 1.000000 1.000000 0.000000 1.000000 0.600000 0.600000 0.600000 1 0
+0.434057 0.582638 1.000000 1.000000 0.600000 0.600000 0.600000 1.000000 1.000000 1.000000 0.000000 1 0
diff --git a/chalk/data/gradients/Flare_Rays_Size_1.ggr b/chalk/data/gradients/Flare_Rays_Size_1.ggr
new file mode 100644
index 000000000..f5d85e7f5
--- /dev/null
+++ b/chalk/data/gradients/Flare_Rays_Size_1.ggr
@@ -0,0 +1,19 @@
+GIMP Gradient
+Name: Flare Rays Size 1
+16
+0.000000 0.031250 0.062500 1.000000 1.000000 1.000000 1.000000 0.240000 0.240000 0.240000 1.000000 0 0
+0.062500 0.117659 0.153589 0.240000 0.240000 0.240000 1.000000 0.860000 0.860000 0.860000 1.000000 0 0
+0.153589 0.161496 0.187500 0.860000 0.860000 0.860000 1.000000 0.730000 0.730000 0.730000 1.000000 0 0
+0.187500 0.225376 0.250000 0.730000 0.730000 0.730000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.250000 0.287771 0.325543 1.000000 1.000000 1.000000 1.000000 0.510000 0.510000 0.510000 1.000000 0 0
+0.325543 0.341148 0.375000 0.510000 0.510000 0.510000 1.000000 0.610000 0.610000 0.610000 1.000000 0 0
+0.375000 0.388982 0.439065 0.610000 0.610000 0.610000 1.000000 0.770000 0.770000 0.770000 1.000000 0 0
+0.439065 0.464107 0.500000 0.770000 0.770000 0.770000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.500000 0.529215 0.562500 1.000000 1.000000 1.000000 1.000000 0.280000 0.280000 0.280000 1.000000 0 0
+0.562500 0.610093 0.628339 0.280000 0.280000 0.280000 1.000000 0.760000 0.760000 0.760000 1.000000 0 0
+0.628339 0.659589 0.690839 0.760000 0.760000 0.760000 1.000000 0.420000 0.420000 0.420000 1.000000 0 0
+0.690839 0.720419 0.750000 0.420000 0.420000 0.420000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.750000 0.781250 0.812500 1.000000 1.000000 1.000000 1.000000 0.490000 0.490000 0.490000 1.000000 0 0
+0.812500 0.843750 0.856427 0.490000 0.490000 0.490000 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
+0.856427 0.906250 0.937500 0.000000 0.000000 0.000000 1.000000 0.760000 0.760000 0.760000 1.000000 0 0
+0.937500 0.968750 1.000000 0.760000 0.760000 0.760000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Flare_Sizefac_101.ggr b/chalk/data/gradients/Flare_Sizefac_101.ggr
new file mode 100644
index 000000000..e654a9eed
--- /dev/null
+++ b/chalk/data/gradients/Flare_Sizefac_101.ggr
@@ -0,0 +1,4 @@
+GIMP Gradient
+Name: Flare Sizefac 101
+1
+0.000000 0.500000 1.000000 0.370000 0.370000 0.370000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Four_bars.ggr b/chalk/data/gradients/Four_bars.ggr
new file mode 100644
index 000000000..7a0a3e242
--- /dev/null
+++ b/chalk/data/gradients/Four_bars.ggr
@@ -0,0 +1,11 @@
+GIMP Gradient
+Name: Four bars
+8
+0.000000 0.062500 0.125000 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.125000 0.187500 0.250000 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
+0.250000 0.312500 0.375000 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.375000 0.437500 0.500000 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
+0.500000 0.562500 0.625000 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.625000 0.687500 0.750000 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
+0.750000 0.812500 0.875000 0.000000 0.000000 0.000000 1.000000 0.875000 0.875000 0.875000 1.000000 0 0
+0.875000 0.937500 1.000000 0.875000 0.875000 0.875000 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/French_flag.ggr b/chalk/data/gradients/French_flag.ggr
new file mode 100644
index 000000000..a61679706
--- /dev/null
+++ b/chalk/data/gradients/French_flag.ggr
@@ -0,0 +1,6 @@
+GIMP Gradient
+Name: French flag
+3
+0.000000 0.166667 0.333333 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 1.000000 0 0
+0.333333 0.500000 0.666667 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.666667 0.833333 1.000000 1.000000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/French_flag_smooth.ggr b/chalk/data/gradients/French_flag_smooth.ggr
new file mode 100644
index 000000000..61b179df2
--- /dev/null
+++ b/chalk/data/gradients/French_flag_smooth.ggr
@@ -0,0 +1,5 @@
+GIMP Gradient
+Name: French flag smooth
+2
+0.000000 0.250000 0.500000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.500000 0.750000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Full_saturation_spectrum_CCW.ggr b/chalk/data/gradients/Full_saturation_spectrum_CCW.ggr
new file mode 100644
index 000000000..9bd2ea3b0
--- /dev/null
+++ b/chalk/data/gradients/Full_saturation_spectrum_CCW.ggr
@@ -0,0 +1,4 @@
+GIMP Gradient
+Name: Full saturation spectrum CCW
+1
+0.000000 0.500000 1.000000 1.000000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 0 1
diff --git a/chalk/data/gradients/Full_saturation_spectrum_CW.ggr b/chalk/data/gradients/Full_saturation_spectrum_CW.ggr
new file mode 100644
index 000000000..d70ba6438
--- /dev/null
+++ b/chalk/data/gradients/Full_saturation_spectrum_CW.ggr
@@ -0,0 +1,4 @@
+GIMP Gradient
+Name: Full saturation spectrum CW
+1
+0.000000 0.500000 1.000000 1.000000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 0 2
diff --git a/chalk/data/gradients/German_flag.ggr b/chalk/data/gradients/German_flag.ggr
new file mode 100644
index 000000000..8d76ac20e
--- /dev/null
+++ b/chalk/data/gradients/German_flag.ggr
@@ -0,0 +1,6 @@
+GIMP Gradient
+Name: German flag
+3
+0.000000 0.166667 0.333333 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
+0.333333 0.500000 0.666667 1.000000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 0 0
+0.666667 0.833333 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/German_flag_smooth.ggr b/chalk/data/gradients/German_flag_smooth.ggr
new file mode 100644
index 000000000..efadfdbc3
--- /dev/null
+++ b/chalk/data/gradients/German_flag_smooth.ggr
@@ -0,0 +1,5 @@
+GIMP Gradient
+Name: German flag smooth
+2
+0.000000 0.250000 0.500000 0.000000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 0 0
+0.500000 0.750000 1.000000 1.000000 0.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Golden.ggr b/chalk/data/gradients/Golden.ggr
new file mode 100644
index 000000000..4f1a65e20
--- /dev/null
+++ b/chalk/data/gradients/Golden.ggr
@@ -0,0 +1,17 @@
+GIMP Gradient
+Name: Golden
+14
+0.000000 0.080316 0.163606 0.137255 0.156863 0.011760 1.000000 0.533330 0.415600 0.086270 1.000000 0 0
+0.163606 0.193879 0.224151 0.533330 0.415600 0.086270 1.000000 0.650000 0.550000 0.161000 1.000000 0 0
+0.224151 0.254424 0.284697 0.650000 0.550000 0.161000 1.000000 0.800000 0.710000 0.290000 1.000000 0 0
+0.284697 0.314969 0.345242 0.800000 0.710000 0.290000 1.000000 0.920000 0.859000 0.400000 1.000000 0 0
+0.345242 0.382304 0.414023 0.920000 0.859000 0.400000 1.000000 0.960000 0.925000 0.440000 1.000000 0 0
+0.414023 0.467446 0.516416 0.960000 0.925000 0.440000 1.000000 0.820000 0.745000 0.298000 1.000000 0 0
+0.516416 0.541681 0.571953 0.820000 0.745000 0.298000 1.000000 0.733300 0.612000 0.200000 1.000000 0 0
+0.571953 0.602226 0.632499 0.733300 0.612000 0.200000 1.000000 0.658800 0.556900 0.165000 1.000000 0 0
+0.632499 0.662771 0.698052 0.658800 0.556900 0.165000 1.000000 0.792160 0.682300 0.266667 1.000000 0 0
+0.698052 0.728325 0.757930 0.792160 0.682300 0.266667 1.000000 0.855000 0.792000 0.337000 1.000000 0 0
+0.757930 0.787201 0.817474 0.855000 0.792000 0.337000 1.000000 0.816000 0.733300 0.286300 1.000000 0 0
+0.817474 0.847746 0.878019 0.816000 0.733300 0.286300 1.000000 0.733300 0.612000 0.200000 1.000000 0 0
+0.878019 0.906511 0.934891 0.733300 0.612000 0.200000 1.000000 0.537000 0.423500 0.101000 1.000000 0 0
+0.934891 0.973289 1.000000 0.537000 0.423500 0.101000 1.000000 0.137255 0.156863 0.011760 1.000000 0 0
diff --git a/chalk/data/gradients/Greens.ggr b/chalk/data/gradients/Greens.ggr
new file mode 100644
index 000000000..0f307a010
--- /dev/null
+++ b/chalk/data/gradients/Greens.ggr
@@ -0,0 +1,12 @@
+GIMP Gradient
+Name: Greens
+9
+0.000000 0.062500 0.086811 0.146341 0.393939 0.133992 1.000000 0.198883 0.300000 0.135000 1.000000 0 0
+0.086811 0.200334 0.250000 0.198883 0.300000 0.135000 1.000000 0.406805 0.613636 0.276136 1.000000 0 0
+0.250000 0.312500 0.375000 0.406805 0.613636 0.276136 1.000000 0.324169 0.454545 0.114714 1.000000 0 0
+0.375000 0.437500 0.500835 0.324169 0.454545 0.114714 1.000000 0.098346 0.136364 0.085909 1.000000 0 0
+0.500835 0.535893 0.577629 0.098346 0.136364 0.085909 1.000000 0.196692 0.272727 0.171818 1.000000 0 0
+0.577629 0.621035 0.657763 0.234710 0.243859 0.187625 1.000000 0.272727 0.214990 0.203431 1.000000 0 0
+0.657763 0.709516 0.757930 0.272727 0.214990 0.203431 1.000000 0.430776 0.666667 0.326636 1.000000 1 0
+0.757930 0.811352 0.839733 0.430776 0.666667 0.326636 1.000000 0.369390 0.420000 0.344400 1.000000 1 0
+0.839733 0.968280 1.000000 0.369390 0.420000 0.344400 1.000000 0.091517 0.260000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Horizon_1.ggr b/chalk/data/gradients/Horizon_1.ggr
new file mode 100644
index 000000000..25db002bd
--- /dev/null
+++ b/chalk/data/gradients/Horizon_1.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Horizon 1
+5
+0.000000 0.348915 0.532554 0.047059 0.360784 0.572549 1.000000 1.000000 0.984314 0.984314 1.000000 0 0
+0.532554 0.542571 0.555927 1.000000 0.984314 0.984314 1.000000 0.258824 0.121569 0.035294 1.000000 3 0
+0.555927 0.582638 0.612688 0.258824 0.121569 0.035294 1.000000 1.000000 0.811765 0.549020 1.000000 3 0
+0.612688 0.778798 0.948247 1.000000 0.811765 0.549020 1.000000 0.349020 0.160784 0.058824 1.000000 0 0
+0.948247 0.974124 1.000000 0.349020 0.160784 0.058824 1.000000 1.000000 0.556863 0.219608 1.000000 0 0
diff --git a/chalk/data/gradients/Horizon_2.ggr b/chalk/data/gradients/Horizon_2.ggr
new file mode 100644
index 000000000..e2d07424b
--- /dev/null
+++ b/chalk/data/gradients/Horizon_2.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Horizon 2
+5
+0.000000 0.290484 0.348915 0.047059 0.360784 0.572549 1.000000 0.370303 0.628966 0.787879 1.000000 0 0
+0.348915 0.470785 0.532554 0.370303 0.628966 0.787879 1.000000 1.000000 0.984314 0.984314 1.000000 0 0
+0.532554 0.542571 0.555927 1.000000 0.984314 0.984314 1.000000 0.039048 0.132980 0.265152 1.000000 3 0
+0.555927 0.582638 0.612688 0.039048 0.132980 0.265152 1.000000 0.522500 0.823569 0.950000 1.000000 3 0
+0.612688 0.754591 1.000000 0.522500 0.823569 0.950000 1.000000 0.087500 0.131053 0.250000 1.000000 0 0
diff --git a/chalk/data/gradients/Incandescent.ggr b/chalk/data/gradients/Incandescent.ggr
new file mode 100644
index 000000000..64a3438b4
--- /dev/null
+++ b/chalk/data/gradients/Incandescent.ggr
@@ -0,0 +1,7 @@
+GIMP Gradient
+Name: Incandescent
+4
+0.000000 0.459098 0.594324 0.000000 0.000000 0.000000 1.000000 0.729412 0.000000 0.000000 1.000000 0 0
+0.594324 0.677796 0.809683 0.729412 0.000000 0.000000 1.000000 1.000000 0.545098 0.196078 1.000000 0 0
+0.809683 0.853088 0.899833 1.000000 0.545098 0.196078 1.000000 0.972549 0.937255 0.074510 1.000000 0 0
+0.899833 0.948247 1.000000 0.972549 0.937255 0.074510 1.000000 0.976471 0.968627 0.831373 1.000000 0 0
diff --git a/chalk/data/gradients/Land_1.ggr b/chalk/data/gradients/Land_1.ggr
new file mode 100644
index 000000000..a2180779e
--- /dev/null
+++ b/chalk/data/gradients/Land_1.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Land 1
+5
+0.000000 0.348915 0.532554 0.047059 0.360784 0.572549 1.000000 1.000000 0.984314 0.984314 1.000000 0 0
+0.532554 0.542571 0.555927 1.000000 0.984314 0.984314 1.000000 0.258824 0.121569 0.035294 1.000000 3 0
+0.555927 0.582638 0.612688 0.258824 0.121569 0.035294 1.000000 0.378491 0.689394 0.398544 1.000000 3 0
+0.612688 0.702838 0.948247 0.378491 0.689394 0.398544 1.000000 0.058824 0.349020 0.114977 1.000000 0 0
+0.948247 0.974124 1.000000 0.058824 0.349020 0.114977 1.000000 0.111468 0.507576 0.162566 1.000000 0 0
diff --git a/chalk/data/gradients/Land_and_Sea.ggr b/chalk/data/gradients/Land_and_Sea.ggr
new file mode 100644
index 000000000..a932b1886
--- /dev/null
+++ b/chalk/data/gradients/Land_and_Sea.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Land and Sea
+5
+0.000000 0.081803 0.166945 1.000000 1.000000 1.000000 1.000000 0.560606 0.560606 0.560606 1.000000 0 0
+0.166945 0.212020 0.265442 0.560606 0.560606 0.560606 1.000000 0.083243 0.462121 0.112054 1.000000 0 0
+0.265442 0.378965 0.390651 0.083243 0.462121 0.112054 1.000000 1.000000 0.988739 0.298904 1.000000 0 0
+0.390651 0.400668 0.459098 1.000000 0.988739 0.298904 1.000000 0.529502 0.586235 1.000000 1.000000 0 0
+0.459098 0.507513 1.000000 0.529502 0.586235 1.000000 1.000000 0.019021 0.108157 0.590909 1.000000 0 0
diff --git a/chalk/data/gradients/Makefile.am b/chalk/data/gradients/Makefile.am
new file mode 100644
index 000000000..da445ce8e
--- /dev/null
+++ b/chalk/data/gradients/Makefile.am
@@ -0,0 +1,4 @@
+
+chalkgradientsdir = $(prefix)/share/apps/chalk/gradients
+
+chalkgradients_DATA = Abstract_1.ggr Abstract_2.ggr Abstract_3.ggr Aneurism.ggr Blinds.ggr Blue_Green.ggr Browns.ggr Brushed_Aluminium.ggr Burning_Paper.ggr Burning_Transparency.ggr Caribbean_Blues.ggr CD.ggr CD_Half.ggr Coffee.ggr Cold_Steel_2.ggr Cold_Steel.ggr Crown_molding.ggr Dark_1.ggr Deep_Sea.ggr Default.ggr Flare_Glow_Angular_1.ggr Flare_Glow_Radial_1.ggr Flare_Glow_Radial_2.ggr Flare_Glow_Radial_3.ggr Flare_Glow_Radial_4.ggr Flare_Radial_101.ggr Flare_Radial_102.ggr Flare_Radial_103.ggr Flare_Rays_Radial_1.ggr Flare_Rays_Radial_2.ggr Flare_Rays_Size_1.ggr Flare_Sizefac_101.ggr Four_bars.ggr French_flag.ggr French_flag_smooth.ggr Full_saturation_spectrum_CCW.ggr Full_saturation_spectrum_CW.ggr German_flag.ggr German_flag_smooth.ggr Golden.ggr Greens.ggr Horizon_1.ggr Horizon_2.ggr Incandescent.ggr Land_1.ggr Land_and_Sea.ggr Metallic_Something.ggr Mexican_flag.ggr Mexican_flag_smooth.ggr Nauseating_Headache.ggr Neon_Cyan.ggr Neon_Green.ggr Neon_Yellow.ggr Pastel_Rainbow.ggr Pastels.ggr Purples.ggr Radial_Eyeball_Blue.ggr Radial_Eyeball_Brown.ggr Radial_Eyeball_Green.ggr Radial_Glow_1.ggr Radial_Rainbow_Hoop.ggr Romanian_flag.ggr Romanian_flag_smooth.ggr Rounded_edge.ggr Shadows_1.ggr Shadows_2.ggr Shadows_3.ggr Skyline.ggr Skyline_polluted.ggr Square_Wood_Frame.ggr Sunrise.ggr Three_bars_sin.ggr Tropical_Colors.ggr Tube_Red.ggr Wood_1.ggr Wood_2.ggr Yellow_Contrast.ggr Yellow_Orange.ggr 
diff --git a/chalk/data/gradients/Metallic_Something.ggr b/chalk/data/gradients/Metallic_Something.ggr
new file mode 100644
index 000000000..19e675b7b
--- /dev/null
+++ b/chalk/data/gradients/Metallic_Something.ggr
@@ -0,0 +1,11 @@
+GIMP Gradient
+Name: Metallic Something
+8
+0.000000 0.036728 0.096828 0.020000 0.050000 0.080000 1.000000 0.142500 0.168750 0.195000 1.000000 2 0
+0.096828 0.163606 0.220367 0.142500 0.168750 0.195000 1.000000 0.317326 0.344269 0.371212 1.000000 2 0
+0.220367 0.287237 0.333890 0.317326 0.344269 0.371212 1.000000 0.425000 0.357284 0.327250 1.000000 2 0
+0.333890 0.368835 0.423205 0.425000 0.357284 0.327250 1.000000 0.271322 0.389264 0.500000 1.000000 2 0
+0.423205 0.517744 0.574290 0.271322 0.389264 0.500000 1.000000 0.592000 0.632258 0.800000 1.000000 2 0
+0.574290 0.657691 0.742905 0.592000 0.632258 0.800000 1.000000 0.931818 0.906382 0.782727 1.000000 2 0
+0.742905 0.808013 0.859766 0.931818 0.906382 0.782727 1.000000 0.841294 0.844890 0.848485 1.000000 2 0
+0.859766 0.914858 1.000000 0.841294 0.844890 0.848485 1.000000 0.581685 0.611610 0.674242 1.000000 2 0
diff --git a/chalk/data/gradients/Mexican_flag.ggr b/chalk/data/gradients/Mexican_flag.ggr
new file mode 100644
index 000000000..bcb7686d0
--- /dev/null
+++ b/chalk/data/gradients/Mexican_flag.ggr
@@ -0,0 +1,6 @@
+GIMP Gradient
+Name: Mexican flag
+3
+0.000000 0.166667 0.333333 0.000000 1.000000 0.000000 1.000000 0.000000 1.000000 0.000000 1.000000 0 0
+0.333333 0.500000 0.666667 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.666667 0.833333 1.000000 1.000000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Mexican_flag_smooth.ggr b/chalk/data/gradients/Mexican_flag_smooth.ggr
new file mode 100644
index 000000000..ee3631163
--- /dev/null
+++ b/chalk/data/gradients/Mexican_flag_smooth.ggr
@@ -0,0 +1,5 @@
+GIMP Gradient
+Name: Mexican flag smooth
+2
+0.000000 0.250000 0.500000 0.000000 1.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.500000 0.750000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Nauseating_Headache.ggr b/chalk/data/gradients/Nauseating_Headache.ggr
new file mode 100644
index 000000000..347453ac8
--- /dev/null
+++ b/chalk/data/gradients/Nauseating_Headache.ggr
@@ -0,0 +1,28 @@
+GIMP Gradient
+Name: Nauseating Headache
+25
+0.000000 0.058431 0.098497 0.391197 0.651515 0.409796 1.000000 0.495110 0.916667 0.865009 1.000000 0 1
+0.098497 0.100167 0.101836 0.495110 0.916667 0.865009 1.000000 0.451393 0.807720 0.778663 1.000000 0 0
+0.101836 0.103506 0.105175 0.451393 0.807720 0.778663 1.000000 0.407676 0.698774 0.692318 1.000000 0 0
+0.105175 0.106845 0.108514 0.407676 0.698774 0.692318 1.000000 0.363958 0.589828 0.605972 1.000000 0 0
+0.108514 0.110184 0.111853 0.363958 0.589828 0.605972 1.000000 0.320241 0.480881 0.519626 1.000000 0 0
+0.111853 0.122705 0.133556 0.320241 0.480881 0.519626 1.000000 0.276524 0.371935 0.433280 1.000000 0 0
+0.133556 0.144407 0.157763 0.276524 0.371935 0.433280 1.000000 0.232807 0.262989 0.346934 1.000000 0 0
+0.157763 0.161937 0.166110 0.232807 0.262989 0.346934 1.000000 0.390299 0.317958 0.537879 1.000000 0 0
+0.166110 0.256469 0.313022 0.390299 0.317958 0.537879 1.000000 0.145373 0.045096 0.174242 1.000000 0 0
+0.313022 0.333890 0.355175 0.145373 0.045096 0.174242 1.000000 0.424242 0.065931 0.036105 1.000000 0 0
+0.355175 0.494470 0.626043 0.424242 0.065931 0.036105 1.000000 0.145373 0.045096 0.174242 1.000000 2 0
+0.626043 0.635363 0.645614 0.232807 0.262989 0.346934 1.000000 0.390299 0.317958 0.537879 1.000000 0 0
+0.645614 0.679871 0.724958 0.390299 0.317958 0.537879 1.000000 0.145373 0.045096 0.174242 1.000000 0 0
+0.724958 0.729132 0.729132 0.232807 0.262989 0.346934 1.000000 0.390299 0.317958 0.537879 1.000000 0 0
+0.729132 0.740427 0.751722 0.390299 0.317958 0.537879 1.000000 0.359683 0.283851 0.492424 1.000000 0 0
+0.751722 0.763016 0.774311 0.359683 0.283851 0.492424 1.000000 0.329067 0.249743 0.446970 1.000000 0 0
+0.774311 0.785606 0.796901 0.329067 0.249743 0.446970 1.000000 0.298452 0.215635 0.401515 1.000000 0 0
+0.796901 0.808196 0.819491 0.298452 0.215635 0.401515 1.000000 0.267836 0.181527 0.356061 1.000000 0 0
+0.819491 0.830786 0.842081 0.267836 0.181527 0.356061 1.000000 0.237220 0.147420 0.310606 1.000000 0 0
+0.842081 0.853375 0.864670 0.310606 0.000000 0.003409 1.000000 0.424242 0.137255 0.137255 1.000000 2 0
+0.864670 0.867435 0.874067 0.206604 0.113312 0.265152 1.000000 0.951331 1.000000 0.487291 1.000000 0 0
+0.874067 0.878939 0.884060 0.951331 1.000000 0.487291 1.000000 0.951331 1.000000 0.487291 1.000000 0 0
+0.884060 0.893477 0.902894 0.951331 1.000000 0.487291 1.000000 0.951331 1.000000 0.487291 1.000000 0 0
+0.902894 0.908389 0.910267 0.951331 1.000000 0.487291 1.000000 0.145373 0.045096 0.174242 1.000000 0 0
+0.910267 1.000000 1.000000 0.145373 0.045096 0.174242 1.000000 0.495110 0.916667 0.865009 1.000000 0 0
diff --git a/chalk/data/gradients/Neon_Cyan.ggr b/chalk/data/gradients/Neon_Cyan.ggr
new file mode 100644
index 000000000..4ae27583e
--- /dev/null
+++ b/chalk/data/gradients/Neon_Cyan.ggr
@@ -0,0 +1,7 @@
+GIMP Gradient
+Name: Neon Cyan
+4
+0.000000 0.672788 0.699499 0.000000 1.000000 0.949020 0.000000 0.000000 1.000000 0.933333 0.901961 1 0
+0.699499 0.737062 0.774624 0.000000 1.000000 0.913725 0.901961 0.827451 1.000000 0.988235 1.000000 1 0
+0.774624 0.812187 0.849750 0.827451 1.000000 0.984314 1.000000 0.000000 1.000000 0.913725 0.901961 1 0
+0.849750 0.874791 1.000000 0.000000 1.000000 0.913725 0.901961 0.000000 1.000000 0.933333 0.000000 1 0
diff --git a/chalk/data/gradients/Neon_Green.ggr b/chalk/data/gradients/Neon_Green.ggr
new file mode 100644
index 000000000..1f7402f86
--- /dev/null
+++ b/chalk/data/gradients/Neon_Green.ggr
@@ -0,0 +1,7 @@
+GIMP Gradient
+Name: Neon Green
+4
+0.000000 0.672788 0.699499 0.000000 1.000000 0.000000 0.000000 0.129412 1.000000 0.000000 0.901961 1 0
+0.699499 0.737062 0.774624 0.129412 1.000000 0.000000 0.901961 0.823529 1.000000 0.807843 1.000000 1 0
+0.774624 0.812187 0.849750 0.823529 1.000000 0.807843 1.000000 0.196078 1.000000 0.000000 0.901961 1 0
+0.849750 0.874791 1.000000 0.196078 1.000000 0.000000 0.901961 0.031373 1.000000 0.000000 0.000000 1 0
diff --git a/chalk/data/gradients/Neon_Yellow.ggr b/chalk/data/gradients/Neon_Yellow.ggr
new file mode 100644
index 000000000..31648b049
--- /dev/null
+++ b/chalk/data/gradients/Neon_Yellow.ggr
@@ -0,0 +1,7 @@
+GIMP Gradient
+Name: Neon Yellow
+4
+0.000000 0.672788 0.699499 1.000000 0.949020 0.000000 0.000000 1.000000 0.933333 0.000000 0.901961 1 0
+0.699499 0.737062 0.774624 1.000000 0.933333 0.000000 0.901961 0.996078 1.000000 0.819608 1.000000 1 0
+0.774624 0.812187 0.849750 1.000000 0.996078 0.819608 1.000000 1.000000 0.949020 0.000000 0.901961 1 0
+0.849750 0.874791 1.000000 1.000000 0.949020 0.000000 0.901961 1.000000 0.949020 0.000000 0.000000 1 0
diff --git a/chalk/data/gradients/Pastel_Rainbow.ggr b/chalk/data/gradients/Pastel_Rainbow.ggr
new file mode 100644
index 000000000..28a71847c
--- /dev/null
+++ b/chalk/data/gradients/Pastel_Rainbow.ggr
@@ -0,0 +1,4 @@
+GIMP Gradient
+Name: Pastel Rainbow
+1
+0.000000 0.500000 1.000000 1.000000 0.749020 0.749020 1.000000 1.000000 0.749020 0.749020 1.000000 0 1
diff --git a/chalk/data/gradients/Pastels.ggr b/chalk/data/gradients/Pastels.ggr
new file mode 100644
index 000000000..f57fa5afa
--- /dev/null
+++ b/chalk/data/gradients/Pastels.ggr
@@ -0,0 +1,17 @@
+GIMP Gradient
+Name: Pastels
+14
+0.000000 0.035714 0.091462 0.960000 0.880000 0.690000 1.000000 0.962857 0.741400 0.930894 1.000000 0 0
+0.091462 0.127176 0.137849 0.962857 0.741400 0.930894 1.000000 0.761897 0.812851 0.965714 1.000000 0 0
+0.137849 0.171953 0.189244 0.761897 0.812851 0.965714 1.000000 0.719697 0.628944 0.660036 1.000000 0 0
+0.189244 0.223706 0.252087 0.719697 0.628944 0.660036 1.000000 0.670286 0.728675 0.971429 1.000000 0 0
+0.252087 0.300501 0.323754 0.670286 0.728675 0.971429 1.000000 0.951464 0.974286 0.876857 1.000000 0 0
+0.323754 0.365609 0.386835 0.951464 0.974286 0.876857 1.000000 0.977143 0.634945 0.718332 1.000000 0 0
+0.386835 0.430897 0.470785 0.977143 0.634945 0.718332 1.000000 0.391757 0.449753 0.484848 1.000000 0 0
+0.470785 0.549249 0.581445 0.391757 0.449753 0.484848 1.000000 0.982857 0.804789 0.790632 1.000000 0 0
+0.581445 0.598796 0.646077 0.982857 0.804789 0.790632 1.000000 0.666941 0.500514 0.727273 1.000000 0 0
+0.646077 0.720308 0.742905 0.666941 0.500514 0.727273 1.000000 0.988571 0.870321 0.798764 1.000000 0 0
+0.742905 0.772955 0.804674 0.988571 0.870321 0.798764 1.000000 0.806903 0.479551 0.856061 1.000000 0 0
+0.804674 0.829716 0.861436 0.806903 0.479551 0.856061 1.000000 0.994286 0.873405 0.686057 1.000000 0 0
+0.861436 0.892857 0.911519 0.994286 0.873405 0.686057 1.000000 0.997143 0.927343 0.955263 1.000000 0 0
+0.911519 0.964286 1.000000 0.997143 0.927343 0.955263 1.000000 1.000000 0.748380 0.866107 1.000000 0 0
diff --git a/chalk/data/gradients/Purples.ggr b/chalk/data/gradients/Purples.ggr
new file mode 100644
index 000000000..6c6ce6891
--- /dev/null
+++ b/chalk/data/gradients/Purples.ggr
@@ -0,0 +1,10 @@
+GIMP Gradient
+Name: Purples
+7
+0.000000 0.057596 0.098497 0.303030 0.109635 0.273088 1.000000 0.514411 0.279242 0.734848 1.000000 0 0
+0.098497 0.176962 0.228715 0.514411 0.279242 0.734848 1.000000 0.604602 0.331500 0.650000 1.000000 0 0
+0.228715 0.347245 0.404006 0.604602 0.331500 0.650000 1.000000 0.200503 0.169888 0.393939 1.000000 0 0
+0.404006 0.480801 0.544241 0.200503 0.169888 0.393939 1.000000 0.500537 0.323300 0.530000 1.000000 0 0
+0.544241 0.628761 0.713283 0.500537 0.323300 0.530000 1.000000 0.600648 0.445741 0.681667 1.000000 0 0
+0.713283 0.766491 0.819699 0.600648 0.445741 0.681667 1.000000 0.700758 0.568182 0.833333 1.000000 0 0
+0.819699 0.928214 1.000000 0.700758 0.568182 0.833333 1.000000 0.184745 0.149793 0.219697 1.000000 0 0
diff --git a/chalk/data/gradients/Radial_Eyeball_Blue.ggr b/chalk/data/gradients/Radial_Eyeball_Blue.ggr
new file mode 100644
index 000000000..9a23068b2
--- /dev/null
+++ b/chalk/data/gradients/Radial_Eyeball_Blue.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Radial Eyeball Blue
+5
+0.000000 0.105175 0.198664 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
+0.198664 0.352254 0.492487 0.000000 0.035294 0.729412 1.000000 0.000000 0.015686 0.376471 1.000000 0 0
+0.492487 0.636060 0.787980 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.787980 0.931553 0.996661 1.000000 1.000000 1.000000 1.000000 1.000000 0.619608 0.619608 1.000000 0 0
+0.996661 0.996661 1.000000 1.000000 0.619608 0.619608 0.000000 1.000000 0.619608 0.619608 0.000000 0 0
diff --git a/chalk/data/gradients/Radial_Eyeball_Brown.ggr b/chalk/data/gradients/Radial_Eyeball_Brown.ggr
new file mode 100644
index 000000000..c90494406
--- /dev/null
+++ b/chalk/data/gradients/Radial_Eyeball_Brown.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Radial Eyeball Brown
+5
+0.000000 0.105175 0.198664 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
+0.198664 0.352254 0.492487 0.478431 0.380392 0.000000 1.000000 0.298039 0.227451 0.000000 1.000000 0 0
+0.492487 0.636060 0.787980 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.787980 0.931553 0.996661 1.000000 1.000000 1.000000 1.000000 1.000000 0.619608 0.619608 1.000000 0 0
+0.996661 0.996661 1.000000 1.000000 0.619608 0.619608 0.000000 1.000000 0.619608 0.619608 0.000000 0 0
diff --git a/chalk/data/gradients/Radial_Eyeball_Green.ggr b/chalk/data/gradients/Radial_Eyeball_Green.ggr
new file mode 100644
index 000000000..5352ec6f1
--- /dev/null
+++ b/chalk/data/gradients/Radial_Eyeball_Green.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Radial Eyeball Green
+5
+0.000000 0.105175 0.198664 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
+0.198664 0.352254 0.492487 0.000000 0.709804 0.423529 1.000000 0.000000 0.356863 0.094118 1.000000 0 0
+0.492487 0.636060 0.787980 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 0
+0.787980 0.931553 0.996661 1.000000 1.000000 1.000000 1.000000 1.000000 0.619608 0.619608 1.000000 0 0
+0.996661 0.996661 1.000000 1.000000 0.619608 0.619608 0.000000 1.000000 0.619608 0.619608 0.000000 0 0
diff --git a/chalk/data/gradients/Radial_Glow_1.ggr b/chalk/data/gradients/Radial_Glow_1.ggr
new file mode 100644
index 000000000..7169c67bb
--- /dev/null
+++ b/chalk/data/gradients/Radial_Glow_1.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Radial Glow 1
+5
+0.000000 0.173623 0.350584 1.000000 1.000000 1.000000 0.809524 1.000000 0.737255 0.737255 0.306122 2 0
+0.350584 0.375626 0.400668 1.000000 0.737255 0.737255 0.306122 1.000000 0.636060 0.636060 0.306122 0 0
+0.400668 0.417919 0.421223 1.000000 0.636060 0.636060 0.306122 1.000000 0.517647 0.517647 0.605442 1 0
+0.421223 0.425153 0.440735 1.000000 0.517647 0.517647 0.605442 0.988235 0.501961 0.501961 0.306122 1 0
+0.440735 0.720367 1.000000 0.988235 0.501961 0.501961 0.306122 1.000000 0.000000 0.000000 0.000000 0 0
diff --git a/chalk/data/gradients/Radial_Rainbow_Hoop.ggr b/chalk/data/gradients/Radial_Rainbow_Hoop.ggr
new file mode 100644
index 000000000..b34ad9158
--- /dev/null
+++ b/chalk/data/gradients/Radial_Rainbow_Hoop.ggr
@@ -0,0 +1,6 @@
+GIMP Gradient
+Name: Radial Rainbow Hoop
+3
+0.000000 0.666110 0.699499 0.000000 1.000000 0.000000 0.000000 1.000000 0.113725 0.000000 1.000000 1 2
+0.699499 0.767947 0.849750 1.000000 0.113725 0.000000 1.000000 1.000000 0.000000 0.047059 1.000000 0 1
+0.849750 0.878130 1.000000 1.000000 0.000000 0.047059 1.000000 1.000000 0.431373 0.000000 0.000000 1 0
diff --git a/chalk/data/gradients/Romanian_flag.ggr b/chalk/data/gradients/Romanian_flag.ggr
new file mode 100644
index 000000000..bcdb9bca6
--- /dev/null
+++ b/chalk/data/gradients/Romanian_flag.ggr
@@ -0,0 +1,6 @@
+GIMP Gradient
+Name: Romanian flag
+3
+0.000000 0.166667 0.333333 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 1.000000 0 0
+0.333333 0.500000 0.666667 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 0 0
+0.666667 0.833333 1.000000 1.000000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Romanian_flag_smooth.ggr b/chalk/data/gradients/Romanian_flag_smooth.ggr
new file mode 100644
index 000000000..08a3daeb0
--- /dev/null
+++ b/chalk/data/gradients/Romanian_flag_smooth.ggr
@@ -0,0 +1,5 @@
+GIMP Gradient
+Name: Romanian flag smooth
+2
+0.000000 0.250000 0.500000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 0.000000 1.000000 0 0
+0.500000 0.750000 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Rounded_edge.ggr b/chalk/data/gradients/Rounded_edge.ggr
new file mode 100644
index 000000000..5cb2f6c60
--- /dev/null
+++ b/chalk/data/gradients/Rounded_edge.ggr
@@ -0,0 +1,10 @@
+GIMP Gradient
+Name: Rounded edge
+7
+0.000000 0.220339 0.440678 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0 1
+0.440678 0.487288 0.533898 1.000000 1.000000 1.000000 1.000000 0.833333 0.833333 0.833333 1.000000 0 2
+0.533898 0.580508 0.627119 0.833333 0.833333 0.833333 1.000000 0.666667 0.666667 0.666667 1.000000 0 2
+0.627119 0.673729 0.720339 0.666667 0.666667 0.666667 1.000000 0.500000 0.500000 0.500000 1.000000 0 2
+0.720339 0.766949 0.813559 0.500000 0.500000 0.500000 1.000000 0.333333 0.333333 0.333333 1.000000 0 2
+0.813559 0.860169 0.906780 0.333333 0.333333 0.333333 1.000000 0.166667 0.166667 0.166667 1.000000 0 2
+0.906780 0.953390 1.000000 0.166667 0.166667 0.166667 1.000000 0.000000 0.000000 0.000000 1.000000 0 2
diff --git a/chalk/data/gradients/Shadows_1.ggr b/chalk/data/gradients/Shadows_1.ggr
new file mode 100644
index 000000000..14574edca
--- /dev/null
+++ b/chalk/data/gradients/Shadows_1.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Shadows 1
+5
+0.000000 0.221580 0.346912 0.113636 0.113636 0.113636 1.000000 0.643939 0.311237 0.107323 1.000000 0 0
+0.346912 0.449416 0.538564 0.643939 0.311237 0.107323 1.000000 0.871212 0.820000 0.820000 1.000000 0 0
+0.538564 0.617696 0.652755 0.871212 0.820000 0.820000 1.000000 0.340000 0.128091 0.107291 1.000000 0 0
+0.652755 0.747913 0.777963 0.340000 0.128091 0.107291 1.000000 1.000000 0.521990 0.220000 1.000000 1 0
+0.777963 0.854667 1.000000 1.000000 0.521990 0.220000 1.000000 0.204545 0.121376 0.046011 1.000000 0 0
diff --git a/chalk/data/gradients/Shadows_2.ggr b/chalk/data/gradients/Shadows_2.ggr
new file mode 100644
index 000000000..31b4f7f26
--- /dev/null
+++ b/chalk/data/gradients/Shadows_2.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Shadows 2
+5
+0.000000 0.048414 0.126878 0.462121 0.462121 0.462121 1.000000 0.940000 0.865112 0.817800 1.000000 0 0
+0.126878 0.368948 0.499165 0.940000 0.865112 0.817800 1.000000 0.380000 0.328734 0.231331 1.000000 0 0
+0.499165 0.602671 0.739566 0.380000 0.328734 0.231331 1.000000 0.553030 0.482304 0.336911 1.000000 0 0
+0.739566 0.766350 0.854758 0.553030 0.482304 0.336911 1.000000 0.007576 0.007576 0.007576 1.000000 0 0
+0.854758 0.968292 1.000000 0.007576 0.007576 0.007576 1.000000 0.659091 0.659091 0.659091 1.000000 1 0
diff --git a/chalk/data/gradients/Shadows_3.ggr b/chalk/data/gradients/Shadows_3.ggr
new file mode 100644
index 000000000..eb9366d8b
--- /dev/null
+++ b/chalk/data/gradients/Shadows_3.ggr
@@ -0,0 +1,9 @@
+GIMP Gradient
+Name: Shadows 3
+6
+0.000000 0.143573 0.297162 0.598485 0.598484 0.598484 1.000000 0.492424 0.303700 0.136994 1.000000 1 0
+0.297162 0.330551 0.365609 0.492424 0.303700 0.136994 1.000000 0.880909 0.584348 0.509475 1.000000 1 0
+0.365609 0.484140 0.549040 0.880909 0.584348 0.509475 1.000000 0.969697 0.673909 0.000000 1.000000 1 0
+0.549040 0.580290 0.611540 0.969697 0.673909 0.000000 1.000000 0.857935 0.931818 0.026245 1.000000 0 0
+0.611540 0.651085 0.699499 0.857935 0.931818 0.026245 1.000000 0.590000 0.660000 0.020000 1.000000 1 0
+0.699499 0.886477 1.000000 0.590000 0.660000 0.020000 1.000000 0.030000 0.050000 0.220000 1.000000 1 0
diff --git a/chalk/data/gradients/Skyline.ggr b/chalk/data/gradients/Skyline.ggr
new file mode 100644
index 000000000..ba43e817f
--- /dev/null
+++ b/chalk/data/gradients/Skyline.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Skyline
+5
+0.000000 0.051753 0.365609 0.000000 0.000000 0.000000 1.000000 0.109804 0.066667 0.568627 1.000000 3 0
+0.365609 0.602671 0.749583 0.109804 0.066667 0.568627 1.000000 0.917647 0.043137 0.043137 1.000000 0 0
+0.749583 0.789649 0.864775 0.917647 0.043137 0.043137 1.000000 1.000000 0.533333 0.000000 1.000000 0 0
+0.864775 0.896494 0.934891 1.000000 0.533333 0.000000 1.000000 0.937255 0.925490 0.215686 1.000000 0 0
+0.934891 0.958264 1.000000 0.537255 0.396078 0.031373 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Skyline_polluted.ggr b/chalk/data/gradients/Skyline_polluted.ggr
new file mode 100644
index 000000000..5677742a4
--- /dev/null
+++ b/chalk/data/gradients/Skyline_polluted.ggr
@@ -0,0 +1,8 @@
+GIMP Gradient
+Name: Skyline polluted
+5
+0.000000 0.051753 0.365609 0.000000 0.000000 0.000000 1.000000 0.227451 0.207843 0.486275 1.000000 3 0
+0.365609 0.602671 0.749583 0.227451 0.207843 0.486275 1.000000 0.709804 0.098039 0.098039 1.000000 0 0
+0.749583 0.789649 0.864775 0.709804 0.098039 0.098039 1.000000 0.819608 0.505882 0.270588 1.000000 0 0
+0.864775 0.896494 0.934891 0.819608 0.505882 0.270588 1.000000 0.800000 0.784314 0.564706 1.000000 0 0
+0.934891 0.958264 1.000000 0.537255 0.396078 0.031373 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Square_Wood_Frame.ggr b/chalk/data/gradients/Square_Wood_Frame.ggr
new file mode 100644
index 000000000..3314e7b2b
--- /dev/null
+++ b/chalk/data/gradients/Square_Wood_Frame.ggr
@@ -0,0 +1,9 @@
+GIMP Gradient
+Name: Square Wood Frame
+6
+0.000000 0.394306 0.797162 0.348485 0.187023 0.027070 0.000000 0.348485 0.187023 0.027070 0.000000 0 0
+0.797162 0.813856 0.830551 0.348485 0.187023 0.027070 1.000000 0.598485 0.321191 0.046490 1.000000 0 0
+0.830551 0.880217 0.929883 0.757576 0.430331 0.081217 1.000000 0.757576 0.430331 0.081217 1.000000 0 0
+0.929883 0.939294 0.949647 0.757576 0.430331 0.081217 1.000000 1.000000 0.681967 0.420000 1.000000 1 0
+0.949647 0.962907 0.976169 1.000000 0.681967 0.420000 1.000000 0.757576 0.424126 0.068392 1.000000 1 0
+0.976169 0.988085 1.000000 0.757576 0.424126 0.068392 1.000000 0.481061 0.266950 0.042141 1.000000 0 0
diff --git a/chalk/data/gradients/Sunrise.ggr b/chalk/data/gradients/Sunrise.ggr
new file mode 100644
index 000000000..2bb3beffd
--- /dev/null
+++ b/chalk/data/gradients/Sunrise.ggr
@@ -0,0 +1,9 @@
+GIMP Gradient
+Name: Sunrise
+6
+0.000000 0.101798 0.203595 1.000000 1.000000 1.000000 1.000000 0.948165 0.969697 0.812122 1.000000 0 0
+0.203595 0.379143 0.487479 0.948165 0.969697 0.812122 1.000000 1.000000 0.552632 0.270000 1.000000 0 0
+0.487479 0.503577 0.529137 1.000000 0.552632 0.270000 1.000000 0.581721 0.096155 0.170043 1.000000 0 0
+0.529137 0.545165 0.562604 0.581721 0.096155 0.170043 1.000000 0.287879 0.155229 0.049835 1.000000 0 0
+0.562604 0.609349 0.697830 0.287879 0.155229 0.049835 1.000000 0.336000 0.425966 0.800000 1.000000 0 0
+0.697830 0.845064 1.000000 0.336000 0.425966 0.800000 1.000000 0.852165 0.985930 1.000000 1.000000 0 0
diff --git a/chalk/data/gradients/Three_bars_sin.ggr b/chalk/data/gradients/Three_bars_sin.ggr
new file mode 100644
index 000000000..564d15c75
--- /dev/null
+++ b/chalk/data/gradients/Three_bars_sin.ggr
@@ -0,0 +1,9 @@
+GIMP Gradient
+Name: Three bars sin
+6
+0.000000 0.083333 0.166667 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 2 0
+0.166667 0.250000 0.333333 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 2 0
+0.333333 0.416667 0.500000 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 2 0
+0.500000 0.583333 0.666667 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 2 0
+0.666667 0.750000 0.833333 0.000000 0.000000 0.000000 1.000000 0.833333 0.833333 0.833333 1.000000 2 0
+0.833333 0.916667 1.000000 0.833333 0.833333 0.833333 1.000000 0.000000 0.000000 0.000000 1.000000 2 0
diff --git a/chalk/data/gradients/Tropical_Colors.ggr b/chalk/data/gradients/Tropical_Colors.ggr
new file mode 100644
index 000000000..bbb0fdac5
--- /dev/null
+++ b/chalk/data/gradients/Tropical_Colors.ggr
@@ -0,0 +1,12 @@
+GIMP Gradient
+Name: Tropical Colors
+9
+0.000000 0.055556 0.085142 0.036578 0.159091 0.015374 1.000000 0.007899 0.310606 0.000000 1.000000 0 0
+0.085142 0.138564 0.193656 0.007899 0.310606 0.000000 1.000000 0.195893 0.575758 0.085655 1.000000 0 0
+0.193656 0.233723 0.276572 0.195893 0.575758 0.085655 1.000000 0.924242 0.750598 0.192395 1.000000 0 0
+0.276572 0.332128 0.387683 0.924242 0.750598 0.192395 1.000000 0.954545 0.239854 0.132221 1.000000 0 0
+0.387683 0.510851 0.555556 0.954545 0.239854 0.132221 1.000000 0.530303 0.319349 0.236012 1.000000 0 0
+0.555556 0.611111 0.666667 0.530303 0.319349 0.236012 1.000000 0.472649 0.295792 1.000000 1.000000 0 0
+0.666667 0.772955 0.826377 0.472649 0.295792 1.000000 1.000000 0.644153 1.000000 0.957743 1.000000 0 0
+0.826377 0.866444 0.884808 0.644153 1.000000 0.957743 1.000000 0.408723 0.870000 0.278400 1.000000 0 0
+0.884808 0.953255 1.000000 0.408723 0.870000 0.278400 1.000000 0.363558 0.500000 0.000000 1.000000 1 0
diff --git a/chalk/data/gradients/Tube_Red.ggr b/chalk/data/gradients/Tube_Red.ggr
new file mode 100644
index 000000000..379fe1ccb
--- /dev/null
+++ b/chalk/data/gradients/Tube_Red.ggr
@@ -0,0 +1,10 @@
+GIMP Gradient
+Name: Tube Red
+7
+0.000000 0.189482 0.378965 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0 0
+0.378965 0.624374 0.721202 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 1 0
+0.721202 0.748748 0.776294 0.393939 0.091171 0.035564 1.000000 0.204545 0.047339 0.018466 1.000000 1 0
+0.776294 0.833723 0.859766 0.204545 0.047339 0.018466 1.000000 0.757576 0.175329 0.068392 1.000000 1 0
+0.859766 0.876461 0.893155 0.757576 0.175329 0.068392 1.000000 1.000000 0.501132 0.420000 1.000000 1 0
+0.893155 0.911519 0.928214 1.000000 0.501132 0.420000 1.000000 0.757576 0.175329 0.068392 1.000000 1 0
+0.928214 0.964107 1.000000 0.757576 0.175329 0.068392 0.000000 0.757576 0.175329 0.068392 0.000000 0 0
diff --git a/chalk/data/gradients/Wood_1.ggr b/chalk/data/gradients/Wood_1.ggr
new file mode 100644
index 000000000..15fcd1068
--- /dev/null
+++ b/chalk/data/gradients/Wood_1.ggr
@@ -0,0 +1,6 @@
+GIMP Gradient
+Name: Wood 1
+3
+0.000000 0.252087 0.555927 1.000000 0.700000 0.400000 1.000000 0.920000 0.579600 0.239200 1.000000 3 0
+0.555927 0.834725 0.981636 0.920000 0.579600 0.239200 1.000000 0.000000 0.000000 0.000000 1.000000 4 0
+0.981636 0.991653 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 4 0
diff --git a/chalk/data/gradients/Wood_2.ggr b/chalk/data/gradients/Wood_2.ggr
new file mode 100644
index 000000000..b23ea06a9
--- /dev/null
+++ b/chalk/data/gradients/Wood_2.ggr
@@ -0,0 +1,12 @@
+GIMP Gradient
+Name: Wood 2
+9
+0.000000 0.069491 0.138982 1.000000 0.700000 0.400000 1.000000 0.944844 0.616991 0.289137 1.000000 3 0
+0.138982 0.208472 0.277963 0.800000 0.522406 0.244813 1.000000 0.928860 0.592934 0.257008 1.000000 3 0
+0.277963 0.347454 0.416945 0.820000 0.523444 0.226888 1.000000 0.922120 0.582791 0.243462 1.000000 3 0
+0.416945 0.486436 0.555927 0.770000 0.486649 0.203299 1.000000 0.920000 0.579600 0.239200 1.000000 3 0
+0.555927 0.609140 0.662354 0.780000 0.491400 0.202800 1.000000 0.903086 0.568944 0.234802 1.000000 4 0
+0.662354 0.715568 0.768781 0.810000 0.510300 0.210600 1.000000 0.850329 0.535708 0.221086 1.000000 4 0
+0.768781 0.821995 0.875209 0.760000 0.478800 0.197600 1.000000 0.708598 0.446417 0.184235 1.000000 4 0
+0.875209 0.928422 0.981636 0.620000 0.390600 0.161200 1.000000 0.000000 0.000000 0.000000 1.000000 4 0
+0.981636 0.991653 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 4 0
diff --git a/chalk/data/gradients/Yellow_Contrast.ggr b/chalk/data/gradients/Yellow_Contrast.ggr
new file mode 100644
index 000000000..dd3d89fba
--- /dev/null
+++ b/chalk/data/gradients/Yellow_Contrast.ggr
@@ -0,0 +1,10 @@
+GIMP Gradient
+Name: Yellow Contrast
+7
+0.000000 0.088481 0.161937 0.000000 0.000000 0.000000 1.000000 0.969697 0.639354 0.000000 1.000000 1 0
+0.161937 0.202003 0.247078 0.969697 0.639354 0.000000 1.000000 1.000000 0.988712 0.000000 1.000000 1 0
+0.247078 0.258765 0.287145 1.000000 0.988712 0.000000 1.000000 0.166667 0.157690 0.000000 1.000000 1 0
+0.287145 0.323038 0.363940 0.166667 0.157690 0.000000 1.000000 0.007576 0.007576 0.007576 1.000000 1 0
+0.363940 0.544240 0.592654 0.007576 0.007576 0.007576 1.000000 1.000000 1.000000 1.000000 1.000000 1 0
+0.592654 0.767947 0.803005 1.000000 1.000000 1.000000 1.000000 0.857143 0.843870 0.030851 1.000000 1 0
+0.803005 0.901503 1.000000 0.857143 0.843870 0.030851 1.000000 0.333333 0.194690 0.180622 1.000000 1 0
diff --git a/chalk/data/gradients/Yellow_Orange.ggr b/chalk/data/gradients/Yellow_Orange.ggr
new file mode 100644
index 000000000..ac1fe2338
--- /dev/null
+++ b/chalk/data/gradients/Yellow_Orange.ggr
@@ -0,0 +1,5 @@
+GIMP Gradient
+Name: Yellow Orange
+2
+0.000000 0.135225 0.565943 1.000000 0.892593 0.000000 1.000000 1.000000 0.534703 0.000000 1.000000 0 0
+0.565943 0.948247 1.000000 1.000000 0.534703 0.000000 1.000000 0.901515 0.428701 0.114311 1.000000 0 0
diff --git a/chalk/data/images/Azay-Le-Rideau.jpg b/chalk/data/images/Azay-Le-Rideau.jpg
new file mode 100644
index 000000000..eb1894590
Binary files /dev/null and b/chalk/data/images/Azay-Le-Rideau.jpg differ
diff --git a/chalk/data/images/Makefile.am b/chalk/data/images/Makefile.am
new file mode 100644
index 000000000..f9f8e4d97
--- /dev/null
+++ b/chalk/data/images/Makefile.am
@@ -0,0 +1,6 @@
+
+chalkimagesdir = $(prefix)/share/apps/chalk/images
+
+# chalkimages_DATA = evenings.jpg hakonepa.jpg hiro_awate.jpg Azay-Le-Rideau.jpg previewfilter.png
+chalkimages_DATA = previewfilter.png
+
diff --git a/chalk/data/images/WeyDesc.png b/chalk/data/images/WeyDesc.png
new file mode 100644
index 000000000..77e97ed61
Binary files /dev/null and b/chalk/data/images/WeyDesc.png differ
diff --git a/chalk/data/images/evenings.jpg b/chalk/data/images/evenings.jpg
new file mode 100644
index 000000000..5880f18ed
Binary files /dev/null and b/chalk/data/images/evenings.jpg differ
diff --git a/chalk/data/images/hakonepa.jpg b/chalk/data/images/hakonepa.jpg
new file mode 100644
index 000000000..9f33cbab4
Binary files /dev/null and b/chalk/data/images/hakonepa.jpg differ
diff --git a/chalk/data/images/hiro_awate.jpg b/chalk/data/images/hiro_awate.jpg
new file mode 100644
index 000000000..26fc42aa7
Binary files /dev/null and b/chalk/data/images/hiro_awate.jpg differ
diff --git a/chalk/data/images/paintbrush.png b/chalk/data/images/paintbrush.png
new file mode 100644
index 000000000..88e4be87d
Binary files /dev/null and b/chalk/data/images/paintbrush.png differ
diff --git a/chalk/data/images/previewfilter.png b/chalk/data/images/previewfilter.png
new file mode 100644
index 000000000..7a115b241
Binary files /dev/null and b/chalk/data/images/previewfilter.png differ
diff --git a/chalk/data/palettes/40_Colors.gpl b/chalk/data/palettes/40_Colors.gpl
new file mode 100644
index 000000000..97d98c37a
--- /dev/null
+++ b/chalk/data/palettes/40_Colors.gpl
@@ -0,0 +1,43 @@
+GIMP Palette
+Name: 40_Colors
+#
+  0   0   0	Black
+ 48  48  48	Almost black
+ 88  88  88	Very dark gray
+128 128 128	Dark gray
+160 160 160	Mid gray
+195 195 195	Light gray
+220 220 220	Very light gray
+255 255 255	White
+ 64   0   0	Very dark red
+128   0   0	Dark red
+192   0   0	Mid red
+255   0   0	Red
+255 192 192	Light red
+  0  64   0	Very dark green
+  0 128   0	Dark green
+  0 192   0	Mid green
+  0 255   0	Green
+192 255 192	Light green
+  0   0 128	Dark blue
+  0   0 192	Mid blue
+  0   0 255	Blue
+192 192 255	Light blue
+ 64  64   0	Very dark yellow
+128 128   0	Dark yellow
+192 192   0	Mid yellow
+255 255   0	Yellow
+255 255 192	Light yellow
+  0  64  64	Very dark cyan
+  0 128 128	Dark cyan
+  0 192 192	Mid cyan
+  0 255 255	Cyan
+192 255 255	Light cyan
+128   0 128	Dark magenta
+192   0 192	Mid magenta
+255   0 255	Magenta
+255 192 255	Light magenta
+192  88   0	Dark orange
+255 128   0	Orange
+255 168  88	Light orange
+255 220 168	Very light orange
diff --git a/chalk/data/palettes/Anchor.gpl b/chalk/data/palettes/Anchor.gpl
new file mode 100644
index 000000000..590838b16
--- /dev/null
+++ b/chalk/data/palettes/Anchor.gpl
@@ -0,0 +1,448 @@
+GIMP Palette
+Name: Anchor
+#
+253 251 255	1 Snow White
+250 250 250	2 White
+251 187 167	6 Salmon - VY LT
+248 165 151	8 Salmon - LT
+244 138 125	9 Salmon - MED LT
+225  90  82	10 Salmon - MED
+225  62  41	11 Salmon - MED DK
+178  16  18	13 Salmon - DK
+164   0  43	19 Burgundy - MED
+121  12  20	20 Burgundy - MED DK
+ 89   9  31	22 Burgundy - VY DK
+251 190 195	23 Baby Pink
+250 166 171	24 Carnation - VY LT
+244 154 169	25 Carnation - LT
+245 105 136	26 Carnation - MED LT
+247 107 132	27 Carnation - MED
+239  59  88	28 Carnation - MED
+204  10  34	29 Carnation - DK
+247 124 138	31 Blush - LT
+248  90 101	33 Blush - MED
+234  49  56	35 Blush - DK
+245 147 158	36 Blossom Pink - LT
+225  58  95	38 Blossom Pink - MED
+177  21  32	39 Blossom Pink - DK
+241  89 129	40 Carmine Rose - LT
+218  59  95	41 Carmine Rose - MED LT
+180  10  62	42 Carmine Rose - MED
+125  20  40	43 Carmine Rose - MED DK
+ 97   0  33	44 Carmine Rose - DK
+ 95  15  20	45 Carmine Rose - VY DK
+211   5  13	46 Crimson Red
+172   0  35	47 Carmine Red
+249 196 206	48 China Rose - VY LT
+236 181 189	49 China Rose - LT
+245 153 175	50 China Rose - MED
+255 164 194	51 Nelke Dunkel
+244  98 147	52 China Rose - MED DK
+224  40  98	54 China Rose - DK
+242 121 163	55 Beauty Rose - LT
+218  27  91	57 Beauty Rose - MED
+168   6  70	59 China Rose
+233 159 190	60 Magenta - LT
+235  93 138	62 Magenta - MED
+225  32 104	63 Magenta - DK
+152  12  71	65 Antique Rose - VY DK
+233 135 173	66 Raspberry - LT
+194  79 119	68 Raspberry - MED LT
+150  36  75	69 Raspberry - MED
+106  11  50	70 Raspberry - DK
+ 85   9  37	72 Raspberry - VY DK
+252 195 204	73 Antique Rose - VY LT
+244 155 175	74 Antique Rose - LT
+242 133 163	75 Antique Rose - MED LT
+208  92 119	76 Antique Rose - MED
+182  48  99	77 Antique Rose - MED DK
+168  18  88	78 Antique Rose - DK
+233 159 200	85 Orchid - LT
+221 120 177	86 Orchid - MED LT
+199  55 132	87 Orchid - MED
+174  17 100	88 Orchid - MED DK
+175  13 100	89 Orchid - DK
+208 149 179	90 Plum - LT
+161  73 152	92 Plum - MED
+131  24 106	94 Plum - DK
+215 167 201	95 Violet - VY LT
+209 142 183	96 Violet - LT
+182 106 166	97 Violet - MED LT
+159  83 140	98 Violet - MED
+135  56 118	99 Violet
+122  40  98	100 Violet - MED DK
+ 90   0  92	101 Violet - DK
+ 69   8  68	102 Violet - VY DK
+227 186 210	103 Plum - VY LT
+194 159 208	108 Lavender - LT
+165 122 175	109 Lavender - MED LT
+122  82 165	110 Lavender - MED
+ 93  46 132	111 Lavender - MED DK
+ 84  34 121	112 Lavender - DK
+153 169 201	117 Thistle - LT
+121 120 182	118 Thistle - MED
+ 80  54 130	119 Thistle - MED
+179 197 223	120 Blueberry - LT
+116 139 184	121 Blueberry - MED LT
+ 82  95 145	122 Blueberry - MED
+ 44  48 106	123 Blueberry - DK
+  0   0  63	127 Indigo
+199 222 233	128 Blue - LT
+136 170 203	129 Blue
+121 156 198	130 Blue - MED LT
+ 62  95 157	131 Blue - MED
+ 16  62 133	132 Blue - MED DK
+ 20  51 116	133 Blue - DK
+  8  23 100	134 Blue - VY DK
+ 91 130 172	136 Wedgewood - LT
+ 49  97 161	137 Wedgewood - MED
+ 13  60 120	139 Wedgewood - DK
+127 165 200	140 Copen Blue - LT
+ 22  91 164	142 Copen Blue - MED
+ 12  67 134	143 Copen Blue - DK
+157 189 207	144 Delft Blue - VY LT
+113 145 188	145 Delft Blue - LT
+ 56 112 169	146 Delft Blue
+  7  77 142	147 Delft Blue - MED LT
+  8  45  99	148 Delft Blue - MED
+  9  32  86	149 Delft Blue - MED DK
+ 21  34  71	150 Delft Blue - DK
+ 15  18  50	152 Delft Blue - VY DK
+206 233 233	158 Sapphire - VY LT
+170 202 226	159 Sapphire - LT
+158 205 221	160 Sapphire - MED LT
+ 67 137 168	161 Sapphire - MED
+ 11 101 140	162 Sapphire - MED DK
+  9  66 100	164 Sapphire - DK
+142 204 211	167 Surf Blue - VY LT
+ 89 158 169	168 Surf Blue - LT
+ 21 113 139	169 Surf Blue - MED
+  0  85 108	170 Surf Blue - DK
+123 157 193	175 Ocean Blue - LT
+100 125 166	176 Ocean Blue
+ 71  82 153	177 Ocean Blue - MED
+ 47  43 103	178 Ocean Blue - DK
+129 214 196	185 Sea Green - LT
+ 82 191 172	186 Sea Green - MED LT
+ 43 168 153	187 Sea Green - MED
+  7 139 129	188 Sea Green - MED DK
+ 14 125 113	189 Sea Green - DK
+124 192 140	203 Mint Green - LT
+100 187 135	204 Mint Green - MED
+ 52 149 104	205 Mint Green - DK
+166 206 164	206 Spruce - LT
+ 99 174 128	208 Spruce - MED LT
+ 73 161 112	209 Spruce
+ 40 117  72	210 Spruce - MED
+ 11  96  51	211 Spruce - MED DK
+ 20  82  54	212 Spruce - DK
+186 204 171	213 Juniper - VY LT
+153 183 134	214 Juniper - LT
+106 142 100	215 Juniper - MED LT
+ 81 124  96	216 Juniper - MED
+ 52 101  68	217 Juniper - MED DK
+ 21  71  37	218 Juniper - DK
+100 181  93	225 Emerald - LT
+ 65 153  55	226 Emerald - MED LT
+ 28 133  50	227 Emerald - MED
+ 10 118  47	228 Emerald - MED DK
+  7 111  47	229 Emerald - DK
+  2 119  78	230 Mint Green - VY DK
+192 176 170	231 Rose Gray - LT
+169 151 147	232 Rose Gray - MED
+130 110 109	233 Rose Gray
+205 208 205	234 Charcoal Gray - LT
+111 113 119	235 Charcoal Gray - MED
+ 53  50  55	236 Charcoal Gray - DK
+ 96 173  54	238 Spring Green - MED
+ 67 156  23	239 Spring Green - DK
+159 205 136	240 Grass Green - LT
+135 198 119	241 Grass Green
+115 168  94	242 Grass Green - MED LT
+ 88 146  74	243 Grass Green - MED
+ 55 119  57	244 Grass Green - MED DK
+ 21 104  23	245 Grass Green - DK
+ 20  76  25	246 Grass Green - VY DK
+207 224 128	253 Parrot Green - VY LT
+199 221  99	254 Parrot Green - LT
+139 175  34	255 Parrot Green - MED LT
+ 92 150  25	256 Parrot Green - MED
+ 71 135  25	257 Parrot Green - MED DK
+ 53 115  22	258 Parrot Green - DK
+222 233 165	259 Loden Green - VY LT
+159 180 118	260 Loden Green - LT
+136 159 114	261 Loden Green - MED LT
+ 70 102  51	262 Loden Green - MED
+ 43  69  30	263 Loden Green - DK
+181 195 130	264 Avocado - VY LT
+152 180  90	265 Avocado - LT
+112 139  58	266 Avocado - MED LT
+ 85 111  31	267 Avocado - MED
+ 58  88  24	268 Avocado - MED DK
+ 55  70  30	269 Avocado - DK
+253 226 221	271 Soft Carnation
+ 85  77  58	273 Stone Gray - DK
+199 209 202	274 Blue Mist - LT
+251 241 206	275 Citrus - LT
+239 217 187	276 Pearl
+124  88  21	277 Desert - VY DK
+207 203 103	278 Olive Green - LT
+191 175  75	279 Olive Green - MED LT
+155 142  62	280 Olive Green - MED
+117 103  44	281 Olive Green - DK
+251 235 105	288 Canary Yellow - LT
+251 233  80	289 Canary Yellow - MED
+253 214  16	290 Canary Yellow - MED
+252 205  13	291 Canary Yellow - DK
+252 236 160	292 Jonquil - VY LT
+252 227 120	293 Jonquil - LT
+253 217  81	295 Jonquil - MED LT
+252 208  29	297 Jonquil - MED
+251 181  30	298 Jonquil - DK
+247 221 159	300 Citrus - LT
+245 212 132	301 Citrus
+250 189  72	302 Citrus - MED LT
+250 149  23	303 Citrus - MED
+247 123  13	304 Citrus - DK
+249 198  84	305 Topaz - LT
+237 162  49	306 Topaz - MED LT
+222 142  23	307 Topaz - MED
+189 110  26	308 Topaz - MED DK
+173  95  38	309 Topaz - DK
+148  76  34	310 Topaz - VY DK
+243 186 113	311 Tangerine - VY LT
+250 170  85	313 Tangerine - LT
+245 137  22	314 Tangerine - MED LT
+250 112  23	316 Tangerine - DK
+249 136  79	323 Apricot - LT
+237 110  50	324 Apricot - MED
+207  70  15	326 Apricot - DK
+252 142 117	328 Melon - LT
+248 110  69	329 Melon - DK
+247  93  31	330 Melon - DK
+246  69  31	332 Blaze - LT
+230  39  20	333 Blaze - MED LT
+232  19  15	334 Blaze - MED
+225   9  13	335 Blaze - DK
+239 158 121	336 Terra Cotta - LT
+226 139 110	337 Terra Cotta - MED LT
+202 110  88	338 Terra Cotta
+177  63  40	339 Terra Cotta - MED
+157  48  34	340 Terra Cotta - MED DK
+141  36  25	341 Terra Cotta - DK
+217 190 221	342 Lilac - LT
+140 162 180	343 Slate Blue
+208 146  92	347 Bark - LT
+170  85  27	349 Bark - MED
+140  47  24	351 Bark - MED DK
+109  24  21	352 Bark - DK
+147  66  26	355 Mocha - MED
+116  43  17	357 Mocha - DK
+117  55  26	358 Coffee
+104  45  18	359 Coffee - MED
+ 83  43  25	360 Coffee - DK
+238 195 138	361 Nutmeg - LT
+225 162 102	362 Nutmeg - MED LT
+224 150  56	363 Nutmeg - MED
+169  96  20	365 Nutmeg - DK
+233 199 151	366 Spice - VY LT
+227 179 134	367 Spice - LT
+210 154 100	368 Spice - MED LT
+184 114  67	369 Spice - MED
+151  73  27	370 Spice - MED DK
+130  58  23	371 Spice - DK
+227 187 133	372 Desert - LT
+196 151  94	373 Desert - MED
+163 110  54	374 Desert - MED
+136  90  35	375 Desert - DK
+215 173 152	376 Fawn - LT
+166 128 104	378 Fawn - MED
+141  97  73	379 Fawn - DK
+ 71  33  23	380 Fudge
+ 61  29  17	381 Fudge - MED
+ 54  28  17	382 Fudge - DK
+245 231 201	386 Citrus - VY LT
+239 218 182	387 Ecru
+201 179 151	388 Ecru - MED
+229 215 184	390 Linen - LT
+202 186 160	391 Linen
+163 139 108	392 Linen - MED
+118  97  57	393 Linen - DK
+197 193 179	397 Gray - LT
+175 176 173	398 Gray
+146 146 147	399 Gray - MED LT
+ 88  86  90	400 Gray - MED
+ 62  58  65	401 Gray - DK
+  0   0   0	403 Black
+  0 120 169	410 Ice Blue - DK
+  0 166 222	433 Ice Blue
+ 85  87  51	681 Forest - DK
+ 31  67  58	683 Turf Green
+238 198 171	778 Flesh - LT
+ 77 120 123	779 Blue Mist - MED DK
+209 191 158	830 Sierra - VY LT
+198 174 138	831 Sierra - LT
+157 131  96	832 Sierra - MED
+193 184 121	842 Fern Green - LT
+138 137  72	843 Fern Green
+129 119  49	844 Fern Green - MED
+ 97  91  32	845 Fern Green - MED DK
+ 70  65  11	846 Fern Green - DK
+214 222 215	847 Blue Mist - VY LT
+175 191 186	848 Blue Mist
+156 170 171	849 Blue Mist - MED LT
+122 139 140	850 Blue Mist - MED
+ 41  80  86	851 Blue Mist - DK
+227 207 159	852 Turf - VY LT
+190 169 117	853 Turf - LT
+162 141  83	854 Turf - MED LT
+153 127  67	855 Turf - MED
+124 106  47	856 Turf - DK
+163 174 143	858 Laurel Green - LT
+139 149 112	859 Laurel Green
+114 126  91	860 Laurel Green - MED LT
+ 74  89  55	861 Laurel Green - MED
+ 49  68  36	862 Laurel Green - DK
+234 166 142	868 Flesh - MED
+196 176 185	869 Amethyst - LT
+171 146 168	870 Amethyst - MED LT
+129  97 117	871 Amethyst - MED LT
+116  79 104	872 Amethyst - MED
+ 88  49  71	873 Amethyst - DK
+214 175  92	874 Saffron - MED
+146 182 159	875 Pine - LT
+ 96 144 121	876 Pine
+ 65 113  96	877 Pine - MED
+ 43  84  70	878 Pine - MED DK
+ 17  76  56	879 Pine - DK
+226 192 165	880 Copper - LT
+233 186 152	881 Copper
+220 148 118	882 Copper - MED LT
+189 114  85	883 Copper - MED
+154  67  46	884 Copper - DK
+245 226 180	885 Sand Stone - LT
+231 206 135	886 Sand Stone
+213 180 113	887 Sand Stone - MED LT
+169 128  56	888 Sand Stone - MED DK
+111  75  26	889 Sand Stone - MED DK
+209 148  63	890 Brass - LT
+234 189 111	891 Brass
+243 211 197	892 Rose Wine - LT
+238 179 167	893 Rose Wine
+223 154 151	894 Rose Wine - MED LT
+209 113 122	895 Rose Wine - MED
+162  66  79	896 Rose Wine - DK
+112  26  36	897 Rose Wine - VY DK
+135 107  62	898 Sierra
+178 155 126	899 Tawny - LT
+169 169 149	900 Pewter - LT
+182 122  39	901 Tawny - MED
+137 112  80	903 Tawny - MED
+ 95  77  49	904 Mocha Brown - DK
+ 65  50  28	905 Tawny - DK
+106  72  13	906 Brass - DK
+182 139  40	907 Saffron - DK
+193 123  93	914 Flesh - MED DK
+114 141 158	920 Denim - LT
+ 86 112 128	921 Denim - MED
+ 65  89 106	922 Denim - DK
+  0  93  48	923 Emerald - VY DK
+ 94  89  14	924 Olive Green - VY DK
+233  82   7	925 Tangerine Very
+249 237 210	926 Ecru - VY LT
+170 217 223	928 Larkspur - LT
+240 207 179	933 Fawn - VY LT
+127  61  38	936 Fawn - VY DK
+121 130 169	939 Stormy Blue - MED
+ 60  80 144	940 Stormy Blue - MED DK
+ 60  71 125	941 Stormy Blue - VY DK
+234 195 129	942 Wheat - LT
+201 157  87	943 Wheat - MED
+133  78  28	944 Wheat - DK
+190 165  88	945 Harvest - MED
+209 191 139	956 Harvest - LT
+229 172 170	968 Wineberry - LT
+206 143 148	969 Wineberry - MED
+171  93 116	970 Wineberry - MED
+138  48  89	972 Wineberry - DK
+170 197 203	975 Sea Blue - LT
+141 172 185	976 Sea Blue - MED LT
+ 97 137 170	977 Sea Blue - MED
+ 70 113 150	978 Sea Blue - MED DK
+ 24  80 115	979 Sea Blue - DK
+210 108  16	1001 Antique Gold - MED
+237 139  29	1002 Antique Gold - LT
+221 108  54	1003 Amberglow
+165  61  20	1004 Apricot - VY DK
+141   8  33	1005 Cherry Red - MED
+155   0  24	1006 Cherry Red
+160  89  69	1007 Chicory - DK
+207 146 120	1008 Chicory - MED
+247 220 194	1009 Copper - VY LT
+253 217 180	1010 Cinnamon - VY LT
+248 220 198	1011 Flesh - VY LT
+245 192 166	1012 Chicory - LT
+198 112  94	1013 Brick - MED
+158  31  33	1014 Brick - VY DK
+144   9  17	1015 Brick - DK
+211 155 167	1016 Antique Mauve - LT
+190 123 142	1017 Antique
+156  89 101	1018 Antique Mauve - DK
+134  63  80	1019 Antique Mauve - VY DK
+241 190 182	1020 Peony - VY LT
+233 171 165	1021 Peony - LT
+228 132 125	1022 Peony - MED LT
+214 107 113	1023 Peony
+198  86  86	1024 Peony - MED
+173  17  35	1025 Peony - MED DK
+247 206 196	1026 Wineberry - VY LT
+188  89  94	1027 Rose Wine - MED DK
+124  28  65	1028 Raspberry - MED DK
+134  16  61	1029 Antique Rose - DK
+115  99 166	1030 Thistle - MED DK
+201 220 227	1031 Antique Blue - LT
+171 194 207	1032 Antique Blue - VY LT
+141 161 180	1033 Antique Blue - LT
+ 93 117 140	1034 Antique
+ 45  63  84	1035 Antique Blue - DK
+ 35  56  86	1036 Antique Blue - VY DK
+222 235 236	1037 Sea Blue - VY LT
+139 189 199	1038 Glacier Blue - MED
+ 87 156 177	1039 Glacier Blue - MED DK
+136 129 112	1040 Pewter - MED
+ 60  54  43	1041 Stone Gray - VY DK
+191 218 192	1042 Pine - VY LT
+206 229 173	1043 Grass Green - VY LT
+ 23  61  19	1044 Grass Green - DK
+202 135  76	1045 Toast - LT
+172 100  31	1046 Toast
+243 159 100	1047 Cinnamon - LT
+212 107  52	1048 Cinnamon - MED
+174  80  35	1049 Cinnamon
+105  66  40	1050 Tawnyu - MED DK
+158 198 205	1060 Blue Violet - VY LT
+ 99 146 161	1062 Peacock Blue
+ 75 130 151	1064 Wedgewood - LT
+ 27  87 106	1066 Wedgewood - DK
+  0  68  87	1068 Wedgewood - VY DK
+ 84 172 153	1070 Sea Green - MED
+ 48 156 132	1072 Sea Green - MED DK
+  0 131 115	1074 Sea Green - DK
+  0 114 101	1076 Misty Green - DK
+200 166 137	1080 Mocha Beige - LT
+159 129 108	1082 Mocha Beige - MED
+132 101  80	1084 Mocha Brown - MED
+ 92  70  54	1086 Mocha Brown - DK
+ 61  44  35	1088 Mocha Brown - VY DK
+  0 136 211	1089 Electric Blue - MED
+ 62 169 234	1090 Electric Blue
+153 216 210	1092 Turquoise - LT
+252 158 197	1094 Cranberry - VY LT
+159 179 193	1096 Blue Violet - LT
+212  24  41	1098 Bright Red
+234 186 164	4146 Sportsman Flesh
+182  82  69	5975 Brick - DK
+121 114  94	8581 Stone Gray
+198   0  25	9046 Christmas Red
+183 218 228	9159 Glacier Blue
+220 148 121	9575 Brick - MED LT
diff --git a/chalk/data/palettes/Bears.gpl b/chalk/data/palettes/Bears.gpl
new file mode 100644
index 000000000..189d4cfd6
--- /dev/null
+++ b/chalk/data/palettes/Bears.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Bears
+#
+  8   8   8	grey3
+ 68  44  44	Untitled
+ 80   8  12	Untitled
+ 72  56  56	Untitled
+104  84  68	Untitled
+116  96  80	Untitled
+ 84  56  44	Untitled
+140 104  88	Untitled
+172 116  92	Untitled
+ 68  44  56	Untitled
+ 88  72  68	Untitled
+112  84  76	Untitled
+  8   8  28	Untitled
+104  96  84	Untitled
+128 116  96	Untitled
+164 136 104	Untitled
+120 116 116	Untitled
+136 128 108	Untitled
+204 160 112	Untitled
+220 184 124	Untitled
+104 100 108	Untitled
+120 116 140	Untitled
+128 124 140	Untitled
+128 132 152	Untitled
+132 144 164	Untitled
+204 172 124	Untitled
+144 152 168	Untitled
+224 196 136	Untitled
+136 152 172	Untitled
+144 156 176	Untitled
+204 184 152	Untitled
+148 164 184	Untitled
+228 212 164	Untitled
+ 96   8   8	Untitled
+116 112 128	Untitled
+144 116  96	Untitled
+132 132 124	Untitled
+224 220 192	Untitled
+128 104  84	Untitled
+ 56  40  40	Untitled
+ 84  56  56	Untitled
+228 208 148	Untitled
+196 144 108	Untitled
+160 124 100	Untitled
+ 96  80  76	Untitled
+ 56  24  24	Untitled
+148  96  80	Untitled
+140  56  16	Untitled
+ 60   8  12	Untitled
+224 216 176	Untitled
+160 168 184	Untitled
+ 60  52  52	Untitled
+152 152 160	Untitled
+208 184 136	Untitled
+184 152 112	Untitled
+216 172 116	Untitled
+220 200 152	Untitled
+ 88   8  32	Untitled
+ 92  56  68	Untitled
+ 68  12  44	Untitled
+ 24   8   8	Untitled
+128  84  76	Untitled
+192 120  20	Untitled
+ 24  12  28	Untitled
+ 56  24  40	Untitled
+236 232 192	Untitled
+148 148 128	Untitled
+148 136 112	Untitled
+112 108  96	Untitled
+140  40  44	Untitled
+ 80  12  48	Untitled
+136 100  72	Untitled
+ 80  44  48	Untitled
+112 104 116	Untitled
+ 72  12  36	Untitled
+124  36  32	Untitled
+ 44  20  40	Untitled
+104  72  68	Untitled
+ 56  40  24	Untitled
+132  92  80	Untitled
+140 132 148	Untitled
+104  68  56	Untitled
+184  64   8	Untitled
+ 44   8   8	Untitled
+ 68  44  28	Untitled
+112   8  12	Untitled
+ 28  24  40	Untitled
+ 92  40  44	Untitled
+ 40   8  24	Untitled
+112  68  68	Untitled
+ 56   8  36	Untitled
+128  84  56	Untitled
+144 104  72	Untitled
+100  32  12	Untitled
+176  28   8	Untitled
+ 68  36  44	Untitled
+152 108  80	Untitled
+120  96  64	Untitled
+116   8  36	Untitled
+ 88  44  56	Untitled
+220 208 184	Untitled
+ 92  68  56	Untitled
+228 228 204	Untitled
+124  56  44	Untitled
+180 136 104	Untitled
+204 136  16	Untitled
+152  96  72	Untitled
+ 80  40   8	Untitled
+ 88  12  60	Untitled
+ 80  60  68	Untitled
+172 172 172	Untitled
+164 116  84	Untitled
+140 140 156	Untitled
+124  88  68	Untitled
+156 112  92	Untitled
+124 120 132	Untitled
+ 76  44  56	Untitled
+124  36   8	Untitled
+120  72  44	Untitled
+ 72  56  64	Untitled
+240 244 212	Untitled
+172 128  92	Untitled
+216 204 168	Untitled
+176  92  12	Untitled
+ 92  56  56	Untitled
+ 44  24  24	Untitled
+136  76  64	Untitled
+116  68  56	Untitled
+ 44  40  40	Untitled
+232 240 236	Untitled
+ 96  60  48	Untitled
+168 116  72	Untitled
+124  60  20	Untitled
+100  40  56	Untitled
+112  76  60	Untitled
+ 24   8  40	Untitled
+ 72  56  44	Untitled
+192 168 132	Untitled
+152 160 172	Untitled
+232 224 176	Untitled
+248 252 236	Untitled
+156  56   8	Untitled
+160 100  84	Untitled
+140 116  84	Untitled
+  8   8  48	Untitled
+136  68  44	Untitled
+104  12  48	Untitled
+120  76  68	Untitled
+228 228 220	Untitled
+176 172 156	Untitled
+188 140  96	Untitled
+172  80  40	Untitled
+ 44  28  40	Untitled
+124  36  60	Untitled
+140  28  76	Untitled
+ 88  72  80	Untitled
+ 44   8  40	Untitled
+184 104  60	Untitled
+132  88  64	Untitled
+160 104  72	Untitled
+124  76  64	Untitled
+ 92  12  48	Untitled
+184 180 180	Untitled
+104  72  48	Untitled
+ 44  40  28	Untitled
+ 56  44  56	Untitled
+ 36  12  48	Untitled
+ 96  44  36	Untitled
+192 192 192	Untitled
+164 176 192	Untitled
+188 128  96	Untitled
+160  84  72	Untitled
+108  56  52	Untitled
+172 156 128	Untitled
+148  72  24	Untitled
+164 160 164	Untitled
+ 80  36  56	Untitled
+156  84   8	Untitled
+152 128  92	Untitled
+144  16  48	Untitled
+152   8   8	Untitled
+ 76  52  28	Untitled
+148  40  12	Untitled
+220 220 208	Untitled
+104  56  60	Untitled
+128  64  64	Untitled
+ 68  28  56	Untitled
+208 192 160	Untitled
+136 136 140	Untitled
+ 44  36  56	Untitled
+ 44  40  16	Untitled
+148  80  56	Untitled
+120  72  12	Untitled
+ 80  68  56	Untitled
+148  92  44	Untitled
+188 184 160	Untitled
+156 160 140	Untitled
+112  20  40	Untitled
+144  88  76	Untitled
+192 180 144	Untitled
+180 200 188	Untitled
+ 56  56  60	Untitled
+ 72  68  72	Untitled
+104  60  32	Untitled
+148  64  68	Untitled
+172 112  36	Untitled
+212 204 192	Untitled
+144  96  60	Untitled
+112  36  44	Untitled
+ 56  36  56	Untitled
+116  56  64	Untitled
+148 144 148	Untitled
+172 160 144	Untitled
+ 12  60  72	Untitled
+ 96  64   8	Untitled
+128  72  72	Untitled
+ 36  40  40	Untitled
+116  48  12	Untitled
+112  40  56	Untitled
+168  96  60	Untitled
+196 192 172	Untitled
+184 168 128	Untitled
+ 96  92 100	Untitled
+204 212 188	Untitled
+ 92  24  40	Untitled
+132 100  16	Untitled
+204 216 204	Untitled
+188 124  68	Untitled
+156  60  44	Untitled
+ 76  28  24	Untitled
+ 92  88  84	Untitled
+204 152 100	Untitled
+136  52  64	Untitled
+ 84  80  72	Untitled
+ 92  76  32	Untitled
+ 28  36  16	Untitled
+140  84  68	Untitled
+ 56  12  56	Untitled
+132  84  16	Untitled
+ 84  40  28	Untitled
+ 44  72  80	Untitled
+196 136  88	Untitled
+172  96  80	Untitled
+132  12  12	Untitled
+120  12  56	Untitled
+180 116  84	Untitled
+204 196 176	Untitled
+164 148 116	Untitled
+136  80  76	Untitled
+  8  32  44	Untitled
+204   8  20	Untitled
+  0   0   0	grey0
+ 40   0   0	Untitled
+  0  56  92	Untitled
+  0   0   4	Untitled
+  0   0   0	grey0
diff --git a/chalk/data/palettes/Bgold.gpl b/chalk/data/palettes/Bgold.gpl
new file mode 100644
index 000000000..3e8e80687
--- /dev/null
+++ b/chalk/data/palettes/Bgold.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Bgold
+#
+236 216  20	Untitled
+236 216  20	Untitled
+236 216  20	Untitled
+236 212  20	Untitled
+236 212  20	Untitled
+236 208  24	Untitled
+236 208  24	Untitled
+232 204  24	Untitled
+232 204  24	Untitled
+232 204  24	Untitled
+232 200  24	Untitled
+232 200  24	Untitled
+232 196  24	Untitled
+232 196  24	Untitled
+228 192  24	Untitled
+228 192  28	Untitled
+228 188  28	Untitled
+228 188  28	Untitled
+228 184  28	Untitled
+228 184  28	Untitled
+228 184  28	Untitled
+224 180  28	Untitled
+224 180  28	Untitled
+224 176  28	Untitled
+224 176  28	Untitled
+224 172  32	Untitled
+224 172  32	Untitled
+224 168  32	Untitled
+224 168  32	Untitled
+220 164  32	Untitled
+220 164  32	Untitled
+220 164  32	Untitled
+220 160  32	Untitled
+220 160  32	Untitled
+220 156  32	Untitled
+220 156  36	Untitled
+216 152  36	Untitled
+216 152  36	Untitled
+216 148  36	Untitled
+216 148  36	Untitled
+216 144  36	Untitled
+216 144  36	Untitled
+216 144  36	Untitled
+212 140  36	Untitled
+212 140  36	Untitled
+212 136  40	Untitled
+212 136  40	Untitled
+212 132  40	Untitled
+212 132  40	Untitled
+212 128  40	Untitled
+208 128  40	Untitled
+208 124  40	Untitled
+208 124  40	Untitled
+208 124  40	Untitled
+208 120  40	Untitled
+208 120  44	Untitled
+208 116  44	Untitled
+204 116  44	Untitled
+204 112  44	Untitled
+204 112  44	Untitled
+204 108  44	Untitled
+204 108  44	Untitled
+204 104  44	Untitled
+204 104  44	Untitled
+204 104  44	Untitled
+200 108  40	Untitled
+200 108  40	Untitled
+200 108  40	Untitled
+200 108  40	Untitled
+200 108  40	Untitled
+200 108  40	Untitled
+200 108  40	Untitled
+200 112  40	Untitled
+200 112  40	Untitled
+200 112  36	Untitled
+200 112  36	Untitled
+200 112  36	Untitled
+200 112  36	Untitled
+200 112  36	Untitled
+200 116  36	Untitled
+200 116  36	Untitled
+200 116  36	Untitled
+200 116  36	Untitled
+200 116  36	Untitled
+196 116  32	Untitled
+196 116  32	Untitled
+196 120  32	Untitled
+196 120  32	Untitled
+196 120  32	Untitled
+196 120  32	Untitled
+196 120  32	Untitled
+196 120  32	Untitled
+196 120  32	Untitled
+196 124  32	Untitled
+196 124  28	Untitled
+196 124  28	Untitled
+196 124  28	Untitled
+196 124  28	Untitled
+196 124  28	Untitled
+196 124  28	Untitled
+196 128  28	Untitled
+196 128  28	Untitled
+196 128  28	Untitled
+196 128  28	Untitled
+192 128  24	Untitled
+192 128  24	Untitled
+192 128  24	Untitled
+192 132  24	Untitled
+192 132  24	Untitled
+192 132  24	Untitled
+192 132  24	Untitled
+192 132  24	Untitled
+192 132  24	Untitled
+192 132  20	Untitled
+192 136  20	Untitled
+192 136  20	Untitled
+192 136  20	Untitled
+192 136  20	Untitled
+192 136  20	Untitled
+192 136  20	Untitled
+192 136  20	Untitled
+192 140  20	Untitled
+192 140  20	Untitled
+188 140  16	Untitled
+188 140  16	Untitled
+188 140  16	Untitled
+188 140  16	Untitled
+188 140  16	Untitled
+188 144  16	Untitled
+188 144  16	Untitled
+188 144  16	Untitled
+188 144  16	Untitled
+188 144  16	Untitled
+188 144  12	Untitled
+188 144  12	Untitled
+188 148  12	Untitled
+188 148  12	Untitled
+188 148  12	Untitled
+188 148  12	Untitled
+188 148  12	Untitled
+188 148  12	Untitled
+188 148  12	Untitled
+188 148  12	Untitled
+148 136  60	Untitled
+112 124 108	Untitled
+116 128 112	Untitled
+116 128 112	Untitled
+116 128 116	Untitled
+120 128 116	Untitled
+120 128 120	Untitled
+120 128 120	Untitled
+120 128 124	Untitled
+124 132 124	Untitled
+124 132 128	Untitled
+124 132 128	Untitled
+124 132 132	Untitled
+128 132 132	Untitled
+128 132 136	Untitled
+128 132 136	Untitled
+132 136 140	Untitled
+132 136 140	Untitled
+132 136 144	Untitled
+132 136 144	Untitled
+136 136 148	Untitled
+136 136 148	Untitled
+136 136 152	Untitled
+136 136 152	Untitled
+140 140 156	Untitled
+140 140 156	Untitled
+140 140 160	Untitled
+144 140 160	Untitled
+144 140 164	Untitled
+144 140 164	Untitled
+144 140 168	Untitled
+148 144 168	Untitled
+148 144 172	Untitled
+148 144 172	Untitled
+148 144 176	Untitled
+152 144 176	Untitled
+152 144 180	Untitled
+152 144 180	Untitled
+156 148 184	Untitled
+156 148 184	Untitled
+156 148 188	Untitled
+156 148 188	Untitled
+160 148 192	Untitled
+160 148 192	Untitled
+160 148 196	Untitled
+160 148 196	Untitled
+164 152 200	Untitled
+164 152 200	Untitled
+164 152 204	Untitled
+168 152 204	Untitled
+168 152 208	Untitled
+168 152 208	Untitled
+168 152 212	Untitled
+172 156 212	Untitled
+172 156 216	Untitled
+172 156 216	Untitled
+172 156 220	Untitled
+176 156 220	Untitled
+176 156 224	Untitled
+176 156 224	Untitled
+176 156 224	Untitled
+168 152 220	Untitled
+164 148 216	Untitled
+156 148 212	Untitled
+152 144 212	Untitled
+148 144 208	Untitled
+140 140 204	Untitled
+136 140 204	Untitled
+132 136 200	Untitled
+124 136 196	Untitled
+120 132 196	Untitled
+116 132 192	Untitled
+108 128 188	Untitled
+104 128 188	Untitled
+100 124 184	Untitled
+ 92 124 180	Untitled
+ 88 120 180	Untitled
+ 80 120 176	Untitled
+ 76 116 172	Untitled
+ 72 116 172	Untitled
+ 64 112 168	Untitled
+ 60 112 164	Untitled
+ 56 108 164	Untitled
+ 48 108 160	Untitled
+ 44 104 156	Untitled
+ 40 104 156	Untitled
+ 32 100 152	Untitled
+ 28 100 148	Untitled
+ 24  96 148	Untitled
+ 16  96 144	Untitled
+ 12  92 140	Untitled
+  8  92 140	Untitled
+ 12  88 136	Untitled
+ 16  88 136	Untitled
+ 20  88 136	Untitled
+ 20  88 132	Untitled
+ 24  84 132	Untitled
+ 28  84 132	Untitled
+ 28  84 128	Untitled
+ 32  84 128	Untitled
+ 36  84 128	Untitled
+ 36  80 128	Untitled
+ 40  80 124	Untitled
+ 44  80 124	Untitled
+ 44  80 124	Untitled
+ 48  76 120	Untitled
+ 52  76 120	Untitled
+ 52  76 120	Untitled
+ 56  76 116	Untitled
+ 60  76 116	Untitled
+ 60  72 116	Untitled
+ 64  72 116	Untitled
+ 68  72 112	Untitled
diff --git a/chalk/data/palettes/Blues.gpl b/chalk/data/palettes/Blues.gpl
new file mode 100644
index 000000000..33fcfc084
--- /dev/null
+++ b/chalk/data/palettes/Blues.gpl
@@ -0,0 +1,261 @@
+GIMP Palette
+Name: Blues
+#
+# For them rainy days ... by Daniel Egnor
+#
+  0   0   0	grey0
+  0   0   0	grey0
+  0   0   4	Untitled
+  0   0  12	Untitled
+  0   0  16	Untitled
+  0   0  24	Untitled
+  0   0  32	Untitled
+  0   0  36	Untitled
+  0   0  44	Untitled
+  0   0  48	Untitled
+  0   0  56	Untitled
+  0   0  64	Untitled
+  0   0  68	Untitled
+  0   0  76	Untitled
+  0   0  80	Untitled
+  0   0  88	Untitled
+  0   0  96	Untitled
+  0   0 100	Untitled
+  0   0 108	Untitled
+  0   0 116	Untitled
+  0   0 120	Untitled
+  0   0 128	NavyBlue
+  0   0 132	Untitled
+  0   0 140	Untitled
+  0   0 148	Untitled
+  0   0 152	Untitled
+  0   0 160	Untitled
+  0   0 164	Untitled
+  0   0 172	Untitled
+  0   0 180	Untitled
+  0   0 184	Untitled
+  0   0 192	Untitled
+  0   0 200	Untitled
+  0   4 200	Untitled
+  0  12 200	Untitled
+  0  16 204	Untitled
+  0  24 204	Untitled
+  0  28 208	Untitled
+  0  36 208	Untitled
+  0  40 208	Untitled
+  0  48 212	Untitled
+  0  56 212	Untitled
+  0  60 216	Untitled
+  0  68 216	Untitled
+  0  72 216	Untitled
+  0  80 220	Untitled
+  0  84 220	Untitled
+  0  92 224	Untitled
+  0 100 224	Untitled
+  0 104 224	Untitled
+  0 112 228	Untitled
+  0 116 228	Untitled
+  0 124 232	Untitled
+  0 128 232	Untitled
+  0 136 232	Untitled
+  0 140 236	Untitled
+  0 148 236	Untitled
+  0 156 240	Untitled
+  0 160 240	Untitled
+  0 168 240	Untitled
+  0 172 244	Untitled
+  0 180 244	Untitled
+  0 184 248	Untitled
+  0 192 248	Untitled
+  0 200 252	Untitled
+  4 200 252	Untitled
+ 12 200 252	Untitled
+ 20 204 252	Untitled
+ 28 204 252	Untitled
+ 36 208 252	Untitled
+ 44 208 252	Untitled
+ 52 208 252	Untitled
+ 60 212 252	Untitled
+ 68 212 252	Untitled
+ 76 216 252	Untitled
+ 84 216 252	Untitled
+ 92 216 252	Untitled
+100 220 252	Untitled
+108 220 252	Untitled
+116 224 252	Untitled
+124 224 252	Untitled
+132 224 252	Untitled
+140 228 252	Untitled
+148 228 252	Untitled
+156 232 252	Untitled
+164 232 252	Untitled
+172 232 252	Untitled
+180 236 252	Untitled
+188 236 252	Untitled
+196 240 252	Untitled
+204 240 252	Untitled
+212 240 252	Untitled
+220 244 252	Untitled
+228 244 252	Untitled
+236 248 252	Untitled
+244 248 252	Untitled
+252 252 252	 		grey99
+248 252 252	Untitled
+244 252 252	Untitled
+240 252 252	Untitled
+232 252 252	Untitled
+228 252 252	Untitled
+224 252 252	Untitled
+216 252 252	Untitled
+212 252 252	Untitled
+208 252 252	Untitled
+200 252 252	Untitled
+196 252 252	Untitled
+192 252 252	Untitled
+184 252 252	Untitled
+180 252 252	Untitled
+176 252 252	Untitled
+168 252 252	Untitled
+164 252 252	Untitled
+160 252 252	Untitled
+156 252 252	Untitled
+148 252 252	Untitled
+144 252 252	Untitled
+140 252 252	Untitled
+132 252 252	Untitled
+128 252 252	Untitled
+124 252 252	Untitled
+116 252 252	Untitled
+112 252 252	Untitled
+108 252 252	Untitled
+100 252 252	Untitled
+ 96 252 252	Untitled
+ 92 252 252	Untitled
+ 84 252 252	Untitled
+ 80 252 252	Untitled
+ 76 252 252	Untitled
+ 72 252 252	Untitled
+ 64 252 252	Untitled
+ 60 252 252	Untitled
+ 56 252 252	Untitled
+ 48 252 252	Untitled
+ 44 252 252	Untitled
+ 40 252 252	Untitled
+ 32 252 252	Untitled
+ 28 252 252	Untitled
+ 24 252 252	Untitled
+ 16 252 252	Untitled
+ 12 252 252	Untitled
+  8 252 252	Untitled
+  0 252 252	Untitled
+  0 248 252	Untitled
+  0 244 252	Untitled
+  0 240 252	Untitled
+  0 232 252	Untitled
+  0 228 252	Untitled
+  0 224 252	Untitled
+  0 216 252	Untitled
+  0 212 252	Untitled
+  0 208 252	Untitled
+  0 200 252	Untitled
+  0 196 252	Untitled
+  0 192 252	Untitled
+  0 184 252	Untitled
+  0 180 252	Untitled
+  0 176 252	Untitled
+  0 168 252	Untitled
+  0 164 252	Untitled
+  0 160 252	Untitled
+  0 156 252	Untitled
+  0 148 252	Untitled
+  0 144 252	Untitled
+  0 140 252	Untitled
+  0 132 252	Untitled
+  0 128 252	Untitled
+  0 124 252	Untitled
+  0 116 252	Untitled
+  0 112 252	Untitled
+  0 108 252	Untitled
+  0 100 252	Untitled
+  0  96 252	Untitled
+  0  92 252	Untitled
+  0  84 252	Untitled
+  0  80 252	Untitled
+  0  76 252	Untitled
+  0  72 252	Untitled
+  0  64 252	Untitled
+  0  60 252	Untitled
+  0  56 252	Untitled
+  0  48 252	Untitled
+  0  44 252	Untitled
+  0  40 252	Untitled
+  0  32 252	Untitled
+  0  28 252	Untitled
+  0  24 252	Untitled
+  0  16 252	Untitled
+  0  12 252	Untitled
+  0   8 252	Untitled
+  0   0 252	Untitled
+  0   0 248	Untitled
+  0   0 244	Untitled
+  0   0 240	Untitled
+  0   0 236	Untitled
+  0   0 232	Untitled
+  0   0 228	Untitled
+  0   0 224	Untitled
+  0   0 220	Untitled
+  0   0 216	Untitled
+  0   0 212	Untitled
+  0   0 208	Untitled
+  0   0 204	Untitled
+  0   0 200	Untitled
+  0   0 196	Untitled
+  0   0 192	Untitled
+  0   0 188	Untitled
+  0   0 184	Untitled
+  0   0 180	Untitled
+  0   0 176	Untitled
+  0   0 172	Untitled
+  0   0 168	Untitled
+  0   0 164	Untitled
+  0   0 160	Untitled
+  0   0 156	Untitled
+  0   0 152	Untitled
+  0   0 148	Untitled
+  0   0 144	Untitled
+  0   0 140	Untitled
+  0   0 136	Untitled
+  0   0 132	Untitled
+  0   0 128	NavyBlue
+  0   0 124	Untitled
+  0   0 120	Untitled
+  0   0 116	Untitled
+  0   0 112	Untitled
+  0   0 108	Untitled
+  0   0 104	Untitled
+  0   0 100	Untitled
+  0   0  96	Untitled
+  0   0  92	Untitled
+  0   0  88	Untitled
+  0   0  84	Untitled
+  0   0  80	Untitled
+  0   0  76	Untitled
+  0   0  72	Untitled
+  0   0  68	Untitled
+  0   0  64	Untitled
+  0   0  60	Untitled
+  0   0  56	Untitled
+  0   0  52	Untitled
+  0   0  48	Untitled
+  0   0  44	Untitled
+  0   0  40	Untitled
+  0   0  36	Untitled
+  0   0  32	Untitled
+  0   0  28	Untitled
+  0   0  24	Untitled
+  0   0  20	Untitled
+  0   0  16	Untitled
+  0   0  12	Untitled
+  0   0   8	Untitled
+  0   0   0	grey0
+  0   0   0	grey0
diff --git a/chalk/data/palettes/Borders.gpl b/chalk/data/palettes/Borders.gpl
new file mode 100644
index 000000000..424d6b6d9
--- /dev/null
+++ b/chalk/data/palettes/Borders.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Borders
+#
+204  52 180	Untitled
+204  52 180	Untitled
+204  52 184	Untitled
+204  48 188	Untitled
+200  48 192	Untitled
+200  44 200	Untitled
+200  44 204	Untitled
+196  40 208	Untitled
+196  40 212	Untitled
+196  36 220	Untitled
+192  36 224	Untitled
+192  32 228	Untitled
+192  32 232	Untitled
+188  28 240	Untitled
+188  28 244	Untitled
+188  24 248	Untitled
+188  24 252	Untitled
+192  28 248	Untitled
+192  32 248	Untitled
+196  36 248	Untitled
+196  40 244	Untitled
+200  44 244	Untitled
+200  48 244	Untitled
+204  48 240	Untitled
+204  52 240	Untitled
+208  56 240	Untitled
+208  60 236	Untitled
+212  64 236	Untitled
+212  68 236	Untitled
+216  72 236	Untitled
+216  72 232	Untitled
+220  76 232	Untitled
+220  80 232	Untitled
+224  84 228	Untitled
+224  88 228	Untitled
+228  92 228	Untitled
+228  92 224	Untitled
+232  96 224	Untitled
+232 100 224	Untitled
+236 104 224	Untitled
+236 108 220	Untitled
+240 112 220	Untitled
+240 116 220	Untitled
+244 116 216	Untitled
+244 120 216	Untitled
+248 124 216	Untitled
+248 128 212	Untitled
+252 132 212	Untitled
+252 136 212	Untitled
+252 136 212	Untitled
+244 132 208	Untitled
+236 128 204	Untitled
+232 124 200	Untitled
+224 120 196	Untitled
+216 116 192	Untitled
+212 112 188	Untitled
+204 112 184	Untitled
+200 108 180	Untitled
+192 104 176	Untitled
+184 100 172	Untitled
+180  96 168	Untitled
+172  92 164	Untitled
+168  92 160	Untitled
+160  88 156	Untitled
+152  84 152	Untitled
+148  80 148	Untitled
+140  76 144	Untitled
+132  72 140	Untitled
+128  68 136	Untitled
+120  68 132	Untitled
+116  64 128	Untitled
+108  60 124	Untitled
+100  56 120	Untitled
+ 96  52 116	Untitled
+ 88  48 112	Untitled
+ 84  48 108	Untitled
+ 76  44 104	Untitled
+ 68  40 100	Untitled
+ 64  36  96	Untitled
+ 56  32  92	Untitled
+ 48  28  88	Untitled
+ 44  24  84	Untitled
+ 36  24  80	Untitled
+ 32  20  76	Untitled
+ 24  16  72	Untitled
+ 16  12  68	Untitled
+ 12   8  64	Untitled
+  4   4  60	Untitled
+  0   4  60	Untitled
+  4  12  56	Untitled
+  8  16  56	Untitled
+  8  20  56	Untitled
+ 12  28  52	Untitled
+ 12  32  52	Untitled
+ 16  36  52	Untitled
+ 16  40  48	Untitled
+ 20  48  48	Untitled
+ 20  52  48	Untitled
+ 24  56  44	Untitled
+ 24  64  44	Untitled
+ 28  68  44	Untitled
+ 28  72  40	Untitled
+ 32  76  40	Untitled
+ 32  84  40	Untitled
+ 36  88  36	Untitled
+ 36  92  36	Untitled
+ 40 100  36	Untitled
+ 40 104  36	Untitled
+ 44 108  32	Untitled
+ 44 112  32	Untitled
+172  24  56	Untitled
+160  20  52	Untitled
+152  20  52	Untitled
+144  20  48	Untitled
+136  16  48	Untitled
+128  16  44	Untitled
+120  16  44	Untitled
+108  16  40	Untitled
+100  12  40	Untitled
+ 92  12  40	Untitled
+ 84  12  36	Untitled
+ 76   8  36	Untitled
+ 68   8  32	Untitled
+ 56   8  32	Untitled
+ 48   8  28	Untitled
+ 40   4  28	Untitled
+ 32   4  24	Untitled
+ 24   4  24	Untitled
+ 16   4  24	Untitled
+ 20  12  28	Untitled
+ 24  16  32	Untitled
+ 24  20  36	Untitled
+ 28  24  40	Untitled
+ 32  28  44	Untitled
+ 32  32  48	Untitled
+ 36  36  52	Untitled
+ 36  40  56	Untitled
+ 40  44  56	Untitled
+ 44  48  60	Untitled
+ 44  52  64	Untitled
+ 48  56  68	Untitled
+ 48  60  72	Untitled
+ 52  64  76	Untitled
+ 56  68  80	Untitled
+ 56  72  84	Untitled
+ 60  76  88	Untitled
+ 60  80  88	Untitled
+ 64  88  92	Untitled
+ 68  92  96	Untitled
+ 68  96 100	Untitled
+ 72 100 104	Untitled
+ 76 104 108	Untitled
+ 76 108 112	Untitled
+ 80 112 116	Untitled
+ 80 116 120	Untitled
+ 84 120 120	Untitled
+ 88 124 124	Untitled
+ 88 128 128	Untitled
+ 92 132 132	Untitled
+ 92 136 136	Untitled
+ 96 140 140	Untitled
+100 144 144	Untitled
+100 148 148	Untitled
+104 152 152	Untitled
+104 156 152	Untitled
+ 96 148 148	Untitled
+ 88 144 148	Untitled
+ 84 140 144	Untitled
+ 76 136 144	Untitled
+ 72 132 140	Untitled
+ 64 128 140	Untitled
+ 60 124 136	Untitled
+ 52 120 136	Untitled
+ 44 116 136	Untitled
+ 40 112 132	Untitled
+ 32 108 132	Untitled
+ 28 104 128	Untitled
+ 20 100 128	Untitled
+ 16  96 124	Untitled
+  8  92 124	Untitled
+  4  88 124	Untitled
+ 12  92 120	Untitled
+ 16  92 116	Untitled
+ 24  92 116	Untitled
+ 28  92 112	Untitled
+ 32  92 112	Untitled
+ 40  96 108	Untitled
+ 44  96 104	Untitled
+ 48  96 104	Untitled
+ 56  96 100	Untitled
+ 60  96 100	Untitled
+ 64  96  96	Untitled
+ 72 100  96	Untitled
+ 76 100  92	Untitled
+ 80 100  88	Untitled
+ 88 100  88	Untitled
+ 92 100  84	Untitled
+100 104  84	Untitled
+104 104  80	Untitled
+108 104  80	Untitled
+116 104  76	Untitled
+120 104  72	Untitled
+124 104  72	Untitled
+132 108  68	Untitled
+136 108  68	Untitled
+140 108  64	Untitled
+148 108  60	Untitled
+152 108  60	Untitled
+156 108  56	Untitled
+164 112  56	Untitled
+168 112  52	Untitled
+176 112  52	Untitled
+180 112  48	Untitled
+184 112  44	Untitled
+192 116  44	Untitled
+196 116  40	Untitled
+200 116  40	Untitled
+208 116  36	Untitled
+212 116  36	Untitled
+216 116  32	Untitled
+224 120  28	Untitled
+228 120  28	Untitled
+232 120  24	Untitled
+240 120  24	Untitled
+244 120  20	Untitled
+248 120  20	Untitled
+244 116  28	Untitled
+244 112  32	Untitled
+244 112  36	Untitled
+240 108  44	Untitled
+240 108  48	Untitled
+240 104  52	Untitled
+236 104  56	Untitled
+236 100  64	Untitled
+236 100  68	Untitled
+232  96  72	Untitled
+232  96  76	Untitled
+232  92  84	Untitled
+228  92  88	Untitled
+228  88  92	Untitled
+228  88  96	Untitled
+224  84 104	Untitled
+224  84 108	Untitled
+224  80 112	Untitled
+220  80 116	Untitled
+220  76 124	Untitled
+220  76 128	Untitled
+216  72 132	Untitled
+216  72 136	Untitled
+216  68 144	Untitled
+212  64 148	Untitled
+212  64 152	Untitled
+212  60 160	Untitled
+208  60 164	Untitled
+208  56 168	Untitled
+208  56 172	Untitled
diff --git a/chalk/data/palettes/Browns_And_Yellows.gpl b/chalk/data/palettes/Browns_And_Yellows.gpl
new file mode 100644
index 000000000..bd100e279
--- /dev/null
+++ b/chalk/data/palettes/Browns_And_Yellows.gpl
@@ -0,0 +1,25 @@
+GIMP Palette
+Name: Browns and Yellows
+#
+189 183 107	Dark Khaki
+240 230 140	Khaki
+238 232 170	Pale Goldenrod
+250 250 210	Light Goldenrod Yellow
+255 255 224	Light Yellow
+255 255   0	Yellow
+255 215   0	Gold
+238 221 130	Light Goldenrod
+218 165  32	Goldenrod
+184 134  11	Dark Goldenrod
+188 143 143	Rosy Brown
+139  69  19	Saddle Brown
+160  82  45	Sienna
+205 133  63	Peru
+222 184 135	Burlywood
+245 245 220	Beige
+245 222 179	Wheat
+244 164  96	Sandy Brown
+210 180 140	Tan
+210 105  30	Chocolate
+255 165   0	Orange
+255 140   0	Dark Orange
diff --git a/chalk/data/palettes/Caramel.gpl b/chalk/data/palettes/Caramel.gpl
new file mode 100644
index 000000000..2ee783dea
--- /dev/null
+++ b/chalk/data/palettes/Caramel.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Caramel
+#
+ 48  48  48	grey19
+164 136 192	Untitled
+172 140 192	Untitled
+180 144 192	Untitled
+188 148 192	Untitled
+196 152 192	Untitled
+204 152 192	Untitled
+212 156 192	Untitled
+220 160 192	Untitled
+228 164 192	Untitled
+236 168 192	Untitled
+228 160 188	Untitled
+216 148 184	Untitled
+204 136 180	Untitled
+192 124 176	Untitled
+180 112 168	Untitled
+168 104 164	Untitled
+156  92 160	Untitled
+144  80 156	Untitled
+132  68 152	Untitled
+120  56 144	Untitled
+140  84 140	Untitled
+160 116 132	Untitled
+180 144 128	Untitled
+200 176 120	Untitled
+224 208 112	Untitled
+212 200 120	Untitled
+196 188 132	Untitled
+184 176 144	Untitled
+168 168 156	Untitled
+156 156 164	Untitled
+140 144 176	Untitled
+128 136 188	Untitled
+112 124 200	Untitled
+ 96 112 212	Untitled
+108 112 192	Untitled
+124 116 172	Untitled
+136 116 148	Untitled
+152 120 128	Untitled
+168 120 108	Untitled
+180 124  84	Untitled
+196 124  64	Untitled
+212 128  40	Untitled
+212 128  44	Untitled
+212 132  48	Untitled
+212 136  52	Untitled
+212 140  56	Untitled
+216 144  60	Untitled
+216 148  64	Untitled
+216 148  68	Untitled
+216 152  72	Untitled
+220 156  76	Untitled
+220 160  80	Untitled
+220 164  84	Untitled
+220 168  88	Untitled
+224 168  92	Untitled
+224 172  96	Untitled
+224 176 100	Untitled
+224 180 104	Untitled
+228 184 108	Untitled
+228 188 112	Untitled
+228 188 116	Untitled
+228 192 120	Untitled
+232 196 124	Untitled
+232 200 128	Untitled
+232 204 132	Untitled
+232 208 136	Untitled
+236 212 140	Untitled
+232 208 140	Untitled
+224 204 140	Untitled
+216 196 140	Untitled
+208 192 136	Untitled
+200 188 136	Untitled
+192 180 136	Untitled
+188 176 132	Untitled
+180 172 132	Untitled
+172 164 132	Untitled
+164 160 128	Untitled
+156 156 128	Untitled
+148 148 128	Untitled
+144 144 124	Untitled
+136 136 124	Untitled
+128 132 124	Untitled
+120 128 120	Untitled
+112 120 120	Untitled
+104 116 120	Untitled
+100 112 116	Untitled
+ 92 104 116	Untitled
+ 84 100 116	Untitled
+ 76  96 112	Untitled
+ 68  88 112	Untitled
+ 60  84 112	Untitled
+ 52  76 108	Untitled
+ 56  80 108	Untitled
+ 60  88 108	Untitled
+ 64  96 108	Untitled
+ 72 100 108	Untitled
+ 76 108 108	Untitled
+ 80 116 108	Untitled
+ 88 120 108	Untitled
+ 92 128 108	Untitled
+ 96 136 108	Untitled
+104 144 104	Untitled
+108 148 104	Untitled
+112 156 104	Untitled
+116 164 104	Untitled
+124 168 104	Untitled
+128 176 104	Untitled
+132 184 104	Untitled
+140 188 104	Untitled
+144 196 104	Untitled
+148 204 104	Untitled
+156 212 100	Untitled
+156 208 100	Untitled
+156 204 100	Untitled
+156 200  96	Untitled
+156 196  96	Untitled
+156 192  92	Untitled
+156 188  92	Untitled
+156 184  88	Untitled
+156 180  88	Untitled
+156 176  84	Untitled
+156 172  84	Untitled
+156 168  80	Untitled
+156 164  80	Untitled
+156 160  76	Untitled
+156 156  76	Untitled
+156 152  72	Untitled
+156 148  72	Untitled
+156 144  68	Untitled
+156 140  68	Untitled
+156 136  64	Untitled
+156 132  64	Untitled
+156 124  60	Untitled
+160 124  72	Untitled
+164 128  84	Untitled
+168 132  96	Untitled
+176 136 112	Untitled
+180 136 124	Untitled
+184 140 136	Untitled
+188 144 148	Untitled
+196 148 164	Untitled
+196 148 164	Untitled
+196 148 160	Untitled
+196 144 156	Untitled
+196 144 152	Untitled
+192 140 148	Untitled
+192 140 144	Untitled
+192 140 140	Untitled
+192 136 136	Untitled
+192 136 132	Untitled
+188 132 128	Untitled
+188 132 124	Untitled
+188 132 120	Untitled
+188 128 116	Untitled
+184 128 112	Untitled
+184 124 108	Untitled
+184 124 104	Untitled
+184 124 104	Untitled
+184 120 100	Untitled
+180 120  96	Untitled
+180 116  92	Untitled
+180 116  88	Untitled
+180 116  84	Untitled
+176 112  80	Untitled
+176 112  76	Untitled
+176 108  72	Untitled
+176 108  68	Untitled
+176 108  64	Untitled
+172 104  60	Untitled
+172 104  56	Untitled
+172 100  52	Untitled
+172 100  48	Untitled
+168  96  44	Untitled
+160  96  44	Untitled
+152  96  48	Untitled
+140 100  52	Untitled
+132 100  56	Untitled
+120 100  60	Untitled
+112 104  60	Untitled
+100 104  64	Untitled
+ 92 104  68	Untitled
+ 80 108  72	Untitled
+ 72 108  76	Untitled
+ 60 108  80	Untitled
+ 52 112  80	Untitled
+ 40 112  84	Untitled
+ 32 112  88	Untitled
+ 20 116  92	Untitled
+ 12 116  96	Untitled
+  0 120 100	Untitled
+  0 120 100	Untitled
+  0 116 100	Untitled
+  0 112 104	Untitled
+  0 112 104	Untitled
+  0 108 104	Untitled
+  0 104 108	Untitled
+  0 104 108	Untitled
+  0 100 112	Untitled
+  0  96 112	Untitled
+  0  96 112	Untitled
+  0  92 116	Untitled
+  4  88 116	Untitled
+  4  84 120	Untitled
+  4  84 120	Untitled
+  4  80 120	Untitled
+  4  76 124	Untitled
+  4  76 124	Untitled
+  4  72 128	Untitled
+  4  68 128	Untitled
+  4  68 128	Untitled
+  4  64 132	Untitled
+  4  60 132	Untitled
+  8  56 136	Untitled
+ 28  60 136	Untitled
+ 48  68 140	Untitled
+ 72  76 144	Untitled
+ 92  80 148	Untitled
+116  88 152	Untitled
+136  96 156	Untitled
+160 100 160	Untitled
+180 108 164	Untitled
+204 116 168	Untitled
+204 116 168	Untitled
+204 120 168	Untitled
+200 124 168	Untitled
+200 128 168	Untitled
+200 128 168	Untitled
+196 132 168	Untitled
+196 136 168	Untitled
+192 140 168	Untitled
+192 140 168	Untitled
+192 144 168	Untitled
+188 148 168	Untitled
+188 152 168	Untitled
+184 156 168	Untitled
+184 156 168	Untitled
+184 160 168	Untitled
+180 164 168	Untitled
+180 168 168	Untitled
+180 168 168	Untitled
+176 172 168	Untitled
+176 176 168	Untitled
+172 180 168	Untitled
+172 184 168	Untitled
+172 184 168	Untitled
+168 188 168	Untitled
+168 192 168	Untitled
+164 196 168	Untitled
+164 196 168	Untitled
+164 200 168	Untitled
+160 204 168	Untitled
+160 208 168	Untitled
+156 212 164	Untitled
+148 212 168	Untitled
+136 216 176	Untitled
diff --git a/chalk/data/palettes/Cascade.gpl b/chalk/data/palettes/Cascade.gpl
new file mode 100644
index 000000000..1c8e7e593
--- /dev/null
+++ b/chalk/data/palettes/Cascade.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Cascade
+#
+108  88 128	Untitled
+108  88 128	Untitled
+108  88 128	Untitled
+104  92 132	Untitled
+104  92 132	Untitled
+100  92 132	Untitled
+ 96  92 132	Untitled
+ 96  96 136	Untitled
+ 92  96 136	Untitled
+ 92  96 136	Untitled
+ 88  96 136	Untitled
+ 84 100 140	Untitled
+ 84 100 140	Untitled
+ 80 100 140	Untitled
+ 76  96 136	Untitled
+ 80 100 140	Untitled
+ 84 104 144	Untitled
+ 88 104 148	Untitled
+ 92 108 148	Untitled
+ 96 112 152	Untitled
+100 112 156	Untitled
+104 116 160	Untitled
+108 116 160	Untitled
+112 120 164	Untitled
+116 124 168	Untitled
+120 124 168	Untitled
+124 128 172	Untitled
+128 128 176	Untitled
+132 132 180	Untitled
+136 136 180	Untitled
+140 136 184	Untitled
+144 140 188	Untitled
+148 140 188	Untitled
+152 144 192	Untitled
+156 148 196	Untitled
+160 148 200	Untitled
+164 152 200	Untitled
+168 156 204	Untitled
+172 156 208	Untitled
+176 160 212	Untitled
+180 160 212	Untitled
+184 164 216	Untitled
+188 168 220	Untitled
+192 168 220	Untitled
+196 172 224	Untitled
+200 172 228	Untitled
+204 176 232	Untitled
+208 180 232	Untitled
+212 180 236	Untitled
+216 184 240	Untitled
+220 184 240	Untitled
+216 180 236	Untitled
+216 180 236	Untitled
+216 180 236	Untitled
+212 180 236	Untitled
+212 180 236	Untitled
+212 180 236	Untitled
+212 180 236	Untitled
+208 180 232	Untitled
+208 176 232	Untitled
+208 176 232	Untitled
+208 176 232	Untitled
+204 176 232	Untitled
+204 176 232	Untitled
+204 176 232	Untitled
+200 176 232	Untitled
+200 176 228	Untitled
+200 176 228	Untitled
+200 172 228	Untitled
+196 172 228	Untitled
+196 172 228	Untitled
+196 172 228	Untitled
+196 172 228	Untitled
+192 172 228	Untitled
+192 172 224	Untitled
+192 172 224	Untitled
+188 172 224	Untitled
+188 168 224	Untitled
+188 168 224	Untitled
+188 168 224	Untitled
+184 168 224	Untitled
+184 168 224	Untitled
+184 168 220	Untitled
+184 168 220	Untitled
+180 168 220	Untitled
+180 168 220	Untitled
+180 164 220	Untitled
+176 164 220	Untitled
+176 164 220	Untitled
+176 164 220	Untitled
+176 164 216	Untitled
+172 164 216	Untitled
+172 164 216	Untitled
+172 164 216	Untitled
+172 160 216	Untitled
+168 160 216	Untitled
+168 160 216	Untitled
+168 160 216	Untitled
+164 160 212	Untitled
+164 160 212	Untitled
+164 160 212	Untitled
+164 160 212	Untitled
+160 160 212	Untitled
+160 156 212	Untitled
+160 156 212	Untitled
+160 156 212	Untitled
+156 156 208	Untitled
+156 156 208	Untitled
+156 156 208	Untitled
+152 156 208	Untitled
+152 156 208	Untitled
+152 156 208	Untitled
+152 152 208	Untitled
+148 152 208	Untitled
+148 152 204	Untitled
+148 152 204	Untitled
+148 152 204	Untitled
+144 152 204	Untitled
+144 152 204	Untitled
+144 152 204	Untitled
+140 152 204	Untitled
+140 148 204	Untitled
+140 148 200	Untitled
+140 148 200	Untitled
+136 148 200	Untitled
+136 148 200	Untitled
+136 148 200	Untitled
+136 148 200	Untitled
+132 148 200	Untitled
+132 148 200	Untitled
+132 144 196	Untitled
+128 144 196	Untitled
+128 144 196	Untitled
+128 144 196	Untitled
+128 144 196	Untitled
+124 144 196	Untitled
+124 144 196	Untitled
+124 144 192	Untitled
+124 140 192	Untitled
+120 140 192	Untitled
+120 140 192	Untitled
+120 140 192	Untitled
+116 140 192	Untitled
+116 140 192	Untitled
+116 140 192	Untitled
+116 140 188	Untitled
+112 140 188	Untitled
+112 136 188	Untitled
+112 136 188	Untitled
+112 136 188	Untitled
+108 136 188	Untitled
+108 136 188	Untitled
+108 136 188	Untitled
+104 136 184	Untitled
+104 136 184	Untitled
+104 136 184	Untitled
+104 132 184	Untitled
+100 132 184	Untitled
+100 132 184	Untitled
+100 132 184	Untitled
+100 132 184	Untitled
+ 96 132 180	Untitled
+ 96 132 180	Untitled
+ 96 132 180	Untitled
+ 92 132 180	Untitled
+ 92 128 180	Untitled
+ 92 128 180	Untitled
+ 92 128 180	Untitled
+ 88 128 180	Untitled
+ 88 128 176	Untitled
+ 88 128 176	Untitled
+ 88 128 176	Untitled
+ 84 128 176	Untitled
+ 84 124 176	Untitled
+ 84 124 176	Untitled
+ 80 124 176	Untitled
+ 80 124 176	Untitled
+ 80 124 172	Untitled
+ 80 124 172	Untitled
+ 76 124 172	Untitled
+ 76 124 172	Untitled
+ 76 124 172	Untitled
+ 76 120 172	Untitled
+ 72 120 172	Untitled
+ 72 120 172	Untitled
+ 72 120 168	Untitled
+ 68 120 168	Untitled
+ 68 120 168	Untitled
+ 68 120 168	Untitled
+ 68 120 168	Untitled
+ 64 120 168	Untitled
+ 64 116 168	Untitled
+ 64 116 168	Untitled
+ 64 116 164	Untitled
+ 60 116 164	Untitled
+ 60 116 164	Untitled
+ 60 116 164	Untitled
+ 56 116 164	Untitled
+ 56 116 164	Untitled
+ 56 116 164	Untitled
+ 56 112 164	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 48 112 160	Untitled
+ 48 112 160	Untitled
+ 48 112 160	Untitled
+ 44 116 156	Untitled
+ 48 112 160	Untitled
+ 48 112 160	Untitled
+ 48 112 160	Untitled
+ 48 112 160	Untitled
+ 48 112 160	Untitled
+ 48 112 160	Untitled
+ 48 112 160	Untitled
+ 48 112 160	Untitled
+ 48 112 160	Untitled
+ 48 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 52 112 160	Untitled
+ 56 112 160	Untitled
+ 56 112 160	Untitled
+ 56 112 160	Untitled
+ 56 112 160	Untitled
+ 56 112 160	Untitled
+160  68 108	Untitled
+156  68 108	Untitled
+156  68 108	Untitled
+152  72 112	Untitled
+152  72 112	Untitled
+148  72 112	Untitled
+144  72 112	Untitled
+144  76 116	Untitled
+140  76 116	Untitled
+140  76 116	Untitled
+136  76 116	Untitled
+132  80 120	Untitled
+132  80 120	Untitled
+128  80 120	Untitled
+128  80 120	Untitled
+124  84 124	Untitled
+120  84 124	Untitled
+120  84 124	Untitled
+116  84 124	Untitled
+116  88 128	Untitled
+112  88 128	Untitled
diff --git a/chalk/data/palettes/China.gpl b/chalk/data/palettes/China.gpl
new file mode 100644
index 000000000..670578ad6
--- /dev/null
+++ b/chalk/data/palettes/China.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: China
+#
+224  76 240	Untitled
+224  76 240	Untitled
+224  80 240	Untitled
+224  84 240	Untitled
+228  88 240	Untitled
+228  92 240	Untitled
+228  96 240	Untitled
+228  96 240	Untitled
+228 100 240	Untitled
+228 104 240	Untitled
+228 108 240	Untitled
+232 112 240	Untitled
+232 116 240	Untitled
+232 120 240	Untitled
+232 120 240	Untitled
+232 124 240	Untitled
+232 128 240	Untitled
+232 132 240	Untitled
+232 136 240	Untitled
+236 140 240	Untitled
+236 140 240	Untitled
+236 144 240	Untitled
+236 148 240	Untitled
+236 152 240	Untitled
+236 156 240	Untitled
+236 160 240	Untitled
+240 164 240	Untitled
+232 156 236	Untitled
+220 148 232	Untitled
+208 140 228	Untitled
+196 128 220	Untitled
+184 120 216	Untitled
+172 112 212	Untitled
+160 104 208	Untitled
+148  92 200	Untitled
+136  68 204	Untitled
+124  40 208	Untitled
+108  12 216	Untitled
+108  12 216	Untitled
+108  12 216	Untitled
+108  12 216	Untitled
+108  12 216	Untitled
+112   8 216	Untitled
+112   8 216	Untitled
+112   8 216	Untitled
+112   8 216	Untitled
+112   8 216	Untitled
+116   4 216	Untitled
+116   4 216	Untitled
+116   4 216	Untitled
+116   4 216	Untitled
+120   0 216	Untitled
+120  12 216	Untitled
+124  24 220	Untitled
+128  36 224	Untitled
+128  48 228	Untitled
+132  64 232	Untitled
+136  76 232	Untitled
+136  88 236	Untitled
+140 100 240	Untitled
+144 112 244	Untitled
+148 128 248	Untitled
+148 128 248	Untitled
+148 128 248	Untitled
+148 132 248	Untitled
+148 132 248	Untitled
+148 132 248	Untitled
+148 136 248	Untitled
+148 136 248	Untitled
+144 136 248	Untitled
+144 140 248	Untitled
+144 140 248	Untitled
+144 140 248	Untitled
+144 144 248	Untitled
+144 144 248	Untitled
+144 144 248	Untitled
+144 148 248	Untitled
+140 148 248	Untitled
+140 152 248	Untitled
+140 152 248	Untitled
+140 152 248	Untitled
+140 156 248	Untitled
+140 156 248	Untitled
+140 156 248	Untitled
+140 160 248	Untitled
+136 160 248	Untitled
+136 160 248	Untitled
+136 164 248	Untitled
+136 164 248	Untitled
+136 164 248	Untitled
+136 168 248	Untitled
+136 168 248	Untitled
+132 172 244	Untitled
+132 168 244	Untitled
+128 164 244	Untitled
+128 160 244	Untitled
+124 156 244	Untitled
+124 152 244	Untitled
+120 148 244	Untitled
+120 144 244	Untitled
+116 136 244	Untitled
+116 132 244	Untitled
+112 128 244	Untitled
+112 124 244	Untitled
+108 120 244	Untitled
+108 116 244	Untitled
+104 112 244	Untitled
+104 108 244	Untitled
+100 100 244	Untitled
+100  96 244	Untitled
+ 96  92 244	Untitled
+ 96  88 244	Untitled
+ 92  84 244	Untitled
+ 92  80 244	Untitled
+ 88  76 244	Untitled
+ 88  68 244	Untitled
+ 84  64 244	Untitled
+ 84  60 244	Untitled
+ 80  56 244	Untitled
+ 80  52 244	Untitled
+ 76  48 244	Untitled
+ 76  44 244	Untitled
+ 72  40 244	Untitled
+ 72  32 244	Untitled
+ 68  28 244	Untitled
+ 68  24 244	Untitled
+ 64  20 244	Untitled
+ 64  16 244	Untitled
+ 60  12 244	Untitled
+ 60   8 244	Untitled
+ 56   0 248	Untitled
+ 56   4 248	Untitled
+ 56   8 244	Untitled
+ 52  16 240	Untitled
+ 52  20 236	Untitled
+ 52  28 232	Untitled
+ 48  32 228	Untitled
+ 48  40 228	Untitled
+ 44  44 224	Untitled
+ 44  52 220	Untitled
+ 44  56 216	Untitled
+ 40  64 212	Untitled
+ 40  68 208	Untitled
+ 36  76 204	Untitled
+ 36  80 204	Untitled
+ 36  84 200	Untitled
+ 32  92 196	Untitled
+ 32  96 192	Untitled
+ 32 104 188	Untitled
+ 28 108 184	Untitled
+ 28 116 184	Untitled
+ 24 120 180	Untitled
+ 24 128 176	Untitled
+ 24 132 172	Untitled
+ 20 140 168	Untitled
+ 20 144 164	Untitled
+ 16 152 160	Untitled
+ 20 152 160	Untitled
+ 24 152 160	Untitled
+ 28 152 160	Untitled
+ 32 152 160	Untitled
+ 40 148 164	Untitled
+ 44 148 164	Untitled
+ 48 148 164	Untitled
+ 52 148 164	Untitled
+ 56 148 168	Untitled
+ 64 144 168	Untitled
+ 68 144 168	Untitled
+ 72 144 168	Untitled
+ 76 144 172	Untitled
+ 80 144 172	Untitled
+ 88 140 172	Untitled
+ 92 140 172	Untitled
+ 96 140 176	Untitled
+100 140 176	Untitled
+108 136 176	Untitled
+112 136 176	Untitled
+116 136 176	Untitled
+120 136 180	Untitled
+124 136 180	Untitled
+132 132 180	Untitled
+136 132 180	Untitled
+140 132 184	Untitled
+144 132 184	Untitled
+148 132 184	Untitled
+156 128 184	Untitled
+160 128 188	Untitled
+164 128 188	Untitled
+168 128 188	Untitled
+172 128 188	Untitled
+180 124 192	Untitled
+184 124 192	Untitled
+188 124 192	Untitled
+192 124 192	Untitled
+200 120 196	Untitled
+160 132 176	Untitled
+116 148 152	Untitled
+ 76 160 128	Untitled
+ 32 176 104	Untitled
+ 32 176 104	Untitled
+ 36 172 104	Untitled
+ 40 168 108	Untitled
+ 44 164 108	Untitled
+ 48 160 108	Untitled
+ 52 156 112	Untitled
+ 56 152 112	Untitled
+ 60 148 112	Untitled
+ 64 144 116	Untitled
+ 68 140 116	Untitled
+ 72 136 120	Untitled
+ 76 132 120	Untitled
+ 80 128 120	Untitled
+ 84 124 124	Untitled
+ 88 120 124	Untitled
+ 92 116 124	Untitled
+ 96 112 128	Untitled
+100 108 128	Untitled
+104 104 128	Untitled
+108 100 132	Untitled
+108 100 132	Untitled
+112  96 136	Untitled
+116  92 136	Untitled
+120  88 136	Untitled
+124  84 140	Untitled
+128  80 140	Untitled
+132  76 140	Untitled
+136  72 144	Untitled
+140  68 144	Untitled
+144  64 144	Untitled
+148  60 148	Untitled
+152  56 148	Untitled
+156  52 152	Untitled
+160  48 152	Untitled
+164  44 152	Untitled
+168  40 156	Untitled
+172  36 156	Untitled
+176  32 156	Untitled
+180  28 160	Untitled
+184  24 160	Untitled
+188  20 164	Untitled
+188  24 164	Untitled
+184  28 164	Untitled
+180  32 164	Untitled
+176  36 164	Untitled
+176  40 164	Untitled
+172  48 164	Untitled
+168  52 164	Untitled
+164  56 164	Untitled
+164  60 164	Untitled
+160  64 164	Untitled
+156  72 164	Untitled
+152  76 164	Untitled
+152  80 164	Untitled
+148  84 164	Untitled
+144  88 164	Untitled
+140  96 168	Untitled
diff --git a/chalk/data/palettes/Coldfire.gpl b/chalk/data/palettes/Coldfire.gpl
new file mode 100644
index 000000000..6c25698ac
--- /dev/null
+++ b/chalk/data/palettes/Coldfire.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Coldfire
+#
+  0 172 252	Untitled
+  0 172 252	Untitled
+  0 172 252	Untitled
+  0 168 252	Untitled
+  0 164 252	Untitled
+  0 160 252	Untitled
+  0 156 252	Untitled
+  0 152 252	Untitled
+  0 152 252	Untitled
+  0 148 252	Untitled
+  0 144 252	Untitled
+  0 140 252	Untitled
+  0 136 252	Untitled
+  0 132 252	Untitled
+  0 132 252	Untitled
+  0 128 252	Untitled
+  0 124 252	Untitled
+  0 120 252	Untitled
+  0 116 252	Untitled
+  0 112 252	Untitled
+  0 112 252	Untitled
+  0 108 252	Untitled
+  0 104 252	Untitled
+  0 100 252	Untitled
+  0  96 252	Untitled
+  0  92 252	Untitled
+  0  92 252	Untitled
+  0  88 252	Untitled
+  0  84 252	Untitled
+  0  80 252	Untitled
+  0  76 252	Untitled
+  0  72 252	Untitled
+  0  68 252	Untitled
+  0  64 252	Untitled
+  0  60 252	Untitled
+  0  56 252	Untitled
+  0  52 252	Untitled
+  0  48 252	Untitled
+  0  44 252	Untitled
+  0  40 252	Untitled
+  0  36 252	Untitled
+  0  32 252	Untitled
+  0  28 252	Untitled
+  0  24 252	Untitled
+  0  20 252	Untitled
+  0  16 252	Untitled
+  0  12 252	Untitled
+  0   8 252	Untitled
+  0   4 252	Untitled
+  0   4 252	Untitled
+  4   4 248	Untitled
+  4   4 248	Untitled
+  8   4 244	Untitled
+  8   8 240	Untitled
+ 12   8 240	Untitled
+ 12   8 236	Untitled
+ 16   8 232	Untitled
+ 16  12 232	Untitled
+ 20  12 228	Untitled
+ 20  12 224	Untitled
+ 24  12 224	Untitled
+ 24  16 220	Untitled
+ 28  16 216	Untitled
+ 28  16 216	Untitled
+ 32  16 212	Untitled
+ 32  20 212	Untitled
+ 36  20 208	Untitled
+ 36  20 204	Untitled
+ 40  20 204	Untitled
+ 40  24 200	Untitled
+ 44  24 196	Untitled
+ 44  24 196	Untitled
+ 48  24 192	Untitled
+ 48  24 188	Untitled
+ 52  28 188	Untitled
+ 52  28 184	Untitled
+ 56  28 180	Untitled
+ 56  28 180	Untitled
+ 60  32 176	Untitled
+ 60  32 172	Untitled
+ 64  32 172	Untitled
+ 64  32 168	Untitled
+ 68  36 168	Untitled
+ 68  36 164	Untitled
+ 72  36 160	Untitled
+ 72  36 160	Untitled
+ 76  40 156	Untitled
+ 76  40 152	Untitled
+ 80  40 152	Untitled
+ 80  40 148	Untitled
+ 84  44 144	Untitled
+ 84  44 144	Untitled
+ 88  44 140	Untitled
+ 88  44 136	Untitled
+ 92  48 136	Untitled
+ 92  48 132	Untitled
+ 96  48 128	Untitled
+100  48 128	Untitled
+100  48 124	Untitled
+104  52 124	Untitled
+104  52 120	Untitled
+108  52 116	Untitled
+108  52 116	Untitled
+112  56 112	Untitled
+112  56 108	Untitled
+116  56 108	Untitled
+116  56 104	Untitled
+120  60 100	Untitled
+120  60 100	Untitled
+124  60  96	Untitled
+124  60  92	Untitled
+128  64  92	Untitled
+128  64  88	Untitled
+132  64  88	Untitled
+132  64  84	Untitled
+136  68  80	Untitled
+136  68  80	Untitled
+140  68  76	Untitled
+140  68  72	Untitled
+144  72  72	Untitled
+144  72  68	Untitled
+148  72  64	Untitled
+148  72  64	Untitled
+152  72  60	Untitled
+152  76  56	Untitled
+156  76  56	Untitled
+156  76  52	Untitled
+160  76  48	Untitled
+160  80  48	Untitled
+164  80  44	Untitled
+164  80  44	Untitled
+168  80  40	Untitled
+168  84  36	Untitled
+172  84  36	Untitled
+172  84  32	Untitled
+176  84  28	Untitled
+176  88  28	Untitled
+180  88  24	Untitled
+180  88  20	Untitled
+184  88  20	Untitled
+184  92  16	Untitled
+188  92  12	Untitled
+188  92  12	Untitled
+192  92   8	Untitled
+196  96   4	Untitled
+196  96   4	Untitled
+196 100   4	Untitled
+196 100   4	Untitled
+196 104   4	Untitled
+200 108   4	Untitled
+200 108   4	Untitled
+200 112   4	Untitled
+200 112   4	Untitled
+200 116   4	Untitled
+204 120   4	Untitled
+204 120   4	Untitled
+204 124   4	Untitled
+204 124   4	Untitled
+208 128   4	Untitled
+208 132   4	Untitled
+208 132   4	Untitled
+208 136   4	Untitled
+208 136   4	Untitled
+212 140   4	Untitled
+212 144   4	Untitled
+212 144   4	Untitled
+212 148   4	Untitled
+216 152   4	Untitled
+216 152   4	Untitled
+216 156   4	Untitled
+216 156   4	Untitled
+216 160   4	Untitled
+220 164   4	Untitled
+220 164   4	Untitled
+220 168   4	Untitled
+220 168   4	Untitled
+224 172   4	Untitled
+224 176   4	Untitled
+224 176   4	Untitled
+224 180   4	Untitled
+224 180   4	Untitled
+228 184   4	Untitled
+228 188   4	Untitled
+228 188   4	Untitled
+228 192   4	Untitled
+228 192   4	Untitled
+232 196   4	Untitled
+232 200   4	Untitled
+232 200   4	Untitled
+232 204   4	Untitled
+236 208   4	Untitled
+236 208   4	Untitled
+236 212   4	Untitled
+236 212   4	Untitled
+236 216   4	Untitled
+240 220   4	Untitled
+240 220   4	Untitled
+240 224   4	Untitled
+240 224   4	Untitled
+244 228   4	Untitled
+244 232   4	Untitled
+244 232   4	Untitled
+244 236   4	Untitled
+244 236   4	Untitled
+248 240   4	Untitled
+248 244   4	Untitled
+248 244   4	Untitled
+248 248   4	Untitled
+252 252   0	Untitled
+252 252 104	Untitled
+252 252 104	Untitled
+252 252 108	Untitled
+252 252 112	Untitled
+252 252 116	Untitled
+252 252 120	Untitled
+252 252 120	Untitled
+252 252 124	Untitled
+252 252 128	Untitled
+252 252 132	Untitled
+252 252 136	Untitled
+252 252 136	Untitled
+252 252 140	Untitled
+252 252 144	Untitled
+252 252 148	Untitled
+252 252 152	Untitled
+252 252 152	Untitled
+252 252 156	Untitled
+252 252 160	Untitled
+252 252 164	Untitled
+252 252 168	Untitled
+252 252 168	Untitled
+252 252 172	Untitled
+252 252 176	Untitled
+252 252 180	Untitled
+252 252 184	Untitled
+252 252 184	Untitled
+252 252 188	Untitled
+252 252 192	Untitled
+252 252 196	Untitled
+252 252 200	Untitled
+252 252 200	Untitled
+252 252 204	Untitled
+252 252 208	Untitled
+252 252 212	Untitled
+252 252 216	Untitled
+252 252 216	Untitled
+252 252 220	Untitled
+252 252 224	Untitled
+252 252 228	Untitled
+252 252 232	Untitled
+252 252 232	Untitled
+252 252 236	Untitled
+252 252 240	Untitled
+252 252 244	Untitled
+252 252 248	Untitled
+252 252 252	grey99
diff --git a/chalk/data/palettes/Cool_Colors.gpl b/chalk/data/palettes/Cool_Colors.gpl
new file mode 100644
index 000000000..3a1b83a5c
--- /dev/null
+++ b/chalk/data/palettes/Cool_Colors.gpl
@@ -0,0 +1,11 @@
+GIMP Palette
+Name: Cool Colors
+#
+ 17  42 198	Untitled
+ 83 155 226	Untitled
+ 22  16 102	Untitled
+ 64  35  76	Untitled
+  7  63 147	Untitled
+ 44 108 204	Untitled
+ 38  81  33	Untitled
+  4  66  44	Untitled
diff --git a/chalk/data/palettes/Cranes.gpl b/chalk/data/palettes/Cranes.gpl
new file mode 100644
index 000000000..6ea0714ed
--- /dev/null
+++ b/chalk/data/palettes/Cranes.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Cranes
+#
+  8   8   8	grey3
+192 176 144	Untitled
+192 164 128	Untitled
+ 80  72  68	Untitled
+112 140  88	Untitled
+104 132  96	Untitled
+ 92 104  84	Untitled
+ 24   8  12	Untitled
+ 96 108  92	Untitled
+128 104  76	Untitled
+ 44  28  24	Untitled
+156 140 116	Untitled
+156 148 116	Untitled
+ 68  68  60	Untitled
+212 196 148	Untitled
+144 136 108	Untitled
+160 148 128	Untitled
+216 220 216	Untitled
+ 44  28  40	Untitled
+ 68  12  16	Untitled
+ 12   8  32	Untitled
+ 56   8  48	Untitled
+ 48   8  40	Untitled
+ 44  20  40	Untitled
+104 104  92	Untitled
+ 52  28  48	Untitled
+156 176 124	Untitled
+124 160  96	Untitled
+ 44  40  24	Untitled
+168 168 172	Untitled
+196 188 168	Untitled
+  8  28  20	Untitled
+160  60  60	Untitled
+180 144 100	Untitled
+192 144 112	Untitled
+132  40  60	Untitled
+ 48   8  24	Untitled
+156 176 144	Untitled
+ 80  84  64	Untitled
+136 148 136	Untitled
+120 160 116	Untitled
+ 44  20  24	Untitled
+128  84  80	Untitled
+128  20  56	Untitled
+168  68  76	Untitled
+ 64  56  44	Untitled
+ 56  40  40	Untitled
+156 172 164	Untitled
+100  92  72	Untitled
+124 116  88	Untitled
+ 32   8  28	Untitled
+176 180 180	Untitled
+156  44  68	Untitled
+172 176 156	Untitled
+176 168 144	Untitled
+188   8  88	Untitled
+148   8  52	Untitled
+ 20  48  52	Untitled
+ 68  60  68	Untitled
+216 204 160	Untitled
+140 160 112	Untitled
+112 116  88	Untitled
+152 160 164	Untitled
+116 156 104	Untitled
+192 192 184	Untitled
+ 80  84  72	Untitled
+ 56  24  24	Untitled
+ 24  36  40	Untitled
+ 48  56  52	Untitled
+ 92  84  64	Untitled
+180 160 120	Untitled
+112 100  76	Untitled
+156 120  88	Untitled
+ 96  96  84	Untitled
+148 160 152	Untitled
+192 200 144	Untitled
+ 68  56  56	Untitled
+100  48  96	Untitled
+108 144 100	Untitled
+188 180 160	Untitled
+ 60  48  68	Untitled
+ 80  48  52	Untitled
+188  56  72	Untitled
+196 176 128	Untitled
+220 180 164	Untitled
+132 116 100	Untitled
+ 68  36  52	Untitled
+168 132 100	Untitled
+180 168 132	Untitled
+148 156 140	Untitled
+120 128 108	Untitled
+108  12  48	Untitled
+108  80  68	Untitled
+ 44  40  56	Untitled
+140 124 104	Untitled
+ 24  28  20	Untitled
+204 172 120	Untitled
+164 156 132	Untitled
+116 104  96	Untitled
+144 152 148	Untitled
+ 84  92  72	Untitled
+120 148 100	Untitled
+120 112 108	Untitled
+ 60  64  56	Untitled
+204 176 140	Untitled
+212 140 128	Untitled
+ 80  56  64	Untitled
+152 140 108	Untitled
+ 72  72  76	Untitled
+ 20  12  48	Untitled
+140 152 128	Untitled
+208 100  88	Untitled
+  8  36  48	Untitled
+ 80 104  68	Untitled
+ 44  40   8	Untitled
+ 76  60  84	Untitled
+ 56  40  24	Untitled
+112  52  64	Untitled
+212 124 112	Untitled
+152  72  76	Untitled
+212 124 128	Untitled
+ 88  88  96	Untitled
+ 16  68   8	Untitled
+ 36   8  40	Untitled
+128 168 112	Untitled
+208 212 196	Untitled
+216 208 176	Untitled
+ 76  68  56	Untitled
+ 40  44  28	Untitled
+ 32  20  80	Untitled
+136  64  68	Untitled
+ 60  76  64	Untitled
+200 104  96	Untitled
+ 92  84  80	Untitled
+164 148 116	Untitled
+116 108  84	Untitled
+148 128 100	Untitled
+ 80  80  84	Untitled
+136 140 128	Untitled
+ 88  16  76	Untitled
+124  12   8	Untitled
+100  96 104	Untitled
+132  52  36	Untitled
+ 56  28  40	Untitled
+196  96  88	Untitled
+ 64  84  44	Untitled
+164 188 132	Untitled
+204 196 168	Untitled
+216 220 208	Untitled
+136 172 100	Untitled
+148 188 124	Untitled
+ 52  72  32	Untitled
+108 108 116	Untitled
+136 172 132	Untitled
+ 60  60  64	Untitled
+108  92  92	Untitled
+216 156 144	Untitled
+104  96  84	Untitled
+172 180 172	Untitled
+140 108  88	Untitled
+160 164 156	Untitled
+148 132 108	Untitled
+128 140 120	Untitled
+ 40  84  56	Untitled
+132  56 108	Untitled
+ 96  32  56	Untitled
+164  88  84	Untitled
+ 96 104  72	Untitled
+172 192 152	Untitled
+192 196 172	Untitled
+208 108 100	Untitled
+ 68  84  72	Untitled
+140 128  96	Untitled
+224 228 224	Untitled
+128 128 132	Untitled
+ 76  96  56	Untitled
+ 88  76 100	Untitled
+ 72  12  52	Untitled
+ 56  44  56	Untitled
+ 68  48  68	Untitled
+ 60  20  64	Untitled
+ 44  12  56	Untitled
+ 84  68  76	Untitled
+ 44   8   8	Untitled
+148 136 100	Untitled
+148 180 108	Untitled
+184  52  20	Untitled
+  0   0   0			grey0
+ 40   0   0	Untitled
+  0  56  92	Untitled
+  0   0   4	Untitled
+  0   0   0			grey0
+ 60  56  56	Untitled
+ 56  20  40	Untitled
+192  28  36	Untitled
+ 72  80  60	Untitled
+ 72  92  68	Untitled
+ 88 100  76	Untitled
+ 88 116  72	Untitled
+  0   0   0	grey0
+ 56  40  56	Untitled
+ 72  76  68	Untitled
+128  48  52	Untitled
+168  36  60	Untitled
+ 76  96  76	Untitled
+ 80 108  80	Untitled
+128 120 108	Untitled
+184  72  80	Untitled
+104 128  84	Untitled
+136 132 108	Untitled
+148 140 116	Untitled
+112 152  92	Untitled
+208 184 132	Untitled
+104 116 100	Untitled
+132 128 116	Untitled
+136 120  88	Untitled
+  0   0   0	grey0
+116 124 120	Untitled
+136 152 152	Untitled
+144 156 160	Untitled
+156 168 176	Untitled
+184 184 176	Untitled
+152 172 184	Untitled
+184 188 188	Untitled
+196 200 196	Untitled
+212 212 208	Untitled
+148 164 172	Untitled
+ 84  96  84	Untitled
+ 96   8  20	Untitled
+100 116  80	Untitled
+ 96 120  92	Untitled
+164 176 184	Untitled
+204 188 152	Untitled
+128 128 100	Untitled
+ 44  40  40	Untitled
+204 204 188	Untitled
+ 92 128  80	Untitled
+100 140  88	Untitled
+ 56  48  44	Untitled
+128 148 112	Untitled
+ 36  28  40	Untitled
+196 160 112	Untitled
+124 116  96	Untitled
+104 104  84	Untitled
+132 140 140	Untitled
+140 132 116	Untitled
+204 208 200	Untitled
+196  80  84	Untitled
+116 112  96	Untitled
+ 88 116  84	Untitled
+ 64  44  56	Untitled
+ 44  24   8	Untitled
+196 116 116	Untitled
+180 148 116	Untitled
+136 176 116	Untitled
+148 140 124	Untitled
diff --git a/chalk/data/palettes/DMC.gpl b/chalk/data/palettes/DMC.gpl
new file mode 100644
index 000000000..7e9a0c0c3
--- /dev/null
+++ b/chalk/data/palettes/DMC.gpl
@@ -0,0 +1,458 @@
+GIMP Palette
+Name: DMC
+#
+255 255 255	BLANC
+255 247 231	ECRU
+207   0  83	150 Bright Red
+255 203 215	151 Pink
+225 161 161	152 Flesh - DK
+234 197 235	153 Lilac
+ 75  35  58	154 Red - VY DK
+151 116 182	155 Forget-me-not Blue
+133 119 180	156 Blue - MED
+181 184 234	157 Blue - LT
+ 57  48 104	158 Blue - DK
+188 181 222	159 Petrol Blue - LT
+129 120 169	160 Petrol Blue - MED
+ 96  86 139	161 Petrol Blue - DK
+202 231 240	162 Baby Blue - LT
+ 85 122  96	163 Green
+186 228 182	164 Green - LT
+225 244 119	165 Green - BRIGHT
+173 194  56	166 Lime Green
+133  93  49	167 Khaki Brown
+177 174 183	168 Silver Grey
+130 125 125	169 Pewter Grey
+148  91 128	208 Lavender - VY DK
+206 148 186	209 Lavender - DK
+236 207 225	210 Lavender - MED
+243 218 228	211 Lavender - LT
+156  41  74	221 Shell Pink - VY DK
+219 128 115	223 Shell Pink - LT
+255 199 176	224 Shell Pink - VY LT
+255 240 228	225 Shell Pink - ULT VY LT
+143  57  38	300 Mahogany - VY DK
+209 102  84	301 Mahogany - MED
+188   0  97	304 Christmas Red - MED
+255 231 109	307 Lemon
+214  43  91	309 Rose - DEEP
+  0   0  0	310 Black
+  0  79  97	311 Navy Blue - MED
+ 58  84 103	312 Navy Blue - LT
+163  90  91	315 Antique Mauve - VY DK
+220 141 141	316 Antique Mauve - MED
+167 139 136	317 Pewter Grey
+197 198 190	318 Steel Grey - LT
+ 85  95  82	319 Pistachio Green - VY DK
+138 153 120	320 Pistachio Green - MED
+231  18  97	321 Christmas Red
+ 81 109 135	322 Navy Blue - VY LT
+188  22  65	326 Rose - VY DEEP
+ 61   0 103	327 Violet - DK
+127  84 130	333 Blue Violet - VY DK
+115 140 170	334 Baby Blue - MED
+219  36  79	335 Rose
+ 36  73 103	336 Navy Blue
+162 121 164	340 Blue Violet - MED
+145 180 197	341 Blue Violet - LT
+194  36  67	347 Salmon - VY DK
+220  61  91	349 Coral - DK
+237  69  90	350 Coral - MED
+255 128 135	351 Coral
+255 157 144	352 Coral - LT
+255 196 184	353 Peach Flesh
+189  73  47	355 Terracotta - DK
+226 114  91	356 Terracotta - MED
+ 95 112  91	367 Pistachio Green - DK
+181 206 162	368 Pistachio Green - LT
+243 250 209	369 Pistachio Green - VY LT
+184 138  87	370 Mustard - MED
+196 155 100	371 Mustard
+203 162 107	372 Mustard - LT
+157  60  39	400 Mahogany - DK
+255 190 164	402 Mahogany - VY LT
+194 101  76	407 Sportsman Flesh - VY DK
+109  95  95	413 Pewter Grey - DK
+167 139 136	414 Steel Grey - DK
+221 221 218	415 Pearl Grey
+140  91  43	420 Hazelnut Brown - DK
+237 172 123	422 Hazelnut Brown - LT
+151  84  20	433 Brown - MED
+178 103  70	434 Brown - LT
+187 107  57	435 Brown - VY LT
+231 152 115	436 Tan
+238 171 121	437 Tan - LT
+255 176   0	444 Lemon - DK
+255 255 190	445 Lemon - LT
+179 151 143	451 Shell Grey - DK
+210 185 175	452 Shell Grey - MED
+235 207 185	453 Shell Grey - LT
+116 114  92	469 Avocado Green
+133 143 108	470 Avocado Green - LT
+176 187 140	471 Avocado Green - VY LT
+238 255 182	472 Avocado Green - ULT LT
+187   0  97	498 Christmas Red - LT
+ 43  57  41	500 Blue Green - VY DK
+ 67  85  73	501 Blue Green - DK
+134 158 134	502 Blue Green
+195 206 183	503 Blue Green - MED
+206 221 193	504 Blue Green - LT
+ 58  99  64	505 Grass Green - DK
+ 16 127 135	517 Wedgwood - MED
+102 148 154	518 Wedgwood - LT
+194 209 207	519 Sky Blue
+ 55  73  18	520 Fern Green - DK
+159 169 142	522 Fern Green
+172 183 142	523 Fern Green - LT
+205 182 158	524 Fern Green - VY LT
+ 85  85  89	535 Ash Grey - VY LT
+239 214 188	543 Beige Brown - ULT VY LT
+109  18  97	550 Violet - VY LT
+146  85 130	552 Violet - MED
+160 100 146	553 Violet
+243 206 225	554 Violet - LT
+ 59  96  76	561 Jade - VY DK
+ 97 134  97	562 Jade - MED
+182 212 180	563 Jade - LT
+214 230 204	564 Jade - VY LT
+  0 103   0	580 Moss Green - DK
+151 152  49	581 Moss Green
+128 151 132	597 Turquoise
+208 223 205	598 Turquoise - LT
+208  57 106	600 Cranberry - VY DK
+222  57 105	601 Cranberry - DK
+231  84 122	602 Cranberry - MED
+255 115 140	603 Cranberry
+255 189 202	604 Cranberry - LT
+255 207 214	605 Cranberry - VY LT
+255   0   0	606 Bright Orange-Red
+255  91   0	608 Bright Orange
+151 104  84	610 Drab Brown - VY DK
+158 109  91	611 Drab Brown - DK
+203 152 103	612 Drab Brown - MED
+219 176 122	613 Drab Brown - LT
+162  77  52	632 Negro Flesh - MED
+163 163 157	640 Beige Grey - VY DK
+174 176 170	642 Beige Grey - DK
+224 224 215	644 Beige Grey - MED
+113 113 113	645 Beaver Grey - VY DK
+121 121 121	646 Beaver Grey - DK
+190 190 185	647 Beaver Grey - MED
+202 202 202	648 Beaver Grey - LT
+213  39  86	666 Christmas Red - LT
+255 206 158	676 Old Gold - LT
+255 231 182	677 Old Gold - VY LT
+209 140 103	680 Old Gold - DK
+  0  91   6	699 Christmas Green
+  0  96  47	700 Christmas Green - BRIGHT
+ 79 108  69	701 Christmas Green - LT
+ 79 121  66	702 Kelly Green
+121 144  76	703 Chartreuse
+165 164 103	704 Chartreuse - BRIGHT
+245 240 219	712 Cream
+219  55 121	718 Plum
+200  36  43	720 Orange Spice - DK
+255 115  97	721 Orange Spice - MED
+255 146 109	722 Orange Spice - LT
+255 200 124	725 Topaz
+255 224 128	726 Topaz - LT
+255 235 168	727 Topaz - VY LT
+242 174  63	728 Golden Yellow
+243 176 128	729 Old Gold - MED
+132 102   0	730 Olive Green - VY DK
+140 103   0	731 Olive Green - DK
+145 104   0	732 Olive Green
+206 155  97	733 Olive Green - MED
+221 166 107	734 Olive Green - LT
+244 195 139	738 Tan - VY LT
+244 233 202	739 Tan - ULT VY LT
+255 131  19	740 Tangerine
+255 142  4	741 Tangerine - MED
+255 183  85	742 Tangerine - LT
+255 230 146	743 Yellow - MED
+255 239 170	744 Yellow - PALE
+255 240 197	745 Yellow - LT PALE
+246 234 219	746 Off White
+240 247 239	747 Sky Blue - VY LT
+251 227 209	754 Peach Flesh - LT
+255 177 147	758 Terracotta - VY LT
+249 160 146	760 Salmon
+255 201 188	761 Salmon - LT
+232 232 229	762 Pearl Grey - VY LT
+231 249 203	772 Pine Green - LT
+247 246 248	775 Baby Blue - VY LT
+255 177 174	776 Pink - MED
+155   0  66	777 Red - DEEP
+255 199 184	778 Antique Mauve - VY LT
+ 83  51  45	779 Brown
+181  98  46	780 Topaz - ULT VY DK
+181 107  56	781 Topaz - VY DK
+204 119  66	782 Topaz - DK
+225 146  85	783 Topaz - MED
+ 71  55  93	791 Cornflower Blue - VY DK
+ 97  97 128	792 Cornflower Blue - DK
+147 139 164	793 Cornflower Blue - MED
+187 208 218	794 Cornflower Blue - LT
+ 30  58  95	796 Royal Blue - DK
+ 30  66  99	797 Royal Blue
+103 115 141	798 Delft - DK
+132 156 182	799 Delft - MED
+233 238 233	800 Delft - PALE
+123  71  20	801 Coffee Brown - DK
+ 32  39  84	803 Blue - DEEP
+ 30 130 133	806 Peacock Blue - DK
+128 167 160	807 Peacock Blue
+190 193 205	809 Delft
+175 195 205	813 Blue - LT
+162   0  88	814 Garnet - DK
+166   0  91	815 Garnet - MED
+179   0  91	816 Garnet
+219  24  85	817 Coral Red - VY DK
+255 234 235	818 Baby Pink
+248 247 221	819 Baby Pink - LT
+ 30  54  85	820 Royal Blue - VY DK
+242 234 219	822 Beige Grey - LT
+  0   0  73	823 Navy Blue - DK
+ 71  97 116	824 Blue - VY DK
+ 85 108 128	825 Blue - DK
+115 138 153	826 Blue - MED
+213 231 232	827 Blue - VY LT
+237 247 238	828 Blue - ULT VY LT
+130  90   8	829 Golden Olive - VY DK
+136  95  18	830 Golden Olive - DK
+144 103  18	831 Golden Olive - MED
+178 119  55	832 Golden Olive
+219 182 128	833 Golden Olive - LT
+242 209 142	834 Golden Olive - VY LT
+ 94  56  27	838 Beige Brown - VY DK
+109  66  39	839 Beige Brown - DK
+128  85  30	840 Beige Brown - MED
+188 134 107	841 Beige Brown - LT
+219 194 164	842 Beige Brown - VY LT
+107 103 102	844 Beaver Brown - ULT DK
+153  92  48	868 Hazelnut Brown - VY DK
+153  92  48	869 Hazelnut Brown - VY DK
+ 79  86  76	890 Pistachio Green - ULT DK
+241  49  84	891 Carnation - DK
+249  90  97	892 Carnation - MED
+243 149 157	893 Carnation - LT
+255 194 191	894 Carnation - VY LT
+ 89  92  78	895 Hunter Green - VY DK
+118  55  19	898 Coffee Brown - VY DK
+233 109 115	899 Rose - MED
+206  43   0	900 Burnt Orange - DK
+138  24  77	902 Garnet - VY DK
+ 78  95  57	904 Parrot Green - VY DK
+ 98 119  57	905 Parrot Green - DK
+143 163  89	906 Parrot Green - MED
+185 200 102	907 Parrot Green - LT
+ 49 105  85	909 Emerald Green - VY DK
+ 48 116  91	910 Emerald Green - DK
+ 49 128  97	911 Emerald Green - MED
+115 158 115	912 Emerald Green - LT
+153 188 149	913 Nile Green - MED
+170  24  91	915 Plum - DK
+171  22  95	917 Plum - MED
+168  68  76	918 Red Copper - DK
+180  75  82	919 Red Copper
+197  94  88	920 Copper - MED
+206 103  91	921 Copper
+237 134 115	922 Copper - LT
+ 86  99 100	924 Grey Green - VY DK
+ 96 116 115	926 Grey Green - DK
+200 198 194	927 Grey Green - LT
+225 224 216	928 Grey Green - VY LT
+102 122 140	930 Antique Blue - DK
+124 135 145	931 Antique Blue - MED
+182 186 194	932 Antique Blue - LT
+ 62  59  40	934 Black Avocado Green
+ 67  63  47	935 Avocado Green - DK
+ 69  69  49	936 Avocado Green - VY DK
+ 73  86  55	937 Avocado Green - MED
+ 99  39  16	938 Coffee Brown - ULT DK
+  0   0  49	939 Navy Blue - VY DK
+  0 162 117	943 Aquamarine - MED
+255 206 164	945 Flesh - MED
+244  73   0	946 Burnt Orange - MED
+255  91   0	947 Burnt Orange
+255 243 231	948 Peach Flesh - VY LT
+239 162 127	950 Sportsman Flesh
+255 229 188	951 Flesh
+170 213 164	954 Nile Green
+214 230 204	955 Nile Green - LT
+255 109 115	956 Geranium
+255 204 208	957 Geranium - PALE
+  0 160 130	958 Sea Green - DK
+171 206 177	959 Sea Green - MED
+243 108 123	961 Dusty Rose - DK
+253 134 141	962 Dusty Rose - MED
+255 233 233	963 Dusty Rose - ULT VY LT
+208 224 210	964 Sea Green - LT
+206 213 176	966 Baby Green - MED
+255 194 172	967 Peach - LT
+255 117  24	970 Pumpkin - LT
+255 106   0	971 Pumpkin
+255 146   0	972 Canary - DEEP
+255 194  67	973 Canary - BRIGHT
+158  67  18	975 Golden Brown - DK
+246 141  57	976 Golden Brown - MED
+255 164  73	977 Golden Brown - LT
+ 58  82  65	986 Forest Green - VY DK
+ 83  97  73	987 Forest Green - DK
+134 145 110	988 Forest Green - MED
+134 153 110	989 Forest Green
+ 47  91  73	991 Aquamarine - DK
+146 183 165	992 Aquamarine
+192 224 200	993 Aquamarine - LT
+  0 123 134	995 Electric Blue - DK
+170 222 225	996 Electric Blue - MED
+123  91  64	3011 Khaki Green - DK
+170 134 103	3012 Khaki Green - MED
+208 195 164	3013 Khaki Green - LT
+115  91  93	3021 Brown Grey - VY DK
+172 172 170	3022 Brown Grey - MED
+198 190 173	3023 Brown Grey - LT
+210 208 205	3024 Brown Grey - VY LT
+ 84  56  23	3031 Mocha Brown - VY DK
+188 156 120	3032 Mocha Brown - MED
+239 219 190	3033 Mocha Brown - VY LT
+190 155 167	3041 Antique Violet - MED
+225 205 200	3042 Antique Violet - LT
+216 151 105	3045 Yellow Beige - DK
+229 193 139	3046 Yellow Beige - MED
+255 236 211	3047 Yellow Beige - LT
+ 85  73   0	3051 Green Grey - DK
+137 141 114	3052 Green Grey - MED
+187 179 148	3053 Green Grey
+194 101  76	3064 Sportsman Flesh - VY DK
+233 233 223	3072 Beaver Grey - VY LT
+255 255 220	3078 Golden Yellow - VY LT
+202 226 229	3325 Baby Blue - LT
+255 157 150	3326 Rose - LT
+188  64  85	3328 Salmon - DK
+255 123 103	3340 Apricot - MED
+255 172 162	3341 Apricot
+ 97 100  82	3345 Hunter Green - DK
+120 134 107	3346 Hunter Green
+128 152 115	3347 Yellow Green - MED
+225 249 190	3348 Yellow Green - LT
+201  79  91	3350 Dusty Rose - ULT DK
+255 214 209	3354 Dusty Rose - LT
+ 96  95  84	3362 Pine Green - DK
+116 127  96	3363 Pine Green - MED
+161 167 135	3364 Pine Green
+ 83  37  16	3371 Black Brown
+231  79 134	3607 Plum - LT
+247 152 182	3608 Plum - VY LT
+255 214 229	3609 Plum - ULT LT
+161  53  79	3685 Mauve - DK
+203  78  97	3687 Mauve
+250 151 144	3688 Mauve - MED
+255 213 216	3689 Mauve - LT
+255  85  91	3705 Melon - DK
+255 128 109	3706 Melon - MED
+254 212 219	3708 Melon - LT
+230 101 107	3712 Salmon - MED
+253 229 217	3713 Salmon - VY LT
+255 211 212	3716 Dusty Rose - VY LT
+184  75  77	3721 Shell Pink - DK
+184  89  88	3722 Shell Pink - MED
+195 118 123	3726 Antique Mauve - DK
+255 199 196	3727 Antique Mauve - LT
+209  93 103	3731 Dusty Rose - VY DK
+255 154 148	3733 Dusty Rose
+156 125 133	3740 Antique Violet - DK
+235 235 231	3743 Antique Violet - VY LT
+149 102 162	3746 Blue Violet - DK
+230 236 232	3747 Blue Violet - VY LT
+ 12  91 108	3750 Antique Blue - VY DK
+194 209 206	3752 Antique Blue - VY LT
+237 247 247	3753 Antique Blue - ULT VY LT
+158 176 206	3755 Baby Blue
+248 248 252	3756 Baby Blue - ULT VY LT
+102 142 152	3760 Wedgwood
+227 234 230	3761 Sky Blue - LT
+ 24 128 134	3765 Peacock Blue - VY DK
+ 24 101 111	3766 Peacock Blue - LT
+ 92 110 108	3768 Grey Green - DK
+255 250 224	3770 Flesh - VY LT
+232 172 155	3771 Peach - DK
+173  83  62	3772 Negro Flesh
+231 134 103	3773 Sportsman Flesh - MED
+255 220 193	3774 Sportsman Flesh - VY LT
+221 109  91	3776 Mahogany - LT
+191  64  36	3777 Terracotta - VY DK
+237 122 100	3778 Terracotta - LT
+255 177 152	3779 Terracotta - ULT VY LT
+113  71  42	3781 Mocha Brown - DK
+206 175 144	3782 Mocha Brown - LT
+139 109 115	3787 Brown Grey - DK
+140 117 109	3790 Beige Grey - ULT DK
+ 81  76  83	3799 Pewter Grey - VY DK
+231  71  79	3801 Christmas Red - LT
+127  43  59	3802 Antique Mauve - VY DK
+171  51  87	3803 Mauve - MED
+231  59 127	3804 Cyclamen Pink - DK
+243  71 139	3805 Cyclamen Pink
+255  87 155	3806 Cyclamen Pink - LT
+ 59  75 131	3807 Cornflower Blue
+ 11  83  95	3808 Turquoise - ULT VY DK
+ 31 107 123	3809 Turquoise - VY DK
+ 59 135 151	3810 Turquoise - DK
+187 227 235	3811 Turquoise - VY LT
+ 23 147 119	3812 Sea Green - VY DK
+151 195 171	3813 Blue Green - LT
+ 35 143 107	3814 Aquamarine
+ 99 127 107	3815 Celadon Green - DK
+135 167 147	3816 Celadon Green
+175 207 191	3817 Celadon Green - LT
+  0 107  46	3818 Emerald Green - ULT VY DK
+231 235 123	3819 Moss Green - LT
+231 179  75	3820 Straw - DK
+243 195  91	3821 Straw
+255 211 107	3822 Straw - LT
+255 251 227	3823 Yellow - ULT PALE
+247 191 183	3824 Apricot - LT
+255 171 131	3825 Pumpkin - PALE
+227 155  79	3826 Golden Brown
+247 187 119	3827 Golden Brown - PALE
+187 135  63	3828 Hazelnut Brown
+203 111   0	3829 Old Gold - VY DK
+199  79  71	3830 Terracotta
+170  68  77	3831 Raspberry - DK
+215  95 104	3832 Raspberry - MED
+224 124 134	3833 Raspberry - LT
+ 76  50  69	3834 Grape - DK
+113  80 105	3835 Grape - MED
+175 130 158	3836 Grape - LT
+109  69 137	3837 Lavender - ULT DK
+ 80  90 162	3838 Lavender Blue - DK
+107 123 189	3839 Lavender Blue - MED
+162 186 238	3840 Lavender Blue - LT
+199 221 235	3841 Baby Blue - PALE
+ 12  65  88	3842 Wedgwood - DK
+ 12 170 224	3843 Electric Blue
+ 43  91 155	3844 Bright Turquoise - DK
+ 63 145 213	3845 Bright Turquoise - MED
+ 82 173 234	3846 Bright Turquoise - LT
+ 48  77  68	3847 Teal Green - DK
+ 65 105  97	3848 Teal Green - MED
+ 90 165 140	3849 Teal Green - LT
+ 50 125 100	3850 Bright Green - DK
+ 90 165 140	3851 Bright Green - LT
+220 163  59	3852 Straw - VY DK
+229 121  75	3853 Autumn Gold - DK
+248 171  99	3854 Autumn Gold - MED
+253 228 174	3855 Autumn Gold - LT
+255 190 130	3856 Mahogany - ULT VY LT
+ 72  43  47	3857 Rosewood - DK
+102  63  65	3858 Rosewood - MED
+177 114 106	3859 Rosewood - LT
+ 98  77  76	3860 Cocoa
+146 121 120	3861 Cocoa - LT
+107  83  71	3862 Mocha Beige - DK
+134 106 88	3863 Mocha Beige - MED
+196 166 141	3864 Mocha Beige - LT
+255 251 244	3865 Winter White
+245 233 213	3866 Mocha Brown - ULT VY LT
+255 255 255	B5200 Bright Wite
diff --git a/chalk/data/palettes/Dark_pastels.gpl b/chalk/data/palettes/Dark_pastels.gpl
new file mode 100644
index 000000000..3802cd00d
--- /dev/null
+++ b/chalk/data/palettes/Dark_pastels.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Dark Pastels
+#
+ 56 104 184	Untitled
+ 52 104 180	Untitled
+ 52 104 180	Untitled
+ 52 104 176	Untitled
+ 52 104 176	Untitled
+ 48 104 172	Untitled
+ 48 104 172	Untitled
+ 48 100 168	Untitled
+ 48 100 168	Untitled
+ 44 100 164	Untitled
+ 44 100 164	Untitled
+ 44 100 164	Untitled
+ 44 100 160	Untitled
+ 44 100 160	Untitled
+ 40 100 156	Untitled
+ 40 100 156	Untitled
+ 40  96 152	Untitled
+ 40  96 152	Untitled
+ 36  96 148	Untitled
+ 36  96 148	Untitled
+ 36  96 144	Untitled
+ 36  96 144	Untitled
+ 32  96 140	Untitled
+ 32  96 140	Untitled
+ 32  96 136	Untitled
+ 32  92 136	Untitled
+ 28  92 132	Untitled
+ 28  92 132	Untitled
+ 28  92 128	Untitled
+ 28  92 128	Untitled
+ 24  92 124	Untitled
+ 24  92 124	Untitled
+ 24  92 120	Untitled
+ 24  92 120	Untitled
+ 24  92 120	Untitled
+ 60 108 112	Untitled
+ 96 120 104	Untitled
+128 132 100	Untitled
+164 148  92	Untitled
+200 160  84	Untitled
+232 172  80	Untitled
+228 168  84	Untitled
+228 164  88	Untitled
+224 160  88	Untitled
+224 156  92	Untitled
+224 152  92	Untitled
+220 148  96	Untitled
+220 144  96	Untitled
+220 144 100	Untitled
+216 140 100	Untitled
+216 136 104	Untitled
+216 132 104	Untitled
+212 128 108	Untitled
+212 124 112	Untitled
+208 120 112	Untitled
+208 120 116	Untitled
+208 116 116	Untitled
+204 112 120	Untitled
+204 108 120	Untitled
+204 104 124	Untitled
+200 100 124	Untitled
+200  96 128	Untitled
+200  96 128	Untitled
+196 100 124	Untitled
+192 104 124	Untitled
+188 108 124	Untitled
+184 112 124	Untitled
+ 76 196 112	Untitled
+ 72 200 112	Untitled
+ 64 204 108	Untitled
+ 60 208 108	Untitled
+ 56 208 108	Untitled
+ 60 204 112	Untitled
+ 64 204 112	Untitled
+ 64 204 116	Untitled
+ 68 200 116	Untitled
+ 68 200 120	Untitled
+ 72 200 120	Untitled
+ 76 200 124	Untitled
+ 76 196 124	Untitled
+ 80 196 128	Untitled
+ 80 196 128	Untitled
+ 84 196 132	Untitled
+ 88 192 132	Untitled
+ 88 192 132	Untitled
+ 92 192 136	Untitled
+ 92 192 136	Untitled
+ 96 188 140	Untitled
+100 188 140	Untitled
+100 188 144	Untitled
+104 188 144	Untitled
+104 184 148	Untitled
+108 184 148	Untitled
+112 184 152	Untitled
+112 180 152	Untitled
+116 180 156	Untitled
+116 180 156	Untitled
+120 180 156	Untitled
+120 176 160	Untitled
+124 176 160	Untitled
+128 176 164	Untitled
+128 176 164	Untitled
+132 172 168	Untitled
+132 172 168	Untitled
+136 172 172	Untitled
+140 172 172	Untitled
+140 168 176	Untitled
+144 168 176	Untitled
+144 168 180	Untitled
+148 168 180	Untitled
+152 164 180	Untitled
+152 164 184	Untitled
+156 164 184	Untitled
+156 160 188	Untitled
+160 160 188	Untitled
+164 160 192	Untitled
+164 160 192	Untitled
+168 156 196	Untitled
+168 156 196	Untitled
+172 156 200	Untitled
+176 156 200	Untitled
+176 152 204	Untitled
+180 152 204	Untitled
+180 152 204	Untitled
+184 152 208	Untitled
+184 148 208	Untitled
+188 148 212	Untitled
+192 148 212	Untitled
+192 148 216	Untitled
+196 144 216	Untitled
+196 144 220	Untitled
+200 144 220	Untitled
+204 140 224	Untitled
+204 140 224	Untitled
+208 140 228	Untitled
+208 140 228	Untitled
+212 136 228	Untitled
+216 136 232	Untitled
+216 136 232	Untitled
+220 136 236	Untitled
+220 132 236	Untitled
+224 132 240	Untitled
+228 132 240	Untitled
+228 132 244	Untitled
+232 128 244	Untitled
+232 128 248	Untitled
+236 128 248	Untitled
+236 128 248	Untitled
+232 124 240	Untitled
+228 124 236	Untitled
+224 124 232	Untitled
+220 120 224	Untitled
+216 120 220	Untitled
+212 120 216	Untitled
+212 116 212	Untitled
+208 116 204	Untitled
+204 116 200	Untitled
+200 112 196	Untitled
+196 112 192	Untitled
+192 112 184	Untitled
+188 108 180	Untitled
+188 108 176	Untitled
+184 108 168	Untitled
+180 104 164	Untitled
+176 104 160	Untitled
+172 104 156	Untitled
+168 100 148	Untitled
+164 100 144	Untitled
+164 100 140	Untitled
+160 100 136	Untitled
+156  96 128	Untitled
+152  96 124	Untitled
+148  96 120	Untitled
+144  92 116	Untitled
+140  92 108	Untitled
+140  92 104	Untitled
+136  88 100	Untitled
+132  88  92	Untitled
+128  88  88	Untitled
+124  84  84	Untitled
+120  84  80	Untitled
+116  84  72	Untitled
+116  80  68	Untitled
+112  80  64	Untitled
+108  80  60	Untitled
+104  76  52	Untitled
+100  76  48	Untitled
+ 96  76  44	Untitled
+ 96  76  40	Untitled
+ 92  80  44	Untitled
+ 92  80  48	Untitled
+ 92  80  52	Untitled
+ 92  80  56	Untitled
+ 92  80  56	Untitled
+ 92  80  60	Untitled
+ 92  84  64	Untitled
+ 88  84  68	Untitled
+ 88  84  68	Untitled
+ 88  84  72	Untitled
+ 88  84  76	Untitled
+ 88  84  80	Untitled
+ 88  88  80	Untitled
+ 88  88  84	Untitled
+ 88  88  88	Untitled
+ 84  88  92	Untitled
+ 84  88  92	Untitled
+ 84  88  96	Untitled
+ 84  92 100	Untitled
+ 84  92 104	Untitled
+ 84  92 108	Untitled
+ 84  92 108	Untitled
+ 84  92 112	Untitled
+ 80  92 116	Untitled
+ 80  96 120	Untitled
+ 80  96 120	Untitled
+ 80  96 124	Untitled
+ 80  96 128	Untitled
+ 80  96 132	Untitled
+ 80  96 132	Untitled
+ 80 100 136	Untitled
+ 76 100 140	Untitled
+ 76 100 144	Untitled
+ 76 100 144	Untitled
+ 76 100 148	Untitled
+ 76 100 152	Untitled
+ 76 104 156	Untitled
+ 76 104 160	Untitled
+ 76 104 160	Untitled
+ 72 104 164	Untitled
+ 72 104 168	Untitled
+ 72 104 172	Untitled
+ 72 108 172	Untitled
+ 72 108 176	Untitled
+ 72 108 180	Untitled
+ 72 108 184	Untitled
+ 72 108 184	Untitled
+ 68 108 188	Untitled
+ 68 112 192	Untitled
+ 68 112 196	Untitled
+ 68 112 196	Untitled
+ 68 112 200	Untitled
+ 68 112 204	Untitled
+ 68 112 208	Untitled
+ 68 112 208	Untitled
+ 64 108 204	Untitled
+ 64 108 204	Untitled
+ 64 108 200	Untitled
+ 64 108 200	Untitled
+ 60 108 196	Untitled
+ 60 108 196	Untitled
+ 60 108 192	Untitled
+ 60 108 192	Untitled
+ 56 108 188	Untitled
+ 56 104 188	Untitled
+ 56 104 184	Untitled
+ 56 104 184	Untitled
diff --git a/chalk/data/palettes/Default.gpl b/chalk/data/palettes/Default.gpl
new file mode 100644
index 000000000..b2541c359
--- /dev/null
+++ b/chalk/data/palettes/Default.gpl
@@ -0,0 +1,26 @@
+GIMP Palette
+Name: Default
+#
+255   0   0	Red
+255   0 255	Magenta
+  0   0 255	Blue
+  0 255 255	Cyan
+  0 255   0	Green
+255 255   0	Yellow
+127   0   0	Dark Red
+127   0 127	Dark Magenta
+  0   0 127	Dark Blue
+  0 127 127	Dark Cyan
+  0 127   0	Dark Green
+130 127   0	Dark Yellow
+  0   0   0	Black
+ 25  25  25	Gray 10%
+ 51  51  51	Gray 20%
+ 76  76  76	Gray 30%
+102 102 102	Gray 40%
+127 127 127	Gray 50%
+153 153 153	Gray 60%
+178 178 178	Gray 70%
+204 204 204	Gray 80%
+229 229 229	Gray 90%
+255 255 255	White
diff --git a/chalk/data/palettes/Ega.gpl b/chalk/data/palettes/Ega.gpl
new file mode 100644
index 000000000..80b6d06d5
--- /dev/null
+++ b/chalk/data/palettes/Ega.gpl
@@ -0,0 +1,244 @@
+GIMP Palette
+Name: Ega
+Columns: 16
+#
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
+  0   0   0	grey0
+168   0 168	Untitled
+252  84  84	Untitled
+252  84 168	Untitled
+252  84 252	Untitled
+252 168 252	Untitled
+252 252   0	Untitled
+252 252 168	Untitled
+252 252 252	grey99
+168 252 252	Untitled
+  0 252 252	Untitled
+ 84 168 252	Untitled
+  0   0 252	Untitled
+  0  84 168	Untitled
+  0   0  84	Untitled
+ 84  84  84	grey33
diff --git a/chalk/data/palettes/Firecode.gpl b/chalk/data/palettes/Firecode.gpl
new file mode 100644
index 000000000..252b738e6
--- /dev/null
+++ b/chalk/data/palettes/Firecode.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Firecode
+#
+  0   0   0	grey0
+  0   0  24	Untitled
+  0   0  24	Untitled
+  0   0  28	Untitled
+  0   0  32	Untitled
+  0   0  32	Untitled
+  0   0  36	Untitled
+  0   0  40	Untitled
+  8   0  40	Untitled
+ 16   0  36	Untitled
+ 24   0  36	Untitled
+ 32   0  32	Untitled
+ 40   0  28	Untitled
+ 48   0  28	Untitled
+ 56   0  24	Untitled
+ 64   0  20	Untitled
+ 72   0  20	Untitled
+ 80   0  16	Untitled
+ 88   0  16	Untitled
+ 96   0  12	Untitled
+104   0   8	Untitled
+112   0   8	Untitled
+120   0   4	Untitled
+128   0   0	Untitled
+128   0   0	Untitled
+132   0   0	Untitled
+136   0   0	Untitled
+140   0   0	Untitled
+144   0   0	Untitled
+144   0   0	Untitled
+148   0   0	Untitled
+152   0   0	Untitled
+156   0   0	Untitled
+160   0   0	Untitled
+160   0   0	Untitled
+164   0   0	Untitled
+168   0   0	Untitled
+172   0   0	Untitled
+176   0   0	Untitled
+180   0   0	Untitled
+184   4   0	Untitled
+188   4   0	Untitled
+192   8   0	Untitled
+196   8   0	Untitled
+200  12   0	Untitled
+204  12   0	Untitled
+208  16   0	Untitled
+212  16   0	Untitled
+216  20   0	Untitled
+220  20   0	Untitled
+224  24   0	Untitled
+228  24   0	Untitled
+232  28   0	Untitled
+236  28   0	Untitled
+240  32   0	Untitled
+244  32   0	Untitled
+252  36   0	Untitled
+252  36   0	Untitled
+252  40   0	Untitled
+252  40   0	Untitled
+252  44   0	Untitled
+252  44   0	Untitled
+252  48   0	Untitled
+252  48   0	Untitled
+252  52   0	Untitled
+252  52   0	Untitled
+252  56   0	Untitled
+252  56   0	Untitled
+252  60   0	Untitled
+252  60   0	Untitled
+252  64   0	Untitled
+252  64   0	Untitled
+252  68   0	Untitled
+252  68   0	Untitled
+252  72   0	Untitled
+252  72   0	Untitled
+252  76   0	Untitled
+252  76   0	Untitled
+252  80   0	Untitled
+252  80   0	Untitled
+252  84   0	Untitled
+252  84   0	Untitled
+252  88   0	Untitled
+252  88   0	Untitled
+252  92   0	Untitled
+252  96   0	Untitled
+252  96   0	Untitled
+252 100   0	Untitled
+252 100   0	Untitled
+252 104   0	Untitled
+252 104   0	Untitled
+252 108   0	Untitled
+252 108   0	Untitled
+252 112   0	Untitled
+252 112   0	Untitled
+252 116   0	Untitled
+252 116   0	Untitled
+252 120   0	Untitled
+252 120   0	Untitled
+252 124   0	Untitled
+252 124   0	Untitled
+252 128   0	Untitled
+252 128   0	Untitled
+252 132   0	Untitled
+252 132   0	Untitled
+252 136   0	Untitled
+252 136   0	Untitled
+252 140   0	Untitled
+252 140   0	Untitled
+252 144   0	Untitled
+252 144   0	Untitled
+252 148   0	Untitled
+252 152   0	Untitled
+252 152   0	Untitled
+252 156   0	Untitled
+252 156   0	Untitled
+252 160   0	Untitled
+252 160   0	Untitled
+252 164   0	Untitled
+252 164   0	Untitled
+252 168   0	Untitled
+252 168   0	Untitled
+252 172   0	Untitled
+252 172   0	Untitled
+252 176   0	Untitled
+252 176   0	Untitled
+252 180   0	Untitled
+252 180   0	Untitled
+252 184   0	Untitled
+252 184   0	Untitled
+252 188   0	Untitled
+252 188   0	Untitled
+252 192   0	Untitled
+252 192   0	Untitled
+252 196   0	Untitled
+252 196   0	Untitled
+252 200   0	Untitled
+252 200   0	Untitled
+252 204   0	Untitled
+252 208   0	Untitled
+252 208   0	Untitled
+252 208   0	Untitled
+252 208   0	Untitled
+252 208   0	Untitled
+252 212   0	Untitled
+252 212   0	Untitled
+252 212   0	Untitled
+252 212   0	Untitled
+252 216   0	Untitled
+252 216   0	Untitled
+252 216   0	Untitled
+252 216   0	Untitled
+252 216   0	Untitled
+252 220   0	Untitled
+252 220   0	Untitled
+252 220   0	Untitled
+252 220   0	Untitled
+252 224   0	Untitled
+252 224   0	Untitled
+252 224   0	Untitled
+252 224   0	Untitled
+252 228   0	Untitled
+252 228   0	Untitled
+252 228   0	Untitled
+252 228   0	Untitled
+252 228   0	Untitled
+252 232   0	Untitled
+252 232   0	Untitled
+252 232   0	Untitled
+252 232   0	Untitled
+252 236   0	Untitled
+252 236   0	Untitled
+252 236   0	Untitled
+252 236   0	Untitled
+252 240   0	Untitled
+252 240   0	Untitled
+252 240   0	Untitled
+252 240   0	Untitled
+252 240   0	Untitled
+252 244   0	Untitled
+252 244   0	Untitled
+252 244   0	Untitled
+252 244   0	Untitled
+252 248   0	Untitled
+252 248   0	Untitled
+252 248   0	Untitled
+252 248   0	Untitled
+252 252   0	Untitled
+252 252   4	Untitled
+252 252   8	Untitled
+252 252  12	Untitled
+252 252  16	Untitled
+252 252  20	Untitled
+252 252  24	Untitled
+252 252  28	Untitled
+252 252  32	Untitled
+252 252  36	Untitled
+252 252  40	Untitled
+252 252  40	Untitled
+252 252  44	Untitled
+252 252  48	Untitled
+252 252  52	Untitled
+252 252  56	Untitled
+252 252  60	Untitled
+252 252  64	Untitled
+252 252  68	Untitled
+252 252  72	Untitled
+252 252  76	Untitled
+252 252  80	Untitled
+252 252  84	Untitled
+252 252  84	Untitled
+252 252  88	Untitled
+252 252  92	Untitled
+252 252  96	Untitled
+252 252 100	Untitled
+252 252 104	Untitled
+252 252 108	Untitled
+252 252 112	Untitled
+252 252 116	Untitled
+252 252 120	Untitled
+252 252 124	Untitled
+252 252 124	Untitled
+252 252 128	Untitled
+252 252 132	Untitled
+252 252 136	Untitled
+252 252 140	Untitled
+252 252 144	Untitled
+252 252 148	Untitled
+252 252 152	Untitled
+252 252 156	Untitled
+252 252 160	Untitled
+252 252 164	Untitled
+252 252 168	Untitled
+252 252 168	Untitled
+252 252 172	Untitled
+252 252 176	Untitled
+252 252 180	Untitled
+252 252 184	Untitled
+252 252 188	Untitled
+252 252 192	Untitled
+252 252 196	Untitled
+252 252 200	Untitled
+252 252 204	Untitled
+252 252 208	Untitled
+252 252 208	Untitled
+252 252 212	Untitled
+252 252 216	Untitled
+252 252 220	Untitled
+252 252 224	Untitled
+252 252 228	Untitled
+252 252 232	Untitled
+252 252 236	Untitled
+252 252 240	Untitled
+252 252 244	Untitled
+252 252 248	Untitled
+252 252 252	grey99
diff --git a/chalk/data/palettes/Gold.gpl b/chalk/data/palettes/Gold.gpl
new file mode 100644
index 000000000..86ccca81f
--- /dev/null
+++ b/chalk/data/palettes/Gold.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Gold
+#
+252 252 128	Untitled
+252 252 128	Untitled
+252 248 124	Untitled
+252 248 124	Untitled
+252 244 120	Untitled
+248 244 120	Untitled
+248 240 116	Untitled
+248 240 112	Untitled
+248 236 112	Untitled
+244 236 108	Untitled
+244 232 108	Untitled
+244 232 104	Untitled
+244 228 104	Untitled
+240 228 100	Untitled
+240 224  96	Untitled
+240 224  96	Untitled
+240 220  92	Untitled
+236 220  92	Untitled
+236 216  88	Untitled
+236 216  84	Untitled
+236 212  84	Untitled
+236 212  80	Untitled
+232 208  80	Untitled
+232 208  76	Untitled
+232 204  76	Untitled
+232 204  72	Untitled
+228 200  68	Untitled
+228 200  68	Untitled
+228 196  64	Untitled
+228 196  64	Untitled
+224 192  60	Untitled
+224 192  56	Untitled
+224 188  56	Untitled
+224 188  52	Untitled
+220 184  52	Untitled
+220 184  48	Untitled
+220 180  48	Untitled
+220 180  44	Untitled
+220 176  40	Untitled
+216 176  40	Untitled
+216 172  36	Untitled
+216 172  36	Untitled
+216 168  32	Untitled
+212 168  28	Untitled
+212 164  28	Untitled
+212 164  24	Untitled
+212 160  24	Untitled
+208 160  20	Untitled
+208 156  20	Untitled
+208 156  16	Untitled
+208 152  12	Untitled
+204 152  12	Untitled
+204 148   8	Untitled
+204 148   8	Untitled
+204 144   4	Untitled
+200 140   0	Untitled
+196 136   0	Untitled
+196 136   0	Untitled
+196 136   0	Untitled
+196 136   0	Untitled
+192 132   0	Untitled
+192 132   0	Untitled
+192 132   0	Untitled
+192 132   0	Untitled
+188 128   0	Untitled
+188 128   0	Untitled
+188 128   0	Untitled
+188 128   0	Untitled
+184 124   0	Untitled
+184 124   0	Untitled
+184 124   0	Untitled
+184 124   0	Untitled
+180 120   0	Untitled
+180 120   0	Untitled
+180 120   0	Untitled
+180 120   0	Untitled
+176 116   0	Untitled
+176 116   0	Untitled
+176 116   0	Untitled
+176 116   0	Untitled
+172 112   0	Untitled
+172 112   0	Untitled
+172 112   0	Untitled
+172 112   0	Untitled
+168 108   0	Untitled
+168 108   0	Untitled
+168 108   0	Untitled
+168 108   0	Untitled
+164 104   0	Untitled
+164 104   0	Untitled
+164 104   0	Untitled
+164 104   0	Untitled
+160 100   0	Untitled
+160 100   0	Untitled
+160 100   0	Untitled
+160 100   0	Untitled
+156  96   0	Untitled
+156  96   0	Untitled
+156  96   0	Untitled
+156  96   0	Untitled
+152  92   0	Untitled
+152  92   0	Untitled
+152  92   0	Untitled
+152  92   0	Untitled
+148  88   0	Untitled
+148  88   0	Untitled
+148  88   0	Untitled
+148  88   0	Untitled
+144  84   0	Untitled
+144  84   0	Untitled
+144  84   0	Untitled
+144  84   0	Untitled
+140  80   0	Untitled
+140  80   0	Untitled
+140  80   0	Untitled
+140  80   0	Untitled
+136  76   0	Untitled
+136  76   0	Untitled
+136  76   0	Untitled
+136  76   0	Untitled
+132  72   0	Untitled
+132  72   0	Untitled
+132  72   0	Untitled
+132  72   0	Untitled
+128  68   0	Untitled
+128  68   0	Untitled
+128  68   0	Untitled
+128  68   0	Untitled
+124  64   0	Untitled
+124  64   0	Untitled
+124  64   0	Untitled
+124  64   0	Untitled
+120  60   0	Untitled
+120  60   0	Untitled
+120  60   0	Untitled
+120  60   0	Untitled
+116  56   0	Untitled
+116  56   0	Untitled
+116  56   0	Untitled
+116  56   0	Untitled
+112  52   0	Untitled
+112  52   0	Untitled
+112  52   0	Untitled
+112  52   0	Untitled
+108  48   0	Untitled
+108  48   0	Untitled
+108  48   0	Untitled
+108  48   0	Untitled
+104  44   0	Untitled
+104  44   0	Untitled
+104  44   0	Untitled
+104  44   0	Untitled
+100  40   0	Untitled
+100  40   0	Untitled
+100  40   0	Untitled
+100  40   0	Untitled
+ 96  36   0	Untitled
+ 96  36   0	Untitled
+ 96  36   0	Untitled
+ 96  36   0	Untitled
+ 92  32   0	Untitled
+ 92  32   0	Untitled
+ 92  32   0	Untitled
+ 92  32   0	Untitled
+ 88  28   0	Untitled
+ 88  28   0	Untitled
+ 88  28   0	Untitled
+ 88  28   0	Untitled
+ 84  24   0	Untitled
+ 84  24   0	Untitled
+ 84  24   0	Untitled
+ 84  24   0	Untitled
+ 80  20   0	Untitled
+ 80  20   0	Untitled
+ 80  20   0	Untitled
+ 80  20   0	Untitled
+ 76  16   0	Untitled
+ 76  16   0	Untitled
+ 76  16   0	Untitled
+ 76  16   0	Untitled
+ 72  12   0	Untitled
+ 72  12   0	Untitled
+ 72  12   0	Untitled
+ 72  12   0	Untitled
+ 68   8   0	Untitled
+ 68   8   0	Untitled
+ 68   8   0	Untitled
+ 68   8   0	Untitled
+ 64   4   0	Untitled
+ 64   4   0	Untitled
+ 64   4   0	Untitled
+ 64   4   0	Untitled
+ 60   0   0	Untitled
+ 60   0   0	Untitled
+ 60   0   0	Untitled
+ 60   0   0	Untitled
+ 56   0   0	Untitled
+ 56   0   0	Untitled
+ 56   0   0	Untitled
+ 56   0   0	Untitled
+ 52   0   0	Untitled
+ 52   0   0	Untitled
+ 52   0   0	Untitled
+ 52   0   0	Untitled
+ 48   0   0	Untitled
+ 48   0   0	Untitled
+ 48   0   0	Untitled
+ 48   0   0	Untitled
+ 44   0   0	Untitled
+ 44   0   0	Untitled
+ 44   0   0	Untitled
+ 44   0   0	Untitled
+ 40   0   0	Untitled
+ 40   0   0	Untitled
+ 40   0   0	Untitled
+ 40   0   0	Untitled
+ 36   0   0	Untitled
+ 36   0   0	Untitled
+ 36   0   0	Untitled
+ 36   0   0	Untitled
+ 32   0   0	Untitled
+ 32   0   0	Untitled
+ 32   0   0	Untitled
+ 32   0   0	Untitled
+ 28   0   0	Untitled
+ 28   0   0	Untitled
+ 28   0   0	Untitled
+ 28   0   0	Untitled
+ 24   0   0	Untitled
+ 24   0   0	Untitled
+ 24   0   0	Untitled
+ 24   0   0	Untitled
+ 20   0   0	Untitled
+ 20   0   0	Untitled
+ 20   0   0	Untitled
+ 20   0   0	Untitled
+ 16   0   0	Untitled
+ 16   0   0	Untitled
+ 16   0   0	Untitled
+ 16   0   0	Untitled
+ 12   0   0	Untitled
+ 12   0   0	Untitled
+ 12   0   0	Untitled
+ 12   0   0	Untitled
+  8   0   0	Untitled
+  8   0   0	Untitled
+  8   0   0	Untitled
+  8   0   0	Untitled
+  4   0   0	Untitled
+  4   0   0	Untitled
+  4   0   0	Untitled
+  4   0   0	Untitled
+  0   0   0	grey0
+  0   0   0	grey0
+  0   0   0	grey0
+  0   0   0	grey0
diff --git a/chalk/data/palettes/GrayViolet.gpl b/chalk/data/palettes/GrayViolet.gpl
new file mode 100644
index 000000000..9bc34021f
--- /dev/null
+++ b/chalk/data/palettes/GrayViolet.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: GrayViolet
+#
+  0   0   0	grey0
+  0   0   0	grey0
+  4   4   4	Untitled
+  4   4   4	Untitled
+  8   8   8	grey3
+  8   8   8	grey3
+ 12  12  12	Untitled
+ 12  12  12	Untitled
+ 16  16  16	Untitled
+ 16  16  16	Untitled
+ 20  20  20	grey8
+ 20  20  20	grey8
+ 20  24  24	Untitled
+ 24  24  24	Untitled
+ 24  28  28	Untitled
+ 28  28  28	grey11
+ 28  32  32	Untitled
+ 32  32  32	Untitled
+ 32  32  36	Untitled
+ 36  36  36	grey14
+ 36  36  40	Untitled
+ 40  40  40	Untitled
+ 40  40  44	Untitled
+ 40  44  44	Untitled
+ 44  44  48	Untitled
+ 44  48  48	Untitled
+ 48  48  52	Untitled
+ 48  52  52	Untitled
+ 52  52  56	Untitled
+ 52  56  56	Untitled
+ 56  56  60	Untitled
+ 56  60  60	Untitled
+ 56  60  64	Untitled
+ 60  64  64	Untitled
+ 60  64  68	Untitled
+ 64  64  68	Untitled
+ 64  68  72	Untitled
+ 68  68  72	Untitled
+ 68  72  76	Untitled
+ 72  72  76	Untitled
+ 72  76  80	Untitled
+ 76  76  80	Untitled
+ 76  80  84	Untitled
+ 76  80  84	Untitled
+ 80  84  88	Untitled
+ 80  84  88	Untitled
+ 84  88  92	Untitled
+ 84  88  92	Untitled
+ 88  92  96	Untitled
+ 88  92  96	Untitled
+ 92  96 100	Untitled
+ 92  96 100	Untitled
+ 96  96 104	Untitled
+ 96 100 104	Untitled
+ 96 100 108	Untitled
+100 104 108	Untitled
+100 104 112	Untitled
+104 108 112	Untitled
+104 108 116	Untitled
+108 112 116	Untitled
+108 112 120	Untitled
+112 116 120	Untitled
+112 116 124	Untitled
+116 120 124	Untitled
+116 120 128	Untitled
+116 124 128	Untitled
+120 124 132	Untitled
+120 124 132	Untitled
+124 128 136	Untitled
+124 128 136	Untitled
+128 132 140	Untitled
+128 132 140	Untitled
+132 136 144	Untitled
+132 136 144	Untitled
+136 140 148	Untitled
+136 140 148	Untitled
+136 144 152	Untitled
+140 144 152	Untitled
+140 148 156	Untitled
+144 148 156	Untitled
+144 152 160	Untitled
+148 152 160	Untitled
+148 156 164	Untitled
+152 156 164	Untitled
+152 156 168	Untitled
+156 160 168	Untitled
+156 160 172	Untitled
+156 164 172	Untitled
+160 164 176	Untitled
+160 168 176	Untitled
+164 168 180	Untitled
+164 172 180	Untitled
+168 172 184	Untitled
+168 176 184	Untitled
+172 176 188	Untitled
+172 180 188	Untitled
+172 180 192	Untitled
+176 184 192	Untitled
+176 184 196	Untitled
+180 188 196	Untitled
+180 188 200	Untitled
+184 188 200	Untitled
+184 192 204	Untitled
+188 192 204	Untitled
+188 196 208	Untitled
+192 196 208	Untitled
+192 200 212	Untitled
+192 200 212	Untitled
+196 204 216	Untitled
+196 204 216	Untitled
+200 208 220	Untitled
+200 208 220	Untitled
+204 212 224	Untitled
+204 212 224	Untitled
+208 216 228	Untitled
+208 216 228	Untitled
+212 220 232	Untitled
+212 220 232	Untitled
+240 240 252	Untitled
+228 232 244	Untitled
+240 240 252	Untitled
+224 232 244	Untitled
+236 236 248	Untitled
+220 228 240	Untitled
+232 236 248	Untitled
+220 228 236	Untitled
+228 232 244	Untitled
+216 224 236	Untitled
+224 232 244	Untitled
+212 220 232	Untitled
+220 228 240	Untitled
+208 220 232	Untitled
+220 228 236	Untitled
+204 216 228	Untitled
+216 224 236	Untitled
+200 216 224	Untitled
+212 220 232	Untitled
+200 212 224	Untitled
+208 220 232	Untitled
+196 212 220	Untitled
+204 216 228	Untitled
+192 208 220	Untitled
+200 216 224	Untitled
+188 208 216	Untitled
+200 212 224	Untitled
+180 204 216	Untitled
+196 212 220	Untitled
+188 208 216	Untitled
+196 212 220	Untitled
+184 204 212	Untitled
+192 208 216	Untitled
+180 200 208	Untitled
+188 208 216	Untitled
+180 200 208	Untitled
+184 204 212	Untitled
+180 196 204	Untitled
+180 200 208	Untitled
+176 192 200	Untitled
+180 200 208	Untitled
+176 188 196	Untitled
+180 196 204	Untitled
+172 184 192	Untitled
+176 192 200	Untitled
+172 180 192	Untitled
+176 188 196	Untitled
+168 176 188	Untitled
+172 184 192	Untitled
+168 172 184	Untitled
+172 180 192	Untitled
+164 168 180	Untitled
+168 176 188	Untitled
+164 164 176	Untitled
+168 172 184	Untitled
+160 160 176	Untitled
+164 168 180	Untitled
+160 156 172	Untitled
+164 164 176	Untitled
+156 152 168	Untitled
+160 160 176	Untitled
+156 148 164	Untitled
+160 156 172	Untitled
+152 144 160	Untitled
+156 152 168	Untitled
+152 140 160	Untitled
+156 148 164	Untitled
+148 136 156	Untitled
+152 144 160	Untitled
+148 132 152	Untitled
+152 140 160	Untitled
+144 128 148	Untitled
+148 136 156	Untitled
+144 124 144	Untitled
+148 132 152	Untitled
+140 120 144	Untitled
+144 128 148	Untitled
+140 116 140	Untitled
+144 124 144	Untitled
+136 112 136	Untitled
+140 120 144	Untitled
+136 108 132	Untitled
+140 116 140	Untitled
+132 104 128	Untitled
+136 112 136	Untitled
+132 100 124	Untitled
+136 108 132	Untitled
+128  96 124	Untitled
+132 104 128	Untitled
+128  92 120	Untitled
+132 100 124	Untitled
+124  88 116	Untitled
+128  96 124	Untitled
+124  84 112	Untitled
+128  92 120	Untitled
+120  80 108	Untitled
+124  88 116	Untitled
+120  76 108	Untitled
+124  84 112	Untitled
+116  72 104	Untitled
+120  80 108	Untitled
+116  68 100	Untitled
+120  76 108	Untitled
+112  64  96	Untitled
+116  72 104	Untitled
+112  60  92	Untitled
+116  68 100	Untitled
+108  56  92	Untitled
+112  64  96	Untitled
+108  52  88	Untitled
+112  60  92	Untitled
+104  48  84	Untitled
+108  56  92	Untitled
+104  44  80	Untitled
+108  52  88	Untitled
+100  40  76	Untitled
+104  48  84	Untitled
+100  36  76	Untitled
+104  44  80	Untitled
+ 96  32  72	Untitled
+100  40  76	Untitled
+ 96  28  68	Untitled
+100  36  76	Untitled
+ 92  24  64	Untitled
+ 96  32  72	Untitled
+ 96  28  68	Untitled
+ 76  24  60	Untitled
+ 92  24  64	Untitled
+ 56  28  52	Untitled
+ 76  24  60	Untitled
+ 48  28  48	Untitled
+ 56  28  52	Untitled
+ 28  32  40	Untitled
+ 36  28  44	Untitled
+  8  36  32	Untitled
+ 20  32  36	Untitled
+ 16  24  24	Untitled
+  8  12  12	Untitled
diff --git a/chalk/data/palettes/Grayblue.gpl b/chalk/data/palettes/Grayblue.gpl
new file mode 100644
index 000000000..982749dc4
--- /dev/null
+++ b/chalk/data/palettes/Grayblue.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Grayblue
+#
+124 164 128	Untitled
+124 164 128	Untitled
+124 164 124	Untitled
+124 160 124	Untitled
+124 160 124	Untitled
+120 160 124	Untitled
+120 160 124	Untitled
+120 156 124	Untitled
+120 156 124	Untitled
+120 156 120	Untitled
+116 156 120	Untitled
+116 152 120	Untitled
+116 152 120	Untitled
+116 152 120	Untitled
+116 152 120	Untitled
+112 148 116	Untitled
+112 148 116	Untitled
+112 148 116	Untitled
+112 148 116	Untitled
+112 144 116	Untitled
+108 144 116	Untitled
+108 144 112	Untitled
+108 144 112	Untitled
+108 140 112	Untitled
+108 140 112	Untitled
+104 140 112	Untitled
+104 140 112	Untitled
+104 136 108	Untitled
+104 136 108	Untitled
+100 136 108	Untitled
+100 136 108	Untitled
+100 132 108	Untitled
+100 132 108	Untitled
+100 132 104	Untitled
+ 96 132 104	Untitled
+ 96 128 104	Untitled
+ 96 128 104	Untitled
+ 96 128 104	Untitled
+ 96 128 104	Untitled
+ 92 124 100	Untitled
+ 92 124 100	Untitled
+ 92 124 100	Untitled
+ 92 124 100	Untitled
+ 92 120 100	Untitled
+ 88 120 100	Untitled
+ 88 120  96	Untitled
+ 88 120  96	Untitled
+ 88 116  96	Untitled
+ 88 116  96	Untitled
+ 84 116  96	Untitled
+ 84 116  96	Untitled
+ 84 112  96	Untitled
+ 84 112  92	Untitled
+ 80 112  92	Untitled
+ 80 112  92	Untitled
+ 80 108  92	Untitled
+ 80 108  92	Untitled
+ 80 108  92	Untitled
+ 76 108  88	Untitled
+ 76 104  88	Untitled
+ 76 104  88	Untitled
+ 76 104  88	Untitled
+ 76 100  88	Untitled
+ 72 100  88	Untitled
+ 72 100  84	Untitled
+ 72 100  84	Untitled
+ 72  96  84	Untitled
+ 72  96  84	Untitled
+ 68  96  84	Untitled
+ 68  96  84	Untitled
+ 68  92  80	Untitled
+ 68  92  80	Untitled
+ 68  92  80	Untitled
+ 64  92  80	Untitled
+ 64  88  80	Untitled
+ 64  88  80	Untitled
+ 64  88  76	Untitled
+ 60  88  76	Untitled
+ 60  84  76	Untitled
+ 60  84  76	Untitled
+ 60  84  76	Untitled
+ 60  84  76	Untitled
+ 56  80  72	Untitled
+ 56  80  72	Untitled
+ 56  80  72	Untitled
+ 56  80  72	Untitled
+ 56  76  72	Untitled
+ 52  76  72	Untitled
+ 52  76  72	Untitled
+ 52  76  68	Untitled
+ 52  72  68	Untitled
+ 52  72  68	Untitled
+ 48  72  68	Untitled
+ 48  72  68	Untitled
+ 48  68  68	Untitled
+ 48  68  64	Untitled
+ 48  68  64	Untitled
+ 44  68  64	Untitled
+ 44  64  64	Untitled
+ 44  64  64	Untitled
+ 44  64  64	Untitled
+ 40  64  60	Untitled
+ 40  60  60	Untitled
+ 40  60  60	Untitled
+ 40  60  60	Untitled
+ 40  60  60	Untitled
+ 36  56  60	Untitled
+ 36  56  56	Untitled
+ 36  56  56	Untitled
+ 36  56  56	Untitled
+ 36  52  56	Untitled
+ 32  52  56	Untitled
+ 32  52  56	Untitled
+ 32  52  52	Untitled
+ 32  48  52	Untitled
+ 32  48  52	Untitled
+ 28  48  52	Untitled
+ 28  48  52	Untitled
+ 28  44  52	Untitled
+ 28  44  48	Untitled
+ 28  44  48	Untitled
+ 24  44  48	Untitled
+ 24  40  48	Untitled
+ 24  40  48	Untitled
+ 24  40  48	Untitled
+ 20  36  44	Untitled
+ 24  40  48	Untitled
+ 24  40  48	Untitled
+ 24  40  48	Untitled
+ 24  40  48	Untitled
+ 24  40  52	Untitled
+ 24  40  52	Untitled
+ 24  40  52	Untitled
+ 28  44  52	Untitled
+ 28  44  56	Untitled
+ 28  44  56	Untitled
+ 28  44  56	Untitled
+ 28  44  56	Untitled
+ 28  44  56	Untitled
+ 28  44  60	Untitled
+ 28  48  60	Untitled
+ 32  48  60	Untitled
+ 32  48  60	Untitled
+ 32  48  64	Untitled
+ 32  48  64	Untitled
+ 32  48  64	Untitled
+ 32  48  64	Untitled
+ 32  52  64	Untitled
+ 36  52  68	Untitled
+ 36  52  68	Untitled
+ 36  52  68	Untitled
+ 36  52  68	Untitled
+ 36  52  72	Untitled
+ 36  52  72	Untitled
+ 36  52  72	Untitled
+ 36  56  72	Untitled
+ 40  56  72	Untitled
+ 40  56  76	Untitled
+ 40  56  76	Untitled
+ 40  56  76	Untitled
+ 40  56  76	Untitled
+ 40  56  80	Untitled
+ 40  60  80	Untitled
+ 44  60  80	Untitled
+ 44  60  80	Untitled
+ 44  60  80	Untitled
+ 44  60  84	Untitled
+ 44  60  84	Untitled
+ 44  60  84	Untitled
+ 44  64  84	Untitled
+ 44  64  88	Untitled
+ 48  64  88	Untitled
+ 48  64  88	Untitled
+ 48  64  88	Untitled
+ 48  64  88	Untitled
+ 48  64  92	Untitled
+ 48  64  92	Untitled
+ 48  68  92	Untitled
+ 48  68  92	Untitled
+ 52  68  96	Untitled
+ 52  68  96	Untitled
+ 52  68  96	Untitled
+ 52  68  96	Untitled
+ 52  68  96	Untitled
+ 52  72 100	Untitled
+ 52  72 100	Untitled
+ 56  72 100	Untitled
+ 56  72 100	Untitled
+ 56  72 104	Untitled
+ 56  72 104	Untitled
+ 56  72 104	Untitled
+ 56  76 104	Untitled
+ 56  76 104	Untitled
+ 56  76 108	Untitled
+ 60  76 108	Untitled
+ 60  76 108	Untitled
+ 60  76 108	Untitled
+ 60  76 112	Untitled
+ 60  80 112	Untitled
+ 60  80 112	Untitled
+ 60  80 112	Untitled
+ 64  80 112	Untitled
+ 64  80 116	Untitled
+ 64  80 116	Untitled
+ 64  80 116	Untitled
+ 64  80 116	Untitled
+ 64  84 120	Untitled
+ 64  84 120	Untitled
+ 64  84 120	Untitled
+ 68  84 120	Untitled
+ 68  84 120	Untitled
+ 68  84 124	Untitled
+ 68  84 124	Untitled
+ 68  88 124	Untitled
+ 68  88 124	Untitled
+ 68  88 128	Untitled
+ 72  88 128	Untitled
+ 72  88 128	Untitled
+ 72  88 128	Untitled
+ 72  88 128	Untitled
+ 72  92 132	Untitled
+ 72  92 132	Untitled
+ 72  92 132	Untitled
+ 72  92 132	Untitled
+ 76  92 136	Untitled
+ 76  92 136	Untitled
+ 76  92 136	Untitled
+ 76  92 136	Untitled
+ 76  96 140	Untitled
+ 76  96 140	Untitled
+ 76  96 140	Untitled
+ 76  96 140	Untitled
+ 80  96 140	Untitled
+ 80  96 144	Untitled
+ 80  96 144	Untitled
+ 80 100 144	Untitled
+ 80 100 144	Untitled
+ 80 100 148	Untitled
+ 80 100 148	Untitled
+ 84 100 148	Untitled
+ 84 100 148	Untitled
+ 84 100 148	Untitled
+ 84 104 152	Untitled
+ 84 104 152	Untitled
+ 84 104 152	Untitled
+ 84 104 152	Untitled
+ 84 104 156	Untitled
+ 88 104 156	Untitled
+ 88 104 156	Untitled
+ 88 104 156	Untitled
+ 88 108 156	Untitled
+ 88 108 160	Untitled
+ 88 108 160	Untitled
+ 88 108 160	Untitled
+ 92 108 160	Untitled
+ 92 108 164	Untitled
diff --git a/chalk/data/palettes/Grays.gpl b/chalk/data/palettes/Grays.gpl
new file mode 100644
index 000000000..49050b22c
--- /dev/null
+++ b/chalk/data/palettes/Grays.gpl
@@ -0,0 +1,34 @@
+GIMP Palette
+Name: Grays
+  0   0   0	gray0
+  7   7   7	gray3
+ 15  15  15	gray6
+ 23  23  23	gray9
+ 31  31  31	gray12
+ 39  39  39	gray15
+ 47  47  47	gray18
+ 55  55  55	gray21
+ 63  63  63	gray25
+ 71  71  71	gray28
+ 79  79  79	gray31
+ 87  87  87	gray34
+ 95  95  95	gray37
+103 103 103	gray40
+111 111 111	gray43
+119 119 119	gray46
+127 127 127	gray50
+135 135 135	gray53
+143 143 143	gray56
+151 151 151	gray59
+159 159 159	gray62
+167 167 167	gray65
+175 175 175	gray68
+183 183 183	gray71
+191 191 191	gray75
+199 199 199	gray78
+207 207 207	gray81
+215 215 215	gray84
+223 223 223	gray87
+231 231 231	gray90
+239 239 239	gray93
+247 247 247	gray96
diff --git a/chalk/data/palettes/Greens.gpl b/chalk/data/palettes/Greens.gpl
new file mode 100644
index 000000000..9da819b4d
--- /dev/null
+++ b/chalk/data/palettes/Greens.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Greens
+#
+  0   0   0	grey0
+  0   0   0	grey0
+  0   4   0	Untitled
+  0  12   0	Untitled
+  0  16   0	Untitled
+  0  24   0	Untitled
+  0  32   0	Untitled
+  0  36   0	Untitled
+  0  44   0	Untitled
+  0  48   0	Untitled
+  0  56   0	Untitled
+  0  64   0	Untitled
+  0  68   0	Untitled
+  0  76   0	Untitled
+  0  80   0	Untitled
+  0  88   0	Untitled
+  0  96   0	Untitled
+  0 100   0	DarkGreen
+  0 108   0	Untitled
+  0 116   0	Untitled
+  0 120   0	Untitled
+  0 128   0	Untitled
+  0 132   0	Untitled
+  0 140   0	Untitled
+  0 148   0	Untitled
+  0 152   0	Untitled
+  0 160   0	Untitled
+  0 164   0	Untitled
+  0 172   0	Untitled
+  0 180   0	Untitled
+  0 184   0	Untitled
+  0 192   0	Untitled
+  0 200   0	Untitled
+  4 200   0	Untitled
+ 12 200   0	Untitled
+ 16 204   0	Untitled
+ 24 204   0	Untitled
+ 28 208   0	Untitled
+ 36 208   0	Untitled
+ 40 208   0	Untitled
+ 48 212   0	Untitled
+ 56 212   0	Untitled
+ 60 216   0	Untitled
+ 68 216   0	Untitled
+ 72 216   0	Untitled
+ 80 220   0	Untitled
+ 84 220   0	Untitled
+ 92 224   0	Untitled
+100 224   0	Untitled
+104 224   0	Untitled
+112 228   0	Untitled
+116 228   0	Untitled
+124 232   0	Untitled
+128 232   0	Untitled
+136 232   0	Untitled
+140 236   0	Untitled
+148 236   0	Untitled
+156 240   0	Untitled
+160 240   0	Untitled
+168 240   0	Untitled
+172 244   0	Untitled
+180 244   0	Untitled
+184 248   0	Untitled
+192 248   0	Untitled
+200 252   0	Untitled
+200 252   4	Untitled
+200 252  12	Untitled
+204 252  20	Untitled
+204 252  28	Untitled
+208 252  36	Untitled
+208 252  44	Untitled
+208 252  52	Untitled
+212 252  60	Untitled
+212 252  68	Untitled
+216 252  76	Untitled
+216 252  84	Untitled
+216 252  92	Untitled
+220 252 100	Untitled
+220 252 108	Untitled
+224 252 116	Untitled
+224 252 124	Untitled
+224 252 132	Untitled
+228 252 140	Untitled
+228 252 148	Untitled
+232 252 156	Untitled
+232 252 164	Untitled
+232 252 172	Untitled
+236 252 180	Untitled
+236 252 188	Untitled
+240 252 196	Untitled
+240 252 204	Untitled
+240 252 212	Untitled
+244 252 220	Untitled
+244 252 228	Untitled
+248 252 236	Untitled
+248 252 244	Untitled
+252 252 252	grey99
+252 252 248	Untitled
+252 252 244	Untitled
+252 252 240	Untitled
+252 252 232	Untitled
+252 252 228	Untitled
+252 252 224	Untitled
+252 252 216	Untitled
+252 252 212	Untitled
+252 252 208	Untitled
+252 252 200	Untitled
+252 252 196	Untitled
+252 252 192	Untitled
+252 252 184	Untitled
+252 252 180	Untitled
+252 252 176	Untitled
+252 252 168	Untitled
+252 252 164	Untitled
+252 252 160	Untitled
+252 252 156	Untitled
+252 252 148	Untitled
+252 252 144	Untitled
+252 252 140	Untitled
+252 252 132	Untitled
+252 252 128	Untitled
+252 252 124	Untitled
+252 252 116	Untitled
+252 252 112	Untitled
+252 252 108	Untitled
+252 252 100	Untitled
+252 252  96	Untitled
+252 252  92	Untitled
+252 252  84	Untitled
+252 252  80	Untitled
+252 252  76	Untitled
+252 252  72	Untitled
+252 252  64	Untitled
+252 252  60	Untitled
+252 252  56	Untitled
+252 252  48	Untitled
+252 252  44	Untitled
+252 252  40	Untitled
+252 252  32	Untitled
+252 252  28	Untitled
+252 252  24	Untitled
+252 252  16	Untitled
+252 252  12	Untitled
+252 252   8	Untitled
+252 252   0	Untitled
+248 252   0	Untitled
+244 252   0	Untitled
+240 252   0	Untitled
+232 252   0	Untitled
+228 252   0	Untitled
+224 252   0	Untitled
+216 252   0	Untitled
+212 252   0	Untitled
+208 252   0	Untitled
+200 252   0	Untitled
+196 252   0	Untitled
+192 252   0	Untitled
+184 252   0	Untitled
+180 252   0	Untitled
+176 252   0	Untitled
+168 252   0	Untitled
+164 252   0	Untitled
+160 252   0	Untitled
+156 252   0	Untitled
+148 252   0	Untitled
+144 252   0	Untitled
+140 252   0	Untitled
+132 252   0	Untitled
+128 252   0	Untitled
+124 252   0	LawnGreen
+116 252   0	Untitled
+112 252   0	Untitled
+108 252   0	Untitled
+100 252   0	Untitled
+ 96 252   0	Untitled
+ 92 252   0	Untitled
+ 84 252   0	Untitled
+ 80 252   0	Untitled
+ 76 252   0	Untitled
+ 72 252   0	Untitled
+ 64 252   0	Untitled
+ 60 252   0	Untitled
+ 56 252   0	Untitled
+ 48 252   0	Untitled
+ 44 252   0	Untitled
+ 40 252   0	Untitled
+ 32 252   0	Untitled
+ 28 252   0	Untitled
+ 24 252   0	Untitled
+ 16 252   0	Untitled
+ 12 252   0	Untitled
+  8 252   0	Untitled
+  0 252   0	Untitled
+  0 248   0	Untitled
+  0 244   0	Untitled
+  0 240   0	Untitled
+  0 236   0	Untitled
+  0 232   0	Untitled
+  0 228   0	Untitled
+  0 224   0	Untitled
+  0 220   0	Untitled
+  0 216   0	Untitled
+  0 212   0	Untitled
+  0 208   0	Untitled
+  0 204   0	Untitled
+  0 200   0	Untitled
+  0 196   0	Untitled
+  0 192   0	Untitled
+  0 188   0	Untitled
+  0 184   0	Untitled
+  0 180   0	Untitled
+  0 176   0	Untitled
+  0 172   0	Untitled
+  0 168   0	Untitled
+  0 164   0	Untitled
+  0 160   0	Untitled
+  0 156   0	Untitled
+  0 152   0	Untitled
+  0 148   0	Untitled
+  0 144   0	Untitled
+  0 140   0	Untitled
+  0 136   0	Untitled
+  0 132   0	Untitled
+  0 128   0	Untitled
+  0 124   0	Untitled
+  0 120   0	Untitled
+  0 116   0	Untitled
+  0 112   0	Untitled
+  0 108   0	Untitled
+  0 104   0	Untitled
+  0 100   0	DarkGreen
+  0  96   0	Untitled
+  0  92   0	Untitled
+  0  88   0	Untitled
+  0  84   0	Untitled
+  0  80   0	Untitled
+  0  76   0	Untitled
+  0  72   0	Untitled
+  0  68   0	Untitled
+  0  64   0	Untitled
+  0  60   0	Untitled
+  0  56   0	Untitled
+  0  52   0	Untitled
+  0  48   0	Untitled
+  0  44   0	Untitled
+  0  40   0	Untitled
+  0  36   0	Untitled
+  0  32   0	Untitled
+  0  28   0	Untitled
+  0  24   0	Untitled
+  0  20   0	Untitled
+  0  16   0	Untitled
+  0  12   0	Untitled
+  0   8   0	Untitled
+  0   0   0	grey0
+  0   0   0	grey0
diff --git a/chalk/data/palettes/Hilite.gpl b/chalk/data/palettes/Hilite.gpl
new file mode 100644
index 000000000..74b286848
--- /dev/null
+++ b/chalk/data/palettes/Hilite.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Hilite
+#
+164 144 180	Untitled
+160 144 180	Untitled
+160 144 180	Untitled
+160 144 176	Untitled
+160 144 176	Untitled
+160 140 172	Untitled
+160 140 172	Untitled
+160 140 168	Untitled
+160 140 168	Untitled
+160 140 168	Untitled
+160 140 164	Untitled
+160 136 164	Untitled
+156 136 160	Untitled
+156 136 160	Untitled
+156 136 156	Untitled
+156 136 156	Untitled
+156 136 156	Untitled
+156 132 152	Untitled
+156 132 152	Untitled
+156 132 148	Untitled
+156 132 148	Untitled
+156 132 144	Untitled
+156 132 144	Untitled
+152 128 144	Untitled
+152 128 140	Untitled
+152 128 140	Untitled
+152 128 136	Untitled
+152 128 136	Untitled
+152 128 132	Untitled
+152 128 132	Untitled
+152 124 132	Untitled
+152 124 128	Untitled
+152 124 128	Untitled
+152 124 124	Untitled
+148 124 124	Untitled
+148 124 120	Untitled
+148 120 120	Untitled
+148 120 120	Untitled
+148 120 116	Untitled
+148 120 116	Untitled
+148 120 112	Untitled
+148 120 112	Untitled
+148 116 108	Untitled
+148 116 108	Untitled
+144 116 108	Untitled
+144 116 104	Untitled
+144 116 104	Untitled
+144 116 100	Untitled
+144 112 100	Untitled
+144 112  96	Untitled
+144 112  96	Untitled
+144 112  96	Untitled
+144 112  92	Untitled
+144 112  92	Untitled
+144 112  88	Untitled
+140 108  88	Untitled
+140 108  84	Untitled
+140 108  84	Untitled
+140 108  84	Untitled
+140 108  80	Untitled
+140 108  80	Untitled
+140 104  76	Untitled
+140 104  76	Untitled
+140 104  72	Untitled
+140 104  72	Untitled
+140 104  72	Untitled
+136 104  68	Untitled
+136 100  68	Untitled
+136 100  64	Untitled
+136 100  64	Untitled
+136 100  60	Untitled
+136 100  60	Untitled
+136 100  60	Untitled
+136  96  56	Untitled
+136  96  56	Untitled
+136  96  52	Untitled
+136  96  52	Untitled
+132  96  48	Untitled
+132  96  48	Untitled
+132  96  48	Untitled
+132  92  44	Untitled
+132  92  44	Untitled
+132  92  40	Untitled
+132  92  40	Untitled
+132  92  36	Untitled
+132  92  36	Untitled
+132  88  36	Untitled
+132  88  32	Untitled
+128  88  32	Untitled
+128  88  28	Untitled
+128  88  28	Untitled
+128  88  24	Untitled
+128  84  24	Untitled
+128  84  24	Untitled
+128  84  20	Untitled
+128  84  20	Untitled
+128  84  16	Untitled
+128  84  16	Untitled
+124  80  12	Untitled
+124  80  12	Untitled
+124  80  12	Untitled
+124  84  16	Untitled
+128  84  16	Untitled
+128  88  20	Untitled
+128  88  20	Untitled
+128  92  24	Untitled
+132  92  24	Untitled
+132  92  28	Untitled
+132  96  28	Untitled
+136  96  32	Untitled
+136 100  32	Untitled
+136 100  32	Untitled
+136 104  36	Untitled
+140 104  36	Untitled
+140 108  40	Untitled
+140 108  40	Untitled
+144 108  44	Untitled
+144 112  44	Untitled
+144 112  48	Untitled
+144 116  48	Untitled
+148 116  52	Untitled
+148 120  52	Untitled
+148 120  56	Untitled
+152 120  56	Untitled
+152 124  56	Untitled
+152 124  60	Untitled
+152 128  60	Untitled
+156 128  64	Untitled
+156 132  64	Untitled
+156 132  68	Untitled
+160 136  68	Untitled
+160 136  72	Untitled
+160 136  72	Untitled
+160 140  76	Untitled
+164 140  76	Untitled
+164 144  76	Untitled
+164 144  80	Untitled
+164 148  80	Untitled
+168 148  84	Untitled
+168 148  84	Untitled
+168 152  88	Untitled
+172 152  88	Untitled
+172 156  92	Untitled
+172 156  92	Untitled
+172 160  96	Untitled
+176 160  96	Untitled
+176 164 100	Untitled
+176 164 100	Untitled
+180 164 100	Untitled
+180 168 104	Untitled
+180 168 104	Untitled
+180 172 108	Untitled
+184 172 108	Untitled
+184 176 112	Untitled
+184 176 112	Untitled
+188 176 116	Untitled
+188 180 116	Untitled
+188 180 120	Untitled
+188 184 120	Untitled
+192 184 120	Untitled
+192 188 124	Untitled
+192 188 124	Untitled
+196 192 128	Untitled
+196 192 128	Untitled
+196 192 132	Untitled
+196 196 132	Untitled
+200 196 136	Untitled
+200 200 136	Untitled
+200 200 140	Untitled
+200 204 140	Untitled
+204 204 144	Untitled
+204 204 144	Untitled
+204 208 144	Untitled
+208 208 148	Untitled
+208 212 148	Untitled
+208 212 152	Untitled
+208 216 152	Untitled
+212 216 156	Untitled
+212 220 156	Untitled
+212 220 160	Untitled
+216 220 160	Untitled
+216 224 164	Untitled
+216 224 164	Untitled
+216 228 164	Untitled
+220 228 168	Untitled
+220 232 168	Untitled
+220 232 172	Untitled
+224 232 172	Untitled
+224 236 176	Untitled
+224 236 176	Untitled
+224 240 180	Untitled
+228 240 180	Untitled
+228 244 184	Untitled
+228 244 184	Untitled
+232 248 188	Untitled
+232 248 188	Untitled
+232 248 188	Untitled
+232 248 188	Untitled
+228 244 188	Untitled
+228 244 188	Untitled
+228 244 188	Untitled
+224 244 188	Untitled
+224 240 188	Untitled
+224 240 188	Untitled
+220 240 188	Untitled
+220 236 188	Untitled
+220 236 188	Untitled
+216 236 188	Untitled
+216 236 188	Untitled
+216 232 188	Untitled
+212 232 188	Untitled
+212 232 184	Untitled
+212 228 184	Untitled
+208 228 184	Untitled
+208 228 184	Untitled
+208 228 184	Untitled
+204 224 184	Untitled
+204 224 184	Untitled
+204 224 184	Untitled
+204 220 184	Untitled
+200 220 184	Untitled
+200 220 184	Untitled
+200 220 184	Untitled
+196 216 184	Untitled
+196 216 184	Untitled
+196 216 184	Untitled
+192 212 184	Untitled
+192 212 184	Untitled
+192 212 180	Untitled
+188 212 180	Untitled
+188 208 180	Untitled
+188 208 180	Untitled
+184 208 180	Untitled
+184 204 180	Untitled
+184 204 180	Untitled
+180 204 180	Untitled
+180 204 180	Untitled
+180 200 180	Untitled
+176 200 180	Untitled
+176 200 180	Untitled
+176 196 180	Untitled
+172 196 180	Untitled
+172 196 180	Untitled
+172 196 180	Untitled
+172 192 180	Untitled
+168 192 176	Untitled
+168 192 176	Untitled
+168 188 176	Untitled
+164 188 176	Untitled
+164 188 176	Untitled
+164 188 176	Untitled
+160 184 176	Untitled
+160 184 176	Untitled
+160 184 176	Untitled
+156 180 176	Untitled
+156 180 176	Untitled
diff --git a/chalk/data/palettes/Khaki.gpl b/chalk/data/palettes/Khaki.gpl
new file mode 100644
index 000000000..88ea22387
--- /dev/null
+++ b/chalk/data/palettes/Khaki.gpl
@@ -0,0 +1,258 @@
+GIMP Palette
+Name: Khaki
+#
+144 132 108	Untitled
+144 132 112	Untitled
+144 132 112	Untitled
+144 132 116	Untitled
+144 136 116	Untitled
+144 136 120	Untitled
+144 136 120	Untitled
+144 140 120	Untitled
+144 140 124	Untitled
+144 140 124	Untitled
+144 140 128	Untitled
+144 144 128	Untitled
+144 144 132	Untitled
+144 144 132	Untitled
+144 144 136	Untitled
+144 148 136	Untitled
+144 148 136	Untitled
+144 148 140	Untitled
+144 152 140	Untitled
+144 152 144	Untitled
+144 152 144	Untitled
+144 152 148	Untitled
+144 156 148	Untitled
+144 156 152	Untitled
+144 156 152	Untitled
+144 160 152	Untitled
+144 160 156	Untitled
+144 160 156	Untitled
+144 160 160	Untitled
+144 164 160	Untitled
+144 164 164	Untitled
+144 164 164	Untitled
+144 164 168	Untitled
+144 168 168	Untitled
+144 168 168	Untitled
+144 168 172	Untitled
+144 172 172	Untitled
+144 172 176	Untitled
+144 172 176	Untitled
+144 172 180	Untitled
+144 176 180	Untitled
+144 176 184	Untitled
+144 176 184	Untitled
+144 180 184	Untitled
+144 180 188	Untitled
+144 180 188	Untitled
+144 180 192	Untitled
+144 184 192	Untitled
+144 184 196	Untitled
+144 184 196	Untitled
+144 184 196	Untitled
+148 188 192	Untitled
+148 188 192	Untitled
+152 188 192	Untitled
+152 188 192	Untitled
+152 188 188	Untitled
+156 188 188	Untitled
+156 188 188	Untitled
+156 188 188	Untitled
+160 188 184	Untitled
+160 188 184	Untitled
+160 188 184	Untitled
+164 188 184	Untitled
+164 188 180	Untitled
+164 192 180	Untitled
+168 192 180	Untitled
+168 192 180	Untitled
+168 192 180	Untitled
+172 192 176	Untitled
+172 192 176	Untitled
+172 192 176	Untitled
+176 192 176	Untitled
+176 192 172	Untitled
+176 192 172	Untitled
+180 192 172	Untitled
+180 192 172	Untitled
+180 192 168	Untitled
+184 192 168	Untitled
+184 196 168	Untitled
+184 196 168	Untitled
+188 196 164	Untitled
+188 196 164	Untitled
+188 196 164	Untitled
+192 196 164	Untitled
+192 196 164	Untitled
+192 196 160	Untitled
+196 196 160	Untitled
+196 196 160	Untitled
+196 196 160	Untitled
+200 196 156	Untitled
+200 196 156	Untitled
+200 200 156	Untitled
+204 200 156	Untitled
+204 200 152	Untitled
+204 200 152	Untitled
+208 200 152	Untitled
+208 200 152	Untitled
+208 200 148	Untitled
+212 200 148	Untitled
+212 200 148	Untitled
+212 200 148	Untitled
+216 200 148	Untitled
+216 200 144	Untitled
+216 200 144	Untitled
+220 200 144	Untitled
+220 204 144	Untitled
+220 204 140	Untitled
+224 204 140	Untitled
+224 204 140	Untitled
+224 204 140	Untitled
+228 204 136	Untitled
+228 204 136	Untitled
+228 204 136	Untitled
+232 204 136	Untitled
+232 204 132	Untitled
+232 204 132	Untitled
+236 204 132	Untitled
+236 204 132	Untitled
+236 204 132	Untitled
+232 200 128	Untitled
+232 200 128	Untitled
+232 200 128	Untitled
+228 200 128	Untitled
+228 196 128	Untitled
+228 196 124	Untitled
+224 196 124	Untitled
+224 196 124	Untitled
+224 196 124	Untitled
+220 192 124	Untitled
+220 192 124	Untitled
+220 192 120	Untitled
+216 192 120	Untitled
+216 192 120	Untitled
+216 188 120	Untitled
+212 188 120	Untitled
+212 188 120	Untitled
+212 188 116	Untitled
+208 188 116	Untitled
+208 184 116	Untitled
+208 184 116	Untitled
+204 184 116	Untitled
+204 184 116	Untitled
+204 184 112	Untitled
+204 180 112	Untitled
+200 180 112	Untitled
+200 180 112	Untitled
+200 180 112	Untitled
+196 180 108	Untitled
+196 176 108	Untitled
+196 176 108	Untitled
+192 176 108	Untitled
+192 176 108	Untitled
+192 176 108	Untitled
+188 172 104	Untitled
+188 172 104	Untitled
+188 172 104	Untitled
+184 172 104	Untitled
+184 172 104	Untitled
+184 168 104	Untitled
+180 168 100	Untitled
+180 168 100	Untitled
+180 168 100	Untitled
+176 168 100	Untitled
+176 164 100	Untitled
+176 164 100	Untitled
+176 164  96	Untitled
+172 164  96	Untitled
+172 164  96	Untitled
+172 160  96	Untitled
+168 160  96	Untitled
+168 160  92	Untitled
+168 160  92	Untitled
+164 160  92	Untitled
+164 156  92	Untitled
+164 156  92	Untitled
+160 156  92	Untitled
+160 156  88	Untitled
+160 156  88	Untitled
+156 152  88	Untitled
+156 152  88	Untitled
+156 152  88	Untitled
+152 152  88	Untitled
+152 152  84	Untitled
+152 148  84	Untitled
+148 148  84	Untitled
+148 148  84	Untitled
+148 148  84	Untitled
+148 148  84	Untitled
+144 144  80	Untitled
+144 144  80	Untitled
+144 144  80	Untitled
+140 144  80	Untitled
+140 140  80	Untitled
+140 140  76	Untitled
+136 140  76	Untitled
+136 140  76	Untitled
+136 140  76	Untitled
+132 136  76	Untitled
+132 136  76	Untitled
+132 136  72	Untitled
+128 136  72	Untitled
+128 136  72	Untitled
+128 132  72	Untitled
+124 132  72	Untitled
+124 132  72	Untitled
+124 132  68	Untitled
+120 132  68	Untitled
+120 128  68	Untitled
+120 128  68	Untitled
+116 128  68	Untitled
+116 128  68	Untitled
+116 128  64	Untitled
+116 124  64	Untitled
+112 124  64	Untitled
+112 124  64	Untitled
+112 124  64	Untitled
+108 124  60	Untitled
+108 120  60	Untitled
+108 120  60	Untitled
+104 120  60	Untitled
+104 120  60	Untitled
+104 120  60	Untitled
+100 116  56	Untitled
+100 116  56	Untitled
+100 116  56	Untitled
+ 96 116  56	Untitled
+ 96 116  56	Untitled
+ 96 112  56	Untitled
+ 92 112  52	Untitled
+ 92 112  52	Untitled
+ 92 112  52	Untitled
+ 88 112  52	Untitled
+ 88 108  52	Untitled
+ 88 108  52	Untitled
+ 88 108  48	Untitled
+ 84 108  48	Untitled
+ 84 108  48	Untitled
+ 84 104  48	Untitled
+ 80 104  48	Untitled
+ 80 104  44	Untitled
+ 80 104  44	Untitled
+ 76 104  44	Untitled
+ 76 100  44	Untitled
+ 76 100  44	Untitled
+ 72 100  44	Untitled
+ 72 100  40	Untitled
+ 72 100  40	Untitled
+ 68  96  40	Untitled
+ 68  96  40	Untitled
+ 68  96  40	Untitled
+ 64  96  40	Untitled
+ 64  96  36	Untitled
+ 64  92  36	Untitled
+ 60  92  36	Untitled
+ 60  92  36	Untitled
diff --git a/chalk/data/palettes/Lights.gpl b/chalk/data/palettes/Lights.gpl
new file mode 100644
index 000000000..d2330496a
--- /dev/null
+++ b/chalk/data/palettes/Lights.gpl
@@ -0,0 +1,28 @@
+GIMP Palette
+Name: Lights
+#
+255 250 250	Snow
+248 248 255	Ghost White
+245 245 245	White Smoke
+220 220 220	Gainsboro
+255 250 240	Floral White
+253 245 230	Old Lace
+250 240 230	Linen
+250 235 215	Antique White
+255 239 213	Papaya Whip
+255 235 205	Blanched Almond
+255 228 196	Bisque
+255 218 185	Peach Puff
+255 222 173	Navajo White
+255 228 181	Moccasin
+255 248 220	Cornsilk
+255 255 240	Ivory
+255 250 205	Lemon Chiffon
+255 245 238	Seashell
+240 255 240	Honeydew
+245 255 250	Mint Cream
+240 255 255	Azure
+240 248 255	Alice Blue
+230 230 250	Lavender
+255 228 225	Misty Rose
+255 255 255	White
diff --git a/chalk/data/palettes/Madeira.gpl b/chalk/data/palettes/Madeira.gpl
new file mode 100644
index 000000000..fbf7c30ac
--- /dev/null
+++ b/chalk/data/palettes/Madeira.gpl
@@ -0,0 +1,372 @@
+GIMP Palette
+Name: Madeira
+#
+  0   0   0	Black Black
+243 232 209	Ecru Ecru
+252 252 252	White White
+249 247 219	101 Lemon - VY LT
+249 245 182	102 Lemon - LT
+247 230 127	103 Lemon - MED
+255 222  68	104 Lemon - DK
+255 212  37	105 Lemon - VY DK
+255 196  16	106 Canary Yellow - BRIGHT
+255 175   5	107 Topaz - MED
+255 203  63	108 Topaz - LT
+255 209  73	109 Topaz - VY LT
+255 221 104	110 Topaz - ULT VY LT
+255 232 135	111 Yellow - VY LT
+255 217 126	112 Yellow - LT
+255 188  35	113 Yellow - MED
+245 136  52	114 Yellow - DK
+245 115   0	201 Tangerine - LT
+245 105   0	202 Tangerine
+245  94   0	203 Tangerine - MED
+245  84   0	204 Tangerine - DK
+250  63   0	205 Tangerine - VY DK
+245   5   5	206 Orange Red
+244  42  42	207 Orange
+206   0  21	208 Orange - DK
+226   0  21	209 Orange - VY DK
+212   0  21	210 Christmas Red - LT
+191   0  21	211 Christmas Red - BRIGHT
+207   0  40	212 Christmas Red - DK
+236  17  67	213 Coral - DK
+236  65  77	214 Coral - MED
+245 102  73	301 Peach - MED
+245 123  94	302 Peach - LT
+245 112 105	303 Coral
+245 177 177	304 Coral - LT
+234 201 191	305 Coral - VY LT
+244 211 191	306 Coral - ULT VY LT
+236 118  73	307 Copper - ULT VY LT
+236 108  63	308 Copper - VY LT
+236  82  37	309 Copper - LT
+215 108  73	310 Copper - MED LT
+215  87  52	311 Copper - MED
+173  34  21	312 Copper - MED DK
+163   7  21	313 Copper - DK
+121   7  21	314 Copper - VY DK
+152  41  45	401 Terracotta
+174  79  65	402 Terracotta - MED LT
+216 131 117	403 Terracotta - LT
+239 168 169	404 Salmon - LT
+218 127 137	405 Salmon - MED
+201  74  82	406 Salmon - DK
+152   0   0	407 Salmon - VY DK
+248 112 143	408 Rose
+244  81 111	409 Rose - MED
+213  52  64	410 Rose - DK
+224  31  53	411 Pink - VY DK
+224  42  74	412 Pink - DK
+235  63 111	413 Pink - MED
+235 105 137	414 Pink
+250 209 202	501 Baby Pink - VY LT
+253 200 205	502 Baby Pink - LT
+253 190 205	503 Baby Pink - MED LT
+255 123 165	504 Baby Pink - MED
+236 112 154	505 Baby Pink - DK
+215  70 112	506 Baby Pink - VY DK
+184   0  60	507 Red
+157   0  39	508 Red - MED DK
+147   0  17	509 Red - DK
+180   0  21	510 Christmas Red
+159   0  31	511 Garnet
+149   0  31	512 Garnet - MED
+128   0  31	513 Garnet - DK
+ 96   0  31	514 Garnet - VY DK
+ 81   0   5	601 Plum - VY DK
+116  20  49	602 Plum - DK
+148  39  66	603 Plum - MED
+168  59  91	604 Plum
+205 107 137	605 Plum - LT
+248 160 185	606 Plum - VY LT
+253 186 200	607 Plum - ULT VY LT
+250 213 216	608 Plum - PALE
+220  95 115	609 Dusty Rose - DK
+199  74  94	610 Dusty Rose - VY DK
+221  64  94	611 Rose - MED DK
+235 117 151	612 Rose - MED LT
+236 149 182	613 Rose - LT
+236 133 182	614 Rose - VY LT
+215  76 132	701 Cerise - LT
+215   7 111	702 Cerise
+184   0  90	703 Cerise - DK
+163   0  69	704 Cerise - VY DK
+131   0  69	705 Mauve - VY DK
+158   0 108	706 Mauve - DK
+179   0 118	707 Mauve - MED DK
+190  52 129	708 Mauve - MED
+216 102 173	709 Mauve - LT
+227 144 194	710 Mauve - VY LT
+179 121 185	711 Violet - LT
+127  37 132	712 Violet - MED
+106  16 111	713 Violet - DK
+ 64   0  69	714 Violet - VY DK
+201 165 203	801 Lavender - VY LT
+175 123 177	802 Lavender - LT
+159 107 177	803 Lavender - DK
+117  54 146	804 Lavender - VY DK
+105   0  73	805 Purple
+112  83  87	806 Antique Violet - DK
+175 143 155	807 Antique Violet - LT
+220 182 184	808 Antique Mauve - LT
+186 115 126	809 Antique Mauve - MED
+123  42  52	810 Antique Mauve - DK
+123   5  21	811 Shell Pink - MED DK
+195  86  95	812 Shell Pink - MED
+227 117 127	813 Shell Pink
+247 207 206	814 Shell Pink - LT
+175 178 211	901 Blue Violet - VY LT
+112 115 169	902 Blue Violet - LT
+ 58  42 106	903 Blue Violet - MED
+  0  21  95	904 Cornflower Blue - VY DK
+ 52  73 137	905 Cornflower Blue - DK
+ 79 100 143	906 Cornflower Blue - MED
+121 142 174	907 Cornflower Blue - LT
+165 196 195	908 Blue - ULT VY LT
+144 165 195	909 Delft
+ 86 128 164	910 Delft - MED
+23   96 158	911 Delft - DK
+  0  53 110	912 Royal Blue - MED
+  0  32 100	913 Royal Blue - DK
+ 21  32  89	914 Royal Blue - VY DK
+187 210 215	1001 Antique Blue - VY LT
+152 181 195	1002 Antique Blue - LT
+ 89 127 158	1003 Antique Blue
+ 58 106 140	1004 Antique Blue - MED
+ 16  74 109	1005 Antique Blue - DK
+  5  43  88	1006 Antique Blue - VY DK
+  0  28  73	1007 Blue - MED DK
+  0   7  42	1008 Blue - DK
+  0   0  31	1009 Blue - VY DK
+  0  81 132	1010 Blue - VY DK
+  0  81 122	1011 Blue - DK
+ 23 107 143	1012 Blue - MED
+107 149 174	1013 Blue
+163 191 195	1014 Blue - LT
+173 201 203	1101 Blue - VY LT
+  0  84 215	1102 Electric Blue - DK
+  0 147 215	1103 Electric Blue - MED
+189 228 233	1104 Wedgewood - ULT VY LT
+107 169 188	1105 Wedgewood - LT
+ 75 137 156	1106 Wedgewood - MED
+ 44 106 146	1107 Wedgewood - DK
+ 23 117 135	1108 Misty Blue - DK
+ 52 138 146	1109 Misty Blue - MED
+ 63 149 156	1110 Misty Blue - MED LT
+105 149 156	1111 Misty Blue - LT
+129 205 186	1112 Turquoise - VY LT
+ 97 194 175	1113 Turquoise - LT
+  7 163 144	1114 Turquoise - MED DK
+ 97 194 165	1201 Turquoise - MED
+  5 142  96	1202 Turquoise - DK
+  0 131  91	1203 Turquoise - VY DK
+  0  73  65	1204 Turquoise - ULT VY DK
+  0  84  60	1205 Blue Green
+ 21 108  52	1206 Jade - DK
+ 94 159 117	1207 Jade - MED
+189 233 212	1208 Jade - LT
+178 202 156	1209 Yellow Green - ULT VY LT
+189 233 201	1210 Leaf Green - VY LT
+152 207 165	1211 Leaf Green - LT
+ 95 157 107	1212 Leaf Green - MED
+ 47 133  81	1213 Leaf Green - DK
+ 31 112  60	1214 Leaf Green - VY DK
+  0 123  60	1301 Emerald Green
+  0 112  60	1302 Emerald Green - DK
+  0 102  48	1303 Christmas Green - DK
+  0 102  40	1304 Christmas Green - BRIGHT
+  0 105   0	1305 Christmas Green - MED
+ 66 158  54	1306 Chartreuse
+118 200  96	1307 Chartreuse - LT
+165 184  67	1308 Yellow Green
+226 236 219	1309 Pistachio Green - VY LT
+115 142 109	1310 Pistachio Green - LT
+ 84 110  77	1311 Pistachio Green - MED
+ 52  89  51	1312 Pistachio Green - DK
+ 31  68  14	1313 Pistachio Green - VY DK
+  0  28  24	1314 Pistachio Green - ULT VY DK
+147 175 115	1401 Green - VY LT
+100 136  54	1402 Green - LT
+ 58 105  17	1403 Green
+  0  80  31	1404 Hunter Green - VY DK
+  0  69  31	1405 Hunter Green - DK
+ 47  94  23	1406 Hunter Green - MED
+ 68 105  23	1407 Hunter Green
+ 89 105  23	1408 Hunter Green - LT
+178 185 107	1409 Forest Green - VY LT
+150 168   0	1410 Forest Green - LT
+114 146   0	1411 Forest Green - MED
+100 147   0	1412 Forest Green - DK
+ 68 126  21	1413 Forest Green - VY DK
+193 178  91	1414 Avocado Green - PALE
+185 195 103	1501 Avocado Green - VY LT
+133 153  50	1502 Avocado Green - LT
+123 143  50	1503 Avocado Green - MED LT
+ 91 111  19	1504 Avocado Green - MED
+ 49  38   0	1505 Fern Green - ULT VY DK
+ 60  48  42	1506 Fern Green - VY DK
+ 63  63   0	1507 Fern Green - DK
+ 68  68   5	1508 Fern Green - MED
+130 128  91	1509 Fern Green - LT
+140 138  96	1510 Fern Green - VY LT
+180 176 157	1511 Gray Green - VY LT
+149 160 136	1512 Gray Green - LT
+123 134 100	1513 Gray Green - MED
+ 60  82  47	1514 Gray Green - DK
+ 60  92  47	1601 Laurel Green - DK
+ 81 103  47	1602 Laurel Green - MED
+144 166  89	1603 Laurel Green - LT
+175 187 131	1604 Laurel Green - VY LT
+165 155  89	1605 Khaki Green - LT
+129 119  53	1606 Khaki Green - MED
+108  93  43	1607 Khaki Green - DK
+ 97 101   0	1608 Green - DK
+147 147   0	1609 Green - MED
+200 170  68	1610 Sage Green - VY LT
+161 147   0	1611 Sage Green - LT
+115  98   0	1612 Sage Green
+126 109   0	1613 Sage Green - MED
+ 94  77   0	1614 Sage Green - DK
+169 180 165	1701 Sea Foam Green - LT
+137 159 144	1702 Sea Foam Green
+ 95 117 102	1703 Sea Foam Green - MED
+ 74  96  81	1704 Sea Foam Green - DK
+ 21  63  42	1705 Sea Foam Green - ULT DK
+  0  63  73	1706 Blue Gray - DK
+ 73 105 115	1707 Blue Gray - MED
+175 185 193	1708 Blue Gray - LT
+175 170 159	1709 Blue Gray - VY LT
+146 164 179	1710 Dusty Blue - LT
+ 72 111 127	1711 Dusty Blue - MED
+ 51  90 116	1712 Dusty Blue - DK
+ 21   0  42	1713 Blue - BLACK
+ 97  88 105	1714 Steel Gray - DK
+108  98 108	1801 Steel Gray - MED
+134 130 139	1802 Steel Gray - LT
+153 140 150	1803 Steel Gray - VY LT
+213 208 212	1804 Pearl Gray - VY LT
+213 217 212	1805 Gray Green - ULT VY LT
+166 143 151	1806 Shell Gray - LT
+157 143 151	1807 Shell Gray - MED
+132 111 119	1808 Shell Gray - DK
+ 79  69  67	1809 Shell Gray - VY DK
+ 58  38  46	1810 Shell Gray - ULT VY DK
+ 91  82  67	1811 Beaver Gray - DK
+123 115  98	1812 Beaver Gray - MED
+138 137 119	1813 Beaver Gray - LT
+178 172 156	1814 Beaver Gray - VY LT
+205 203 195	1901 Beige Gray - LT
+179 169 153	1902 Beige Gray - MED
+148 127 111	1903 Beige Gray - DK
+ 64  43  27	1904 Beige Gray - ULT VY DK
+106  85  59	1905 Beige Gray - VY DK
+153 127 101	1906 Beige Gray
+216 190 174	1907 Beige Gray - MED LT
+237 221 206	1908 Beige Brown - ULT VY LT
+216 191 176	1909 Beige Brown - VY LT
+213 179 164	1910 Beige Brown - LT
+171 137 122	1911 Beige Brown - MED
+150 112  96	1912 Beige Brown - DK
+118  81  65	1913 Beige Brown - VY DK
+ 87  49  17	1914 Beige Brown - ULT VY DK
+216 200 185	2001 Mocha Brown - LT
+150 127  90	2002 Mocha Brown - MED
+ 54  23   0	2003 Brown - DK
+ 42  21   0	2004 Black Brown
+ 73  26   0	2005 Chocolate
+ 63  26   0	2006 Tan - ULT VY DK
+ 84  37  31	2007 Tan - VY DK
+110  52  31	2008 Tan - DK
+131  63  21	2009 Tan - MED DK
+173  94  52	2010 Tan - MED
+199 126  73	2011 Tan
+231 168  94	2012 Tan - LT
+241 188 126	2013 Tan - VY LT
+248 219 178	2014 Tan - ULT VY LT
+255 247 231	2101 Cream
+220 166 105	2102 Hazelnut Brown - LT
+178 124  63	2103 Hazelnut Brown - LT
+157 102  42	2104 Hazelnut Brown - MED
+110  64   5	2105 Hazelnut Brown - DK
+ 79  43   5	2106 Drab Brown - VY DK
+ 90  63   5	2107 Drab Brown - DK
+159 124  84	2108 Drab Brown - MED
+212 181 147	2109 Drab Brown - LT
+170 160 105	2110 Avocado - LT
+160 129  63	2111 Avocado - MED
+118  97  31	2112 Avocado - DK
+103  55   0	2113 Hazelnut Brown - VY DK
+103  66   0	2114 Avocado - VY DK
+145  97   0	2201 Old Gold - DK
+155 118   0	2202 Old Gold - MED
+197 139  42	2203 Old Gold
+208 150  52	2204 Old Gold - LT
+246 229 168	2205 Old Gold - VY LT
+213 186 110	2206 Avocado - VY LT
+249 228 163	2207 Gold - VY LT
+229 181 105	2208 Gold - LT
+197 139  52	2209 Gold - MED
+187 118  21	2210 Gold - DK
+197  97   0	2211 Topaz - MED DK
+197 113  21	2212 Topaz - DK
+155  82   0	2213 Topaz - VY DK
+134  71   0	2214 Topaz - ULT VY DK
+229 132  68	2301 Golden Brown - VY LT
+218 101  42	2302 Golden Brown - LT
+155  50   0	2303 Golden Brown - MED
+145  50  42	2304 Mahogany - DK
+171  29   0	2305 Mahogany - MED
+181  61  31	2306 Mahogany - LT
+236 145  65	2307 Mahogany - VY LT
+255 220 199	2308 Flesh - LT
+245 189 168	2309 Flesh - MED
+217 116 119	2310 Flesh - DK
+127  55  63	2311 Peach Flesh - VY DK
+193 107  93	2312 Peach Flesh - MED
+241 169 148	2313 Peach Flesh
+255 236 215	2314 Golden Brown - VY LT
+248 248 248	2402 Off White
+253 253 248	2403 Winter White
+100   0  31	2501 Bright Terracotta - DK
+148   0  42	2502 Bright Terracotta - MED
+255 175 146	2503 Bright Terracotta - LT
+224 236 226	2504 Wedgewood - VY LT
+  0  89 112	2505 Wedgewood - VY DK
+  0 131 136	2506 Misty Green - BRIGHT
+  0 105  95	2507 Misty Green - DK
+ 90 142 144	2508 Misty Green - MED
+234 171  73	2509 Golden Yellow - BRIGHT
+196 157  76	2510 Golden Yellow - DK
+238 229 193	2511 Golden Yellow - LT
+238 223 182	2512 Golden Brown - LT
+244 166  93	2513 Golden Brown - BRIGHT
+213 134  72	2514 Golden Brown - MED
+153 110 100	2601 Coffee Brown - VY LT
+110  42  21	2602 Coffee Brown - LT
+ 63  89  52	2603 Nile Green - LT
+136 178 136	2604 Nile Green - DK
+245 175 156	2605 Peach - VY LT
+ 89   0  31	2606 Peach - ULT VY DK
+ 58   0  31	2607 Antique Plum - VY DK
+ 79   0  42	2608 Antique Plum - DK
+121  31  84	2609 Antique Plum - MED
+215 163 175	2610 Antique Plum - LT
+179 169 169	2611 Dusty Violet - LT
+164 149 164	2612 Dusty Violet - MED
+136 110 136	2613 Dusty Violet - DK
+ 94  68  94	2614 Dusty Violet - VY DK
+  0   0  52	2701 Blue Violet - DK
+ 77  96 147	2702 Blue Violet - VY DK
+199 189  42	2703 Yellow Green - LT
+  0  69  35	2704 Christmas Green - DK
+  0  91  87	2705 Misty Turquoise - MED
+  0 133 118	2706 Misty Turquoise - DK
+243 117 154	2707 Bright Pink - LT
+216   0  56	2708 Bright Pink - MED
+ 47   0  84	2709 Antique Lavender - LT
+ 79  31 115	2710 Antique Lavender - MED
+152 136 178	2711 Antique Lavender - DK
+227 185 195	2712 Pink Purple - LT
+190 131 157	2713 Pink Purple - MED
+115  31  98	2714 Pink Purple - DK
diff --git a/chalk/data/palettes/Makefile.am b/chalk/data/palettes/Makefile.am
new file mode 100644
index 000000000..c454af145
--- /dev/null
+++ b/chalk/data/palettes/Makefile.am
@@ -0,0 +1,50 @@
+chalkpalettesdir = $(prefix)/share/apps/chalk/palettes
+
+chalkpalettes_DATA = \
+    40_Colors.gpl \
+    Anchor.gpl \
+    Bears.gpl \
+    Bgold.gpl \
+    Blues.gpl \
+    Borders.gpl \
+    Browns_And_Yellows.gpl \
+    Caramel.gpl \
+    Cascade.gpl \
+    China.gpl \
+    Coldfire.gpl \
+    Cool_Colors.gpl \
+    Cranes.gpl \
+    Dark_pastels.gpl \
+    Default.gpl \
+    DMC.gpl \
+    Ega.gpl \
+    Firecode.gpl \
+    Gold.gpl \
+    Grayblue.gpl \
+    Grays.gpl \
+    GrayViolet.gpl \
+    Greens.gpl \
+    Hilite.gpl \
+    Khaki.gpl \
+    Lights.gpl \
+    Madeira.gpl \
+    Makefile.am \
+    Makefile.in \
+    Muted.gpl \
+    Named_Colors.gpl \
+    new_kde.gpl \
+    News3.gpl \
+    Op2.gpl \
+    Paintjet.gpl \
+    Pantone_Coated_Approx.gpl \
+    Pastels.gpl \
+    Plasma.gpl \
+    Reds_And_Purples.gpl \
+    Reds.gpl \
+    Royal.gpl \
+    Topographic.gpl \
+    Visibone_2.gpl \
+    Visibone.gpl \
+    Volcano.gpl \
+    Warm_Colors.gpl \
+    Web.gpl 
diff --git a/chalk/data/palettes/Muted.gpl b/chalk/data/palettes/Muted.gpl
new file mode 100644
index 000000000..9d32a02df
--- /dev/null
+++ b/chalk/data/palettes/Muted.gpl
@@ -0,0 +1,81 @@
+GIMP Palette
+Name: Muted
+#
+139 137 137	Snow
+139 134 130	Seashell
+139 131 120	Antique White
+139 125 107	Bisque
+139 119 101	Peach Puff
+139 121  94	Navajo White
+139 137 112	Lemon Chiffon
+139 136 120	Cornsilk
+139 139 131	Ivory
+131 139 131	Honeydew
+139 131 134	Lavender Blush
+139 125 123	Misty Rose
+131 139 139	Azure
+ 71  60 139	Slate Blue
+ 39  64 139	Royal Blue
+  0   0 139	Blue
+ 16  78 139	Dodger Blue
+ 54 100 139	Steel Blue
+  0 104 139	Deep Sky Blue
+ 74 112 139	Sky Blue
+ 96 123 139	Light Sky Blue
+108 123 139	Slate Gray
+110 123 139	Light Steel Blue
+104 131 139	Light Blue
+122 139 139	Light Cyan
+102 139 139	Pale Turquoise
+ 83 134 139	Cadet Blue
+  0 134 139	Turquoise
+  0 139 139	Cyan
+ 82 139 139	Dark Slate Gray
+ 69 139 116	Aquamarine
+105 139 105	Dark Sea Green
+ 46 139  87	Sea Green
+ 84 139  84	Pale Green
+  0 139  69	Spring Green
+  0 139   0	Green
+ 69 139   0	Chartreuse
+105 139  34	Olive Drab
+110 139  61	Dark Olive Green
+139 134  78	Khaki
+139 129  76	Light Goldenrod
+139 139 122	Light Yellow
+139 139   0	Yellow
+139 117   0	Gold
+139 105  20	Goldenrod
+139 101   8	Dark Goldenrod
+139 105 105	Rosy Brown
+139  58  58	Indian Red
+139  71  38	Sienna
+139 115  85	Burlywood
+139 126 102	Wheat
+139  90  43	Tan
+139  69  19	Chocolate
+139  26  26	Firebrick
+139  35  35	Brown
+139  76  57	Salmon
+139  87  66	Light Salmon
+139  90   0	Orange
+139  69   0	Dark Orange
+139  62  47	Coral
+139  54  38	Tomato
+139  37   0	Orange Red
+139   0   0	Red
+139  10  80	Deep Pink
+139  58  98	Hot Pink
+139  99 108	Pink
+139  95 101	Light Pink
+139  71  93	Pale Violet Red
+139  28  98	Maroon
+139  34  82	Violet Red
+139   0 139	Magenta
+139  71 137	Orchid
+139 102 139	Plum
+122  55 139	Medium Orchid
+104  34 139	Dark Orchid
+ 85  26 139	Purple
+ 93  71 139	Medium Purple
+139 123 139	Thistle
diff --git a/chalk/data/palettes/Named_Colors.gpl b/chalk/data/palettes/Named_Colors.gpl
new file mode 100644
index 000000000..ce7af0238
--- /dev/null
+++ b/chalk/data/palettes/Named_Colors.gpl
@@ -0,0 +1,452 @@
+GIMP Palette
+Name: Named Colors
+Columns: 16
+#
+255 250 250	snow (255 250 250)
+248 248 255	ghost white (248 248 255)
+245 245 245	white smoke (245 245 245)
+220 220 220	gainsboro (220 220 220)
+255 250 240	floral white (255 250 240)
+253 245 230	old lace (253 245 230)
+250 240 230	linen (250 240 230)
+250 235 215	antique white (250 235 215)
+255 239 213	papaya whip (255 239 213)
+255 235 205	blanched almond (255 235 205)
+255 228 196	bisque (255 228 196)
+255 218 185	peach puff (255 218 185)
+255 222 173	navajo white (255 222 173)
+255 228 181	tqmoccasin (255 228 181)
+255 248 220	cornsilk (255 248 220)
+255 255 240	ivory (255 255 240)
+255 250 205	lemon chiffon (255 250 205)
+255 245 238	seashell (255 245 238)
+240 255 240	honeydew (240 255 240)
+245 255 250	mint cream (245 255 250)
+240 255 255	azure (240 255 255)
+240 248 255	alice blue (240 248 255)
+230 230 250	lavender (230 230 250)
+255 240 245	lavender blush (255 240 245)
+255 228 225	misty rose (255 228 225)
+255 255 255	white (255 255 255)
+  0   0   0	black (  0   0   0)
+ 47  79  79	dark slate gray ( 47  79  79)
+105 105 105	dim gray (105 105 105)
+112 128 144	slate gray (112 128 144)
+119 136 153	light slate gray (119 136 153)
+190 190 190	gray (190 190 190)
+211 211 211	light gray (211 211 211)
+ 25  25 112	midnight blue ( 25  25 112)
+  0   0 128	navy blue (  0   0 128)
+100 149 237	cornflower blue (100 149 237)
+ 72  61 139	dark slate blue ( 72  61 139)
+106  90 205	slate blue (106  90 205)
+123 104 238	medium slate blue (123 104 238)
+132 112 255	light slate blue (132 112 255)
+  0   0 205	medium blue (  0   0 205)
+ 65 105 225	royal blue ( 65 105 225)
+  0   0 255	blue (  0   0 255)
+ 30 144 255	dodger blue ( 30 144 255)
+  0 191 255	deep sky blue (  0 191 255)
+135 206 235	sky blue (135 206 235)
+135 206 250	light sky blue (135 206 250)
+ 70 130 180	steel blue ( 70 130 180)
+176 196 222	light steel blue (176 196 222)
+173 216 230	light blue (173 216 230)
+176 224 230	powder blue (176 224 230)
+175 238 238	pale turquoise (175 238 238)
+  0 206 209	dark turquoise (  0 206 209)
+ 72 209 204	medium turquoise ( 72 209 204)
+ 64 224 208	turquoise ( 64 224 208)
+  0 255 255	cyan (  0 255 255)
+224 255 255	light cyan (224 255 255)
+ 95 158 160	cadet blue ( 95 158 160)
+102 205 170	medium aquamarine (102 205 170)
+127 255 212	aquamarine (127 255 212)
+  0 100   0	dark green (  0 100   0)
+ 85 107  47	dark olive green ( 85 107  47)
+143 188 143	dark sea green (143 188 143)
+ 46 139  87	sea green ( 46 139  87)
+ 60 179 113	medium sea green ( 60 179 113)
+ 32 178 170	light sea green ( 32 178 170)
+152 251 152	pale green (152 251 152)
+  0 255 127	spring green (  0 255 127)
+124 252   0	lawn green (124 252   0)
+  0 255   0	green (  0 255   0)
+127 255   0	chartreuse (127 255   0)
+  0 250 154	medium spring green (  0 250 154)
+173 255  47	green yellow (173 255  47)
+ 50 205  50	lime green ( 50 205  50)
+154 205  50	yellow green (154 205  50)
+ 34 139  34	forest green ( 34 139  34)
+107 142  35	olive drab (107 142  35)
+189 183 107	dark khaki (189 183 107)
+240 230 140	khaki (240 230 140)
+238 232 170	pale goldenrod (238 232 170)
+250 250 210	light goldenrod yellow (250 250 210)
+255 255 224	light yellow (255 255 224)
+255 255   0	yellow (255 255   0)
+255 215   0	gold (255 215   0 )
+238 221 130	light goldenrod (238 221 130)
+218 165  32	goldenrod (218 165  32)
+184 134  11	dark goldenrod (184 134  11)
+188 143 143	rosy brown (188 143 143)
+205  92  92	indian red (205  92  92)
+139  69  19	saddle brown (139  69  19)
+160  82  45	sienna (160  82  45)
+205 133  63	peru (205 133  63)
+222 184 135	burlywood (222 184 135)
+245 245 220	beige (245 245 220)
+245 222 179	wheat (245 222 179)
+244 164  96	sandy brown (244 164  96)
+210 180 140	tan (210 180 140)
+210 105  30	chocolate (210 105  30)
+178  34  34	firebrick (178  34  34)
+165  42  42	brown (165  42  42)
+233 150 122	dark salmon (233 150 122)
+250 128 114	salmon (250 128 114)
+255 160 122	light salmon (255 160 122)
+255 165   0	orange (255 165   0)
+255 140   0	dark orange (255 140   0)
+255 127  80	coral (255 127  80)
+240 128 128	light coral (240 128 128)
+255  99  71	tomato (255  99  71)
+255  69   0	orange red (255  69   0)
+255   0   0	red (255   0   0)
+255 105 180	hot pink (255 105 180)
+255  20 147	deep pink (255  20 147)
+255 192 203	pink (255 192 203)
+255 182 193	light pink (255 182 193)
+219 112 147	pale violet red (219 112 147)
+176  48  96	maroon (176  48  96)
+199  21 133	medium violet red (199  21 133)
+208  32 144	violet red (208  32 144)
+255   0 255	magenta (255   0 255)
+238 130 238	violet (238 130 238)
+221 160 221	plum (221 160 221)
+218 112 214	orchid (218 112 214)
+186  85 211	medium orchid (186  85 211)
+153  50 204	dark orchid (153  50 204)
+148   0 211	dark violet (148   0 211)
+138  43 226	blue violet (138  43 226)
+160  32 240	purple (160  32 240)
+147 112 219	medium purple (147 112 219)
+216 191 216	thistle (216 191 216)
+255 250 250	snow 1 (255 250 250)
+238 233 233	snow 2 (238 233 233)
+205 201 201	snow 3 (205 201 201)
+139 137 137	snow 4 (139 137 137)
+255 245 238	seashell 1 (255 245 238)
+238 229 222	seashell 2 (238 229 222)
+205 197 191	seashell 3 (205 197 191)
+139 134 130	seashell 4 (139 134 130)
+255 239 219	antique white 1 (255 239 219)
+238 223 204	antique white 2 (238 223 204)
+205 192 176	antique white 3 (205 192 176)
+139 131 120	antique white 4 (139 131 120)
+255 228 196	bisque 1 (255 228 196)
+238 213 183	bisque 2 (238 213 183)
+205 183 158	bisque 3 (205 183 158)
+139 125 107	bisque 4 (139 125 107)
+255 218 185	peach puff 1 (255 218 185)
+238 203 173	peach puff 2 (238 203 173)
+205 175 149	peach puff 3 (205 175 149)
+139 119 101	peach puff 4 (139 119 101)
+255 222 173	navajo white 1 (255 222 173)
+238 207 161	navajo white 2 (238 207 161)
+205 179 139	navajo white 3 (205 179 139)
+139 121  94	navajo white 4 (139 121  94)
+255 250 205	lemon chiffon 1 (255 250 205)
+238 233 191	lemon chiffon 2 (238 233 191)
+205 201 165	lemon chiffon 3 (205 201 165)
+139 137 112	lemon chiffon 4 (139 137 112)
+255 248 220	cornsilk 1 (255 248 220)
+238 232 205	cornsilk 2 (238 232 205)
+205 200 177	cornsilk 3 (205 200 177)
+139 136 120	cornsilk 4 (139 136 120)
+255 255 240	ivory 1 (255 255 240)
+238 238 224	ivory 2 (238 238 224)
+205 205 193	ivory 3 (205 205 193)
+139 139 131	ivory 4 (139 139 131)
+240 255 240	honeydew 1 (240 255 240)
+224 238 224	honeydew 2 (224 238 224)
+193 205 193	honeydew 3 (193 205 193)
+131 139 131	honeydew 4 (131 139 131)
+255 240 245	lavender blush 1 (255 240 245)
+238 224 229	lavender blush 2 (238 224 229)
+205 193 197	lavender blush 3 (205 193 197)
+139 131 134	lavender blush 4 (139 131 134)
+255 228 225	misty rose 1 (255 228 225)
+238 213 210	misty rose 2 (238 213 210)
+205 183 181	misty rose 3 (205 183 181)
+139 125 123	misty rose 4 (139 125 123)
+240 255 255	azure 1 (240 255 255)
+224 238 238	azure 2 (224 238 238)
+193 205 205	azure 3 (193 205 205)
+131 139 139	azure 4 (131 139 139)
+131 111 255	slate blue 1 (131 111 255)
+122 103 238	slate blue 2 (122 103 238)
+105  89 205	slate blue 3 (105  89 205)
+ 71  60 139	slate blue 4 ( 71  60 139)
+ 72 118 255	royal blue 1 ( 72 118 255)
+ 67 110 238	royal blue 2 ( 67 110 238)
+ 58  95 205	royal blue 3 ( 58  95 205)
+ 39  64 139	royal blue 4 ( 39  64 139)
+  0   0 255	blue 1 (  0   0 255)
+  0   0 238	blue 2 (  0   0 238)
+  0   0 205	blue 3 (  0   0 205)
+  0   0 139	blue 4 (  0   0 139)
+ 30 144 255	dodger blue 1 ( 30 144 255)
+ 28 134 238	dodger blue 2 ( 28 134 238)
+ 24 116 205	dodger blue 3 ( 24 116 205)
+ 16  78 139	dodger blue 4 ( 16  78 139)
+ 99 184 255	steel blue 1 ( 99 184 255)
+ 92 172 238	steel blue 2 ( 92 172 238)
+ 79 148 205	steel blue 3 ( 79 148 205)
+ 54 100 139	steel blue 4 ( 54 100 139)
+  0 191 255	deep sky blue 1 (  0 191 255)
+  0 178 238	deep sky blue 2 (  0 178 238)
+  0 154 205	deep sky blue 3 (  0 154 205)
+  0 104 139	deep sky blue 4 (  0 104 139)
+135 206 255	sky blue 1 (135 206 255)
+126 192 238	sky blue 2 (126 192 238)
+108 166 205	sky blue 3 (108 166 205)
+ 74 112 139	sky blue 4 ( 74 112 139)
+176 226 255	light sky blue 1 (176 226 255)
+164 211 238	light sky blue 2 (164 211 238)
+141 182 205	light sky blue 3 (141 182 205)
+ 96 123 139	light sky blue 4 ( 96 123 139)
+198 226 255	slate gray 1 (198 226 255)
+185 211 238	slate gray 2 (185 211 238)
+159 182 205	slate gray 3 (159 182 205)
+108 123 139	slate gray 4 (108 123 139)
+202 225 255	light steel blue 1 (202 225 255)
+188 210 238	light steel blue 2 (188 210 238)
+162 181 205	light steel blue 3 (162 181 205)
+110 123 139	light steel blue 4 (110 123 139)
+191 239 255	light blue 1 (191 239 255)
+178 223 238	light blue 2 (178 223 238)
+154 192 205	light blue 3 (154 192 205)
+104 131 139	light blue 4 (104 131 139)
+224 255 255	light cyan 1 (224 255 255)
+209 238 238	light cyan 2 (209 238 238)
+180 205 205	light cyan 3 (180 205 205)
+122 139 139	light cyan 4 (122 139 139)
+187 255 255	pale turquoise 1 (187 255 255)
+174 238 238	pale turquoise 2 (174 238 238)
+150 205 205	pale turquoise 3 (150 205 205)
+102 139 139	pale turquoise 4 (102 139 139)
+152 245 255	cadet blue 1 (152 245 255)
+142 229 238	cadet blue 2 (142 229 238)
+122 197 205	cadet blue 3 (122 197 205)
+ 83 134 139	cadet blue 4 ( 83 134 139)
+  0 245 255	turquoise 1 (  0 245 255)
+  0 229 238	turquoise 2 (  0 229 238)
+  0 197 205	turquoise 3 (  0 197 205)
+  0 134 139	turquoise 4 (  0 134 139)
+  0 255 255	cyan 1 (  0 255 255)
+  0 238 238	cyan 2 (  0 238 238)
+  0 205 205	cyan 3 (  0 205 205)
+  0 139 139	cyan 4 (  0 139 139)
+151 255 255	dark slate gray 1 (151 255 255)
+141 238 238	dark slate gray 2 (141 238 238)
+121 205 205	dark slate gray 3 (121 205 205)
+ 82 139 139	dark slate gray 4 ( 82 139 139)
+127 255 212	aquamarine 1 (127 255 212)
+118 238 198	aquamarine 2 (118 238 198)
+102 205 170	aquamarine 3 (102 205 170)
+ 69 139 116	aquamarine 4 ( 69 139 116)
+193 255 193	dark sea green 1 (193 255 193)
+180 238 180	dark sea green 2 (180 238 180)
+155 205 155	dark sea green 3 (155 205 155)
+105 139 105	dark sea green 4 (105 139 105)
+ 84 255 159	sea green 1 ( 84 255 159)
+ 78 238 148	sea green 2 ( 78 238 148)
+ 67 205 128	sea green 3 ( 67 205 128)
+ 46 139  87	sea green 4 ( 46 139)
+154 255 154	pale green 1 (154 255 154)
+144 238 144	pale green 2 (144 238 144)
+124 205 124	pale green 3 (124 205 124)
+ 84 139  84	pale green 4 ( 84 139)
+  0 255 127	spring green 1 (  0 255 127)
+  0 238 118	spring green 2 (  0 238 118)
+  0 205 102	spring green 3 (  0 205 102)
+  0 139  69	spring green 4 (  0 139  69)
+  0 255   0	green 1 (  0 255   0)
+  0 238   0	green 2 (  0 238   0)
+  0 205   0	green 3 (  0 205   0)
+  0 139   0	green 4 (  0 139   0)
+127 255   0	chartreuse 1 (127 255   0)
+118 238   0	chartreuse 2 (118 238   0)
+102 205   0	chartreuse 3 (102 205   0)
+ 69 139   0	chartreuse 4 ( 69 139   0)
+192 255  62	olive drab 1 (192 255  62)
+179 238  58	olive drab 2 (179 238  58)
+154 205  50	olive drab 3 (154 205  50)
+105 139  34	olive drab 4 (105 139  34)
+202 255 112	dark olive green 1 (202 255 112)
+188 238 104	dark olive green 2 (188 238 104)
+162 205  90	dark olive green 3 (162 205)
+110 139  61	dark olive green 4 (110 139)
+255 246 143	khaki 1 (255 246 143)
+238 230 133	khaki 2 (238 230 133)
+205 198 115	khaki 3 (205 198 115)
+139 134  78	khaki 4 (139 134  78)
+255 236 139	light goldenrod 1 (255 236 139)
+238 220 130	light goldenrod 2 (238 220 130)
+205 190 112	light goldenrod 3 (205 190 112)
+139 129  76	light goldenrod 4 (139 129  76)
+255 255 224	light yellow 1 (255 255 224)
+238 238 209	light yellow 2 (238 238 209)
+205 205 180	light yellow 3 (205 205 180)
+139 139 122	light yellow 4 (139 139 122)
+255 255   0	yellow 1 (255 255   0)
+238 238   0	yellow 2 (238 238   0)
+205 205   0	yellow 3 (205 205   0)
+139 139   0	yellow 4 (139 139   0)
+255 215   0	gold 1 (255 215   0)
+238 201   0	gold 2 (238 201   0)
+205 173   0	gold 3 (205 173   0)
+139 117   0	gold 4 (139 117   0)
+255 193  37	goldenrod 1 (255 193  37)
+238 180  34	goldenrod 2 (238 180  34)
+205 155  29	goldenrod 3 (205 155  29)
+139 105  20	goldenrod 4 (139 105  20)
+255 185  15	dark goldenrod 1 (255 185  15)
+238 173  14	dark goldenrod 2 (238 173  14)
+205 149  12	dark goldenrod 3 (205 149  12)
+139 101   8	dark goldenrod 4 (139 101   8)
+255 193 193	rosy brown 1 (255 193 193)
+238 180 180	rosy brown 2 (238 180 180)
+205 155 155	rosy brown 3 (205 155 155)
+139 105 105	rosy brown 4 (139 105 105)
+255 106 106	indian red 1 (255 106 106)
+238  99  99	indian red 2 (238  99  99)
+205  85  85	indian red 3 (205  85  85)
+139  58  58	indian red 4 (139  58  58)
+255 130  71	sienna 1 (255 130  71)
+238 121  66	sienna 2 (238 121  66)
+205 104  57	sienna 3 (205 104  57)
+139  71  38	sienna 4 (139  71  38)
+255 211 155	burlywood 1 (255 211 155)
+238 197 145	burlywood 2 (238 197 145)
+205 170 125	burlywood 3 (205 170 125)
+139 115  85	burlywood 4 (139 115)
+255 231 186	wheat 1 (255 231 186)
+238 216 174	wheat 2 (238 216 174)
+205 186 150	wheat 3 (205 186 150)
+139 126 102	wheat 4 (139 126 102)
+255 165  79	tan 1 (255 165  79)
+238 154  73	tan 2 (238 154  73)
+205 133  63	tan 3 (205 133  63)
+139  90  43	tan 4 (139  90  43)
+255 127  36	chocolate 1 (255 127  36)
+238 118  33	chocolate 2 (238 118  33)
+205 102  29	chocolate 3 (205 102  29)
+139  69  19	chocolate 4 (139  69  19)
+255  48  48	firebrick 1 (255  48  48)
+238  44  44	firebrick 2 (238  44  44)
+205  38  38	firebrick 3 (205  38  38)
+139  26  26	firebrick 4 (139  26  26)
+255  64  64	brown 1 (255  64  64)
+238  59  59	brown 2 (238  59  59)
+205  51  51	brown 3 (205  51  51)
+139  35  35	brown 4 (139  35  35)
+255 140 105	salmon 1 (255 140 105)
+238 130  98	salmon 2 (238 130  98)
+205 112  84	salmon 3 (205 112  84)
+139  76  57	salmon 4 (139  76  57)
+255 160 122	light salmon 1 (255 160 122)
+238 149 114	light salmon 2 (238 149 114)
+205 129  98	light salmon 3 (205 129  98)
+139  87  66	light salmon 4 (139  87  66)
+255 165   0	orange 1 (255 165   0)
+238 154   0	orange 2 (238 154   0)
+205 133   0	orange 3 (205 133   0)
+139  90   0	orange 4 (139  90   0)
+255 127   0	dark orange 1 (255 127   0)
+238 118   0	dark orange 2 (238 118   0)
+205 102   0	dark orange 3 (205 102   0)
+139  69   0	dark orange 4 (139  69   0)
+255 114  86	coral 1 (255 114  86)
+238 106  80	coral 2 (238 106  80)
+205  91  69	coral 3 (205  91  69)
+139  62  47	coral 4 (139  62  47)
+255  99  71	tomato 1 (255  99  71)
+238  92  66	tomato 2 (238  92  66)
+205  79  57	tomato 3 (205  79  57)
+139  54  38	tomato 4 (139  54  38)
+255  69   0	orange red 1 (255  69   0)
+238  64   0	orange red 2 (238  64   0)
+205  55   0	orange red 3 (205  55   0)
+139  37   0	orange red 4 (139  37   0)
+255   0   0	red 1 (255   0   0)
+238   0   0	red 2 (238   0   0)
+205   0   0	red 3 (205   0   0)
+139   0   0	red 4 (139   0   0)
+255  20 147	deep pink 1 (255  20 147)
+238  18 137	deep pink 2 (238  18 137)
+205  16 118	deep pink 3 (205  16 118)
+139  10  80	deep pink 4 (139  10  80)
+255 110 180	hot pink 1 (255 110 180)
+238 106 167	hot pink 2 (238 106 167)
+205  96 144	hot pink 3 (205  96 144)
+139  58  98	hot pink 4 (139  58  98)
+255 181 197	pink 1 (255 181 197)
+238 169 184	pink 2 (238 169 184)
+205 145 158	pink 3 (205 145 158)
+139  99 108	pink 4 (139  99 108)
+255 174 185	light pink 1 (255 174 185)
+238 162 173	light pink 2 (238 162 173)
+205 140 149	light pink 3 (205 140 149)
+139  95 101	light pink 4 (139  95 101)
+255 130 171	pale violet red 1 (255 130 171)
+238 121 159	pale violet red 2 (238 121 159)
+205 104 137	pale violet red 3 (205 104 137)
+139  71  93	pale violet red 4 (139  71  93)
+255  52 179	maroon 1 (255  52 179)
+238  48 167	maroon 2 (238  48 167)
+205  41 144	maroon 3 (205  41 144)
+139  28  98	maroon 4 (139  28  98)
+255  62 150	violet red 1 (255  62 150)
+238  58 140	violet red 2 (238  58 140)
+205  50 120	violet red 3 (205  50 120)
+139  34  82	violet red 4 (139  34  82)
+255   0 255	magenta 1 (255   0 255)
+238   0 238	magenta 2 (238   0 238)
+205   0 205	magenta 3 (205   0 205)
+139   0 139	magenta 4 (139   0 139)
+255 131 250	orchid 1 (255 131 250)
+238 122 233	orchid 2 (238 122 233)
+205 105 201	orchid 3 (205 105 201)
+139  71 137	orchid 4 (139  71 137)
+255 187 255	plum 1 (255 187 255)
+238 174 238	plum 2 (238 174 238)
+205 150 205	plum 3 (205 150 205)
+139 102 139	plum 4 (139 102 139)
+224 102 255	medium orchid 1 (224 102 255)
+209  95 238	medium orchid 2 (209  95 238)
+180  82 205	medium orchid 3 (180  82 205)
+122  55 139	medium orchid 4 (122  55 139)
+191  62 255	dark orchid 1 (191  62 255)
+178  58 238	dark orchid 2 (178  58 238)
+154  50 205	dark orchid 3 (154  50 205)
+104  34 139	dark orchid 4 (104  34 139)
+155  48 255	purple 1 (155  48 255)
+145  44 238	purple 2 (145  44 238)
+125  38 205	purple 3 (125  38 205)
+ 85  26 139	purple 4 ( 85  26 139)
+171 130 255	medium purple 1 (171 130 255)
+159 121 238	medium purple 2 (159 121 238)
+137 104 205	medium purple 3 (137 104 205)
+ 93  71 139	medium purple 4 ( 93  71 139)
+255 225 255	thistle 1 (255 225 255)
+238 210 238	thistle 2 (238 210 238)
+205 181 205	thistle 3 (205 181 205)
+139 123 139	thistle 4 (139 123 139)
+169 169 169	dark grey (169 169 169)
+169 169 169	dark gray (169 169 169)
+  0   0 139	dark blue (0     0 139)
+  0 139 139	dark cyan (0   139 139)
+139   0 139	dark magenta (139   0 139)
+139   0   0	dark red (139   0   0)
+144 238 144	light green (144 238 144)
diff --git a/chalk/data/palettes/News3.gpl b/chalk/data/palettes/News3.gpl
new file mode 100644
index 000000000..2fb443782
--- /dev/null
+++ b/chalk/data/palettes/News3.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: News3
+#
+236 232   4	Untitled
+236 232   4	Untitled
+232 232   4	Untitled
+228 232   4	Untitled
+228 232   4	Untitled
+224 232   4	Untitled
+220 232   4	Untitled
+220 232   4	Untitled
+216 232   4	Untitled
+212 228   4	Untitled
+212 228   4	Untitled
+208 228   4	Untitled
+204 228   4	Untitled
+204 228   4	Untitled
+200 228   4	Untitled
+196 228   4	Untitled
+196 228   4	Untitled
+192 228   4	Untitled
+188 228   4	Untitled
+188 228   4	Untitled
+184 228   4	Untitled
+180 224   4	Untitled
+180 224   4	Untitled
+176 224   4	Untitled
+172 224   4	Untitled
+172 224   4	Untitled
+168 224   4	Untitled
+164 224   4	Untitled
+164 224   8	Untitled
+160 224   8	Untitled
+156 224   8	Untitled
+156 224   8	Untitled
+152 220   8	Untitled
+148 220   8	Untitled
+148 220   8	Untitled
+144 220   8	Untitled
+140 220   8	Untitled
+140 220   8	Untitled
+136 220   8	Untitled
+132 220   8	Untitled
+132 220   8	Untitled
+128 220   8	Untitled
+124 220   8	Untitled
+124 220   8	Untitled
+120 216   8	Untitled
+116 216   8	Untitled
+112 216   8	Untitled
+112 216   8	Untitled
+108 216   8	Untitled
+104 216   8	Untitled
+104 216   8	Untitled
+100 216   8	Untitled
+ 96 216   8	Untitled
+ 96 216   8	Untitled
+ 92 216   8	Untitled
+ 88 212   8	Untitled
+ 88 212   8	Untitled
+ 84 212   8	Untitled
+ 80 212   8	Untitled
+ 80 212  12	Untitled
+ 76 212  12	Untitled
+ 72 212  12	Untitled
+ 72 212  12	Untitled
+ 68 212  12	Untitled
+ 64 212  12	Untitled
+ 64 212  12	Untitled
+ 60 212  12	Untitled
+ 56 208  12	Untitled
+ 56 208  12	Untitled
+ 52 208  12	Untitled
+ 48 208  12	Untitled
+ 48 208  12	Untitled
+ 44 208  12	Untitled
+ 40 208  12	Untitled
+ 40 208  12	Untitled
+ 36 208  12	Untitled
+ 32 208  12	Untitled
+ 32 208  12	Untitled
+ 28 204  12	Untitled
+ 24 204  12	Untitled
+ 24 204  12	Untitled
+ 20 204  12	Untitled
+ 16 204  12	Untitled
+ 16 204  12	Untitled
+ 12 204  12	Untitled
+  8 204  12	Untitled
+  8 204  12	Untitled
+  4 204  12	Untitled
+  0 204  12	Untitled
+  0 204  12	Untitled
+  8 200  28	Untitled
+ 16 196  40	Untitled
+ 24 192  52	Untitled
+ 32 188  64	Untitled
+ 40 188  76	Untitled
+ 48 184  88	Untitled
+ 56 180 100	Untitled
+ 64 176 112	Untitled
+ 72 176 124	Untitled
+ 68 184 120	Untitled
+ 64 188 120	Untitled
+ 60 192 116	Untitled
+ 56 196 116	Untitled
+ 52 204 116	Untitled
+ 48 208 112	Untitled
+ 44 212 112	Untitled
+ 40 216 112	Untitled
+ 36 212 116	Untitled
+ 36 212 120	Untitled
+ 32 212 124	Untitled
+ 32 208 124	Untitled
+ 28 208 128	Untitled
+ 28 208 132	Untitled
+ 28 204 136	Untitled
+ 24 204 136	Untitled
+ 24 204 140	Untitled
+ 20 200 144	Untitled
+ 20 200 144	Untitled
+ 20 200 148	Untitled
+ 16 196 152	Untitled
+ 16 196 156	Untitled
+ 12 196 156	Untitled
+ 12 192 160	Untitled
+ 12 192 164	Untitled
+  8 192 168	Untitled
+  8 188 168	Untitled
+  4 188 172	Untitled
+  4 188 176	Untitled
+  4 188 176	Untitled
+  8 180 172	Untitled
+ 12 172 168	Untitled
+ 12 164 168	Untitled
+ 16 156 164	Untitled
+ 16 148 164	Untitled
+ 20 140 160	Untitled
+ 20 132 160	Untitled
+ 24 124 156	Untitled
+ 24 116 156	Untitled
+ 28 108 152	Untitled
+ 28 100 152	Untitled
+ 32  92 148	Untitled
+ 32  84 148	Untitled
+ 36  76 144	Untitled
+ 36  68 144	Untitled
+ 40  60 140	Untitled
+ 40  52 140	Untitled
+ 44  44 136	Untitled
+ 44  40 136	Untitled
+ 48  36 132	Untitled
+ 48  36 132	Untitled
+ 48  36 128	Untitled
+ 48  36 128	Untitled
+ 48  36 128	Untitled
+ 48  36 124	Untitled
+ 48  36 124	Untitled
+ 48  36 124	Untitled
+ 48  36 120	Untitled
+ 48  36 120	Untitled
+ 48  32 116	Untitled
+ 48  32 116	Untitled
+ 48  32 116	Untitled
+ 48  32 112	Untitled
+ 48  32 112	Untitled
+ 48  32 112	Untitled
+ 52  32 108	Untitled
+ 52  32 108	Untitled
+ 52  32 104	Untitled
+ 52  32 104	Untitled
+ 52  32 104	Untitled
+ 52  28 100	Untitled
+ 52  28 100	Untitled
+ 52  28 100	Untitled
+ 52  28  96	Untitled
+ 52  28  96	Untitled
+ 52  28  96	Untitled
+ 52  28  92	Untitled
+ 52  28  92	Untitled
+ 52  28  88	Untitled
+ 52  28  88	Untitled
+ 52  24  88	Untitled
+ 52  24  84	Untitled
+ 56  24  84	Untitled
+ 56  24  84	Untitled
+ 56  24  80	Untitled
+ 56  24  80	Untitled
+ 56  24  76	Untitled
+ 56  24  76	Untitled
+ 56  24  76	Untitled
+ 56  24  72	Untitled
+ 56  24  72	Untitled
+ 56  20  72	Untitled
+ 56  20  68	Untitled
+ 56  20  68	Untitled
+ 56  20  68	Untitled
+ 56  20  64	Untitled
+ 56  20  64	Untitled
+ 56  20  60	Untitled
+ 56  20  60	Untitled
+ 60  20  60	Untitled
+ 60  20  56	Untitled
+ 60  16  56	Untitled
+ 60  16  56	Untitled
+ 60  16  52	Untitled
+ 60  16  52	Untitled
+ 60  16  48	Untitled
+ 60  16  48	Untitled
+ 60  16  48	Untitled
+ 60  16  44	Untitled
+ 60  16  44	Untitled
+ 60  16  44	Untitled
+ 60  16  40	Untitled
+ 60  12  40	Untitled
+ 60  12  40	Untitled
+ 60  12  36	Untitled
+ 60  12  36	Untitled
+ 64  12  32	Untitled
+ 64  12  32	Untitled
+ 64  12  32	Untitled
+ 64  12  28	Untitled
+ 64  12  28	Untitled
+ 64  12  28	Untitled
+ 64   8  24	Untitled
+ 64   8  24	Untitled
+ 64   8  20	Untitled
+ 64   8  20	Untitled
+ 64   8  20	Untitled
+ 64   8  16	Untitled
+ 64   8  16	Untitled
+ 64   8  16	Untitled
+ 64   8  12	Untitled
+ 64   8  12	Untitled
+ 64   8  12	Untitled
+ 68  12  16	Untitled
+ 68  16  16	Untitled
+ 68  16  16	Untitled
+ 68  20  16	Untitled
+ 68  20  20	Untitled
+ 72  24  20	Untitled
+ 72  24  20	Untitled
+ 72  28  20	Untitled
+ 72  28  24	Untitled
+ 72  32  24	Untitled
+ 76  32  24	Untitled
+ 76  36  24	Untitled
+ 76  36  28	Untitled
+ 76  40  28	Untitled
+ 76  44  28	Untitled
+ 80  44  28	Untitled
+ 80  48  32	Untitled
+ 80  48  32	Untitled
+ 80  52  32	Untitled
+ 80  52  32	Untitled
+ 84  56  36	Untitled
+ 84  56  36	Untitled
+ 84  60  36	Untitled
+ 84  60  36	Untitled
diff --git a/chalk/data/palettes/Op2.gpl b/chalk/data/palettes/Op2.gpl
new file mode 100644
index 000000000..891f1fb47
--- /dev/null
+++ b/chalk/data/palettes/Op2.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Op2
+#
+204 144 100	Untitled
+204 144 100	Untitled
+200 148 104	Untitled
+200 152 108	Untitled
+200 152 112	Untitled
+196 156 116	Untitled
+196 160 120	Untitled
+192 164 124	Untitled
+172 212 180	Untitled
+192 168 128	Untitled
+192 172 132	Untitled
+188 176 136	Untitled
+188 180 140	Untitled
+184 184 144	Untitled
+184 184 148	Untitled
+180 188 152	Untitled
+180 192 156	Untitled
+180 196 160	Untitled
+176 200 164	Untitled
+176 204 168	Untitled
+172 208 172	Untitled
+172 212 176	Untitled
+248  88  24	Untitled
+244  92  28	Untitled
+244  96  32	Untitled
+240  96  36	Untitled
+240 100  36	Untitled
+240 100  40	Untitled
+236 104  44	Untitled
+236 104  44	Untitled
+236 108  48	Untitled
+232 108  52	Untitled
+232 112  52	Untitled
+232 116  56	Untitled
+228 116  60	Untitled
+228 120  64	Untitled
+228 120  64	Untitled
+224 124  68	Untitled
+224 124  72	Untitled
+224 128  72	Untitled
+220 128  76	Untitled
+220 132  80	Untitled
+220 136  80	Untitled
+216 136  84	Untitled
+216 140  88	Untitled
+216 140  92	Untitled
+212 144  92	Untitled
+212 144  96	Untitled
+212 148 100	Untitled
+208 148 100	Untitled
+208 152 104	Untitled
+208 156 108	Untitled
+204 156 108	Untitled
+204 160 112	Untitled
+204 160 116	Untitled
+200 164 116	Untitled
+200 164 120	Untitled
+200 168 124	Untitled
+196 168 128	Untitled
+196 172 128	Untitled
+196 176 132	Untitled
+192 176 136	Untitled
+192 180 136	Untitled
+192 180 140	Untitled
+188 184 144	Untitled
+188 184 144	Untitled
+188 188 148	Untitled
+184 188 152	Untitled
+184 192 156	Untitled
+184 196 156	Untitled
+180 196 160	Untitled
+180 200 164	Untitled
+180 200 164	Untitled
+176 204 168	Untitled
+176 204 172	Untitled
+176 208 172	Untitled
+172 208 176	Untitled
+172 212 180	Untitled
+ 12   0 120	Untitled
+ 16   4 124	Untitled
+ 16   8 124	Untitled
+ 20   8 124	Untitled
+ 20  12 124	Untitled
+ 24  16 124	Untitled
+ 24  16 128	Untitled
+ 28  20 128	Untitled
+ 28  24 128	Untitled
+ 32  24 128	Untitled
+ 32  28 128	Untitled
+ 36  32 132	Untitled
+ 36  32 132	Untitled
+ 40  36 132	Untitled
+ 40  40 132	Untitled
+ 44  40 132	Untitled
+ 44  44 132	Untitled
+ 48  48 136	Untitled
+ 48  48 136	Untitled
+ 52  52 136	Untitled
+ 52  56 136	Untitled
+ 56  56 136	Untitled
+ 56  60 140	Untitled
+ 60  64 140	Untitled
+ 60  64 140	Untitled
+ 64  68 140	Untitled
+ 64  72 140	Untitled
+ 68  72 144	Untitled
+ 68  76 144	Untitled
+ 72  80 144	Untitled
+ 72  80 144	Untitled
+ 76  84 144	Untitled
+ 76  88 144	Untitled
+ 80  88 148	Untitled
+ 80  92 148	Untitled
+ 84  96 148	Untitled
+ 84  96 148	Untitled
+ 88 100 148	Untitled
+ 88 104 152	Untitled
+ 92 104 152	Untitled
+ 92 108 152	Untitled
+ 96 112 152	Untitled
+ 96 112 152	Untitled
+100 116 156	Untitled
+100 120 156	Untitled
+104 120 156	Untitled
+104 124 156	Untitled
+108 128 156	Untitled
+108 128 156	Untitled
+112 132 160	Untitled
+112 136 160	Untitled
+116 136 160	Untitled
+116 140 160	Untitled
+120 144 160	Untitled
+120 144 164	Untitled
+124 148 164	Untitled
+124 152 164	Untitled
+128 152 164	Untitled
+128 156 164	Untitled
+132 160 168	Untitled
+132 160 168	Untitled
+136 164 168	Untitled
+136 168 168	Untitled
+140 168 168	Untitled
+140 172 168	Untitled
+144 176 172	Untitled
+144 176 172	Untitled
+148 180 172	Untitled
+148 184 172	Untitled
+152 184 172	Untitled
+152 188 176	Untitled
+156 192 176	Untitled
+156 192 176	Untitled
+160 196 176	Untitled
+160 200 176	Untitled
+164 200 180	Untitled
+164 204 180	Untitled
+168 208 180	Untitled
+168 208 180	Untitled
+172 212 180	Untitled
+240 172 224	Untitled
+236 176 220	Untitled
+236 176 220	Untitled
+236 176 220	Untitled
+236 176 220	Untitled
+236 176 220	Untitled
+236 176 220	Untitled
+232 176 220	Untitled
+232 176 220	Untitled
+232 176 220	Untitled
+232 176 216	Untitled
+232 180 216	Untitled
+232 180 216	Untitled
+228 180 216	Untitled
+228 180 216	Untitled
+228 180 216	Untitled
+228 180 216	Untitled
+228 180 216	Untitled
+228 180 216	Untitled
+224 180 216	Untitled
+224 180 212	Untitled
+224 180 212	Untitled
+224 184 212	Untitled
+224 184 212	Untitled
+224 184 212	Untitled
+220 184 212	Untitled
+220 184 212	Untitled
+220 184 212	Untitled
+220 184 212	Untitled
+220 184 208	Untitled
+220 184 208	Untitled
+220 184 208	Untitled
+216 188 208	Untitled
+216 188 208	Untitled
+216 188 208	Untitled
+216 188 208	Untitled
+216 188 208	Untitled
+216 188 208	Untitled
+212 188 208	Untitled
+212 188 204	Untitled
+212 188 204	Untitled
+212 188 204	Untitled
+212 188 204	Untitled
+212 192 204	Untitled
+208 192 204	Untitled
+208 192 204	Untitled
+208 192 204	Untitled
+208 192 204	Untitled
+208 192 204	Untitled
+208 192 200	Untitled
+204 192 200	Untitled
+204 192 200	Untitled
+204 192 200	Untitled
+204 192 200	Untitled
+204 196 200	Untitled
+204 196 200	Untitled
+204 196 200	Untitled
+200 196 200	Untitled
+200 196 196	Untitled
+200 196 196	Untitled
+200 196 196	Untitled
+200 196 196	Untitled
+200 196 196	Untitled
+196 196 196	grey77
+196 200 196	Untitled
+196 200 196	Untitled
+196 200 196	Untitled
+196 200 196	Untitled
+196 200 192	Untitled
+192 200 192	Untitled
+192 200 192	Untitled
+192 200 192	Untitled
+192 200 192	Untitled
+192 200 192	Untitled
+192 200 192	Untitled
+188 204 192	Untitled
+188 204 192	Untitled
+188 204 192	Untitled
+188 204 188	Untitled
+188 204 188	Untitled
+188 204 188	Untitled
+188 204 188	Untitled
+184 204 188	Untitled
+184 204 188	Untitled
+184 204 188	Untitled
+184 208 188	Untitled
+184 208 188	Untitled
+184 208 184	Untitled
+180 208 184	Untitled
+180 208 184	Untitled
+180 208 184	Untitled
+180 208 184	Untitled
+180 208 184	Untitled
+180 208 184	Untitled
+176 208 184	Untitled
+176 208 184	Untitled
+176 212 184	Untitled
+176 212 180	Untitled
diff --git a/chalk/data/palettes/Paintjet.gpl b/chalk/data/palettes/Paintjet.gpl
new file mode 100644
index 000000000..c061b6c56
--- /dev/null
+++ b/chalk/data/palettes/Paintjet.gpl
@@ -0,0 +1,22 @@
+GIMP Palette
+Name: Paintjet
+#
+#       A map with the PaintJet's 8 primary colors repeated twice.
+#       Use these colors for 180dpi PaintJet images.
+#
+ 24  20  12	Untitled
+244 240 232	Untitled
+196  68  72	Untitled
+ 48 132  92	Untitled
+240 232  72	Untitled
+ 52  48 116	Untitled
+188  48 108	Untitled
+ 40 116 196	Untitled
+ 24  20  12	Untitled
+244 240 232	Untitled
+196  68  72	Untitled
+ 48 132  92	Untitled
+240 232  72	Untitled
+ 52  48 116	Untitled
+188  48 108	Untitled
+ 40 116 196	Untitled
diff --git a/chalk/data/palettes/Pantone_Coated_Approx.gpl b/chalk/data/palettes/Pantone_Coated_Approx.gpl
new file mode 100644
index 000000000..5ddb0d463
--- /dev/null
+++ b/chalk/data/palettes/Pantone_Coated_Approx.gpl
@@ -0,0 +1,949 @@
+GIMP Palette
+Name: Pantone_Coated_Approx
+Columns: 16
+#
+244 228   0	Process Yellow
+193   0  89	Process Magenta
+  0 143 216	Process Cyan
+ 31  31  33	Process Black
+243  53   0	Orange 021
+216   0  29	Red 032
+  9   0 139	Blue 072
+240 233 124	100
+243 232  59	101
+247 228   0	102
+251 217   0	Yellow
+186 160   0	103
+157 139   0	104
+109  97   0	105
+244 228  73	106
+246 223  22	107
+247 217   0	108
+250 203   0	109
+209 167   0	110
+156 130   0	111
+134 115   0	112
+245 221  66	113
+246 219  45	114
+246 218  36	115
+253 160   0	116
+186 143   0	117
+159 126   0	118
+116 100  10	119
+244 221 102	120
+245 217  87	121
+247 205  42	122
+250 183   0	123
+214 148   0	124
+162 120   0	125
+142 113   0	126
+241 227 172	1205
+244 218 131	1215
+250 187  38	1225
+251 157   0	1235
+179 130   0	1245
+144 108   0	1255
+104  80  12	1265
+239 218 110	127
+238 210  82	128
+236 190  25	129
+226 112   0	130
+187 121   0	131
+145 107   0	132
+ 92  75  12	133
+246 207 111	134
+250 186  60	135
+251 169  15	136
+251 139   0	137
+210 108   0	138
+155  93   0	139
+105  78  16	140
+246 203 126	1345
+248 189  97	1355
+250 163  49	1365
+250 121   0	1375
+190  94   0	1385
+128  75   0	1395
+ 86  58  17	1405
+235 194  91	141
+232 170  50	142
+231 162  38	143
+223 108   0	144
+187 101   0	145
+136  83   0	146
+ 90  73  28	147
+247 201 139	148
+249 189 116	149
+251 146  43	150
+248  89   0	151
+210  86   0	152
+164  81   0	153
+128  68   0	154
+254 169  96	1485
+255 134  29	1495
+254  98   0	1505
+243  53   0	Orange 021
+170  53   0	1525
+121  50   0	1535
+ 54  28  13	1545
+235 208 165	155
+231 182 125	156
+224 130  59	157
+215  80   8	158
+182  64   0	159
+137  60  10	160
+ 76  44  20	161
+249 173 131	1555
+250 143  90	1565
+249 105  42	1575
+244  72   0	1585
+189  63   0	1595
+136  59  19	1605
+109  48  17	1615
+248 185 158	162
+251 126  83	163
+248  92  38	164
+236  16   0	165
+203  52   0	166
+161  54  10	167
+ 86  36  17	168
+250 150 128	1625
+250 118  93	1635
+247  86  52	1645
+240  53   0	1655
+209  51   9	1665
+146  47  21	1675
+115  45  26	1685
+250 168 162	169
+250 104  92	170
+245  63  44	171
+236  30   0	172
+189  46  23	173
+118  31  17	174
+ 82  35  27	175
+249 150 163	176
+249  93 111	177
+243  53  68	178
+225   0   0	Warm Red
+203  33  37	179
+166  39  42	180
+102  33  34	181
+245 132 157	1765
+243 105 135	1775
+235  54  89	1785
+212   0   0	1788
+192   0  39	1795
+154  24  43	1805
+105  27  37	1815
+240 162 181	1767
+236  72 107	1777
+228  16  62	1787
+216   0  29	Red 032
+180  22  44	1797
+128  29  40	1807
+ 66  37  36	1817
+243 175 197	182
+239 107 145	183
+230  52 100	184
+204   0   0	185
+181   0  39	186
+145  10  43	187
+100  31  45	188
+238 135 174	189
+232  84 135	190
+224  37  98	191
+210   0  57	192
+163   0  48	193
+129  25  55	194
+ 92  36  50	195
+237 164 197	1895
+234 125 171	1905
+222  44 114	1915
+206   0  66	1925
+173   0  52	1935
+139   0  53	1945
+125  25  60	1955
+230 186 202	196
+223 134 165	197
+211  59 105	198
+198   0  60	199
+169   0  52	200
+137  21  54	201
+115  29  52	202
+226 160 198	203
+218 101 160	204
+209  52 124	205
+194   0  68	206
+154   0  64	207
+117  27  64	208
+ 96  34  59	209
+240 132 188	210
+234  86 159	211
+225  44 132	212
+208   0  95	213
+178   0  77	214
+135   0  63	215
+100  30  59	216
+228 173 215	217
+216  90 174	218
+205  18 131	219
+181   0  49	Rubine Red
+145   0  70	220
+122   0  64	221
+ 86  24  56	222
+227 129 201	223
+219  73 173	224
+209  15 143	225
+192   0 103	226
+145   0  81	227
+112   0  72	228
+ 85  29  59	229
+238 145 212	230
+229  77 185	231
+221  41 168	232
+190   0 106	Rhodamine Red
+177   0 114	233
+138   0  90	234
+116   6  76	235
+232 149 215	236
+220  93 194	237
+207  45 173	238
+172   0 117	239
+161   0 126	240
+139   0 107	241
+ 95  20  72	242
+231 182 224	2365
+205  76 193	2375
+187   0 166	2385
+164   0 131	2395
+133   0 112	2405
+119   0 101	2415
+105   9  90	2425
+224 166 223	243
+217 138 217	244
+204  99 203	245
+172   0 158	246
+150   0 138	247
+127   0 118	248
+101  32  91	249
+223 189 229	250
+203 136 221	251
+181  76 203	252
+135   0 153	Purple
+146   0 160	253
+127  24 140	254
+ 95  36  98	255
+209 179 219	256
+188 144 204	257
+126  59 147	258
+ 86  17 102	259
+ 76  22  83	260
+ 73  30  76	261
+ 65  31  64	262
+193 150 226	2562
+166 106 215	2572
+130  50 191	2582
+103   0 164	2592
+ 92   6 138	2602
+ 78  24 103	2612
+ 73  40  80	2622
+170 123 203	2563
+142  84 183	2573
+111  46 156	2583
+ 86  17 125	2593
+ 74  15 101	2603
+ 71  18  92	2613
+ 67  17  83	2623
+161 122 207	2567
+131  84 188	2577
+ 99  43 160	2587
+ 68  10 126	2597
+ 63  15 109	2607
+ 59  20  96	2617
+ 53  21  79	2627
+208 194 229	263
+169 146 224	264
+107  73 200	265
+ 65  25 167	266
+ 54  20 135	267
+ 51  25  98	268
+ 47  26  75	269
+173 156 225	2635
+144 122 216	2645
+112  84 201	2655
+ 91  53 183	2665
+ 29   0  99	Violet
+ 50  13 123	2685
+ 49  31  80	2695
+168 164 217	270
+136 131 203	271
+107 101 187	272
+ 37  27 115	273
+ 36  26  97	274
+ 32  23  79	275
+ 38  31  62	276
+143 135 220	2705
+109  99 206	2715
+ 74  58 187	2725
+ 41  10 146	2735
+ 35  14 118	2745
+ 35  21 103	2755
+ 37  26  87	2765
+187 192 230	2706
+129 139 219	2716
+ 62  69 186	2726
+ 43  37 163	2736
+ 36  36 138	2746
+ 34  37 102	2756
+ 34  36  79	2766
+169 188 231	2707
+129 158 230	2717
+ 39  84 211	2727
+  9   0 139	Blue 072
+  8  16  83	2747
+ 11  18  60	2757
+ 16  19  33	2767
+154 174 224	2708
+ 65  96 199	2718
+ 22  48 166	2728
+ 13  15 132	2738
+ 14  27 100	2748
+ 15  25  79	2758
+ 16  22  50	2768
+172 196 229	277
+136 173 227	278
+ 66 120 211	279
+  0  14 120	Reflex Blue
+  0  35 105	280
+  0  28  77	281
+ 12  30  60	282
+141 182 228	283
+101 155 223	284
+ 17  96 198	285
+  0  45 154	286
+  0  37 119	287
+  0  35 100	288
+ 11  32  58	289
+175 207 232	290
+133 184 232	291
+ 87 155 225	292
+  0  65 173	293
+  0  53 116	294
+  0  46  89	295
+ 17  39  56	296
+133 187 228	2905
+ 83 158 222	2915
+ 15 122 209	2925
+  0  68 173	2935
+  0  60 135	2945
+  0  45  84	2955
+  7  36  56	2965
+123 192 232	297
+ 62 161 226	298
+  0 100 196	299
+  0  79 179	300
+  0  63 128	301
+  0  54  87	302
+ 12  53  70	303
+154 210 231	2975
+ 65 172 227	2985
+  0 142 216	2995
+  0 104 195	3005
+  0  88 147	3015
+  0  66  94	3025
+ 10  56  70	3035
+151 213 229	304
+ 92 193 231	305
+  0 148 216	306
+  0  95 185	Process Blue
+  0 101 165	307
+  0  72 107	308
+ 11  60  70	309
+ 98 197 224	310
+ 58 184 219	311
+  0 154 203	312
+  0 121 177	313
+  0  97 138	314
+  0  76 100	315
+ 13  61  68	316
+120 206 219	3105
+ 55 184 209	3115
+  0 168 198	3125
+  0 135 172	3135
+  0 112 135	3145
+  0  93 110	3155
+  0  71  80	3165
+183 226 224	317
+134 214 219	318
+ 64 192 203	319
+  0 110 127	320
+  0 116 128	321
+  0  97 104	322
+  0  84  87	323
+159 216 215	324
+ 87 191 189	325
+  0 161 155	326
+  0  94  75	327
+  0 101  92	328
+  0  90  82	329
+ 25  73  68	330
+133 217 209	3242
+ 82 203 194	3252
+  0 182 173	3262
+  0 155 145	3272
+  0 119 110	3282
+  0  77  69	3292
+ 17  56  50	3302
+132 219 204	3245
+ 78 206 186	3255
+  0 185 162	3265
+  0 163 137	3275
+  0 133 113	3285
+  0 113  96	3295
+ 25  68  57	3305
+125 204 189	3248
+ 70 183 160	3258
+  0 158 128	3268
+  0 137 103	3278
+  0 113  87	3288
+  0  86  68	3298
+ 21  54  44	3308
+181 230 216	331
+147 226 206	332
+ 83 212 183	333
+  0 131  86	Green
+  0 136 100	334
+  0 108  82	335
+ 13  87  67	336
+145 211 188	337
+106 198 165	338
+ 12 163 115	339
+  0 133  79	340
+  0  97  63	341
+  9  83  57	342
+ 29  69  51	343
+142 225 192	3375
+ 98 214 168	3385
+ 29 195 133	3395
+  0 169  95	3405
+  0 111  70	3415
+ 22  90  59	3425
+ 25  62  42	3435
+163 217 178	344
+133 207 155	345
+ 95 191 127	346
+  0 136  52	347
+  0 112  48	348
+ 21  85  43	349
+ 37  62  40	350
+170 229 186	351
+142 224 165	352
+116 218 146	353
+  0 139  13	354
+  0 138  41	355
+ 13 105  40	356
+ 42  80  46	357
+158 214 122	358
+144 208 107	359
+ 94 185  53	360
+ 53 162  17	361
+ 61 138  26	362
+ 63 123  28	363
+ 59 101  29	364
+202 227 148	365
+183 221 117	366
+154 210  77	367
+ 40 149   0	368
+ 79 151   0	369
+ 77 121   0	370
+ 70  85  26	371
+209 233 132	372
+195 230 101	373
+174 226  57	374
+ 79 186   0	375
+112 175   0	376
+ 98 134   0	377
+ 71  82  17	378
+220 229  87	379
+210 225  49	380
+197 219   0	381
+143 190   0	382
+150 162   0	383
+132 139   0	384
+101  99  20	385
+225 232  67	386
+219 230  31	387
+207 226   0	388
+193 220   0	389
+168 183   0	390
+141 143   0	391
+116 114   0	392
+236 233 107	393
+232 231  31	394
+226 228   0	395
+214 222   0	396
+181 181   0	397
+163 159   0	398
+142 135   0	399
+239 232  76	3935
+237 227   0	3945
+230 218   0	3955
+227 214   0	3965
+169 154   0	3975
+131 118   0	3985
+ 85  75   0	3995
+193 186 176	400
+170 162 152	401
+145 137 127	402
+128 120 109	403
+103  95  84	404
+ 83  75  66	405
+ 49  46  43	Black
+189 178 172	406
+166 154 148	407
+145 133 127	408
+130 117 112	409
+107  94  88	410
+ 85  72  67	411
+ 43  36  34	412
+183 182 171	413
+165 164 153	414
+146 145 134	415
+120 120 108	416
+ 98  98  86	417
+ 79  79  68	418
+ 39  40  34	419
+198 196 193	420
+178 177 174	421
+158 157 155	422
+133 133 131	423
+108 109 107	424
+ 79  80  80	425
+ 42  42  42	426
+209 209 207	427
+184 186 186	428
+150 154 156	429
+118 123 127	430
+ 80  86  91	431
+ 56  61  66	432
+ 10  13  16	433
+205 193 196	434
+187 172 178	435
+160 142 150	436
+113  94 102	437
+ 66  51  55	438
+ 51  40  42	439
+ 47  40  39	440
+191 198 196	441
+167 177 177	442
+140 151 154	443
+114 126 130	444
+ 69  77  82	445
+ 57  62  63	446
+ 49  51  48	447
+216 209 198	Warm Gray 1
+202 194 184	Warm Gray 2
+184 175 165	Warm Gray 3
+170 160 151	Warm Gray 4
+159 149 139	Warm Gray 5
+149 138 129	Warm Gray 6
+137 126 117	Warm Gray 7
+126 116 106	Warm Gray 8
+116 105  95	Warm Gray 9
+107  96  87	Warm Gray 10
+ 86  75  66	Warm Gray 11
+219 215 210	Cool Gray 1
+203 201 198	Cool Gray 2
+192 190 189	Cool Gray 3
+177 175 174	Cool Gray 4
+166 164 165	Cool Gray 5
+157 156 157	Cool Gray 6
+140 139 141	Cool Gray 7
+124 123 126	Cool Gray 8
+114 114 116	Cool Gray 9
+ 93  93  96	Cool Gray 10
+ 81  81  84	Cool Gray 11
+ 65  57  39	448
+ 72  62  38	449
+ 79  70  40	450
+149 142 108	451
+175 169 139	452
+197 192 167	453
+211 207 186	454
+ 71  56  17	4485
+108  91  35	4495
+137 121  64	4505
+168 154 102	4515
+187 175 130	4525
+207 197 162	4535
+218 210 179	4545
+ 82  70  16	455
+130 110   0	456
+157 129   0	457
+206 187  78	458
+218 204 112	459
+226 215 142	460
+232 224 167	461
+ 76  57  31	462
+103  70  33	463
+ 93  49  16	464
+176 145  95	465
+197 173 129	466
+206 186 146	467
+217 201 167	468
+ 58  30  18	4625
+111  65  34	4635
+152 107  76	4645
+179 138 110	4655
+200 165 141	4665
+214 185 164	4675
+223 200 182	4685
+ 80  43  21	469
+128  57  17	470
+140  44   0	471
+221 147 106	472
+232 177 144	473
+236 194 166	474
+238 204 180	475
+ 65  35  30	4695
+103  63  54	4705
+132  94  83	4715
+161 127 116	4725
+187 158 149	4735
+200 176 166	4745
+214 195 186	4755
+ 73  46  37	476
+ 82  40  32	477
+ 99  44  36	478
+161 116  98	479
+196 165 150	480
+212 189 176	481
+221 204 192	482
+ 91  41  34	483
+136  32  31	484
+192   0   0	485
+223 131 122	486
+228 165 157	487
+231 187 178	488
+233 203 195	489
+ 71  28  33	490
+ 98  30  38	491
+123  36  49	492
+199 107 131	493
+226 159 178	494
+232 176 190	495
+236 192 202	496
+ 60  34  35	497
+ 84  41  42	498
+ 95  44  43	499
+180 115 128	500
+214 163 174	501
+227 188 196	502
+233 205 209	503
+ 56  28  30	4975
+105  56  64	4985
+142  91 100	4995
+167 118 127	5005
+196 155 162	5015
+207 172 177	5025
+219 191 192	5035
+ 64  25  34	504
+ 85  25  42	505
+101  27  50	506
+187 106 139	507
+210 142 170	508
+223 169 190	509
+230 187 202	510
+ 64  26  55	511
+ 94  27  93	512
+115  28 125	513
+185 106 185	514
+207 141 202	515
+220 168 213	516
+228 190 219	517
+ 62  30  54	5115
+ 94  55  87	5125
+123  86 119	5135
+150 117 145	5145
+189 163 185	5155
+209 190 204	5165
+219 204 213	5175
+ 61  38  61	518
+ 74  39  85	519
+ 79  39 100	520
+153 116 176	521
+173 141 192	522
+193 167 205	523
+209 189 214	524
+ 50  32  44	5185
+ 68  42  58	5195
+112  80 101	5205
+150 120 138	5215
+176 150 164	5225
+203 183 192	5235
+215 200 204	5245
+ 60  32  74	525
+ 70  27 112	526
+ 80  23 148	527
+138  93 197	528
+177 140 217	529
+191 159 222	530
+206 181 224	531
+ 38  31  59	5255
+ 53  45  87	5265
+ 75  67 111	5275
+115 109 148	5285
+153 147 178	5295
+179 173 197	5305
+200 194 209	5315
+ 46  46  61	532
+ 45  52  84	533
+ 46  58 105	534
+131 142 181	535
+156 164 195	536
+180 186 208	537
+197 201 215	538
+ 20  42  61	539
+  1  45  82	540
+  0  53 108	541
+ 76 130 185	542
+126 166 209	543
+160 190 219	544
+180 202 222	545
+ 21  38  53	5395
+ 50  76  98	5405
+ 81 106 127	5415
+113 135 154	5425
+151 168 183	5435
+181 192 202	5445
+203 209 215	5455
+ 16  36  43	546
+  0  44  58	547
+  0  54  74	548
+ 80 132 159	549
+118 161 184	550
+150 183 201	551
+187 206 216	552
+ 21  50  54	5463
+ 44  86  92	5473
+ 87 128 133	5483
+125 160 164	5493
+159 185 188	5503
+191 208 208	5513
+208 219 217	5523
+ 26  40  38	5467
+ 53  73  69	5477
+ 85 104 101	5487
+126 142 139	5497
+156 170 167	5507
+181 191 188	5517
+198 205 201	5527
+ 39  60  45	553
+ 39  79  58	554
+ 36  91  64	555
+114 156 133	556
+150 182 165	557
+173 198 184	558
+194 210 198	559
+ 33  52  43	5535
+ 69  95  83	5545
+103 127 114	5555
+130 152 140	5565
+165 182 171	5575
+179 194 182	5585
+200 209 198	5595
+ 41  64  56	560
+ 40  87  78	561
+ 41 110 102	562
+114 177 167	563
+145 197 187	564
+173 213 203	565
+198 223 214	566
+ 30  43  33	5605
+ 65  81  66	5615
+ 97 112  97	5625
+139 151 138	5635
+168 177 165	5645
+186 193 182	5655
+205 209 199	5665
+ 38  66  56	567
+ 30  92  79	568
+ 20 118 104	569
+109 187 173	570
+149 208 196	571
+175 219 208	572
+194 224 215	573
+ 58  69  30	574
+ 68  94  28	575
+ 81 122  35	576
+160 187 116	577
+177 198 137	578
+192 208 155	579
+205 216 173	580
+ 50  56  28	5743
+ 76  82  42	5753
+100 105  64	5763
+138 143 104	5773
+163 166 131	5783
+189 191 162	5793
+208 208 185	5803
+ 50  55  19	5747
+ 87  92  34	5757
+120 125  64	5767
+152 155  99	5777
+185 186 141	5787
+203 203 167	5797
+214 212 182	5807
+ 81  77  10	581
+117 119   0	582
+151 167   0	583
+199 208  57	584
+210 216  88	585
+217 221 112	586
+226 226 146	587
+ 61  57  16	5815
+ 98  92  30	5825
+140 135  72	5835
+163 158 101	5845
+191 186 138	5855
+202 198 155	5865
+214 209 174	5875
+237 233 183	600
+237 231 149	601
+235 228 120	602
+233 224  76	603
+228 214   0	604
+212 191   0	605
+207 185   0	606
+234 230 194	607
+233 228 175	608
+229 223 146	609
+221 213 108	610
+205 193  50	611
+188 173   0	612
+162 145   0	613
+223 217 179	614
+219 214 170	615
+212 205 150	616
+194 186 116	617
+166 156  72	618
+129 118  24	619
+118 107  19	620
+200 212 201	621
+179 197 185	622
+141 168 154	623
+107 139 124	624
+ 72 108  92	625
+ 28  60  47	626
+ 18  39  30	627
+188 218 220	628
+165 208 216	629
+125 190 207	630
+ 78 165 190	631
+ 39 143 174	632
+  0 107 142	633
+  0  78 114	634
+174 217 226	635
+144 207 225	636
+106 192 222	637
+ 45 167 211	638
+  0 141 196	639
+  0 119 180	640
+  0 102 165	641
+189 201 215	642
+173 189 209	643
+131 155 187	644
+103 131 169	645
+ 73 104 146	646
+ 32  65 108	647
+ 17  43  81	648
+190 198 216	649
+165 179 206	650
+126 145 185	651
+ 82 106 154	652
+ 34  61 113	653
+ 11  31  74	654
+  9  21  52	655
+198 207 229	656
+165 182 224	657
+127 153 215	658
+ 84 117 198	659
+ 41  80 174	660
+ 11  48 144	661
+  0  23 103	662
+210 201 215	663
+193 182 204	664
+170 157 187	665
+137 122 161	666
+ 96  80 125	667
+ 71  53 100	668
+ 51  36  76	669
+230 202 221	670
+227 189 217	671
+216 153 200	672
+204 119 180	673
+187  82 154	674
+162  35 116	675
+142   0  88	676
+227 206 216	677
+219 190 209	678
+211 173 199	679
+187 132 170	680
+156  88 134	681
+133  59 108	682
+102  31  72	683
+223 191 204	684
+214 173 194	685
+201 152 179	686
+175 115 150	687
+147  82 122	688
+114  46  87	689
+ 82  28  57	690
+227 199 202	691
+218 178 185	692
+203 150 161	693
+185 123 137	694
+152  82  98	695
+116  46  61	696
+ 98  36  45	697
+234 194 200	698
+230 171 184	699
+222 142 161	700
+207 108 132	701
+185  69  97	702
+149  29  53	703
+128  16  31	704
+240 214 218	705
+240 185 198	706
+238 148 170	707
+231 108 138	708
+220  65 101	709
+199  21  58	710
+183   6  41	711
+244 208 174	712
+245 196 152	713
+244 169 108	714
+238 141  64	715
+223 107   0	716
+202  78   0	717
+181  60   0	718
+233 203 173	719
+229 190 154	720
+216 164 118	721
+190 125  68	722
+172 104  43	723
+121  56   0	724
+ 97  41   0	725
+222 194 164	726
+210 175 141	727
+196 155 116	728
+174 128  85	729
+148  97  51	730
+ 83  41   5	731
+ 70  35   9	732
+ 48  44  33	Black 2
+ 31  35  29	Black 3
+ 40  33  26	Black 4
+ 43  32  33	Black 5
+ 25  31  37	Black 6
+ 49  46  43	Black 7
diff --git a/chalk/data/palettes/Pastels.gpl b/chalk/data/palettes/Pastels.gpl
new file mode 100644
index 000000000..bcfd93429
--- /dev/null
+++ b/chalk/data/palettes/Pastels.gpl
@@ -0,0 +1,21 @@
+GIMP Palette
+Name: Pastels
+#
+226 145 145	Untitled
+153 221 146	Untitled
+147 216 185	Untitled
+148 196 211	Untitled
+148 154 206	Untitled
+179 148 204	Untitled
+204 150 177	Untitled
+204 164 153	Untitled
+223 229 146	Untitled
+255 165  96	Untitled
+107 255  99	Untitled
+101 255 204	Untitled
+101 196 255	Untitled
+101 107 255	Untitled
+173 101 255	Untitled
+255 101 244	Untitled
+255 101 132	Untitled
+255 101 101	Untitled
diff --git a/chalk/data/palettes/Plasma.gpl b/chalk/data/palettes/Plasma.gpl
new file mode 100644
index 000000000..db3982bc1
--- /dev/null
+++ b/chalk/data/palettes/Plasma.gpl
@@ -0,0 +1,260 @@
+GIMP Palette
+Name: Plasma
+Columns: 16
+#
+240 240   0	Untitled
+240 224   0	Untitled
+240 208   0	Untitled
+240 192   0	Untitled
+240 176   0	Untitled
+240 160   0	Untitled
+240 144   0	Untitled
+240 128   0	Untitled
+240 112   0	Untitled
+240  96   0	Untitled
+240  80   0	Untitled
+240  64   0	Untitled
+240  48   0	Untitled
+240  32   0	Untitled
+240  16   0	Untitled
+240   0   0	Untitled
+224 224  16	Untitled
+224 212  16	Untitled
+224 200  16	Untitled
+224 184  16	Untitled
+224 172  12	Untitled
+224 156  12	Untitled
+224 144  12	Untitled
+224 128  12	Untitled
+224 116   8	Untitled
+224 100   8	Untitled
+224  88   8	Untitled
+224  72   8	Untitled
+224  60   4	Untitled
+224  44   4	Untitled
+224  32   4	Untitled
+224  16   0	Untitled
+208 208  32	Untitled
+208 200  32	Untitled
+208 188  28	Untitled
+208 176  28	Untitled
+208 164  24	Untitled
+208 152  24	Untitled
+208 140  20	Untitled
+208 128  20	Untitled
+208 116  16	Untitled
+208 104  16	Untitled
+208  92  12	Untitled
+208  80  12	Untitled
+208  68   8	Untitled
+208  56   8	Untitled
+208  44   4	Untitled
+208  32   0	Untitled
+192 192  48	Untitled
+192 184  48	Untitled
+192 176  44	Untitled
+192 164  40	Untitled
+192 156  36	Untitled
+192 144  32	Untitled
+192 136  32	Untitled
+192 128  28	Untitled
+192 116  24	Untitled
+192 108  20	Untitled
+192  96  16	Untitled
+192  88  16	Untitled
+192  80  12	Untitled
+192  68   8	Untitled
+192  60   4	Untitled
+192  48   0	Untitled
+176 176  64	Untitled
+176 172  60	Untitled
+176 164  56	Untitled
+176 156  52	Untitled
+176 148  48	Untitled
+176 140  44	Untitled
+176 132  40	Untitled
+176 124  36	Untitled
+176 120  32	Untitled
+176 112  28	Untitled
+176 104  24	Untitled
+176  96  20	Untitled
+176  88  16	Untitled
+176  80  12	Untitled
+176  72   8	Untitled
+176  64   0	Untitled
+160 160  80	Untitled
+160 156  76	Untitled
+160 152  72	Untitled
+160 144  64	Untitled
+160 140  60	Untitled
+160 136  56	Untitled
+160 128  48	Untitled
+160 124  44	Untitled
+160 120  40	Untitled
+160 112  32	Untitled
+160 108  28	Untitled
+160 104  24	Untitled
+160  96  16	Untitled
+160  92  12	Untitled
+160  88   8	Untitled
+160  80   0	Untitled
+144 144  96	Untitled
+144 144  92	Untitled
+144 140  84	Untitled
+144 136  80	Untitled
+144 132  72	Untitled
+144 128  64	Untitled
+144 128  60	Untitled
+144 124  52	Untitled
+144 120  48	Untitled
+144 116  40	Untitled
+144 112  32	Untitled
+144 112  28	Untitled
+144 108  20	Untitled
+144 104  16	Untitled
+144 100   8	Untitled
+144  96   0	Untitled
+128 128 112	Untitled
+128 128 108	Untitled
+128 128 100	Untitled
+128 128  92	Untitled
+128 124  84	Untitled
+128 124  76	Untitled
+128 124  68	Untitled
+128 124  60	Untitled
+128 120  56	Untitled
+128 120  48	Untitled
+128 120  40	Untitled
+128 120  32	Untitled
+128 116  24	Untitled
+128 116  16	Untitled
+128 116   8	Untitled
+128 112   0	Untitled
+112 112 128	Untitled
+112 112 120	Untitled
+112 112 112	grey44
+112 112 104	Untitled
+112 116  96	Untitled
+112 116  88	Untitled
+112 116  80	Untitled
+112 116  72	Untitled
+112 120  60	Untitled
+112 120  52	Untitled
+112 120  44	Untitled
+112 120  36	Untitled
+112 124  28	Untitled
+112 124  20	Untitled
+112 124  12	Untitled
+112 128   0	Untitled
+ 96  96 144	Untitled
+ 96  96 136	Untitled
+ 96 100 128	Untitled
+ 96 104 116	Untitled
+ 96 108 108	Untitled
+ 96 112  96	Untitled
+ 96 112  88	Untitled
+ 96 116  80	Untitled
+ 96 120  68	Untitled
+ 96 124  60	Untitled
+ 96 128  48	Untitled
+ 96 128  40	Untitled
+ 96 132  32	Untitled
+ 96 136  20	Untitled
+ 96 140  12	Untitled
+ 96 144   0	Untitled
+ 80  80 160	Untitled
+ 80  84 152	Untitled
+ 80  88 140	Untitled
+ 80  96 128	Untitled
+ 80 100 120	Untitled
+ 80 104 108	Untitled
+ 80 112  96	Untitled
+ 80 116  88	Untitled
+ 80 120  76	Untitled
+ 80 128  64	Untitled
+ 80 132  56	Untitled
+ 80 136  44	Untitled
+ 80 144  32	Untitled
+ 80 148  24	Untitled
+ 80 152  12	Untitled
+ 80 160   0	Untitled
+ 64  64 176	Untitled
+ 64  68 168	Untitled
+ 64  76 156	Untitled
+ 64  84 144	Untitled
+ 64  92 132	Untitled
+ 64 100 120	Untitled
+ 64 108 108	Untitled
+ 64 116  96	Untitled
+ 64 120  84	Untitled
+ 64 128  72	Untitled
+ 64 136  60	Untitled
+ 64 144  48	Untitled
+ 64 152  36	Untitled
+ 64 160  24	Untitled
+ 64 168  12	Untitled
+ 64 176   0	Untitled
+ 48  48 192	Untitled
+ 48  56 180	Untitled
+ 48  64 168	Untitled
+ 48  76 156	Untitled
+ 48  84 144	Untitled
+ 48  96 128	Untitled
+ 48 104 116	Untitled
+ 48 112 104	Untitled
+ 48 124  92	Untitled
+ 48 132  80	Untitled
+ 48 144  64	Untitled
+ 48 152  52	Untitled
+ 48 160  40	Untitled
+ 48 172  28	Untitled
+ 48 180  16	Untitled
+ 48 192   0	Untitled
+ 32  32 208	Untitled
+ 32  40 196	Untitled
+ 32  52 184	Untitled
+ 32  64 168	Untitled
+ 32  76 156	Untitled
+ 32  88 140	Untitled
+ 32 100 128	Untitled
+ 32 112 112	Untitled
+ 32 124 100	Untitled
+ 32 136  84	Untitled
+ 32 148  72	Untitled
+ 32 160  56	Untitled
+ 32 172  44	Untitled
+ 32 184  28	Untitled
+ 32 196  16	Untitled
+ 32 208   0	Untitled
+ 16  16 224	Untitled
+ 16  28 212	Untitled
+ 16  40 196	Untitled
+ 16  56 180	Untitled
+ 16  68 168	Untitled
+ 16  84 152	Untitled
+ 16  96 136	Untitled
+ 16 112 120	Untitled
+ 16 124 108	Untitled
+ 16 140  92	Untitled
+ 16 152  76	Untitled
+ 16 168  60	Untitled
+ 16 180  48	Untitled
+ 16 196  32	Untitled
+ 16 208  16	Untitled
+ 16 224   0	Untitled
+  0   0 240	Untitled
+  0  16 224	Untitled
+  0  32 208	Untitled
+  0  48 192	Untitled
+  0  64 176	Untitled
+  0  80 160	Untitled
+  0  96 144	Untitled
+  0 112 128	Untitled
+  0 128 112	Untitled
+  0 144  96	Untitled
+  0 160  80	Untitled
+  0 176  64	Untitled
+  0 192  48	Untitled
+  0 208  32	Untitled
+  0 224  16	Untitled
+  0 240   0	Untitled
diff --git a/chalk/data/palettes/Reds.gpl b/chalk/data/palettes/Reds.gpl
new file mode 100644
index 000000000..8297e143d
--- /dev/null
+++ b/chalk/data/palettes/Reds.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Reds
+#
+  0   0   0	grey0
+ 76   0   0	Untitled
+ 76   0   0	Untitled
+ 72   0   0	Untitled
+ 68   0   0	Untitled
+ 68   0   0	Untitled
+ 64   0   0	Untitled
+ 60   0   0	Untitled
+ 56   0   0	Untitled
+ 56   0   0	Untitled
+ 52   0   0	Untitled
+ 48   0   0	Untitled
+ 48   0   0	Untitled
+ 44   0   0	Untitled
+ 40   0   0	Untitled
+ 40   0   0	Untitled
+ 36   0   0	Untitled
+ 32   0   0	Untitled
+ 28   0   0	Untitled
+ 28   0   0	Untitled
+ 24   0   0	Untitled
+ 20   0   0	Untitled
+ 20   0   0	Untitled
+ 16   0   0	Untitled
+ 12   0   0	Untitled
+ 12   0   0	Untitled
+  8   0   0	Untitled
+  4   0   0	Untitled
+  0   0   0	grey0
+  0   0   0	grey0
+  0   0   0	grey0
+  4   0   0	Untitled
+  4   0   0	Untitled
+  4   4   4	Untitled
+  8   4   4	Untitled
+  8   4   4	Untitled
+  8   4   4	Untitled
+ 12   8   8	Untitled
+ 12   8   8	Untitled
+ 16   8   8	Untitled
+ 16   8   8	Untitled
+ 16  12  12	Untitled
+ 20  12  12	Untitled
+ 20  12  12	Untitled
+ 20  12  12	Untitled
+ 24  16  16	Untitled
+ 24  16  16	Untitled
+ 28  16  16	Untitled
+ 28  16  16	Untitled
+ 28  20  20	Untitled
+ 32  20  20	Untitled
+ 32  20  20	Untitled
+ 32  20  20	Untitled
+ 36  24  24	Untitled
+ 36  24  24	Untitled
+ 36  24  24	Untitled
+ 40  24  24	Untitled
+ 40  28  28	Untitled
+ 44  28  28	Untitled
+ 44  28  28	Untitled
+ 44  28  28	Untitled
+ 48  32  32	Untitled
+ 48  32  32	Untitled
+ 48  32  32	Untitled
+ 52  32  32	Untitled
+ 52  36  36	Untitled
+ 56  36  36	Untitled
+ 56  36  36	Untitled
+ 56  36  36	Untitled
+ 60  40  40	Untitled
+ 60  40  40	Untitled
+ 60  40  40	Untitled
+ 64  40  40	Untitled
+ 64  44  44	Untitled
+ 64  44  44	Untitled
+ 68  44  44	Untitled
+ 68  44  44	Untitled
+ 72  48  48	Untitled
+ 72  48  48	Untitled
+ 72  48  48	Untitled
+ 76  48  48	Untitled
+ 76  52  52	Untitled
+ 76  52  52	Untitled
+ 80  52  52	Untitled
+ 80  52  52	Untitled
+ 84  56  56	Untitled
+ 84  56  56	Untitled
+ 84  56  56	Untitled
+ 88  56  56	Untitled
+ 88  60  60	Untitled
+ 88  60  60	Untitled
+ 92  60  60	Untitled
+ 92  60  60	Untitled
+ 92  64  64	Untitled
+ 96  64  64	Untitled
+ 96  64  64	Untitled
+100  64  64	Untitled
+100  68  68	Untitled
+100  68  68	Untitled
+104  68  68	Untitled
+104  68  68	Untitled
+104  72  72	Untitled
+108  72  72	Untitled
+108  72  72	Untitled
+112  72  72	Untitled
+112  76  76	Untitled
+112  76  76	Untitled
+116  76  76	Untitled
+116  76  76	Untitled
+116  80  80	Untitled
+120  80  80	Untitled
+120  80  80	Untitled
+120  80  80	Untitled
+124  84  84	Untitled
+124  84  84	Untitled
+128  84  84	Untitled
+128  84  84	Untitled
+128  88  88	Untitled
+132  88  88	Untitled
+132  88  88	Untitled
+132  88  88	Untitled
+252 252 252	grey99
+252 252 252	grey99
+252 248 248	Untitled
+252 244 244	Untitled
+252 240 240	Untitled
+252 236 236	Untitled
+252 232 232	Untitled
+252 228 228	Untitled
+252 224 224	Untitled
+252 224 224	Untitled
+252 220 220	Untitled
+252 216 216	Untitled
+252 212 212	Untitled
+252 208 208	Untitled
+252 204 204	Untitled
+252 200 200	Untitled
+252 196 196	Untitled
+252 196 196	Untitled
+252 192 192	Untitled
+252 188 188	Untitled
+252 184 184	Untitled
+252 180 180	Untitled
+252 176 176	Untitled
+252 172 172	Untitled
+252 168 168	Untitled
+252 168 168	Untitled
+252 164 164	Untitled
+252 160 160	Untitled
+252 156 156	Untitled
+252 152 152	Untitled
+252 148 148	Untitled
+252 144 144	Untitled
+252 140 140	Untitled
+252 140 140	Untitled
+252 136 136	Untitled
+252 132 132	Untitled
+252 128 128	Untitled
+252 124 124	Untitled
+252 120 120	Untitled
+252 116 116	Untitled
+252 112 112	Untitled
+252 112 112	Untitled
+252 108 108	Untitled
+252 104 104	Untitled
+252 100 100	Untitled
+252  96  96	Untitled
+252  92  92	Untitled
+252  88  88	Untitled
+252  84  84	Untitled
+252  84  84	Untitled
+252  80  80	Untitled
+252  76  76	Untitled
+252  72  72	Untitled
+252  68  68	Untitled
+252  64  64	Untitled
+252  60  60	Untitled
+252  56  56	Untitled
+252  56  56	Untitled
+252  52  52	Untitled
+252  48  48	Untitled
+252  44  44	Untitled
+252  40  40	Untitled
+252  36  36	Untitled
+252  32  32	Untitled
+252  28  28	Untitled
+252  28  28	Untitled
+252  24  24	Untitled
+252  20  20	Untitled
+252  16  16	Untitled
+252  12  12	Untitled
+252   8   8	Untitled
+252   4   4	Untitled
+252   0   0	Untitled
+252   0   0	Untitled
+248   0   0	Untitled
+244   0   0	Untitled
+244   0   0	Untitled
+240   0   0	Untitled
+236   0   0	Untitled
+236   0   0	Untitled
+232   0   0	Untitled
+228   0   0	Untitled
+224   0   0	Untitled
+224   0   0	Untitled
+220   0   0	Untitled
+216   0   0	Untitled
+216   0   0	Untitled
+212   0   0	Untitled
+208   0   0	Untitled
+208   0   0	Untitled
+204   0   0	Untitled
+200   0   0	Untitled
+196   0   0	Untitled
+196   0   0	Untitled
+192   0   0	Untitled
+188   0   0	Untitled
+188   0   0	Untitled
+184   0   0	Untitled
+180   0   0	Untitled
+180   0   0	Untitled
+176   0   0	Untitled
+172   0   0	Untitled
+168   0   0	Untitled
+168   0   0	Untitled
+164   0   0	Untitled
+160   0   0	Untitled
+160   0   0	Untitled
+156   0   0	Untitled
+152   0   0	Untitled
+152   0   0	Untitled
+148   0   0	Untitled
+144   0   0	Untitled
+140   0   0	Untitled
+140   0   0	Untitled
+136   0   0	Untitled
+132   0   0	Untitled
+132   0   0	Untitled
+128   0   0	Untitled
+124   0   0	Untitled
+124   0   0	Untitled
+120   0   0	Untitled
+116   0   0	Untitled
+112   0   0	Untitled
+112   0   0	Untitled
+108   0   0	Untitled
+104   0   0	Untitled
+104   0   0	Untitled
+100   0   0	Untitled
+ 96   0   0	Untitled
+ 96   0   0	Untitled
+ 92   0   0	Untitled
+ 88   0   0	Untitled
+ 84   0   0	Untitled
+ 84   0   0	Untitled
+ 80   0   0	Untitled
diff --git a/chalk/data/palettes/Reds_And_Purples.gpl b/chalk/data/palettes/Reds_And_Purples.gpl
new file mode 100644
index 000000000..6096547c0
--- /dev/null
+++ b/chalk/data/palettes/Reds_And_Purples.gpl
@@ -0,0 +1,33 @@
+GIMP Palette
+Name: Reds and Purples
+#
+205  92  92	Indian Red
+178  34  34	Firebrick
+165  42  42	Brown Red
+233 150 122	Dark Salmon
+250 128 114	Salmon
+255 160 122	Light Salmon
+255 127  80	Coral
+240 128 128	Light Coral
+255  99  71	Tomato
+255  69   0	Orange Red
+255   0   0	Red
+255 105 180	Hot Pink
+255  20 147	Deep Pink
+255 192 203	Pink
+255 182 193	Light Pink
+219 112 147	Pale Violet Red
+176  48  96	Maroon
+199  21 133	Medium Violet Red
+208  32 144	Violet Red
+255   0 255	Magenta
+238 130 238	Violet
+221 160 221	Plum
+218 112 214	Orchid
+186  85 211	Medium Orchid
+153  50 204	Dark Orchid
+148   0 211	Dark Violet
+138  43 226	Blue Violet
+160  32 240	Purple
+147 112 219	Medium Purple
+216 191 216	Thistle
diff --git a/chalk/data/palettes/Royal.gpl b/chalk/data/palettes/Royal.gpl
new file mode 100644
index 000000000..67c5bbb7a
--- /dev/null
+++ b/chalk/data/palettes/Royal.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Royal
+#
+  0   0   0	grey0
+ 60   0  80	Untitled
+ 60   0  80	Untitled
+ 60   0  84	Untitled
+ 64   0  84	Untitled
+ 64   0  84	Untitled
+ 64   0  88	Untitled
+ 64   0  88	Untitled
+ 68   0  88	Untitled
+ 68   0  92	Untitled
+ 68   0  92	Untitled
+ 68   0  92	Untitled
+ 72   0  96	Untitled
+ 72   0  96	Untitled
+ 72   0  96	Untitled
+ 72   0 100	Untitled
+ 76   0 100	Untitled
+ 76   0 100	Untitled
+ 76   0 104	Untitled
+ 76   0 104	Untitled
+ 76   0 104	Untitled
+ 80   0 104	Untitled
+ 80   0 108	Untitled
+ 80   0 108	Untitled
+ 80   0 108	Untitled
+ 84   0 112	Untitled
+ 84   0 112	Untitled
+ 84   0 112	Untitled
+ 84   0 116	Untitled
+ 88   0 116	Untitled
+ 88   0 116	Untitled
+ 88   0 120	Untitled
+ 88   0 120	Untitled
+ 92   0 120	Untitled
+ 92   0 124	Untitled
+ 92   0 124	Untitled
+ 92   0 124	Untitled
+ 96   0 128	Untitled
+ 96   0 128	Untitled
+ 96   0 128	Untitled
+ 96   0 132	Untitled
+ 96   0 132	Untitled
+100   0 132	Untitled
+100   0 132	Untitled
+100   0 136	Untitled
+100   0 136	Untitled
+104   0 136	Untitled
+104   0 140	Untitled
+104   0 140	Untitled
+104   0 140	Untitled
+108   0 144	Untitled
+108   0 144	Untitled
+108   0 144	Untitled
+108   0 148	Untitled
+112   0 148	Untitled
+112   0 148	Untitled
+112   0 152	Untitled
+112   0 152	Untitled
+116   0 152	Untitled
+116   0 156	Untitled
+116   0 156	Untitled
+116   0 156	Untitled
+120   0 160	Untitled
+120   0 160	Untitled
+124   4 160	Untitled
+124   8 164	Untitled
+128  12 164	Untitled
+128  16 164	Untitled
+132  20 168	Untitled
+132  24 168	Untitled
+136  28 168	Untitled
+136  32 172	Untitled
+140  36 172	Untitled
+140  40 172	Untitled
+144  44 176	Untitled
+144  48 176	Untitled
+148  52 180	Untitled
+148  56 180	Untitled
+152  60 180	Untitled
+152  64 184	Untitled
+156  68 184	Untitled
+156  72 184	Untitled
+160  76 188	Untitled
+160  80 188	Untitled
+164  84 188	Untitled
+164  88 192	Untitled
+168  92 192	Untitled
+168  96 192	Untitled
+172 100 196	Untitled
+172 104 196	Untitled
+176 108 200	Untitled
+176 112 200	Untitled
+180 116 200	Untitled
+180 120 204	Untitled
+184 124 204	Untitled
+188 128 204	Untitled
+188 132 208	Untitled
+192 136 208	Untitled
+192 140 208	Untitled
+196 144 212	Untitled
+196 148 212	Untitled
+200 152 216	Untitled
+200 156 216	Untitled
+204 160 216	Untitled
+204 164 220	Untitled
+208 168 220	Untitled
+208 172 220	Untitled
+212 176 224	Untitled
+212 180 224	Untitled
+216 184 224	Untitled
+216 188 228	Untitled
+220 192 228	Untitled
+220 196 228	Untitled
+224 200 232	Untitled
+224 204 232	Untitled
+228 208 236	Untitled
+228 212 236	Untitled
+232 216 236	Untitled
+232 220 240	Untitled
+236 224 240	Untitled
+236 228 240	Untitled
+240 232 244	Untitled
+240 236 244	Untitled
+244 240 244	Untitled
+244 244 248	Untitled
+248 248 248	Untitled
+252 252 252	grey99
+252 252 252	grey99
+252 252 248	Untitled
+252 252 244	Untitled
+252 252 240	Untitled
+252 252 236	Untitled
+252 252 232	Untitled
+252 252 228	Untitled
+252 252 224	Untitled
+252 252 220	Untitled
+252 252 216	Untitled
+252 252 212	Untitled
+252 252 208	Untitled
+252 252 204	Untitled
+252 252 200	Untitled
+252 252 196	Untitled
+252 252 192	Untitled
+252 252 188	Untitled
+252 252 184	Untitled
+252 252 180	Untitled
+252 252 176	Untitled
+252 252 172	Untitled
+252 252 168	Untitled
+252 252 164	Untitled
+252 252 160	Untitled
+252 252 156	Untitled
+252 252 152	Untitled
+252 252 148	Untitled
+252 252 144	Untitled
+252 252 140	Untitled
+252 252 136	Untitled
+252 252 132	Untitled
+252 252 128	Untitled
+252 252 124	Untitled
+252 252 120	Untitled
+252 252 116	Untitled
+252 252 112	Untitled
+252 252 108	Untitled
+252 252 104	Untitled
+252 252 100	Untitled
+252 252  96	Untitled
+252 252  92	Untitled
+252 252  88	Untitled
+252 252  84	Untitled
+252 252  80	Untitled
+252 252  76	Untitled
+252 252  72	Untitled
+252 252  68	Untitled
+252 252  64	Untitled
+252 252  60	Untitled
+252 252  56	Untitled
+252 252  52	Untitled
+252 252  48	Untitled
+252 252  44	Untitled
+252 252  40	Untitled
+252 252  36	Untitled
+252 252  32	Untitled
+252 252  28	Untitled
+252 252  24	Untitled
+252 252  20	Untitled
+252 252  16	Untitled
+252 252  12	Untitled
+252 252   8	Untitled
+252 252   4	Untitled
+252 252   0	Untitled
+252 248   0	Untitled
+248 244   0	Untitled
+244 240   0	Untitled
+240 236   4	Untitled
+240 232   4	Untitled
+236 228   4	Untitled
+232 224   8	Untitled
+228 220   8	Untitled
+228 216   8	Untitled
+224 212  12	Untitled
+220 208  12	Untitled
+216 204  12	Untitled
+212 200  16	Untitled
+212 196  16	Untitled
+208 192  16	Untitled
+204 188  20	Untitled
+200 184  20	Untitled
+200 180  20	Untitled
+196 176  24	Untitled
+192 172  24	Untitled
+188 168  24	Untitled
+184 164  28	Untitled
+184 160  28	Untitled
+180 156  28	Untitled
+176 152  32	Untitled
+172 148  32	Untitled
+172 144  32	Untitled
+168 140  36	Untitled
+164 136  36	Untitled
+160 132  36	Untitled
+160 128  36	Untitled
+156 124  40	Untitled
+152 120  40	Untitled
+148 116  40	Untitled
+144 112  44	Untitled
+144 108  44	Untitled
+140 104  44	Untitled
+136 100  48	Untitled
+132  96  48	Untitled
+132  92  48	Untitled
+128  88  52	Untitled
+124  84  52	Untitled
+120  80  52	Untitled
+116  76  56	Untitled
+116  72  56	Untitled
+112  68  56	Untitled
+108  64  60	Untitled
+104  60  60	Untitled
+104  56  60	Untitled
+100  52  64	Untitled
+ 96  48  64	Untitled
+ 92  44  64	Untitled
+ 88  40  68	Untitled
+ 88  36  68	Untitled
+ 84  32  68	Untitled
+ 80  28  72	Untitled
+ 76  24  72	Untitled
+ 76  20  72	Untitled
+ 72  16  76	Untitled
+ 68  12  76	Untitled
+ 64   8  76	Untitled
+ 60   0  80	Untitled
+ 60   0  80	Untitled
+ 60   0  80	Untitled
+ 60   0  80	Untitled
diff --git a/chalk/data/palettes/Topographic.gpl b/chalk/data/palettes/Topographic.gpl
new file mode 100644
index 000000000..8361edc72
--- /dev/null
+++ b/chalk/data/palettes/Topographic.gpl
@@ -0,0 +1,265 @@
+GIMP Palette
+Name: Topographic
+#
+#   "Topographic" color map - M. Davis
+#  waterline
+#       Rocks
+#       Snow
+#      Rocks
+#
+  0   0   0	grey0
+  0   0 168	Untitled
+  4   0 172	Untitled
+  4   8 172	Untitled
+  4  12 172	Untitled
+  4  16 172	Untitled
+  8  20 176	Untitled
+  8  24 176	Untitled
+  8  28 176	Untitled
+ 12  32 176	Untitled
+ 12  36 180	Untitled
+ 16  40 184	Untitled
+ 16  44 184	Untitled
+ 20  48 184	Untitled
+ 20  52 188	Untitled
+ 24  56 192	Untitled
+ 24  60 192	Untitled
+ 28  64 192	Untitled
+ 28  68 196	Untitled
+ 32  72 200	Untitled
+ 32  76 200	Untitled
+ 36  80 200	Untitled
+ 36  84 204	Untitled
+ 40  88 208	Untitled
+ 40  92 208	Untitled
+ 44  96 208	Untitled
+ 44 100 212	Untitled
+ 48 104 216	Untitled
+ 48 108 216	Untitled
+ 52 112 216	Untitled
+ 52 116 220	Untitled
+ 56 120 224	Untitled
+ 60 124 224	Untitled
+ 60 128 224	Untitled
+ 64 132 228	Untitled
+ 64 136 232	Untitled
+ 68 132 232	Untitled
+ 68 136 232	Untitled
+ 68 140 232	Untitled
+ 68 144 232	Untitled
+ 72 148 236	Untitled
+ 72 152 240	Untitled
+ 76 156 240	Untitled
+ 76 160 240	Untitled
+ 80 164 244	Untitled
+ 80 168 248	Untitled
+ 84 172 248	Untitled
+ 84 176 248	Untitled
+ 40 124   0	Untitled
+ 40 124   0	Untitled
+ 44 124   0	Untitled
+ 44 124   0	Untitled
+ 44 124   4	Untitled
+ 44 124   4	Untitled
+ 44 128   4	Untitled
+ 44 128   4	Untitled
+ 48 128   4	Untitled
+ 48 128   4	Untitled
+ 48 128   8	Untitled
+ 48 128   8	Untitled
+ 48 132   8	Untitled
+ 48 132   8	Untitled
+ 52 132   8	Untitled
+ 52 132   8	Untitled
+ 56 132  12	Untitled
+ 56 132  12	Untitled
+ 60 132  12	Untitled
+ 60 132  12	Untitled
+ 60 136  12	Untitled
+ 60 136  12	Untitled
+ 60 136  16	Untitled
+ 60 136  16	Untitled
+ 60 140  16	Untitled
+ 60 140  16	Untitled
+ 64 140  16	Untitled
+ 64 140  16	Untitled
+ 64 140  20	Untitled
+ 64 140  20	Untitled
+ 64 144  20	Untitled
+ 64 144  20	Untitled
+ 68 144  20	Untitled
+ 68 144  20	Untitled
+ 68 144  24	Untitled
+ 68 144  24	Untitled
+ 68 148  24	Untitled
+ 72 148  24	Untitled
+ 72 148  28	Untitled
+ 72 152  28	Untitled
+ 72 152  32	Untitled
+ 76 152  32	Untitled
+ 76 156  32	Untitled
+ 80 156  32	Untitled
+ 80 156  36	Untitled
+ 80 160  36	Untitled
+ 80 160  40	Untitled
+ 84 160  40	Untitled
+ 84 164  40	Untitled
+ 88 164  40	Untitled
+ 88 164  44	Untitled
+ 88 168  44	Untitled
+ 88 168  48	Untitled
+ 92 168  48	Untitled
+ 92 172  48	Untitled
+ 96 172  48	Untitled
+ 96 172  52	Untitled
+ 96 176  52	Untitled
+100 176  52	Untitled
+100 176  56	Untitled
+100 180  56	Untitled
+100 180  56	Untitled
+104 180  60	Untitled
+104 184  60	Untitled
+104 184  64	Untitled
+108 184  64	Untitled
+108 188  64	Untitled
+108 188  68	Untitled
+112 188  68	Untitled
+112 188  72	Untitled
+112 192  72	Untitled
+112 192  76	Untitled
+116 192  76	Untitled
+116 196  76	Untitled
+116 196  80	Untitled
+120 196  80	Untitled
+120 200  80	Untitled
+120 200  84	Untitled
+124 200  84	Untitled
+124 204  84	Untitled
+124 204  88	Untitled
+128 204  88	Untitled
+128 208  88	Untitled
+128 208  92	Untitled
+132 208  92	Untitled
+132 212  92	Untitled
+136 212  92	Untitled
+136 212  96	Untitled
+136 216  96	Untitled
+136 216 100	Untitled
+140 216 100	Untitled
+140 220 100	Untitled
+140 220 104	Untitled
+144 220 104	Untitled
+144 224 104	Untitled
+144 224 108	Untitled
+148 224 108	Untitled
+148 228 108	Untitled
+152 228 108	Untitled
+152 228 108	Untitled
+156 228 108	Untitled
+156 228 108	Untitled
+160 228 108	Untitled
+164 228 108	Untitled
+168 228 108	Untitled
+168 228 108	Untitled
+172 228 108	Untitled
+172 228 108	Untitled
+176 228 108	Untitled
+176 228 108	Untitled
+180 228 108	Untitled
+180 228 108	Untitled
+184 228 108	Untitled
+184 228 108	Untitled
+188 228 108	Untitled
+188 228 108	Untitled
+192 228 108	Untitled
+196 228 108	Untitled
+196 228 108	Untitled
+200 228 108	Untitled
+204 228 108	Untitled
+204 228 108	Untitled
+208 228 108	Untitled
+208 228 108	Untitled
+212 228 108	Untitled
+212 228 108	Untitled
+216 228 108	Untitled
+220 228 108	Untitled
+220 228 108	Untitled
+224 228 108	Untitled
+228 228 108	Untitled
+228 228 108	Untitled
+232 228 108	Untitled
+232 228 108	Untitled
+232 228 104	Untitled
+232 228 104	Untitled
+232 228 100	Untitled
+232 228 100	Untitled
+232 228  96	Untitled
+232 228  96	Untitled
+232 228  92	Untitled
+232 224  92	Untitled
+232 224  92	Untitled
+232 220  88	Untitled
+232 216  84	Untitled
+232 216  80	Untitled
+232 212  80	Untitled
+232 212  76	Untitled
+232 208  76	Untitled
+232 204  72	Untitled
+232 204  68	Untitled
+232 200  68	Untitled
+232 200  64	Untitled
+232 200  64	Untitled
+232 196  64	Untitled
+232 196  60	Untitled
+232 192  60	Untitled
+232 192  56	Untitled
+232 188  56	Untitled
+232 188  52	Untitled
+232 184  52	Untitled
+232 184  48	Untitled
+232 180  48	Untitled
+232 180  44	Untitled
+232 180  44	Untitled
+232 176  44	Untitled
+232 176  44	Untitled
+232 176  40	Untitled
+232 176  40	Untitled
+232 172  40	Untitled
+232 172  36	Untitled
+232 168  36	Untitled
+232 168  36	Untitled
+228 164  32	Untitled
+228 164  32	Untitled
+228 160  32	Untitled
+228 160  32	Untitled
+224 156  28	Untitled
+224 152  24	Untitled
+224 152  24	Untitled
+224 148  20	Untitled
+220 148  20	Untitled
+220 140  16	Untitled
+220 140  16	Untitled
+220 132  16	Untitled
+216 132  16	Untitled
+216 124   8	Untitled
+216 124   8	Untitled
+216 116   8	Untitled
+128 128 128	Untitled
+128 128 128	Untitled
+252 252 252	grey99
+252 252 252	grey99
+252 252 252	grey99
+252 252 252	grey99
+252 252 252	grey99
+252 252 252	grey99
+252 252 252	grey99
+252 252 252	grey99
+192 192 192	Untitled
+192 192 192	Untitled
+252 252 252	grey99
+252 252 252	grey99
+252 252 252	grey99
+252 252 252	grey99
+252 252 252	grey99
+252 252 252	grey99
+252 252 252	grey99
diff --git a/chalk/data/palettes/Visibone.gpl b/chalk/data/palettes/Visibone.gpl
new file mode 100644
index 000000000..17c357b9f
--- /dev/null
+++ b/chalk/data/palettes/Visibone.gpl
@@ -0,0 +1,346 @@
+GIMP Palette
+Name: Visibone
+Columns: 16
+#
+# Visibone -- GIMP Palette file
+#
+#  Arrangement idea from www.visibone.com
+#  Conversion to GIMP Palette and addition of
+#  hex codes and color names by Tigert <tigert@gimp.org>
+# 
+255 255 255	#FFFFFF - White
+204 204 204	#CCCCCC - Pale Gray
+153 153 153	#999999 - Light Gray
+102 102 102	#666666 - Dark Gray
+ 51  51  51	#333333 - Obscure Gray
+  0   0   0	#000000 - Black
+255 204   0	#FFCC00 - Yellow-Yellow-Orange
+255 153   0	#FF9900 - Orange-Orange-Yellow
+255 102   0	#FF6600 - Orange-Orange-Red
+255  51   0	#FF3300 - Red-Red-Orange
+  0   0   0	#000000 - Black
+ 51  51  51	#333333 - Obscure Gray
+102 102 102	#666666 - Dark Gray
+153 153 153	#999999 - Light Gray
+204 204 204	#CCCCCC - Pale Gray
+255 255 255	#FFFFFF - White
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+255 204  51	#FFCC33 - Light Yellow-Orange
+255 204 102	#FFCC66 - Light Orange-Yellow
+255 153 102	#FF9966 - Light Orange-Red
+255 102  51	#FF6633 - Light Red-Orange
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+204 153   0	#CC9900 - Dark Yellow-Orange
+204 153  51	#CC9933 - Medium Orange-Yellow
+204 102  51	#CC6633 - Medium Orange-Red
+204  51   0	#CC3300 - Dark Red-Orange
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+ 51  51   0	#333300 - Obscure Weak Yellow
+102 102   0	#666600 - Obscure Dull Yellow
+153 153   0	#999900 - Dark Faded Yellow
+204 204   0	#CCCC00 - Dark Hard Yellow
+255 255   0	#FFFF00 - Yellow
+153 102   0	#996600 - Dark Orange-Yellow
+153  51   0	#993300 - Dark Orange-Red
+ 51   0   0	#330000 - Obscure Weak Red
+102   0   0	#660000 - Obscure Dull Red
+153   0   0	#990000 - Dark Faded Red
+204   0   0	#CC0000 - Dark Hard Red
+255   0   0	#FF0000 - Red
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+204 255   0	#CCFF00 - Yellow-Yellow-Spring
+204 255  51	#CCFF33 - Light Yellow-Spring
+153 204   0	#99CC00 - Dark Yellow-Spring
+102 102  51	#666633 - Dark Weak Yellow
+153 153  51	#999933 - Dark Dull Yellow
+204 204  51	#CCCC33 - Medium Faded Yellow
+255 255  51	#FFFF33 - Light Hard Yellow
+102  51   0	#663300 - Obscure Dull Orange
+  0   0   0	#000000 - Black
+102  51  51	#663333 - Dark Weak Red
+153  51  51	#993333 - Dark Dull Red
+204  51  51	#CC3333 - Medium Faded Red
+255  51  51	#FF3333 - Light Hard Red
+204   0  51	#CC0033 - Dark Red-Pink
+255  51 102	#FF3366 - Light Red-Pink
+255   0  51	#FF0033 - Red-Red-Pink 
+153 255   0	#99FF00 - Spring-Spring-Yellow
+204 255 102	#CCFF66 - Light Spring-Yellow
+153 204  51	#99CC33 - Medium Spring-Yellow
+102 153   0	#669900 - Dark Spring-Yellow
+153 153 102	#999966 - Medium Weak Yellow
+204 204 102	#CCCC66 - Light Dull Yellow
+255 255 102	#FFFF66 - Light Faded Yellow
+153 102  51	#996633 - Dark Dull Orange
+204 102   0	#CC6600 - Dark Hard Orange
+153 102 102	#996666 - Medium Weak Red
+204 102 102	#CC6666 - Light Dull Red
+255 102 102	#FF6666 - Light Faded Red
+153   0  51	#990033 - Dark Pink-Red
+204  51 102	#CC3366 - Medium Pink-Red
+255 102 153	#FF6699 - Light Pink-Red
+255   0 102	#FF0066 - Pink-Pink-Red
+102 255   0	#66FF00 - Spring-Spring-Green
+153 255 102	#99FF66 - Light Spring-Green
+102 204  51	#66CC33 - Medium Spring-Green
+ 51 153   0	#339900 - Dark Spring-Green
+  0   0   0	#000000 - Black
+204 204 153	#CCCC99 - Light Weak Yellow
+255 255 153	#FFFF99 - Pale Dull Yellow
+204 153 102	#CC9966 - Light Dull Orange
+255 153  51	#FF9933 - Light Hard Orange
+204 153 153	#CC9999 - Light Weak Red
+255 153 153	#FF9999 - Pale Dull Red
+  0   0   0	#000000 - Black
+153   0 102	#990066 - Dark Pink-Magenta
+204  51 153	#CC3399 - Medium Pink-Magenta
+255 102 204	#FF66CC - Light Pink-Magenta
+255   0 153	#FF0099 - Pink-Pink-Magenta
+ 51 255   0	#33FF00 - Green-Green-Spring
+102 255  51	#66FF33 - Light Green-Spring
+ 51 204   0	#33CC00 - Dark Green-Spring
+ 51 102   0	#336600 - Obscure Dull Spring
+102 204   0	#66CC00 - Dark Hard Spring
+153 255  51	#99FF33 - Light Hard Spring
+255 255 204	#FFFFCC - Pale Weak Yellow
+255 204 153	#FFCC99 - Pale Dull Orange
+  0   0   0	#000000 - Black
+255 204 204	#FFCCCC - Pale Weak Red
+204 102 153	#CC6699 - Light Dull Pink
+153  51 102	#993366 - Dark Dull Pink
+102   0  51	#660033 - Obscure Dull Pink
+204   0 153	#CC0099 - Dark Magenta-Pink
+255  51 204	#FF33CC - Light Magenta-Pink
+255   0 204	#FF00CC - Magenta-Magenta-Pink
+  0 255   0	#00FF00 - Green
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+102 153  51	#669933 - Dark Dull Spring
+153 204 102	#99CC66 - Light Dull Spring
+204 255 153	#CCFF99 - Pale Dull Spring
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+255 153 204	#FF99CC - Pale Dull Pink
+255  51 153	#FF3399 - Light Hard Pink
+204   0 102	#CC0066 - Dark Hard Pink
+  0   0   0	#000000 - Black
+102  51 102	#663366 - Dark Weak Magenta
+ 51   0  51	#330033 - Obscure Weak Magenta
+  0 204   0	#00CC00 - Dark Hard Green
+ 51 255  51	#33FF33 - Light Hard Green
+102 255 102	#66FF66 - Light Faded Green
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+204 153 204	#CC99CC - Light Weak Magenta
+153 102 153	#996699 - Medium Weak Magenta
+153  51 153	#993399 - Dark Dull Magenta
+102   0 102	#660066 - Obscure Dull Magenta
+  0 153   0	#009900 - Dark Faded Green
+ 51 204  51	#33CC33 - Medium Faded Green
+102 204 102	#66CC66 - Light Dull Green
+153 255 153	#99FF99 - Pale Dull Green
+204 255 204	#CCFFCC - Pale Weak Green
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+255 204 255	#FFCCFF - Pale Weak Magenta
+255 153 255	#FF99FF - Pale Dull Magenta
+204 102 204	#CC66CC - Light Dull Magenta
+204  51 204	#CC33CC - Medium Faded Magenta
+153   0 153	#990099 - Dark Faded Magenta
+  0 102   0	#006600 - Obscure Dull Green
+ 51 153  51	#339933 - Dark Dull Green
+102 153 102	#669966 - Medium Weak Green
+153 204 153	#99CC99 - Light Weak Green
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+255 102 255	#FF66FF - Light Faded Magenta
+255  51 255	#FF33FF - Light Hard Magenta
+204   0 204	#CC00CC - Dark Hard Magenta
+  0  51   0	#003300 - Obscure Weak Green
+ 51 102  51	#336633 - Dark Weak Green
+  0   0   0	#000000 - Black
+  0 204 102	#00CC66 - Dark Hard Teal
+ 51 255 153	#33FF99 - Light Hard Teal
+153 255 204	#99FFCC - Pale Dull Teal
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+204 153 255	#CC99FF - Pale Dull Violet
+153 102 204	#9966CC - Light Dull Violet
+102  51 153	#663399 - Dark Dull Violet
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+255   0 255	#FF00FF - Magenta
+  0 255  51	#00FF33 - Green-Green-Teal
+ 51 255 102	#33FF66 - Light Green-Teal
+  0 204  51	#00CC33 - Dark Green-Teal
+  0 102  51	#006633 - Obscure Dull Teal
+ 51 153 102	#339966 - Dark Dull Teal
+102 204 153	#66CC99 - Light Dull Teal
+204 255 255	#CCFFFF - Pale Weak Cyan
+  0   0   0	#000000 - Black
+153 204 255	#99CCFF - Pale Dull Azure
+204 204 255	#CCCCFF - Pale Weak Blue
+153  51 255	#9933FF - Light Hard Violet
+102   0 204	#6600CC - Dark Hard Violet
+ 51   0 102	#330066 - Obscure Dull Violet
+153   0 204	#9900CC - Dark Magenta-Violet
+204  51 255	#CC33FF - Light Magenta-Violet
+204   0 255	#CC00FF - Magenta-Magenta-Violet
+  0 255 102	#00FF66 - Teal-Teal-Green
+102 255 153	#66FF99 - Light Teal-Green
+ 51 204 102	#33CC66 - Medium Teal-Green
+  0 153  51	#009933 - Dark Teal-Green
+  0   0   0	#000000 - Black
+153 255 255	#99FFFF - Pale Dull Cyan
+153 204 204	#99CCCC - Light Weak Cyan
+ 51 153 255	#3399FF - Light Hard Azure
+102 153 204	#6699CC - Light Dull Azure
+153 153 255	#9999FF - Pale Dull Blue
+153 153 204	#9999CC - Light Weak Blue
+  0   0   0	#000000 - Black
+102   0 153	#660099 - Dark Violet-Magenta
+153  51 204	#9933CC - Medium Violet-Magenta
+204 102 255	#CC66FF - Light Violet-Magenta
+153   0 255	#9900FF - Violet-Violet-Magenta
+  0 255 153	#00FF99 - Teal-Teal-Cyan
+102 255 204	#66FFCC - Light Teal-Cyan
+ 51 204 153	#33CC99 - Medium Teal-Cyan
+  0 153 102	#009966 - Dark Teal-Cyan
+102 255 255	#66FFFF - Light Faded Cyan
+102 204 204	#66CCCC - Light Dull Cyan
+102 153 153	#669999 - Medium Weak Cyan
+  0 102 204	#0066CC - Dark Hard Azure
+ 51 102 153	#336699 - Dark Dull Azure
+102 102 255	#6666FF - Light Faded Blue
+102 102 204	#6666CC - Light Dull Blue
+102 102 153	#666699 - Medium Weak Blue
+102   0 153	#660099 - Dark Violet-Magenta
+153  51 204	#9933CC - Medium Violet-Magenta
+204 102 255	#CC66FF - Light Violet-Magenta
+153   0 255	#9900FF - Violet-Violet-Magenta
+  0 255 204	#00FFCC - Cyan-Cyan-Teal
+ 51 255 204	#33FFCC - Light Cyan-Teal
+  0 204 153	#00CC99 - Dark Cyan-Teal
+ 51 255 255	#33FFFF - Light Hard Cyan
+ 51 204 204	#33CCCC - Medium Faded Cyan
+ 51 153 153	#339999 - Dark Dull Cyan
+ 51 102 102	#336666 - Dark Weak Cyan
+  0   0   0	#000000 - Black
+  0  51 102	#003366 - Obscure Dull Azure
+ 51  51 255	#3333FF - Light Hard Blue
+ 51  51 204	#3333CC - Medium Faded Blue
+ 51  51 153	#333399 - Dark Dull Blue
+ 51  51 102	#333366 - Dark Weak Blue
+ 51   0 204	#3300CC - Dark Blue-Violet
+102  51 255	#6633FF - Light Blue-Violet
+ 51   0 255	#3300FF - Blue-Blue-Violet
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0 255 255	#00FFFF - Cyan
+  0 204 204	#00CCCC - Dark Hard Cyan
+  0 153 153	#009999 - Dark Faded Cyan
+  0 102 102	#006666 - Obscure Dull Cyan
+  0  51  51	#003333 - Obscure Weak Cyan
+  0 102 153	#006699 - Dark Azure-Cyan
+  0  51 153	#003399 - Dark Azure-Blue
+  0   0 255	#0000FF - Blue
+  0   0 204	#0000CC - Dark Hard Blue
+  0   0 153	#000099 - Dark Faded Blue
+  0   0 102	#000066 - Obscure Dull Blue
+  0   0  51	#000033 - Obscure Weak Blue
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0 153 204	#0099CC - Dark Cyan-Azure
+ 51 153 204	#3399CC - Medium Azure-Cyan
+ 51 102 204	#3366CC - Medium Azure-Blue
+  0  51 204	#0033CC - Dark Blue-Azure
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+ 51 204 255	#33CCFF - Light Cyan-Azure
+102 204 255	#66CCFF - Light Azure-Cyan
+102 153 255	#6699FF - Light Azure-Blue
+ 51 102 255	#3366FF - Light Blue-Azure
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+  0   0   0	#000000 - Black
+255 255 255	#FFFFFF - White
+204 204 204	#CCCCCC - Pale Gray
+153 153 153	#999999 - Light Gray
+102 102 102	#666666 - Dark Gray
+ 51  51  51	#333333 - Obscure Gray
+  0   0   0	#000000 - Black
+  0 204 255	#00CCFF - Cyan-Cyan-Azure
+  0 153 255	#0099FF - Azure-Azure-Cyan
+  0 102 255	#0066FF - Azure-Azure-Blue
+  0  51 255	#0033FF - Blue-Blue-Azure
+  0   0   0	#000000 - Black
+ 51  51  51	#333333 - Obscure Gray
+102 102 102	#666666 - Dark Gray
+153 153 153	#999999 - Light Gray
+204 204 204	#CCCCCC - Pale Gray
+255 255 255	#FFFFFF - White
diff --git a/chalk/data/palettes/Visibone_2.gpl b/chalk/data/palettes/Visibone_2.gpl
new file mode 100644
index 000000000..affacd187
--- /dev/null
+++ b/chalk/data/palettes/Visibone_2.gpl
@@ -0,0 +1,266 @@
+GIMP Palette
+Name: Visibone 2
+Columns: 16
+#
+# Visibone 2 -- GIMP Palette file
+#
+#  Arrangement idea from www.visibone.com
+#  Conversion to GIMP Palette and addition of
+#  RGB and hex codes by Carey Bunks <cbunks@bbn.com>
+# 
+255 255 255	(255 255 255) #FFFFFF
+204 204 204	(204 204 204) #CCCCCC
+153 153 153	(153 153 153) #999999
+102 102 102	(102 102 102) #666666
+ 51  51  51	( 51  51  51) #333333
+  0   0   0	(  0   0   0) #000000
+255 204   0	(255 204   0) #FFCC00
+255 153   0	(255 153   0) #FF9900
+255 102   0	(255 102   0) #FF6600
+255  51   0	(255  51   0) #FF3300
+  0   0   0	(  0   0   0) #000000
+ 51  51  51	( 51  51  51) #333333
+102 102 102	(102 102 102) #666666
+153 153 153	(153 153 153) #999999
+204 204 204	(204 204 204) #CCCCCC
+255 255 255	(255 255 255) #FFFFFF
+153 204   0	(153 204   0) #99CC00
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+204 153   0	(204 153   0) #CC9900
+255 204  51	(255 204  51) #FFCC33
+255 204 102	(255 204 102) #FFCC66
+255 153 102	(255 153 102) #FF9966
+255 102  51	(255 102  51) #FF6633
+204  51   0	(204  51   0) #CC3300
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+204   0  51	(204   0  51) #CC0033
+204 255   0	(204 255   0) #CCFF00
+204 255  51	(204 255  51) #CCFF33
+ 51  51   0	( 51  51   0) #333300
+102 102   0	(102 102   0) #666600
+153 153   0	(153 153   0) #999900
+204 204   0	(204 204   0) #CCCC00
+255 255   0	(255 255   0) #FFFF00
+204 153  51	(204 153  51) #CC9933
+204 102  51	(204 102  51) #CC6633
+ 51   0   0	( 51   0   0) #330000
+102   0   0	(102   0   0) #660000
+153   0   0	(153   0   0) #990000
+204   0   0	(204   0   0) #CC0000
+255   0   0	(255   0   0) #FF0000
+255  51 102	(255  51 102) #FF3366
+255   0  51	(255   0  51) #FF0033
+153 255   0	(153 255   0) #99FF00
+204 255 102	(204 255 102) #CCFF66
+153 204  51	(153 204  51) #99CC33
+102 102  51	(102 102  51) #666633
+153 153  51	(153 153  51) #999933
+204 204  51	(204 204  51) #CCCC33
+255 255  51	(255 255  51) #FFFF33
+153 102   0	(153 102   0) #996600
+153  51   0	(153  51   0) #993300
+102  51  51	(102  51  51) #663333
+153  51  51	(153  51  51) #993333
+204  51  51	(204  51  51) #CC3333
+255  51  51	(255  51  51) #FF3333
+204  51 102	(204  51 102) #CC3366
+255 102 153	(255 102 153) #FF6699
+255   0 102	(255   0 102) #FF0066
+102 255   0	(102 255   0) #66FF00
+153 255 102	(153 255 102) #99FF66
+102 204  51	(102 204  51) #66CC33
+102 153   0	(102 153   0) #669900
+153 153 102	(153 153 102) #999966
+204 204 102	(204 204 102) #CCCC66
+255 255 102	(255 255 102) #FFFF66
+153 102  51	(153 102  51) #996633
+102  51   0	(102  51   0) #663300
+153 102 102	(153 102 102) #996666
+204 102 102	(204 102 102) #CC6666
+255 102 102	(255 102 102) #FF6666
+153   0  51	(153   0  51) #990033
+204  51 153	(204  51 153) #CC3399
+255 102 204	(255 102 204) #FF66CC
+255   0 153	(255   0 153) #FF0099
+ 51 255   0	( 51 255   0) #33FF00
+102 255  51	(102 255  51) #66FF33
+ 51 153   0	( 51 153   0) #339900
+102 204   0	(102 204   0) #66CC00
+153 255  51	(153 255  51) #99FF33
+204 204 153	(204 204 153) #CCCC99
+255 255 153	(255 255 153) #FFFF99
+204 153 102	(204 153 102) #CC9966
+204 102   0	(204 102   0) #CC6600
+204 153 153	(204 153 153) #CC9999
+255 153 153	(255 153 153) #FF9999
+255  51 153	(255  51 153) #FF3399
+204   0 102	(204   0 102) #CC0066
+153   0 102	(153   0 102) #990066
+255  51 204	(255  51 204) #FF33CC
+255   0 204	(255   0 204) #FF00CC
+  0 204   0	(  0 204   0) #00CC00
+ 51 204   0	( 51 204   0) #33CC00
+ 51 102   0	( 51 102   0) #336600
+102 153  51	(102 153  51) #669933
+153 204 102	(153 204 102) #99CC66
+204 255 153	(204 255 153) #CCFF99
+255 255 204	(255 255 204) #FFFFCC
+255 204 153	(255 204 153) #FFCC99
+255 153  51	(255 153  51) #FF9933
+255 204 204	(255 204 204) #FFCCCC
+255 153 204	(255 153 204) #FF99CC
+204 102 153	(204 102 153) #CC6699
+153  51 102	(153  51 102) #993366
+102   0  51	(102   0  51) #660033
+204   0 153	(204   0 153) #CC0099
+ 51   0  51	( 51   0  51) #330033
+ 51 204  51	( 51 204  51) #33CC33
+102 204 102	(102 204 102) #66CC66
+  0 255   0	(  0 255   0) #00FF00
+ 51 255  51	( 51 255  51) #33FF33
+102 255 102	(102 255 102) #66FF66
+153 255 153	(153 255 153) #99FF99
+204 255 204	(204 255 204) #CCFFCC
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+204 153 204	(204 153 204) #CC99CC
+153 102 153	(153 102 153) #996699
+153  51 153	(153  51 153) #993399
+153   0 153	(153   0 153) #990099
+102  51 102	(102  51 102) #663366
+102   0 102	(102   0 102) #660066
+  0 102   0	(  0 102   0) #006600
+ 51 102  51	( 51 102  51) #336633
+  0 153   0	(  0 153   0) #009900
+ 51 153  51	( 51 153  51) #339933
+102 153 102	(102 153 102) #669966
+153 204 153	(153 204 153) #99CC99
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+255 204 255	(255 204 255) #FFCCFF
+255 153 255	(255 153 255) #FF99FF
+255 102 255	(255 102 255) #FF66FF
+255  51 255	(255  51 255) #FF33FF
+255   0 255	(255   0 255) #FF00FF
+204 102 204	(204 102 204) #CC66CC
+204  51 204	(204  51 204) #CC33CC
+  0  51   0	(  0  51   0) #003300
+  0 204  51	(  0 204  51) #00CC33
+  0 102  51	(  0 102  51) #006633
+ 51 153 102	( 51 153 102) #339966
+102 204 153	(102 204 153) #66CC99
+153 255 204	(153 255 204) #99FFCC
+204 255 255	(204 255 255) #CCFFFF
+ 51 153 255	( 51 153 255) #3399FF
+153 204 255	(153 204 255) #99CCFF
+204 204 255	(204 204 255) #CCCCFF
+204 153 255	(204 153 255) #CC99FF
+153 102 204	(153 102 204) #9966CC
+102  51 153	(102  51 153) #663399
+ 51   0 102	( 51   0 102) #330066
+153   0 204	(153   0 204) #9900CC
+204   0 204	(204   0 204) #CC00CC
+  0 255  51	(  0 255  51) #00FF33
+ 51 255 102	( 51 255 102) #33FF66
+  0 153  51	(  0 153  51) #009933
+  0 204 102	(  0 204 102) #00CC66
+ 51 255 153	( 51 255 153) #33FF99
+153 255 255	(153 255 255) #99FFFF
+153 204 204	(153 204 204) #99CCCC
+  0 102 204	(  0 102 204) #0066CC
+102 153 204	(102 153 204) #6699CC
+153 153 255	(153 153 255) #9999FF
+153 153 204	(153 153 204) #9999CC
+153  51 255	(153  51 255) #9933FF
+102   0 204	(102   0 204) #6600CC
+102   0 153	(102   0 153) #660099
+204  51 255	(204  51 255) #CC33FF
+204   0 255	(204   0 255) #CC00FF
+  0 255 102	(  0 255 102) #00FF66
+102 255 153	(102 255 153) #66FF99
+ 51 204 102	( 51 204 102) #33CC66
+  0 153 102	(  0 153 102) #009966
+102 255 255	(102 255 255) #66FFFF
+102 204 204	(102 204 204) #66CCCC
+102 153 153	(102 153 153) #669999
+  0  51 102	(  0  51 102) #003366
+ 51 102 153	( 51 102 153) #336699
+102 102 255	(102 102 255) #6666FF
+102 102 204	(102 102 204) #6666CC
+102 102 153	(102 102 153) #666699
+ 51   0 153	( 51   0 153) #330099
+153  51 204	(153  51 204) #9933CC
+204 102 255	(204 102 255) #CC66FF
+153   0 255	(153   0 255) #9900FF
+  0 255 153	(  0 255 153) #00FF99
+102 255 204	(102 255 204) #66FFCC
+ 51 204 153	( 51 204 153) #33CC99
+ 51 255 255	( 51 255 255) #33FFFF
+ 51 204 204	( 51 204 204) #33CCCC
+ 51 153 153	( 51 153 153) #339999
+ 51 102 102	( 51 102 102) #336666
+  0 102 153	(  0 102 153) #006699
+  0  51 153	(  0  51 153) #003399
+ 51  51 255	( 51  51 255) #3333FF
+ 51  51 204	( 51  51 204) #3333CC
+ 51  51 153	( 51  51 153) #333399
+ 51  51 102	( 51  51 102) #333366
+102  51 204	(102  51 204) #6633CC
+153 102 255	(153 102 255) #9966FF
+102   0 255	(102   0 255) #6600FF
+  0 255 204	(  0 255 204) #00FFCC
+ 51 255 204	( 51 255 204) #33FFCC
+  0 255 255	(  0 255 255) #00FFFF
+  0 204 204	(  0 204 204) #00CCCC
+  0 153 153	(  0 153 153) #009999
+  0 102 102	(  0 102 102) #006666
+  0  51  51	(  0  51  51) #003333
+ 51 153 204	( 51 153 204) #3399CC
+ 51 102 204	( 51 102 204) #3366CC
+  0   0 255	(  0   0 255) #0000FF
+  0   0 204	(  0   0 204) #0000CC
+  0   0 153	(  0   0 153) #000099
+  0   0 102	(  0   0 102) #000066
+  0   0  51	(  0   0  51) #000033
+102  51 255	(102  51 255) #6633FF
+ 51   0 255	( 51   0 255) #3300FF
+  0 204 153	(  0 204 153) #00CC99
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+  0 153 202	(  0 153 202) #0099CA
+ 51 204 255	( 51 204 255) #33CCFF
+102 204 255	(102 204 255) #66CCFF
+102 153 255	(102 153 255) #6699FF
+ 51 102 255	( 51 102 255) #3366FF
+  0  51 204	(  0  51 204) #0033CC
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+  0   0   0	(  0   0   0) #000000
+ 51   0 204	( 51   0 204) #3300CC
+255 255 255	(255 255 255) #FFFFFF
+204 204 204	(204 204 204) #CCCCCC
+153 153 153	(153 153 153) #999999
+102 102 102	(102 102 102) #666666
+ 51  51  51	( 51  51  51) #333333
+  0   0   0	(  0   0   0) #000000
+  0 204 255	(  0 204 255) #00CCFF
+  0 153 255	(  0 153 255) #0099FF
+  0 102 255	(  0 102 255) #0066FF
+  0  51 255	(  0  51 255) #0033FF
+  0   0   0	(  0   0   0) #000000
+ 51  51  51	( 51  51  51) #333333
+102 102 102	(102 102 102) #666666
+153 153 153	(153 153 153) #999999
+204 204 204	(204 204 204) #CCCCCC
+255 255 255	(255 255 255) #FFFFFF
diff --git a/chalk/data/palettes/Volcano.gpl b/chalk/data/palettes/Volcano.gpl
new file mode 100644
index 000000000..f9031e3df
--- /dev/null
+++ b/chalk/data/palettes/Volcano.gpl
@@ -0,0 +1,259 @@
+GIMP Palette
+Name: Volcano
+#
+  0   0   0	grey0
+  0   0   0	grey0
+  0   0   8	Untitled
+  0   0  16	Untitled
+  0   0  24	Untitled
+  0   0  32	Untitled
+  0   0  40	Untitled
+  0   0  48	Untitled
+  0   0  56	Untitled
+  0   0  64	Untitled
+  0   0  72	Untitled
+  0   0  84	Untitled
+  0   0  92	Untitled
+  0   0 100	Untitled
+  0   0 108	Untitled
+  0   0 116	Untitled
+  0   0 124	Untitled
+  0   0 132	Untitled
+  0   0 140	Untitled
+  0   0 148	Untitled
+  0   0 156	Untitled
+  0   0 168	Untitled
+  0   0 176	Untitled
+  0   0 184	Untitled
+  0   0 192	Untitled
+  0   0 200	Untitled
+  0   0 208	Untitled
+  0   0 216	Untitled
+  0   0 224	Untitled
+  0   0 232	Untitled
+  0   0 240	Untitled
+  0   0 252	Untitled
+  8   0 252	Untitled
+ 16   0 252	Untitled
+ 24   0 252	Untitled
+ 32   0 252	Untitled
+ 40   0 252	Untitled
+ 48   0 252	Untitled
+ 56   0 252	Untitled
+ 64   0 252	Untitled
+ 72   0 252	Untitled
+ 84   0 252	Untitled
+ 92   0 252	Untitled
+100   0 252	Untitled
+108   0 252	Untitled
+116   0 252	Untitled
+124   0 252	Untitled
+132   0 252	Untitled
+140   0 252	Untitled
+148   0 252	Untitled
+156   0 252	Untitled
+168   0 252	Untitled
+176   0 252	Untitled
+184   0 252	Untitled
+192   0 252	Untitled
+200   0 252	Untitled
+208   0 252	Untitled
+216   0 252	Untitled
+224   0 252	Untitled
+232   0 252	Untitled
+240   0 252	Untitled
+252   0 252	Untitled
+252   0 244	Untitled
+252   0 236	Untitled
+252   0 228	Untitled
+252   0 220	Untitled
+252   0 212	Untitled
+252   0 200	Untitled
+252   0 192	Untitled
+252   0 184	Untitled
+252   0 176	Untitled
+252   0 168	Untitled
+252   0 160	Untitled
+252   0 148	Untitled
+252   0 140	Untitled
+252   0 132	Untitled
+252   0 124	Untitled
+252   0 116	Untitled
+252   0 108	Untitled
+252   0  96	Untitled
+252   0  88	Untitled
+252   0  80	Untitled
+252   0  72	Untitled
+252   0  64	Untitled
+252   0  56	Untitled
+252   0  44	Untitled
+252   0  36	Untitled
+252   0  28	Untitled
+252   0  20	Untitled
+252   0  12	Untitled
+252   0   0	Untitled
+252   8   0	Untitled
+252  16   0	Untitled
+252  24   0	Untitled
+252  32   0	Untitled
+252  40   0	Untitled
+252  48   0	Untitled
+252  56   0	Untitled
+252  64   0	Untitled
+252  72   0	Untitled
+252  80   0	Untitled
+252  88   0	Untitled
+252  96   0	Untitled
+252 104   0	Untitled
+252 112   0	Untitled
+252 120   0	Untitled
+252 128   0	Untitled
+252 128   0	Untitled
+252 132   0	Untitled
+252 136   0	Untitled
+252 140   0	Untitled
+252 144   0	Untitled
+252 148   0	Untitled
+252 152   0	Untitled
+252 156   0	Untitled
+252 160   0	Untitled
+252 164   0	Untitled
+252 168   0	Untitled
+252 172   0	Untitled
+252 176   0	Untitled
+252 180   0	Untitled
+252 184   0	Untitled
+252 188   0	Untitled
+252 192   0	Untitled
+252 196   0	Untitled
+252 200   0	Untitled
+252 204   0	Untitled
+252 208   0	Untitled
+252 212   0	Untitled
+252 216   0	Untitled
+252 220   0	Untitled
+252 224   0	Untitled
+252 228   0	Untitled
+252 232   0	Untitled
+252 236   0	Untitled
+252 240   0	Untitled
+252 244   0	Untitled
+252 248   0	Untitled
+252 252   0	Untitled
+248 252   0	Untitled
+240 252   0	Untitled
+232 252   0	Untitled
+224 252   0	Untitled
+216 252   0	Untitled
+208 252   0	Untitled
+200 252   0	Untitled
+192 252   0	Untitled
+184 252   0	Untitled
+176 252   0	Untitled
+168 252   0	Untitled
+160 252   0	Untitled
+152 252   0	Untitled
+144 252   0	Untitled
+136 252   0	Untitled
+128 252   0	Untitled
+124 252   0	LawnGreen
+116 252   0	Untitled
+108 252   0	Untitled
+100 252   0	Untitled
+ 92 252   0	Untitled
+ 84 252   0	Untitled
+ 76 252   0	Untitled
+ 68 252   0	Untitled
+ 60 252   0	Untitled
+ 52 252   0	Untitled
+ 44 252   0	Untitled
+ 36 252   0	Untitled
+ 28 252   0	Untitled
+ 20 252   0	Untitled
+ 12 252   0	Untitled
+  4 252   0	Untitled
+ 12 252   0	Untitled
+ 20 252   0	Untitled
+ 28 252   0	Untitled
+ 36 252   0	Untitled
+ 44 252   0	Untitled
+ 52 252   0	Untitled
+ 60 252   0	Untitled
+ 68 252   0	Untitled
+ 76 252   0	Untitled
+ 84 252   0	Untitled
+ 92 252   0	Untitled
+100 252   0	Untitled
+108 252   0	Untitled
+116 252   0	Untitled
+124 252   0	LawnGreen
+128 252   0	Untitled
+132 252   0	Untitled
+136 252   0	Untitled
+140 252   0	Untitled
+144 252   0	Untitled
+148 252   0	Untitled
+152 252   0	Untitled
+156 252   0	Untitled
+160 252   0	Untitled
+164 252   0	Untitled
+168 252   0	Untitled
+172 252   0	Untitled
+176 252   0	Untitled
+180 252   0	Untitled
+184 252   0	Untitled
+188 252   0	Untitled
+192 252   0	Untitled
+196 252   0	Untitled
+200 252   0	Untitled
+204 252   0	Untitled
+208 252   0	Untitled
+212 252   0	Untitled
+216 252   0	Untitled
+220 252   0	Untitled
+224 252   0	Untitled
+228 252   0	Untitled
+232 252   0	Untitled
+236 252   0	Untitled
+240 252   0	Untitled
+244 252   0	Untitled
+248 252   0	Untitled
+252 252   0	Untitled
+252 232   0	Untitled
+252 208   0	Untitled
+252 184   0	Untitled
+252 164   0	Untitled
+252 140   0	Untitled
+252 116   0	Untitled
+252  92   0	Untitled
+252  72   0	Untitled
+252  48   0	Untitled
+252  24   0	Untitled
+252   0   0	Untitled
+252   8   0	Untitled
+252  20   0	Untitled
+252  32   0	Untitled
+252  44   0	Untitled
+252  56   0	Untitled
+252  68   0	Untitled
+252  80   0	Untitled
+252  88   0	Untitled
+252 100   0	Untitled
+252 112   0	Untitled
+252 124   0	Untitled
+252 136   0	Untitled
+252 148   0	Untitled
+252 160   0	Untitled
+252 168   0	Untitled
+252 180   0	Untitled
+252 192   0	Untitled
+252 204   0	Untitled
+252 216   0	Untitled
+252 228   0	Untitled
+252 240   0	Untitled
+252 252   0	Untitled
+  0   0   0	grey0
+  0   0   0	grey0
+  0   0   0	grey0
+  0   0   0	grey0
+  0   0   0	grey0
diff --git a/chalk/data/palettes/Warm_Colors.gpl b/chalk/data/palettes/Warm_Colors.gpl
new file mode 100644
index 000000000..654ad5da4
--- /dev/null
+++ b/chalk/data/palettes/Warm_Colors.gpl
@@ -0,0 +1,10 @@
+GIMP Palette
+Name: Warm Colors
+#
+196   9   9	Untitled
+216 213   8	Untitled
+237 110   0	Untitled
+232   0  50	Untitled
+140  11  11	Untitled
+228 170   4	Untitled
+117   0   0	Untitled
diff --git a/chalk/data/palettes/Web.gpl b/chalk/data/palettes/Web.gpl
new file mode 100644
index 000000000..0b907f796
--- /dev/null
+++ b/chalk/data/palettes/Web.gpl
@@ -0,0 +1,220 @@
+GIMP Palette
+Name: Web
+Columns: 6
+#
+255 255 255	Untitled
+255 255 204	Untitled
+255 255 153	Untitled
+255 255 102	Untitled
+255 255  51	Untitled
+255 255   0	Untitled
+255 204 255	Untitled
+255 204 204	Untitled
+255 204 153	Untitled
+255 204 102	Untitled
+255 204  51	Untitled
+255 204   0	Untitled
+255 153 255	Untitled
+255 153 204	Untitled
+255 153 153	Untitled
+255 153 102	Untitled
+255 153  51	Untitled
+255 153   0	Untitled
+255 102 255	Untitled
+255 102 204	Untitled
+255 102 153	Untitled
+255 102 102	Untitled
+255 102  51	Untitled
+255 102   0	Untitled
+255  51 255	Untitled
+255  51 204	Untitled
+255  51 153	Untitled
+255  51 102	Untitled
+255  51  51	Untitled
+255  51   0	Untitled
+255   0 255	Untitled
+255   0 204	Untitled
+255   0 153	Untitled
+255   0 102	Untitled
+255   0  51	Untitled
+255   0   0	Untitled
+204 255 255	Untitled
+204 255 204	Untitled
+204 255 153	Untitled
+204 255 102	Untitled
+204 255  51	Untitled
+204 255   0	Untitled
+204 204 255	Untitled
+204 204 204	Untitled
+204 204 153	Untitled
+204 204 102	Untitled
+204 204  51	Untitled
+204 204   0	Untitled
+204 153 255	Untitled
+204 153 204	Untitled
+204 153 153	Untitled
+204 153 102	Untitled
+204 153  51	Untitled
+204 153   0	Untitled
+204 102 255	Untitled
+204 102 204	Untitled
+204 102 153	Untitled
+204 102 102	Untitled
+204 102  51	Untitled
+204 102   0	Untitled
+204  51 255	Untitled
+204  51 204	Untitled
+204  51 153	Untitled
+204  51 102	Untitled
+204  51  51	Untitled
+204  51   0	Untitled
+204   0 255	Untitled
+204   0 204	Untitled
+204   0 153	Untitled
+204   0 102	Untitled
+204   0  51	Untitled
+204   0   0	Untitled
+153 255 255	Untitled
+153 255 204	Untitled
+153 255 153	Untitled
+153 255 102	Untitled
+153 255  51	Untitled
+153 255   0	Untitled
+153 204 255	Untitled
+153 204 204	Untitled
+153 204 153	Untitled
+153 204 102	Untitled
+153 204  51	Untitled
+153 204   0	Untitled
+153 153 255	Untitled
+153 153 204	Untitled
+153 153 153	Untitled
+153 153 102	Untitled
+153 153  51	Untitled
+153 153   0	Untitled
+153 102 255	Untitled
+153 102 204	Untitled
+153 102 153	Untitled
+153 102 102	Untitled
+153 102  51	Untitled
+153 102   0	Untitled
+153  51 255	Untitled
+153  51 204	Untitled
+153  51 153	Untitled
+153  51 102	Untitled
+153  51  51	Untitled
+153  51   0	Untitled
+153   0 255	Untitled
+153   0 204	Untitled
+153   0 153	Untitled
+153   0 102	Untitled
+153   0  51	Untitled
+153   0   0	Untitled
+102 255 255	Untitled
+102 255 204	Untitled
+102 255 153	Untitled
+102 255 102	Untitled
+102 255  51	Untitled
+102 255   0	Untitled
+102 204 255	Untitled
+102 204 204	Untitled
+102 204 153	Untitled
+102 204 102	Untitled
+102 204  51	Untitled
+102 204   0	Untitled
+102 153 255	Untitled
+102 153 204	Untitled
+102 153 153	Untitled
+102 153 102	Untitled
+102 153  51	Untitled
+102 153   0	Untitled
+102 102 255	Untitled
+102 102 204	Untitled
+102 102 153	Untitled
+102 102 102	Untitled
+102 102  51	Untitled
+102 102   0	Untitled
+102  51 255	Untitled
+102  51 204	Untitled
+102  51 153	Untitled
+102  51 102	Untitled
+102  51  51	Untitled
+102  51   0	Untitled
+102   0 255	Untitled
+102   0 204	Untitled
+102   0 153	Untitled
+102   0 102	Untitled
+102   0  51	Untitled
+102   0   0	Untitled
+ 51 255 255	Untitled
+ 51 255 204	Untitled
+ 51 255 153	Untitled
+ 51 255 102	Untitled
+ 51 255  51	Untitled
+ 51 255   0	Untitled
+ 51 204 255	Untitled
+ 51 204 204	Untitled
+ 51 204 153	Untitled
+ 51 204 102	Untitled
+ 51 204  51	Untitled
+ 51 204   0	Untitled
+ 51 153 255	Untitled
+ 51 153 204	Untitled
+ 51 153 153	Untitled
+ 51 153 102	Untitled
+ 51 153  51	Untitled
+ 51 153   0	Untitled
+ 51 102 255	Untitled
+ 51 102 204	Untitled
+ 51 102 153	Untitled
+ 51 102 102	Untitled
+ 51 102  51	Untitled
+ 51 102   0	Untitled
+ 51  51 255	Untitled
+ 51  51 204	Untitled
+ 51  51 153	Untitled
+ 51  51 102	Untitled
+ 51  51  51	Untitled
+ 51  51   0	Untitled
+ 51   0 255	Untitled
+ 51   0 204	Untitled
+ 51   0 153	Untitled
+ 51   0 102	Untitled
+ 51   0  51	Untitled
+ 51   0   0	Untitled
+  0 255 255	Untitled
+  0 255 204	Untitled
+  0 255 153	Untitled
+  0 255 102	Untitled
+  0 255  51	Untitled
+  0 255   0	Untitled
+  0 204 255	Untitled
+  0 204 204	Untitled
+  0 204 153	Untitled
+  0 204 102	Untitled
+  0 204  51	Untitled
+  0 204   0	Untitled
+  0 153 255	Untitled
+  0 153 204	Untitled
+  0 153 153	Untitled
+  0 153 102	Untitled
+  0 153  51	Untitled
+  0 153   0	Untitled
+  0 102 255	Untitled
+  0 102 204	Untitled
+  0 102 153	Untitled
+  0 102 102	Untitled
+  0 102  51	Untitled
+  0 102   0	Untitled
+  0  51 255	Untitled
+  0  51 204	Untitled
+  0  51 153	Untitled
+  0  51 102	Untitled
+  0  51  51	Untitled
+  0  51   0	Untitled
+  0   0 255	Untitled
+  0   0 204	Untitled
+  0   0 153	Untitled
+  0   0 102	Untitled
+  0   0  51	Untitled
+  0   0   0	Untitled
diff --git a/chalk/data/palettes/new_kde.gpl b/chalk/data/palettes/new_kde.gpl
new file mode 100644
index 000000000..336476068
--- /dev/null
+++ b/chalk/data/palettes/new_kde.gpl
@@ -0,0 +1,48 @@
+GIMP Palette
+Name: KDE (new)
+Columns: 4
+#
+82 34 0
+159 95 0
+217 174 126
+243 223 198
+181 0 47
+231 35 0
+240 164 185
+246 207 221
+249 186 7
+255 220 0
+255 233 68
+255 245 146
+83 147 22
+99 176 31
+127 187 86
+180 213 151
+0 102 47
+0 151 84
+128 195 155
+171 215 188
+0 65 136
+0 113 188
+0 148 213
+179 221 245
+27 45 131
+74 108 179
+95 143 203
+197 217 240
+85 18 123
+121 103 171
+164 158 205
+191 184 216
+123 12 130
+155 87 159
+186 144 192
+209 176 210
+0 0 28
+11 17 45
+68 78 90
+109 113 121
+157 161 166
+187 191 195
+218 221 224
+235 236 237
\ No newline at end of file
diff --git a/chalk/data/patterns/3dgreen.pat b/chalk/data/patterns/3dgreen.pat
new file mode 100644
index 000000000..763f912b5
Binary files /dev/null and b/chalk/data/patterns/3dgreen.pat differ
diff --git a/chalk/data/patterns/Craters.pat b/chalk/data/patterns/Craters.pat
new file mode 100644
index 000000000..4590349d0
Binary files /dev/null and b/chalk/data/patterns/Craters.pat differ
diff --git a/chalk/data/patterns/Makefile.am b/chalk/data/patterns/Makefile.am
new file mode 100644
index 000000000..1225aee82
--- /dev/null
+++ b/chalk/data/patterns/Makefile.am
@@ -0,0 +1,5 @@
+
+chalkpatternsdir = $(prefix)/share/apps/chalk/patterns
+
+chalkpatterns_DATA = 3dgreen.pat Craters.pat Moonfoot.pat Stripes1px.pat Stripes2px.pat amethyst.pat bark.pat blue.pat bluegrid.pat bluesquares.pat blueweb.pat brick.pat burlap.pat burlwood.pat choc_swirl.pat corkboard.pat cracked.pat crinklepaper.pat electric.pat fibers.pat granite1.pat ground1.pat ice.pat java.pat leather.pat leaves.pat leopard.pat lightning.pat marble1.pat marble2.pat marble3.pat nops.pat paper.pat parque1.pat parque2.pat parque3.pat pastel.pat pine.pat pink_marble.pat pool.pat qube1.pat rain.pat recessed.pat redcube.pat rock.pat sky.pat slate.pat sm_squares.pat starfield.pat stone33.pat terra.pat walnut.pat warning.pat wood1.pat wood2.pat wood3.pat wood4.pat wood5.pat 
+
diff --git a/chalk/data/patterns/Moonfoot.pat b/chalk/data/patterns/Moonfoot.pat
new file mode 100644
index 000000000..4c9236c60
Binary files /dev/null and b/chalk/data/patterns/Moonfoot.pat differ
diff --git a/chalk/data/patterns/Stripes1px.pat b/chalk/data/patterns/Stripes1px.pat
new file mode 100644
index 000000000..ddfd0c700
Binary files /dev/null and b/chalk/data/patterns/Stripes1px.pat differ
diff --git a/chalk/data/patterns/Stripes2px.pat b/chalk/data/patterns/Stripes2px.pat
new file mode 100644
index 000000000..411e1b341
Binary files /dev/null and b/chalk/data/patterns/Stripes2px.pat differ
diff --git a/chalk/data/patterns/amethyst.pat b/chalk/data/patterns/amethyst.pat
new file mode 100644
index 000000000..f83eb861e
Binary files /dev/null and b/chalk/data/patterns/amethyst.pat differ
diff --git a/chalk/data/patterns/bark.pat b/chalk/data/patterns/bark.pat
new file mode 100644
index 000000000..ba137b12e
Binary files /dev/null and b/chalk/data/patterns/bark.pat differ
diff --git a/chalk/data/patterns/blue.pat b/chalk/data/patterns/blue.pat
new file mode 100644
index 000000000..f13209545
Binary files /dev/null and b/chalk/data/patterns/blue.pat differ
diff --git a/chalk/data/patterns/bluegrid.pat b/chalk/data/patterns/bluegrid.pat
new file mode 100644
index 000000000..33bf092cc
Binary files /dev/null and b/chalk/data/patterns/bluegrid.pat differ
diff --git a/chalk/data/patterns/bluesquares.pat b/chalk/data/patterns/bluesquares.pat
new file mode 100644
index 000000000..2bce749fd
Binary files /dev/null and b/chalk/data/patterns/bluesquares.pat differ
diff --git a/chalk/data/patterns/blueweb.pat b/chalk/data/patterns/blueweb.pat
new file mode 100644
index 000000000..fce2c1f69
Binary files /dev/null and b/chalk/data/patterns/blueweb.pat differ
diff --git a/chalk/data/patterns/brick.pat b/chalk/data/patterns/brick.pat
new file mode 100644
index 000000000..9e018230e
Binary files /dev/null and b/chalk/data/patterns/brick.pat differ
diff --git a/chalk/data/patterns/burlap.pat b/chalk/data/patterns/burlap.pat
new file mode 100644
index 000000000..f2fc3c4e4
Binary files /dev/null and b/chalk/data/patterns/burlap.pat differ
diff --git a/chalk/data/patterns/burlwood.pat b/chalk/data/patterns/burlwood.pat
new file mode 100644
index 000000000..2d89ba145
Binary files /dev/null and b/chalk/data/patterns/burlwood.pat differ
diff --git a/chalk/data/patterns/choc_swirl.pat b/chalk/data/patterns/choc_swirl.pat
new file mode 100644
index 000000000..b6551129f
Binary files /dev/null and b/chalk/data/patterns/choc_swirl.pat differ
diff --git a/chalk/data/patterns/corkboard.pat b/chalk/data/patterns/corkboard.pat
new file mode 100644
index 000000000..ffb912e5e
Binary files /dev/null and b/chalk/data/patterns/corkboard.pat differ
diff --git a/chalk/data/patterns/cracked.pat b/chalk/data/patterns/cracked.pat
new file mode 100644
index 000000000..a13cc556a
Binary files /dev/null and b/chalk/data/patterns/cracked.pat differ
diff --git a/chalk/data/patterns/crinklepaper.pat b/chalk/data/patterns/crinklepaper.pat
new file mode 100644
index 000000000..2efa9f769
Binary files /dev/null and b/chalk/data/patterns/crinklepaper.pat differ
diff --git a/chalk/data/patterns/electric.pat b/chalk/data/patterns/electric.pat
new file mode 100644
index 000000000..342633001
Binary files /dev/null and b/chalk/data/patterns/electric.pat differ
diff --git a/chalk/data/patterns/fibers.pat b/chalk/data/patterns/fibers.pat
new file mode 100644
index 000000000..66d743375
Binary files /dev/null and b/chalk/data/patterns/fibers.pat differ
diff --git a/chalk/data/patterns/granite1.pat b/chalk/data/patterns/granite1.pat
new file mode 100644
index 000000000..e798a389f
Binary files /dev/null and b/chalk/data/patterns/granite1.pat differ
diff --git a/chalk/data/patterns/ground1.pat b/chalk/data/patterns/ground1.pat
new file mode 100644
index 000000000..88874598a
Binary files /dev/null and b/chalk/data/patterns/ground1.pat differ
diff --git a/chalk/data/patterns/ice.pat b/chalk/data/patterns/ice.pat
new file mode 100644
index 000000000..ffb8439ff
Binary files /dev/null and b/chalk/data/patterns/ice.pat differ
diff --git a/chalk/data/patterns/java.pat b/chalk/data/patterns/java.pat
new file mode 100644
index 000000000..60f8d2ca9
Binary files /dev/null and b/chalk/data/patterns/java.pat differ
diff --git a/chalk/data/patterns/leather.pat b/chalk/data/patterns/leather.pat
new file mode 100644
index 000000000..133c9c157
Binary files /dev/null and b/chalk/data/patterns/leather.pat differ
diff --git a/chalk/data/patterns/leaves.pat b/chalk/data/patterns/leaves.pat
new file mode 100644
index 000000000..6ebdeba0a
Binary files /dev/null and b/chalk/data/patterns/leaves.pat differ
diff --git a/chalk/data/patterns/leopard.pat b/chalk/data/patterns/leopard.pat
new file mode 100644
index 000000000..62f780b69
Binary files /dev/null and b/chalk/data/patterns/leopard.pat differ
diff --git a/chalk/data/patterns/lightning.pat b/chalk/data/patterns/lightning.pat
new file mode 100644
index 000000000..1e0226769
Binary files /dev/null and b/chalk/data/patterns/lightning.pat differ
diff --git a/chalk/data/patterns/marble1.pat b/chalk/data/patterns/marble1.pat
new file mode 100644
index 000000000..7be031b1e
Binary files /dev/null and b/chalk/data/patterns/marble1.pat differ
diff --git a/chalk/data/patterns/marble2.pat b/chalk/data/patterns/marble2.pat
new file mode 100644
index 000000000..447c32dfa
Binary files /dev/null and b/chalk/data/patterns/marble2.pat differ
diff --git a/chalk/data/patterns/marble3.pat b/chalk/data/patterns/marble3.pat
new file mode 100644
index 000000000..c3b57e97a
Binary files /dev/null and b/chalk/data/patterns/marble3.pat differ
diff --git a/chalk/data/patterns/nops.pat b/chalk/data/patterns/nops.pat
new file mode 100644
index 000000000..52d49fba9
Binary files /dev/null and b/chalk/data/patterns/nops.pat differ
diff --git a/chalk/data/patterns/paper.pat b/chalk/data/patterns/paper.pat
new file mode 100644
index 000000000..26fa02631
Binary files /dev/null and b/chalk/data/patterns/paper.pat differ
diff --git a/chalk/data/patterns/parque1.pat b/chalk/data/patterns/parque1.pat
new file mode 100644
index 000000000..d647761b2
Binary files /dev/null and b/chalk/data/patterns/parque1.pat differ
diff --git a/chalk/data/patterns/parque2.pat b/chalk/data/patterns/parque2.pat
new file mode 100644
index 000000000..0d493c6a6
Binary files /dev/null and b/chalk/data/patterns/parque2.pat differ
diff --git a/chalk/data/patterns/parque3.pat b/chalk/data/patterns/parque3.pat
new file mode 100644
index 000000000..aa43ec0d3
Binary files /dev/null and b/chalk/data/patterns/parque3.pat differ
diff --git a/chalk/data/patterns/pastel.pat b/chalk/data/patterns/pastel.pat
new file mode 100644
index 000000000..09b3efb13
Binary files /dev/null and b/chalk/data/patterns/pastel.pat differ
diff --git a/chalk/data/patterns/pine.pat b/chalk/data/patterns/pine.pat
new file mode 100644
index 000000000..284d7b4e0
Binary files /dev/null and b/chalk/data/patterns/pine.pat differ
diff --git a/chalk/data/patterns/pink_marble.pat b/chalk/data/patterns/pink_marble.pat
new file mode 100644
index 000000000..03b4060c6
Binary files /dev/null and b/chalk/data/patterns/pink_marble.pat differ
diff --git a/chalk/data/patterns/pool.pat b/chalk/data/patterns/pool.pat
new file mode 100644
index 000000000..748f9fa12
Binary files /dev/null and b/chalk/data/patterns/pool.pat differ
diff --git a/chalk/data/patterns/qube1.pat b/chalk/data/patterns/qube1.pat
new file mode 100644
index 000000000..de49fb2a1
Binary files /dev/null and b/chalk/data/patterns/qube1.pat differ
diff --git a/chalk/data/patterns/rain.pat b/chalk/data/patterns/rain.pat
new file mode 100644
index 000000000..d00aadb2a
Binary files /dev/null and b/chalk/data/patterns/rain.pat differ
diff --git a/chalk/data/patterns/recessed.pat b/chalk/data/patterns/recessed.pat
new file mode 100644
index 000000000..04d86f374
Binary files /dev/null and b/chalk/data/patterns/recessed.pat differ
diff --git a/chalk/data/patterns/redcube.pat b/chalk/data/patterns/redcube.pat
new file mode 100644
index 000000000..7411b5584
Binary files /dev/null and b/chalk/data/patterns/redcube.pat differ
diff --git a/chalk/data/patterns/rock.pat b/chalk/data/patterns/rock.pat
new file mode 100644
index 000000000..8c545fd26
Binary files /dev/null and b/chalk/data/patterns/rock.pat differ
diff --git a/chalk/data/patterns/sky.pat b/chalk/data/patterns/sky.pat
new file mode 100644
index 000000000..0add1646e
Binary files /dev/null and b/chalk/data/patterns/sky.pat differ
diff --git a/chalk/data/patterns/slate.pat b/chalk/data/patterns/slate.pat
new file mode 100644
index 000000000..152da130c
Binary files /dev/null and b/chalk/data/patterns/slate.pat differ
diff --git a/chalk/data/patterns/sm_squares.pat b/chalk/data/patterns/sm_squares.pat
new file mode 100644
index 000000000..93ddc976d
Binary files /dev/null and b/chalk/data/patterns/sm_squares.pat differ
diff --git a/chalk/data/patterns/starfield.pat b/chalk/data/patterns/starfield.pat
new file mode 100644
index 000000000..f53ba402e
Binary files /dev/null and b/chalk/data/patterns/starfield.pat differ
diff --git a/chalk/data/patterns/stone33.pat b/chalk/data/patterns/stone33.pat
new file mode 100644
index 000000000..08646912b
Binary files /dev/null and b/chalk/data/patterns/stone33.pat differ
diff --git a/chalk/data/patterns/terra.pat b/chalk/data/patterns/terra.pat
new file mode 100644
index 000000000..79bc2ec42
Binary files /dev/null and b/chalk/data/patterns/terra.pat differ
diff --git a/chalk/data/patterns/walnut.pat b/chalk/data/patterns/walnut.pat
new file mode 100644
index 000000000..7007dd812
Binary files /dev/null and b/chalk/data/patterns/walnut.pat differ
diff --git a/chalk/data/patterns/warning.pat b/chalk/data/patterns/warning.pat
new file mode 100644
index 000000000..a62d98adc
Binary files /dev/null and b/chalk/data/patterns/warning.pat differ
diff --git a/chalk/data/patterns/wood1.pat b/chalk/data/patterns/wood1.pat
new file mode 100644
index 000000000..07fa24cab
Binary files /dev/null and b/chalk/data/patterns/wood1.pat differ
diff --git a/chalk/data/patterns/wood2.pat b/chalk/data/patterns/wood2.pat
new file mode 100644
index 000000000..7da760e6d
Binary files /dev/null and b/chalk/data/patterns/wood2.pat differ
diff --git a/chalk/data/patterns/wood3.pat b/chalk/data/patterns/wood3.pat
new file mode 100644
index 000000000..0712c2de7
Binary files /dev/null and b/chalk/data/patterns/wood3.pat differ
diff --git a/chalk/data/patterns/wood4.pat b/chalk/data/patterns/wood4.pat
new file mode 100644
index 000000000..1fc27822a
Binary files /dev/null and b/chalk/data/patterns/wood4.pat differ
diff --git a/chalk/data/patterns/wood5.pat b/chalk/data/patterns/wood5.pat
new file mode 100644
index 000000000..5f415ce69
Binary files /dev/null and b/chalk/data/patterns/wood5.pat differ
diff --git a/chalk/data/profiles/Adobe.icm b/chalk/data/profiles/Adobe.icm
new file mode 100644
index 000000000..ae368c6d1
Binary files /dev/null and b/chalk/data/profiles/Adobe.icm differ
diff --git a/chalk/data/profiles/Apple.icm b/chalk/data/profiles/Apple.icm
new file mode 100644
index 000000000..6113a226e
Binary files /dev/null and b/chalk/data/profiles/Apple.icm differ
diff --git a/chalk/data/profiles/CIE.icm b/chalk/data/profiles/CIE.icm
new file mode 100644
index 000000000..bd5e20a8e
Binary files /dev/null and b/chalk/data/profiles/CIE.icm differ
diff --git a/chalk/data/profiles/CMY.icm b/chalk/data/profiles/CMY.icm
new file mode 100644
index 000000000..acc71ddd9
Binary files /dev/null and b/chalk/data/profiles/CMY.icm differ
diff --git a/chalk/data/profiles/ColorMatch.icm b/chalk/data/profiles/ColorMatch.icm
new file mode 100644
index 000000000..d1c1a1f87
Binary files /dev/null and b/chalk/data/profiles/ColorMatch.icm differ
diff --git a/chalk/data/profiles/Makefile.am b/chalk/data/profiles/Makefile.am
new file mode 100644
index 000000000..22269dc5b
--- /dev/null
+++ b/chalk/data/profiles/Makefile.am
@@ -0,0 +1,4 @@
+
+chalkprofilesdir = $(prefix)/share/apps/chalk/profiles
+
+chalkprofiles_DATA = Adobe.icm Apple.icm CIE.icm CMY.icm cmyk.icm ColorMatch.icm fogra27l.icm lcmslabi.icm lcmsxyzi.icm monoscnr.icm NTSC.icm PAL.icm SMPTE-C.icm srgb_color_space_profile.icm sRGB.icm srgbspac.icm tifflab8spac.icm WideGamut.icm ycc601.icm ycc709.icm
diff --git a/chalk/data/profiles/NTSC.icm b/chalk/data/profiles/NTSC.icm
new file mode 100644
index 000000000..abe4dcfb8
Binary files /dev/null and b/chalk/data/profiles/NTSC.icm differ
diff --git a/chalk/data/profiles/PAL.icm b/chalk/data/profiles/PAL.icm
new file mode 100644
index 000000000..173a0d2ba
Binary files /dev/null and b/chalk/data/profiles/PAL.icm differ
diff --git a/chalk/data/profiles/README b/chalk/data/profiles/README
new file mode 100644
index 000000000..f0a757980
--- /dev/null
+++ b/chalk/data/profiles/README
@@ -0,0 +1,5 @@
+The icm profile files have been downloaded from the littlecms
+(http://www.littlecms.com) and from the Scarse website
+(http://www.scarse.org). The Scarse profiles have been available under
+the GPL; the littlecms profiles appear to be public domain.
+The cmyk.icm profile is taken from the GPL version jpedal.
diff --git a/chalk/data/profiles/SMPTE-C.icm b/chalk/data/profiles/SMPTE-C.icm
new file mode 100644
index 000000000..7f4ef578a
Binary files /dev/null and b/chalk/data/profiles/SMPTE-C.icm differ
diff --git a/chalk/data/profiles/WideGamut.icm b/chalk/data/profiles/WideGamut.icm
new file mode 100644
index 000000000..120a99a17
Binary files /dev/null and b/chalk/data/profiles/WideGamut.icm differ
diff --git a/chalk/data/profiles/cmyk.icm b/chalk/data/profiles/cmyk.icm
new file mode 100644
index 000000000..65bc4e854
Binary files /dev/null and b/chalk/data/profiles/cmyk.icm differ
diff --git a/chalk/data/profiles/fogra27l.icm b/chalk/data/profiles/fogra27l.icm
new file mode 100644
index 000000000..1cf03c3aa
Binary files /dev/null and b/chalk/data/profiles/fogra27l.icm differ
diff --git a/chalk/data/profiles/lcmslabi.icm b/chalk/data/profiles/lcmslabi.icm
new file mode 100644
index 000000000..f86821b5c
Binary files /dev/null and b/chalk/data/profiles/lcmslabi.icm differ
diff --git a/chalk/data/profiles/lcmsxyzi.icm b/chalk/data/profiles/lcmsxyzi.icm
new file mode 100644
index 000000000..099006aaf
Binary files /dev/null and b/chalk/data/profiles/lcmsxyzi.icm differ
diff --git a/chalk/data/profiles/monoscnr.icm b/chalk/data/profiles/monoscnr.icm
new file mode 100644
index 000000000..411a9728f
Binary files /dev/null and b/chalk/data/profiles/monoscnr.icm differ
diff --git a/chalk/data/profiles/sRGB.icm b/chalk/data/profiles/sRGB.icm
new file mode 100644
index 000000000..878fdf128
Binary files /dev/null and b/chalk/data/profiles/sRGB.icm differ
diff --git a/chalk/data/profiles/srgb_color_space_profile.icm b/chalk/data/profiles/srgb_color_space_profile.icm
new file mode 100644
index 000000000..7f9d18d09
Binary files /dev/null and b/chalk/data/profiles/srgb_color_space_profile.icm differ
diff --git a/chalk/data/profiles/srgbspac.icm b/chalk/data/profiles/srgbspac.icm
new file mode 100644
index 000000000..83563ef93
Binary files /dev/null and b/chalk/data/profiles/srgbspac.icm differ
diff --git a/chalk/data/profiles/tifflab8spac.icm b/chalk/data/profiles/tifflab8spac.icm
new file mode 100644
index 000000000..0b6543cce
Binary files /dev/null and b/chalk/data/profiles/tifflab8spac.icm differ
diff --git a/chalk/data/profiles/ycc601.icm b/chalk/data/profiles/ycc601.icm
new file mode 100644
index 000000000..7ee086dbb
Binary files /dev/null and b/chalk/data/profiles/ycc601.icm differ
diff --git a/chalk/data/profiles/ycc709.icm b/chalk/data/profiles/ycc709.icm
new file mode 100644
index 000000000..d9f5a5a5d
Binary files /dev/null and b/chalk/data/profiles/ycc709.icm differ
diff --git a/chalk/data/templates/.directory b/chalk/data/templates/.directory
new file mode 100644
index 000000000..66f4bc3ca
--- /dev/null
+++ b/chalk/data/templates/.directory
@@ -0,0 +1,56 @@
+[Desktop Entry]
+Name=Empty
+Name[bg]=Празен документ
+Name[br]=Goullonderiñ
+Name[ca]=Buit
+Name[cs]=Prázdné
+Name[cy]=Gwag
+Name[da]=Tom
+Name[de]=Leer
+Name[el]=Κενό
+Name[eo]=Malplena
+Name[es]=Vacío
+Name[et]=Tühi
+Name[eu]=Hutsa
+Name[fa]=خالی
+Name[fi]=Tyhjä
+Name[fr]=Neutre
+Name[fy]=Leech
+Name[ga]=Folamh
+Name[gl]=Valeira
+Name[he]=ריק
+Name[hi]=खाली
+Name[hr]=Prazno
+Name[hu]=Üres
+Name[is]=Tómt
+Name[it]=Vuoto
+Name[ja]=空
+Name[km]=ទទេ
+Name[lt]=Tuščias
+Name[lv]=Tukšs
+Name[ms]=Kosong
+Name[nb]=Tom
+Name[nds]=Leddig
+Name[ne]=खाली
+Name[nl]=Leeg
+Name[nn]=Tomt
+Name[pl]=Pusta
+Name[pt]=Vazio
+Name[pt_BR]=Vazio
+Name[ru]=Чистый лист
+Name[se]=Guorus
+Name[sk]=Prázdna
+Name[sl]=Prazno
+Name[sr]=Празно
+Name[sr@Latn]=Prazno
+Name[sv]=Tom
+Name[ta]= வெற்று
+Name[tg]=Ҳолӣ
+Name[tr]=Boş
+Name[uk]=Порожня
+Name[uz]=Boʻsh
+Name[uz@cyrillic]=Бўш
+Name[wa]=Vude
+Name[zh_CN]=空
+Name[zh_TW]=空白
+X-KDE-DefaultTab=true
diff --git a/chalk/design.h b/chalk/design.h
new file mode 100644
index 000000000..e4317fd81
--- /dev/null
+++ b/chalk/design.h
@@ -0,0 +1,27 @@
+/**
+  @mainpage Chalk Image manipulation and paint application
+
+  Chalk is an advanced and modular paint and image manipulation
+  application.
+
+  Chalk is built around two core libraries: chalkcolor and chalkimage.
+
+  The chalkcolor library abstracts colorspaces and color
+  transformations. Colorspaces provide functions to manipulate pixels. The
+  kritcolor library loads colorspace plugins to extend the range of
+  available colorspaces.
+
+  The chalkimage library abstracts the storage, creation, inspection
+  and manipulation of pixels stored in a rectangular area. It provides
+  layers, filters, iterators and painters. Filters and paint operations
+  are provided as service plugins loaded through the appropriate trader
+  queries.
+
+  Both libraries are used by the user interface, which is a KOffice
+  part. the user interface loads tools and other plugins.
+
+ */
+#ifndef DESIGN
+#define DESIGN
+// Let's keep icefox.net/kde/tests.headerincluded_koffice.html happy
+#endif
\ No newline at end of file
diff --git a/chalk/doc/DESIGN.obsolete b/chalk/doc/DESIGN.obsolete
new file mode 100644
index 000000000..51cadc587
--- /dev/null
+++ b/chalk/doc/DESIGN.obsolete
@@ -0,0 +1,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 tqshapes,
+              patterns (and colours, too?) Patrick intended a Flyweight
+              here.
+
+            * The composite pattern is used in paint devices, layers, channels,
+              etc. (What about tqmasks?)
+
+            * 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 kparts.
+
+            * 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,
+              tqmask, 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 Qt
+        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_tqmask
+    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_tqmask 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.cc?
+
+       - 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?
diff --git a/chalk/doc/Developing Chalk Plugins.odt b/chalk/doc/Developing Chalk Plugins.odt
new file mode 100644
index 000000000..1e74bff82
Binary files /dev/null and b/chalk/doc/Developing Chalk Plugins.odt differ
diff --git a/chalk/doc/autoextending paintdevices b/chalk/doc/autoextending paintdevices
new file mode 100644
index 000000000..a42dc6835
--- /dev/null
+++ b/chalk/doc/autoextending paintdevices	
@@ -0,0 +1,54 @@
+ 
+This is an attempt to explain how autosizing paintdevices work
+
+The tileddatamanager which is the underlying object that organizes the pixel
+storage is autoextending. So it starts with zero tiles, and as writing is
+being done new tiles are added as needed.
+
+There is also a default tile that is only readable (in theory). Whenever
+access is only readaccess you get this tile for areas that don't have their
+own tile yet. The idea is that the default tile is filled with transparent
+pixels. (Or, with special layers like the background pattern or the selection,
+with something else relevant. bsar)
+
+
+So imagine a new image of size 640x640. The layer has no tiles, but when the
+layer is being read (for viewing) we probe all over the image (640x640) and
+read from the default tile wherever we probe.
+
+The extent of the layer (paintdevice) is 0x0 because nothing has been
+written yet.
+
+Then some drawing is done in one corner and a tile is created automatically.
+Now the extent is 64x64 (tilesize defined at compilation) because a single
+tile exists.
+
+If some drawing is done in the opposite corner another tile is created. The
+extent is now 640x640, but only two tiles exist (one in each opposite
+corner). When probing for viewing the default tile is what you get except
+for the two tiles.
+
+If we now apply a filer that lightens the colors (or something else) we
+could iterate over the extent. That way we are sure to get all the real
+tiles that have been created.
+
+As there is no way for us to know which pixel have true tiles and which have
+the default, we would write to all the pixels within the extent, which would
+automatically create ALL the tiles inside the extent.
+(XXX: Of course, the tile manager could decide that the written value
+is the same as the default value, and if that's true for all pixels in a tile, 
+not create a tile at all) (bsar))
+
+In other cases like a gradient fill we would probably want to fill the
+current image area, so we we would just write to the paintdevice, and tiles
+would be automatically created for us.
+
+So in short: if you read - data will be available (either real tiles or a
+default) - and if you write to the paintdevice - tiles will be created as
+needed. So simply don't worry.
+
+But in some cases, when you want to modify already written pixels, as in
+some filters you want to know where true data have been written. Otherwise
+we would have to modify an infinite number of pixels to be sure everything is
+changed. This is where the extent comes in handy. If you have absolutely 
+no leeway, use exactBounds which is slow, but sure.
diff --git a/chalk/doc/background_paper.txt b/chalk/doc/background_paper.txt
new file mode 100644
index 000000000..96226fe2f
--- /dev/null
+++ b/chalk/doc/background_paper.txt
@@ -0,0 +1,84 @@
+Background, paper, layers, blobs
+
+An image in Chalk is imposed upon a plane. Perhaps, using OpenGL,
+we'll be able to rotate and elevate that plane at the users' whim.
+If we can elevate the plane, there will be a direction of gravity
+that naturalistic media can play with. Note: Wet & Sticky make it
+possible to "paint" gravity. This looks like a fun feature, but
+that needs to be done per-layer, and not for the whole image.
+
+The plane is represented by the checkered background. Ideally,
+we'd be able to set the color of the checks & the size, and the
+size shouldn't change with the zoomlevel. The checks are one
+pattern, repeated for the whole image:
+
+O#
+#O
+
+Placed on the plane is optionally the substrate -- a naturalistic
+representation of canvas, linen, paper, board, wood, levkas. Or
+something weird, kopper, rock, sand... There is one substrate
+per image. The substrate can be a small texture repeated for the
+whole image, or as big as the image -- the latter is important
+if we want to make it possible to perturb the substrate (think scoring
+lines into levkas or erasing through the paper).
+
+Provisionally, the substrate has the following properties:
+
+height
+smoothness
+absorbency
+reflectiveness
+
+(Of course, layers below the current layer can influence these values
+for layers on top of them.)
+
+I have a hunch that the effect of these properties are really easy to 
+render using OpenGL, but not so easy using plain QPainter. In any case,
+media layers will need to know these values at every pixel. We need
+a really easy & fast way to acquire them.
+
+We need to avoid the Corel Painter feature where you can use a naturalistic
+paper and then paint away the paper structure, mixing the color of the paper
+with your paint as if the paper were paint. So, we need to separate paper
+and paint thoroughly.
+
+On top of the substrate and background are the layers themselves.
+Some layers are just color; others contain media. Media means color,
+but possibly in a kubelka-munk colorspace, and properties like:
+
+height
+graininess
+viscosity
+wetness
+smoothness
+absorbency
+stickiness (i.e, charcoal isn't sticky at all, acryl paints very
+sticky)
+
+Note: Impasto models thick, 3-d paint, where tufts of thick oipaint can
+cast shadows...
+
+Ordinary color layers (Shoup layers in the terminology of Cockshott) can
+make use of the substrate parameters using special paint ops, and ordinary
+color can be painted on a media layer, but the ordinary color paintops
+do not deposit the above properties. Media paint just leaves color on the 
+color layers. We need to avoid at all costs the Corel Painter effect where
+trying to use a pencil on a watercolor layer causes a nasty flow-impeding
+useless error box to popup.
+
+Media and ordinary layers can be grouped and mixed at will, together with adjustment
+layers. Adjustment layers can also be attached to selection tqmasks, per layer.
+
+The composited layers is either scaled and color corrected, or color corrected and
+then scaled, depending on whether the zoom > 100% or < 100%.
+
+Note: do we need a visualisation layer on top of the layers for things
+like wetness, reflectiveness, height? Perhaps this is the right place for that.
+We need perhaps to add a light source or two, in OpenGL mode... I think
+we do.
+
+On top of the layers are what Xara calls blobs: the temporary droppings of
+tools, like rubber bands, vector paths, brush tqshape cursors.
+
+
diff --git a/chalk/doc/brush.txt b/chalk/doc/brush.txt
new file mode 100644
index 000000000..bb932eeec
--- /dev/null
+++ b/chalk/doc/brush.txt
@@ -0,0 +1,36 @@
+Painting with brushes
+
+:.,I don't know anything, nada, zilch, noppes about writing paint applications. So
+when I started working on Chalk, I felt I needed examples. I used the following
+sources:
+
+* 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)
+* Peter Jodda's Perico (http://software.jodda.de/perico.html)
+* The source of the Gimp (both current and 0.99.11 -- the oldest version I could tqfind) (http://www.gimp.org)
+* David Hodson's article on Gimp brushes (http://members.ozemail.com.au/~hodsond/gimpbrush.html)
+* Raph Levien's article on Gimp brushes (http://www.levien.com/gimp/brush-arch.html)
+
+Chalk uses the gimp's brush file formats: .gbr and .gih, for singe
+and pipeline brushes, respectively. These brushes contain one or more
+grayscale or rgba images. If the image is grayscale, the gray image is
+intended to be used as an alpha tqmask: each gray level corresponds to
+a certain alpha level, and when painting the current painting colour
+is composited in the image with this level as its alpha component. The
+image brushes should be tqmasked -- i.e., these are coloured images placed
+on a white background. The white background should be made transparent,
+and then the brush image can be composited onto our image.
+
+This is currently only half supported: I make tqmasks of everything,
+partly because I like that better, partly because until very recently
+there was no way of making out the difference between gray and rgb
+brushes because KisBrush didn't remember that bit of data.
+
+Making the initial tqmask of a brush is however by now pretty well done; the next
+problem is painting with those tqmasks.
+
+Here we have two situations, one easy, one difficult. The easy one is the single
+mouse click. If the user clicks or taps with his stylus, we can composite the 
+tqmask or the image at the pixel position of the mouse click.
+
+The difficult situation is drawing a line. This line needs to be antialiased.
+
diff --git a/chalk/doc/chalk-features b/chalk/doc/chalk-features
new file mode 100644
index 000000000..77f79dcbf
--- /dev/null
+++ b/chalk/doc/chalk-features
@@ -0,0 +1,215 @@
+Chalk Features
+
+The following is a comprehensive list of all Chalk's features
+that are or will be implemented for version 1.5.
+
+* Plugins
+
+Chalk is extensible through plugins. There are tools, colorspaces,
+paint operations, filters and kpart-based user interface plugins.
+It is intended to make layer types plugins, too.
+
+* Scriptable
+
+Chalk is scriptable in Python and Ruby. The scripting is
+compatible with using the PyQt/KDE and Korundum for adding
+GUI items.
+
+* File
+
+Import: png, tiff, jpeg, dicom, xcf, psd (up to version 6,
+from version 7 on, the photoshop file format is closed and it
+is impossible to get the spec to implement support in a
+free software application), gif, raw, bmp, xpm, targa, rgb, ico,
+openEXR.
+
+Export: png, tiff, jpeg, dicom, xcf, psd (up to version 6,
+from version 7 on, the photoshop file format is closed and it
+is impossible to get the spec to implement support in a
+free software application), gif, bmp, xpm, targa, rgb, openEXR.
+
+Embedded icc profiles and exif information are preserved on
+export to supporting file formats.
+
+Chalk's native file format stores icc and exif information.
+
+* Color models
+
+Chalk uses lcms for a dependable color workflow using icc profiles
+for importing, exporting, selecting paint colors, printing,
+cutting and pasting.
+
+** 8 bit/channel rgb, cmyk, grayscale, wet watercolors
+** 16 bit/channel rgb, cmyk, grayscale, l*a*b, xyz (xyz may be removed)
+** "half" rgb
+** 32 bit float rgb (HDR), lms
+** Colors can be selected from a color wheel, rgb or grayscale sliders
+   or with a palette
+
+* Editing
+
+** Unlimited undo and redo
+** Cut, copy and paste with conversion through icc profiles if necessary
+** paste into a new image
+
+** Viewing
+
+** Use OpenGL for display when possible
+** View fullscreen
+** Multiple views on one image
+** Rulers
+** zooming
+** show or hide all palette windows in one go
+** palette windows position is kept between sessions
+** When maximized, Chalk is usable on a 1024x768 screen with all
+   palettes open.
+** Permanently accurate histogram palette
+** Exposure slider for HDR images
+** Optional "greening-out" of inactive layers to assist with artistic
+   workflow.
+** Bird's eyeview of image and zooming (not sure this will be done in time)
+
+* Images
+
+** mirror, shear, rotate and scale images
+** change the size of the canvas
+** change the resolution of the image
+** convert images between colorspaces
+** set image properties (name, comments, profile, resolution)
+** Combine layers in different colorspaces. The bottom-most
+   layer determines the image colorspace.
+** Separate the channels of an image into grayscale (8 or 16 bits)
+   layers or images.
+   
+* Layers
+
+** Embed KOffice documents as layers into an image
+** Group layers
+** Adjustment layers (not sure whether this'll make it)
+** Lock layers (tools and filters cannot change the layer, but not all
+   destructive operations are disabled yet)
+** Make layers invisible
+** Add and remove layers
+** Change the position of layers in the layer stack
+** Mirror, shear, rotate and scale layers
+** Save layer as image
+** Composite layers with supported composite options, like
+   over, in, out, atop, xor, plus, minus, add, subtract, diff,
+   mult, divide, dodge, burn, bumpmap, copy, copy one channel,
+   clear, dissolve, displace, darken, lighten, hue, saturation, value,
+   color, colorize, luminize, screen, overlay, erase. (Not all colorspaces
+   support all composite operations).
+** Change layer properties like name, position, colorspace
+** Create a drop shadow behind the layer
+** View the histogram of a layer; 16 bits or wider images have zoomable
+   histograms
+** Insert screenshot as layer
+
+
+* Selections
+
+** Select by colorrange
+** Feather selection
+** Invert selection
+
+* Tools
+
+Throught the innovative paintOp plugin system, all painting tools
+(brush, ellipse, line, etc.) can paint aliased, anti-aliased,
+erase, airbrush and more.
+
+** paintbrush
+** colorpicker
+** duplicate
+** ellipse
+** anti-aliased bucket fill and selection fill with color, patterns
+   or gradients.
+** gradient
+** line
+** layer or selection move
+** canvas pan
+** rectangle
+** text
+** zoom
+** crop
+** paint with filters (to be integrated in the paintop system)
+** polygons
+** polylines
+** stars
+** transform selection/layer
+** select similar colors
+** select by painting
+** select contiguous areas
+** select ellipse
+** deselect by erasing
+** select by painting outline
+** select polygonal
+** select rectangular
+
+* Filters
+
+Chalk can multithread the operation of some filters. Chalk's
+filters can be previewed in the filter gallery.
+
+** Apply previous filter again
+** bumpmap
+** image restoration with cimg
+** brightness/contrast
+** color adjustment per channel
+** autocontrast
+** desaturate
+** gaussian blur
+** sharpen
+** remove mean
+** emboss (laplacian, all directions, horizontal, vertical, horizontal and
+vertical)
+** edge detection (top, right, bottom, left)
+** custom convolution
+** cubism (converts to 8 bit rgba and back)
+** invert
+** reduce noise (simple and with wavelets)
+** oilpaint (converts to 8 bit rgba and back)
+** pixelize (converts to 8 bit rgba and back)
+** raindrops (converts to 8 bit rgba and back)
+** round corners
+** small tiles (converts to 8 bit rgba and back)
+** sobel (converts to 8 bit rgba and back)
+
+* Paint operations
+
+Chalk's paint operations are usable with all painting tools.
+
+PaintOps can support composite options, like
+over, in, out, atop, xor, plus, minus, add, subtract, diff,
+mult, divide, dodge, burn, bumpmap, copy, copy one channel,
+clear, dissolve, displace, darken, lighten, hue, saturation, value,
+color, colorize, luminize, screen, overlay, erase. (Not all colorspaces
+support all composite operations).
+
+PaintOps can support opacity settings and use the pressure value
+of a tablet. Tilt and rotation is not yet supported.
+
+** airbrush
+** eraser
+** anti-aliased brush
+** convolve
+** duplicate
+** aliased brush (pen tool)
+** smeary brush (not sure whether this will get finished in time)
+** paint with a tablet stylus. The pressure sensitivity
+   characteristics can be set.
+
+* Brushes
+
+** gimp brush tqshapes. Support for colored and grayscale brushes and
+   pipe brushes. Support from Gimp parasites in brushes.
+** custom brush tqshapes
+** text brush tqshapes
+** brushes created from layers or images. These brushes can be saved
+** colored brushes can also be used as tqmasks
+
+* Fills
+
+** gimp-style patterns
+** gimp-style gradients
+** custom gradients
\ No newline at end of file
diff --git a/chalk/doc/chalk.kpr b/chalk/doc/chalk.kpr
new file mode 100644
index 000000000..b1fe023e8
Binary files /dev/null and b/chalk/doc/chalk.kpr differ
diff --git a/chalk/doc/chalk.pdf b/chalk/doc/chalk.pdf
new file mode 100644
index 000000000..1073941b5
Binary files /dev/null and b/chalk/doc/chalk.pdf differ
diff --git a/chalk/doc/chalk.xmi b/chalk/doc/chalk.xmi
new file mode 100644
index 000000000..913db5778
--- /dev/null
+++ b/chalk/doc/chalk.xmi
@@ -0,0 +1,56432 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="org.omg/standards/UML" verified="false" timestamp="" xmi.version="1.2" >
+ <XMI.header>
+  <XMI.documentation>
+   <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+   <XMI.exporterVersion>1.2.0</XMI.exporterVersion>
+   <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+  </XMI.documentation>
+  <XMI.model xmi.name="chalk" href="/home/boud/prj/koffice/chalk/doc/chalk.xmi" />
+  <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+  <docsettings viewid="1" documentation="" uniqueid="2643" />
+  <UML:Model>
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2" name="int" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="3" name="char" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="4" name="bool" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="5" name="float" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="6" name="double" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="7" name="long" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="8" name="short" />
+   <UML:Class stereotype="class" visibility="public" xmi.id="9" name="KisBuilderSubject" >
+    <UML:Operation visibility="public" xmi.id="10" type="virtual void" isAbstract="true" name="intr" />
+    <UML:Operation visibility="protected" xmi.id="11" type="virtual " name="~KisBuilderSubject" />
+   </UML:Class>
+   <UML:Class stereotype="class" comment="Build a KisImage representation of an image file." visibility="public" xmi.id="12" name="KisImageMagickConverter" >
+    <UML:Operation visibility="protected" xmi.id="18" type="KisImageMagickConverter &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="19" value="" type="const KisImageMagickConverter &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="20" type="" name="KisImageMagickConverter" >
+     <UML:Parameter visibility="private" xmi.id="21" value="" type="KisDoc *" name="doc" />
+     <UML:Parameter visibility="private" xmi.id="22" value="" type="KisUndoAdapter *" name="adapter" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="23" type="" name="KisImageMagickConverter" >
+     <UML:Parameter visibility="private" xmi.id="24" value="" type="const KisImageMagickConverter &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="25" type="KisImageBuilder_Result" name="buildFile" >
+     <UML:Parameter visibility="private" xmi.id="26" value="" type="const KURL &amp;" name="uri" />
+     <UML:Parameter visibility="private" xmi.id="27" value="" type="KisImageSP" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="28" type="KisImageBuilder_Result" name="buildFile" >
+     <UML:Parameter visibility="private" xmi.id="29" value="" type="const KURL &amp;" name="uri" />
+     <UML:Parameter visibility="private" xmi.id="30" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="31" type="KisImageBuilder_Result" name="buildImage" >
+     <UML:Parameter visibility="private" xmi.id="32" value="" type="const KURL &amp;" name="uri" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="33" type="KisImageBuilder_Result" name="decode" >
+     <UML:Parameter visibility="private" xmi.id="34" value="" type="const KURL &amp;" name="uri" />
+     <UML:Parameter visibility="private" xmi.id="35" value="" type="bool" name="isBlob" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="36" type="KisImageSP" name="image" />
+    <UML:Operation visibility="protected" xmi.id="37" type="void" name="init" >
+     <UML:Parameter visibility="private" xmi.id="38" value="" type="KisDoc *" name="doc" />
+     <UML:Parameter visibility="private" xmi.id="39" value="" type="KisUndoAdapter *" name="adapter" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="40" type="virtual void" name="intr" />
+    <UML:Operation visibility="public" xmi.id="41" type=TQSTRING_OBJECT_NAME_STRING name="readFilters" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="42" type=TQSTRING_OBJECT_NAME_STRING name="writeFilters" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="43" type="virtual " name="~KisImageMagickConverter" />
+    <UML:Attribute visibility="private" xmi.id="13" value="" type="KisUndoAdapter *" name="m_adapter" />
+    <UML:Attribute visibility="private" xmi.id="14" value="" type="QValueVector" name="m_data" />
+    <UML:Attribute visibility="private" xmi.id="15" value="" type="KisDoc *" name="m_doc" />
+    <UML:Attribute visibility="private" xmi.id="16" value="" type="KisImageSP" name="m_img" />
+    <UML:Attribute visibility="private" xmi.id="17" value="" type="bool" name="m_stop" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="44" name="KisBuilderMonitor" >
+    <UML:Operation visibility="public" xmi.id="46" type="" name="KisBuilderMonitor" >
+     <UML:Parameter visibility="private" xmi.id="47" value="" type="QObject *" name="tqparent" />
+     <UML:Parameter visibility="private" xmi.id="48" value="" type="const char *" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="49" type="void" name="attach" >
+     <UML:Parameter visibility="private" xmi.id="50" value="" type="KisBuilderSubject *" name="subject" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="51" type="void" name="detach" >
+     <UML:Parameter visibility="private" xmi.id="52" value="" type="KisBuilderSubject *" name="subject" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="53" type="virtual " name="~KisBuilderMonitor" />
+    <UML:Attribute visibility="private" xmi.id="45" value="" type="vKisBuilderSubject" name="m_subjects" />
+   </UML:Class>
+   <UML:Enum stereotype="enum" visibility="public" xmi.id="55" name="KisImageBuilder_Result" >
+    <UML:EnumLiteral visibility="public" xmi.id="56" name="KisImageBuilder_RESULT_FAILURE" />
+    <UML:EnumLiteral visibility="public" xmi.id="57" name="KisImageBuilder_RESULT_NOT_EXIST" />
+    <UML:EnumLiteral visibility="public" xmi.id="58" name="KisImageBuilder_RESULT_NOT_LOCAL" />
+    <UML:EnumLiteral visibility="public" xmi.id="59" name="KisImageBuilder_RESULT_BAD_FETCH" />
+    <UML:EnumLiteral visibility="public" xmi.id="60" name="KisImageBuilder_RESULT_INVALID_ARG" />
+    <UML:EnumLiteral visibility="public" xmi.id="61" name="KisImageBuilder_RESULT_OK" />
+    <UML:EnumLiteral visibility="public" xmi.id="62" name="KisImageBuilder_RESULT_PROGRESS" />
+    <UML:EnumLiteral visibility="public" xmi.id="63" name="KisImageBuilder_RESULT_EMPTY" />
+    <UML:EnumLiteral visibility="public" xmi.id="64" name="KisImageBuilder_RESULT_BUSY" />
+    <UML:EnumLiteral visibility="public" xmi.id="65" name="KisImageBuilder_RESULT_NO_URI" />
+    <UML:EnumLiteral visibility="public" xmi.id="66" name="KisImageBuilder_RESULT_UNSUPPORTED" />
+    <UML:EnumLiteral visibility="public" xmi.id="67" name="KisImageBuilder_RESULT_INTR" />
+    <UML:EnumLiteral visibility="public" xmi.id="68" name="KisImageBuilder_RESULT_PATH" />
+   </UML:Enum>
+   <UML:Enum stereotype="enum" visibility="public" xmi.id="69" name="KisImageBuilder_Step" >
+    <UML:EnumLiteral visibility="public" xmi.id="70" name="KisImageBuilder_STEP_PREP" />
+    <UML:EnumLiteral visibility="public" xmi.id="71" name="KisImageBuilder_STEP_LOADING" />
+    <UML:EnumLiteral visibility="public" xmi.id="72" name="KisImageBuilder_STEP_SAVING" />
+    <UML:EnumLiteral visibility="public" xmi.id="73" name="KisImageBuilder_STEP_DECODING" />
+    <UML:EnumLiteral visibility="public" xmi.id="74" name="KisImageBuilder_STEP_TILING" />
+    <UML:EnumLiteral visibility="public" xmi.id="75" name="KisImageBuilder_STEP_DONE" />
+    <UML:EnumLiteral visibility="public" xmi.id="76" name="KisImageBuilder_STEP_ERROR" />
+   </UML:Enum>
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="77" name="vKisBuilderSubject_it" />
+   <UML:DataType stereotype="datatype" comment="The KisResource class provides a representation of Chalk image resources.  This
+includes, but not limited to, brushes and patterns.
+
+This replaces the KisKrayon facility that used to be present in Krayon." visibility="public" xmi.id="78" name="super" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="79" name="vKisBuilderSubject" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="80" name="vKisBuilderSubject_cit" />
+   <UML:Class stereotype="class" visibility="public" xmi.id="81" name="KisStrategyColorSpaceCMYK" >
+    <UML:Operation visibility="public" xmi.id="86" type="" name="KisStrategyColorSpaceCMYK" />
+    <UML:Operation visibility="public" xmi.id="87" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="88" value="" type="QRgb" name="rgb" />
+     <UML:Parameter visibility="private" xmi.id="89" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="90" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="91" value="" type="QRgb" name="rgb" />
+     <UML:Parameter visibility="private" xmi.id="92" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="93" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="94" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="95" value="" type="const KoColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="96" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="97" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="98" value="" type="const KoColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="99" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="100" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="101" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="102" value="" type="const QColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="103" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="104" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="105" value="" type="const QColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="106" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="107" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="108" type="virtual void" name="render" >
+     <UML:Parameter visibility="private" xmi.id="109" value="" type="KisImageSP" name="projection" />
+     <UML:Parameter visibility="private" xmi.id="110" value="" type="QPainter &amp;" name="painter" />
+     <UML:Parameter visibility="private" xmi.id="111" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="112" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="113" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="114" value="" type="Q_INT32" name="height" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="115" type="virtual void" name="tileBlt" >
+     <UML:Parameter visibility="private" xmi.id="116" value="" type="Q_INT32" name="stride" />
+     <UML:Parameter visibility="private" xmi.id="117" value="" type="QUANTUM *" name="dst" />
+     <UML:Parameter visibility="private" xmi.id="118" value="" type="Q_INT32" name="dststride" />
+     <UML:Parameter visibility="private" xmi.id="119" value="" type="QUANTUM *" name="src" />
+     <UML:Parameter visibility="private" xmi.id="120" value="" type="Q_INT32" name="srcstride" />
+     <UML:Parameter visibility="private" xmi.id="121" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="122" value="" type="Q_INT32" name="rows" />
+     <UML:Parameter visibility="private" xmi.id="123" value="" type="Q_INT32" name="cols" />
+     <UML:Parameter visibility="private" xmi.id="124" value="" type="CompositeOp" name="op" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="125" type="virtual void" name="tileBlt" >
+     <UML:Parameter visibility="private" xmi.id="126" value="" type="Q_INT32" name="stride" />
+     <UML:Parameter visibility="private" xmi.id="127" value="" type="QUANTUM *" name="dst" />
+     <UML:Parameter visibility="private" xmi.id="128" value="" type="Q_INT32" name="dststride" />
+     <UML:Parameter visibility="private" xmi.id="129" value="" type="QUANTUM *" name="src" />
+     <UML:Parameter visibility="private" xmi.id="130" value="" type="Q_INT32" name="srcstride" />
+     <UML:Parameter visibility="private" xmi.id="131" value="" type="Q_INT32" name="rows" />
+     <UML:Parameter visibility="private" xmi.id="132" value="" type="Q_INT32" name="cols" />
+     <UML:Parameter visibility="private" xmi.id="133" value="" type="CompositeOp" name="op" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="134" type="virtual " name="~KisStrategyColorSpaceCMYK" />
+    <UML:Attribute visibility="private" xmi.id="82" value="" type="QUANTUM *" name="m_buf" />
+    <UML:Attribute visibility="private" xmi.id="83" value="" type="KPixmapIO" name="m_pixio" />
+    <UML:Attribute visibility="private" xmi.id="84" value="" type=TQPIXMAP_OBJECT_NAME_STRING name="m_pixmap" />
+    <UML:Attribute visibility="private" xmi.id="85" value="" type="ColorLUT" name="m_rgbLUT" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="135" name="RGB" >
+    <UML:Attribute visibility="public" xmi.id="136" value="" type="QUANTUM" name="b" />
+    <UML:Attribute visibility="public" xmi.id="137" value="" type="QUANTUM" name="g" />
+    <UML:Attribute visibility="public" xmi.id="138" value="" type="QUANTUM" name="r" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="139" name="KisStrategyColorSpace" >
+    <UML:Operation visibility="protected" xmi.id="140" type="KisStrategyColorSpace &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="141" value="" type="const KisStrategyColorSpace &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="142" type="" name="KisStrategyColorSpace" />
+    <UML:Operation visibility="protected" xmi.id="143" type="" name="KisStrategyColorSpace" >
+     <UML:Parameter visibility="private" xmi.id="144" value="" type="const KisStrategyColorSpace &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="145" type="virtual void" isAbstract="true" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="146" value="" type="QRgb" name="rgb" />
+     <UML:Parameter visibility="private" xmi.id="147" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="148" type="virtual void" isAbstract="true" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="149" value="" type="QRgb" name="rgb" />
+     <UML:Parameter visibility="private" xmi.id="150" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="151" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="152" type="virtual void" isAbstract="true" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="153" value="" type="const KoColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="154" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="155" type="virtual void" isAbstract="true" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="156" value="" type="const KoColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="157" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="158" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="159" type="virtual void" isAbstract="true" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="160" value="" type="const QColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="161" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="162" type="virtual void" isAbstract="true" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="163" value="" type="const QColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="164" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="165" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="166" type="virtual void" isAbstract="true" name="render" >
+     <UML:Parameter visibility="private" xmi.id="167" value="" type="KisImageSP" name="projection" />
+     <UML:Parameter visibility="private" xmi.id="168" value="" type="QPainter &amp;" name="painter" />
+     <UML:Parameter visibility="private" xmi.id="169" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="170" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="171" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="172" value="" type="Q_INT32" name="height" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="173" type="virtual void" isAbstract="true" name="tileBlt" >
+     <UML:Parameter visibility="private" xmi.id="174" value="" type="Q_INT32" name="stride" />
+     <UML:Parameter visibility="private" xmi.id="175" value="" type="QUANTUM *" name="dst" />
+     <UML:Parameter visibility="private" xmi.id="176" value="" type="Q_INT32" name="dststride" />
+     <UML:Parameter visibility="private" xmi.id="177" value="" type="QUANTUM *" name="src" />
+     <UML:Parameter visibility="private" xmi.id="178" value="" type="Q_INT32" name="srcstride" />
+     <UML:Parameter visibility="private" xmi.id="179" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="180" value="" type="Q_INT32" name="rows" />
+     <UML:Parameter visibility="private" xmi.id="181" value="" type="Q_INT32" name="cols" />
+     <UML:Parameter visibility="private" xmi.id="182" value="" type="CompositeOp" name="op" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="183" type="virtual void" isAbstract="true" name="tileBlt" >
+     <UML:Parameter visibility="private" xmi.id="184" value="" type="Q_INT32" name="stride" />
+     <UML:Parameter visibility="private" xmi.id="185" value="" type="QUANTUM *" name="dst" />
+     <UML:Parameter visibility="private" xmi.id="186" value="" type="Q_INT32" name="dststride" />
+     <UML:Parameter visibility="private" xmi.id="187" value="" type="QUANTUM *" name="src" />
+     <UML:Parameter visibility="private" xmi.id="188" value="" type="Q_INT32" name="srcstride" />
+     <UML:Parameter visibility="private" xmi.id="189" value="" type="Q_INT32" name="rows" />
+     <UML:Parameter visibility="private" xmi.id="190" value="" type="Q_INT32" name="cols" />
+     <UML:Parameter visibility="private" xmi.id="191" value="" type="CompositeOp" name="op" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="192" type="virtual " name="~KisStrategyColorSpace" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="193" name="KisColorSpaceFactoryInterface" >
+    <UML:Operation visibility="protected" xmi.id="195" type="KisColorSpaceFactoryInterface" name="=" >
+     <UML:Parameter visibility="private" xmi.id="196" value="" type="const KisColorSpaceFactoryInterface &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="197" type="" name="KisColorSpaceFactoryInterface" />
+    <UML:Operation visibility="protected" xmi.id="198" type="" name="KisColorSpaceFactoryInterface" >
+     <UML:Parameter visibility="private" xmi.id="199" value="" type="const KisColorSpaceFactoryInterface &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="200" type="virtual KisStrategyColorSpaceSP" isAbstract="true" name="create" >
+     <UML:Parameter visibility="private" xmi.id="201" value="" type="const KisPaintDeviceSP &amp;" name="device" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="202" type="virtual KisStrategyColorSpaceSP" isAbstract="true" name="create" >
+     <UML:Parameter visibility="private" xmi.id="203" value="" type="enumImgType" name="imgType" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="204" type="KisColorSpaceFactoryInterface *" name="singleton" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="205" type="virtual " name="~KisColorSpaceFactoryInterface" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="206" name="KisStrategyColorSpaceRGB" >
+    <UML:Operation visibility="public" xmi.id="210" type="" name="KisStrategyColorSpaceRGB" />
+    <UML:Operation visibility="public" xmi.id="211" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="212" value="" type="QRgb" name="rgb" />
+     <UML:Parameter visibility="private" xmi.id="213" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="214" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="215" value="" type="QRgb" name="rgb" />
+     <UML:Parameter visibility="private" xmi.id="216" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="217" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="218" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="219" value="" type="const KoColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="220" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="221" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="222" value="" type="const KoColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="223" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="224" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="225" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="226" value="" type="const QColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="227" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="228" type="virtual void" name="nativeColor" >
+     <UML:Parameter visibility="private" xmi.id="229" value="" type="const QColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="230" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="231" value="" type="QUANTUM *" name="dst" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="232" type="virtual void" name="render" >
+     <UML:Parameter visibility="private" xmi.id="233" value="" type="KisImageSP" name="projection" />
+     <UML:Parameter visibility="private" xmi.id="234" value="" type="QPainter &amp;" name="painter" />
+     <UML:Parameter visibility="private" xmi.id="235" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="236" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="237" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="238" value="" type="Q_INT32" name="height" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="239" type="virtual void" name="tileBlt" >
+     <UML:Parameter visibility="private" xmi.id="240" value="" type="Q_INT32" name="stride" />
+     <UML:Parameter visibility="private" xmi.id="241" value="" type="QUANTUM *" name="dst" />
+     <UML:Parameter visibility="private" xmi.id="242" value="" type="Q_INT32" name="dststride" />
+     <UML:Parameter visibility="private" xmi.id="243" value="" type="QUANTUM *" name="src" />
+     <UML:Parameter visibility="private" xmi.id="244" value="" type="Q_INT32" name="srcstride" />
+     <UML:Parameter visibility="private" xmi.id="245" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="246" value="" type="Q_INT32" name="rows" />
+     <UML:Parameter visibility="private" xmi.id="247" value="" type="Q_INT32" name="cols" />
+     <UML:Parameter visibility="private" xmi.id="248" value="" type="CompositeOp" name="op" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="249" type="virtual void" name="tileBlt" >
+     <UML:Parameter visibility="private" xmi.id="250" value="" type="Q_INT32" name="stride" />
+     <UML:Parameter visibility="private" xmi.id="251" value="" type="QUANTUM *" name="dst" />
+     <UML:Parameter visibility="private" xmi.id="252" value="" type="Q_INT32" name="dststride" />
+     <UML:Parameter visibility="private" xmi.id="253" value="" type="QUANTUM *" name="src" />
+     <UML:Parameter visibility="private" xmi.id="254" value="" type="Q_INT32" name="srcstride" />
+     <UML:Parameter visibility="private" xmi.id="255" value="" type="Q_INT32" name="rows" />
+     <UML:Parameter visibility="private" xmi.id="256" value="" type="Q_INT32" name="cols" />
+     <UML:Parameter visibility="private" xmi.id="257" value="" type="CompositeOp" name="op" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="258" type="virtual " name="~KisStrategyColorSpaceRGB" />
+    <UML:Attribute visibility="private" xmi.id="207" value="" type="QUANTUM *" name="m_buf" />
+    <UML:Attribute visibility="private" xmi.id="208" value="" type="KPixmapIO" name="m_pixio" />
+    <UML:Attribute visibility="private" xmi.id="209" value="" type=TQPIXMAP_OBJECT_NAME_STRING name="m_pixmap" />
+   </UML:Class>
+   <UML:Class stereotype="class" comment="This class implements the conversion of the Chalk images that contain cmy + transparency
+data to rbg for screen rendering." visibility="public" xmi.id="259" name="CMYK" >
+    <UML:Operation visibility="public" xmi.id="264" type="bool" name="&lt;" >
+     <UML:Parameter visibility="private" xmi.id="265" value="" type="const CMYK &amp;" />
+    </UML:Operation>
+    <UML:Attribute visibility="public" xmi.id="260" value="" type="QUANTUM" name="c" />
+    <UML:Attribute visibility="public" xmi.id="261" value="" type="QUANTUM" name="k" />
+    <UML:Attribute visibility="public" xmi.id="262" value="" type="QUANTUM" name="m" />
+    <UML:Attribute visibility="public" xmi.id="263" value="" type="QUANTUM" name="y" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="266" name="KisColorSpaceFactoryFlyweight" >
+    <UML:Operation visibility="public" xmi.id="268" type="" name="KisColorSpaceFactoryFlyweight" />
+    <UML:Operation visibility="public" xmi.id="269" type="virtual KisStrategyColorSpaceSP" name="create" >
+     <UML:Parameter visibility="private" xmi.id="270" value="" type="const KisPaintDeviceSP &amp;" name="device" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="271" type="virtual KisStrategyColorSpaceSP" name="create" >
+     <UML:Parameter visibility="private" xmi.id="272" value="" type="enumImgType" name="imgType" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="273" type="KisStrategyColorSpaceSP" name="tqfind" >
+     <UML:Parameter visibility="private" xmi.id="274" value="" type="enumImgType" name="imgType" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="275" type="virtual " name="~KisColorSpaceFactoryFlyweight" />
+    <UML:Attribute visibility="private" xmi.id="267" value="" type="acFlyweights" name="m_flyweights" />
+   </UML:Class>
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="279" name="acFlyweights_it" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="280" name="ColorLUT" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="281" name="acFlyweights_cit" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="282" name="acFlyweights" />
+   <UML:Class stereotype="class" visibility="public" xmi.id="283" name="KisScopedLock" >
+    <UML:Operation visibility="public" xmi.id="285" type="" name="KisScopedLock" >
+     <UML:Parameter visibility="private" xmi.id="286" value="" type="QMutex *" name="lock" />
+     <UML:Parameter visibility="private" xmi.id="287" value="" type="bool" name="initialLock" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="288" type="void" name="lock" />
+    <UML:Operation visibility="public" xmi.id="289" type="void" name="trylock" />
+    <UML:Operation visibility="public" xmi.id="290" type="void" name="unlock" />
+    <UML:Operation visibility="public" xmi.id="291" type="" name="~KisScopedLock" />
+    <UML:Attribute visibility="private" xmi.id="284" value="" type="QMutex *" name="m_mutex" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="292" name="KisStrategyMove" >
+    <UML:Operation visibility="protected" xmi.id="300" type="KisStrategyMove &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="301" value="" type="const KisStrategyMove &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="302" type="" name="KisStrategyMove" />
+    <UML:Operation visibility="public" xmi.id="303" type="explicit" name="KisStrategyMove" >
+     <UML:Parameter visibility="private" xmi.id="304" value="" type="KisCanvasSubject *" name="subject" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="305" type="" name="KisStrategyMove" >
+     <UML:Parameter visibility="private" xmi.id="306" value="" type="const KisStrategyMove &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="307" type="void" name="drag" >
+     <UML:Parameter visibility="private" xmi.id="308" value="" type="const QPoint &amp;" name="pos" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="309" type="void" name="endDrag" >
+     <UML:Parameter visibility="private" xmi.id="310" value="" type="const QPoint &amp;" name="pos" />
+     <UML:Parameter visibility="private" xmi.id="311" value="" type="bool" name="undo" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="312" type="void" name="reset" >
+     <UML:Parameter visibility="private" xmi.id="313" value="" type="KisCanvasSubject *" name="subject" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="314" type="void" name="simpleMove" >
+     <UML:Parameter visibility="private" xmi.id="315" value="" type="Q_INT32" name="x1" />
+     <UML:Parameter visibility="private" xmi.id="316" value="" type="Q_INT32" name="y1" />
+     <UML:Parameter visibility="private" xmi.id="317" value="" type="Q_INT32" name="x2" />
+     <UML:Parameter visibility="private" xmi.id="318" value="" type="Q_INT32" name="y2" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="319" type="void" name="simpleMove" >
+     <UML:Parameter visibility="private" xmi.id="320" value="" type="const QPoint &amp;" name="pt1" />
+     <UML:Parameter visibility="private" xmi.id="321" value="" type="const QPoint &amp;" name="pt2" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="322" type="void" name="startDrag" >
+     <UML:Parameter visibility="private" xmi.id="323" value="" type="const QPoint &amp;" name="pos" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="324" type="virtual " name="~KisStrategyMove" />
+    <UML:Attribute visibility="private" xmi.id="293" value="" type="KisCanvasControllerInterface *" name="m_controller" />
+    <UML:Attribute visibility="private" xmi.id="294" value="" type="KoDocument *" name="m_doc" />
+    <UML:Attribute visibility="private" xmi.id="295" value="" type=TQPOINT_OBJECT_NAME_STRING name="m_dragStart" />
+    <UML:Attribute visibility="private" xmi.id="296" value="" type="bool" name="m_dragging" />
+    <UML:Attribute visibility="private" xmi.id="297" value="" type=TQPOINT_OBJECT_NAME_STRING name="m_layerPosition" />
+    <UML:Attribute visibility="private" xmi.id="298" value="" type=TQPOINT_OBJECT_NAME_STRING name="m_layerStart" />
+    <UML:Attribute visibility="private" xmi.id="299" value="" type="KisCanvasSubject *" name="m_subject" />
+   </UML:Class>
+   <UML:Class stereotype="class" comment="KisTileMgr manages the imagedata that for implementations of KisRenderInterface.
+Those are:
+
+KisPaintDevices
+   KisLayer
+      KisBackround
+      KisSelection
+   KisChannel
+      KisMask
+
+and
+
+KisImage
+
+Imagedata is structured in the form of tiles, by default 64 by 64
+pixels big. The KisTileMgr is smart enough to hide most of the
+details of reading on and writing from tiles.
+
+@short KisTileMgr manages the pixels for every layer.
+" visibility="public" xmi.id="325" name="KisTileMgr" >
+    <UML:Operation visibility="protected" xmi.id="335" type="KisTileMgr &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="336" value="" type="const KisTileMgr &amp;" />
+    </UML:Operation>
+    <UML:Operation comment="Create a new KisTileMgr of width and height with the
+specified colour depth. Deep copies the tiles of tm to the
+new KisTileMgr.
+
+XXX: I am not sure what happens when tm is bigger or smaller
+than width and height, nor what happens when tm has a
+different depth." visibility="public" xmi.id="337" type="" name="KisTileMgr" >
+     <UML:Parameter visibility="private" xmi.id="338" value="" type="KisTileMgr *" name="tm" />
+     <UML:Parameter visibility="private" xmi.id="339" value="" type="Q_UINT32" name="depth" />
+     <UML:Parameter visibility="private" xmi.id="340" value="" type="Q_UINT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="341" value="" type="Q_UINT32" name="height" />
+    </UML:Operation>
+    <UML:Operation comment="Create a KisTileMgr of width and height with the specified
+colour depth." visibility="public" xmi.id="342" type="" name="KisTileMgr" >
+     <UML:Parameter visibility="private" xmi.id="343" value="" type="Q_UINT32" name="depth" />
+     <UML:Parameter visibility="private" xmi.id="344" value="" type="Q_UINT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="345" value="" type="Q_UINT32" name="height" />
+    </UML:Operation>
+    <UML:Operation comment="Creates a new KisTileMgr based on rhs, shares a reference
+to the tiles of rhs." visibility="public" xmi.id="346" type="" name="KisTileMgr" >
+     <UML:Parameter visibility="private" xmi.id="347" value="" type="const KisTileMgr &amp;" name="rhs" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="348" type="void" name="allocate" >
+     <UML:Parameter visibility="private" xmi.id="349" value="" type="Q_INT32" name="ntiles" />
+    </UML:Operation>
+    <UML:Operation comment="XXX?" visibility="public" xmi.id="350" type="void" name="attach" >
+     <UML:Parameter visibility="private" xmi.id="351" value="" type="KisTileSP" name="tile" />
+     <UML:Parameter visibility="private" xmi.id="352" value="" type="Q_INT32" name="tilenum" />
+     <UML:Parameter visibility="private" xmi.id="353" value="" type="bool" name="keepold" />
+    </UML:Operation>
+    <UML:Operation comment="Color-depth of the KisRenderInterface implementation
+managed by this KisTileMgr" visibility="public" xmi.id="354" type="Q_INT32" name="depth" />
+    <UML:Operation comment="XXX?" visibility="public" xmi.id="355" type="void" name="detach" >
+     <UML:Parameter visibility="private" xmi.id="356" value="" type="KisTileSP" name="tile" />
+     <UML:Parameter visibility="private" xmi.id="357" value="" type="Q_INT32" name="tilenum" />
+     <UML:Parameter visibility="private" xmi.id="358" value="" type="bool" name="keepold" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="359" type="void" name="duplicate" >
+     <UML:Parameter visibility="private" xmi.id="360" value="" type="Q_INT32" name="ntiles" />
+     <UML:Parameter visibility="private" xmi.id="361" value="" type="KisTileMgr *" name="tm" />
+    </UML:Operation>
+    <UML:Operation comment="Returns true if this KisTileMgr does not manage any
+tiles." visibility="public" xmi.id="362" type="bool" name="empty" />
+    <UML:Operation comment="Height in pixels of the total area managed by this KisTileMgr" visibility="public" xmi.id="363" type="Q_INT32" name="height" />
+    <UML:Operation comment="XXX" visibility="public" xmi.id="364" type="KisTileSP" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="365" value="" type="KisTileSP" name="tile" />
+     <UML:Parameter visibility="private" xmi.id="366" value="" type="Q_INT32" name="xpix" />
+     <UML:Parameter visibility="private" xmi.id="367" value="" type="Q_INT32" name="ypix" />
+    </UML:Operation>
+    <UML:Operation comment="XXX" visibility="public" xmi.id="368" type="KisTileSP" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="369" value="" type="Q_INT32" name="tileno" />
+    </UML:Operation>
+    <UML:Operation comment="XXX" visibility="public" xmi.id="370" type="KisTileSP" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="371" value="" type="Q_INT32" name="xpix" />
+     <UML:Parameter visibility="private" xmi.id="372" value="" type="Q_INT32" name="ypix" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="373" type="KisTileSP" name="tqinvalidateTile" >
+     <UML:Parameter visibility="private" xmi.id="374" value="" type="KisTileSP" name="tile" />
+     <UML:Parameter visibility="private" xmi.id="375" value="" type="Q_INT32" name="tilenum" />
+    </UML:Operation>
+    <UML:Operation comment="XXX" visibility="public" xmi.id="376" type="void" name="tqinvalidateTiles" >
+     <UML:Parameter visibility="private" xmi.id="377" value="" type="KisTileSP" name="tile" />
+    </UML:Operation>
+    <UML:Operation comment="Total size in memory the data managed by this KisTileMgr " visibility="public" xmi.id="378" type="Q_UINT32" name="memSize" />
+    <UML:Operation comment="Number of columns of tiles managed by this KisTileMgr" visibility="public" xmi.id="379" type="Q_UINT32" name="ncols" />
+    <UML:Operation comment="Number of rows of tiles managed by this KisTileMgr" visibility="public" xmi.id="380" type="Q_UINT32" name="nrows" />
+    <UML:Operation comment="Returns the KisPixelData defined by the rectangle x1, y1,
+x2, y2. Depending on mode, this data is readable, writable
+or both." visibility="public" xmi.id="381" type="KisPixelDataSP" name="pixelData" >
+     <UML:Parameter visibility="private" xmi.id="382" value="" type="Q_INT32" name="x1" />
+     <UML:Parameter visibility="private" xmi.id="383" value="" type="Q_INT32" name="y1" />
+     <UML:Parameter visibility="private" xmi.id="384" value="" type="Q_INT32" name="x2" />
+     <UML:Parameter visibility="private" xmi.id="385" value="" type="Q_INT32" name="y2" />
+     <UML:Parameter visibility="private" xmi.id="386" value="" type="Q_INT32" name="mode" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="387" type="void" name="readPixelData" >
+     <UML:Parameter visibility="private" xmi.id="388" value="" type="KisPixelDataSP" name="pd" />
+    </UML:Operation>
+    <UML:Operation comment="Read the area defined by x1, y2, x2, y2 into the buffer. Stride is number of bytes
+that a pixel takes in the buffer." visibility="public" xmi.id="389" type="void" name="readPixelData" >
+     <UML:Parameter visibility="private" xmi.id="390" value="" type="Q_INT32" name="x1" />
+     <UML:Parameter visibility="private" xmi.id="391" value="" type="Q_INT32" name="y1" />
+     <UML:Parameter visibility="private" xmi.id="392" value="" type="Q_INT32" name="x2" />
+     <UML:Parameter visibility="private" xmi.id="393" value="" type="Q_INT32" name="y2" />
+     <UML:Parameter visibility="private" xmi.id="394" value="" type="QUANTUM *" name="buffer" />
+     <UML:Parameter visibility="private" xmi.id="395" value="" type="Q_UINT32" name="stride" />
+    </UML:Operation>
+    <UML:Operation comment="Not sure what this does... Perhaps write changed data if
+owner, else mark something invalid. XXX" visibility="public" xmi.id="396" type="void" name="releasePixelData" >
+     <UML:Parameter visibility="private" xmi.id="397" value="" type="KisPixelDataSP" name="pd" />
+    </UML:Operation>
+    <UML:Operation comment="Create or duplicate a tile with identity tilenum; tilenum
+is computed from the x/y coordinates of the tile in the
+image
+
+XXX: Not sure what 'mode' is. Presumbly related to the
+TILEMODE constants." visibility="public" xmi.id="398" type="KisTileSP" name="tile" >
+     <UML:Parameter visibility="private" xmi.id="399" value="" type="Q_INT32" name="tilenum" />
+     <UML:Parameter visibility="private" xmi.id="400" value="" type="Q_INT32" name="mode" />
+    </UML:Operation>
+    <UML:Operation comment="Create or duplicate a tile at location xpix/ypix.
+
+XXX: Not sure what 'mode' is. Presumbly related to the
+TILEMODE constants." visibility="public" xmi.id="401" type="KisTileSP" name="tile" >
+     <UML:Parameter visibility="private" xmi.id="402" value="" type="Q_INT32" name="xpix" />
+     <UML:Parameter visibility="private" xmi.id="403" value="" type="Q_INT32" name="ypix" />
+     <UML:Parameter visibility="private" xmi.id="404" value="" type="Q_INT32" name="mode" />
+    </UML:Operation>
+    <UML:Operation comment="Puts the x/y coordinates of the top left (?) corner
+of tile in coord." visibility="public" xmi.id="405" type="void" name="tileCoord" >
+     <UML:Parameter visibility="private" xmi.id="406" value="" type="const KisTileSP &amp;" name="tile" />
+     <UML:Parameter visibility="private" xmi.id="407" value="" type="QPoint &amp;" name="coord" />
+    </UML:Operation>
+    <UML:Operation comment="Puts the x/y coordinates of the top left (?) corner
+of tile in x and y." visibility="public" xmi.id="408" type="void" name="tileCoord" >
+     <UML:Parameter visibility="private" xmi.id="409" value="" type="const KisTileSP &amp;" name="tile" />
+     <UML:Parameter visibility="private" xmi.id="410" value="" type="Q_INT32 *" name="x" />
+     <UML:Parameter visibility="private" xmi.id="411" value="" type="Q_INT32 *" name="y" />
+    </UML:Operation>
+    <UML:Operation comment="XXX" visibility="public" xmi.id="412" type="void" name="tileMap" >
+     <UML:Parameter visibility="private" xmi.id="413" value="" type="Q_INT32" name="tilenum" />
+     <UML:Parameter visibility="private" xmi.id="414" value="" type="KisTileSP" name="src" />
+    </UML:Operation>
+    <UML:Operation comment="XXX" visibility="public" xmi.id="415" type="void" name="tileMap" >
+     <UML:Parameter visibility="private" xmi.id="416" value="" type="Q_INT32" name="xpix" />
+     <UML:Parameter visibility="private" xmi.id="417" value="" type="Q_INT32" name="ypix" />
+     <UML:Parameter visibility="private" xmi.id="418" value="" type="KisTileSP" name="src" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="419" type="Q_INT32" name="tileNum" >
+     <UML:Parameter visibility="private" xmi.id="420" value="" type="Q_UINT32" name="xpix" />
+     <UML:Parameter visibility="private" xmi.id="421" value="" type="Q_UINT32" name="ypix" />
+    </UML:Operation>
+    <UML:Operation comment="Width in pixels of the total area managed by this KisTileMgr" visibility="public" xmi.id="422" type="Q_INT32" name="width" />
+    <UML:Operation visibility="public" xmi.id="423" type="void" name="writePixelData" >
+     <UML:Parameter visibility="private" xmi.id="424" value="" type="KisPixelDataSP" name="pd" />
+    </UML:Operation>
+    <UML:Operation comment="Commit the pixel data in buffer." visibility="public" xmi.id="425" type="void" name="writePixelData" >
+     <UML:Parameter visibility="private" xmi.id="426" value="" type="Q_INT32" name="x1" />
+     <UML:Parameter visibility="private" xmi.id="427" value="" type="Q_INT32" name="y1" />
+     <UML:Parameter visibility="private" xmi.id="428" value="" type="Q_INT32" name="x2" />
+     <UML:Parameter visibility="private" xmi.id="429" value="" type="Q_INT32" name="y2" />
+     <UML:Parameter visibility="private" xmi.id="430" value="" type="QUANTUM *" name="buffer" />
+     <UML:Parameter visibility="private" xmi.id="431" value="" type="Q_UINT32" name="stride" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="432" type="virtual " name="~KisTileMgr" />
+    <UML:Attribute visibility="private" xmi.id="326" value="" type="Q_UINT32" name="m_depth" />
+    <UML:Attribute visibility="private" xmi.id="327" value="" type="Q_UINT32" name="m_height" />
+    <UML:Attribute visibility="private" xmi.id="330" value="" type="QMutex" name="m_mutex" />
+    <UML:Attribute visibility="private" xmi.id="331" value="" type="Q_UINT32" name="m_ntileCols" />
+    <UML:Attribute visibility="private" xmi.id="332" value="" type="Q_UINT32" name="m_ntileRows" />
+    <UML:Attribute visibility="private" xmi.id="333" value="" type="vKisTileSP" name="m_tiles" />
+    <UML:Attribute visibility="private" xmi.id="334" value="" type="Q_UINT32" name="m_width" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="328" name="KisTileMediator" >
+    <UML:Operation visibility="protected" xmi.id="436" type="KisTileMediator &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="437" value="" type="const KisTileMediator &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="438" type="" name="KisTileMediator" />
+    <UML:Operation visibility="protected" xmi.id="439" type="" name="KisTileMediator" >
+     <UML:Parameter visibility="private" xmi.id="440" value="" type="const KisTileMediator &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="441" type="void" name="attach" >
+     <UML:Parameter visibility="private" xmi.id="442" value="" type="KisTileSP" name="tile" />
+     <UML:Parameter visibility="private" xmi.id="443" value="" type="KisTileMgrSP" name="mgr" />
+     <UML:Parameter visibility="private" xmi.id="444" value="" type="Q_INT32" name="tilenum" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="445" type="void" name="detach" >
+     <UML:Parameter visibility="private" xmi.id="446" value="" type="KisTileSP" name="tile" />
+     <UML:Parameter visibility="private" xmi.id="447" value="" type="KisTileMgrSP" name="mgr" />
+     <UML:Parameter visibility="private" xmi.id="448" value="" type="Q_INT32" name="tilenum" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="449" type="void" name="detachAll" >
+     <UML:Parameter visibility="private" xmi.id="450" value="" type="KisTileMgr *" name="mgr" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="451" type="Q_INT32" name="tileNum" >
+     <UML:Parameter visibility="private" xmi.id="452" value="" type="KisTileSP" name="tile" />
+     <UML:Parameter visibility="private" xmi.id="453" value="" type="KisTileMgrSP" name="mgr" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="454" type="" name="~KisTileMediator" />
+    <UML:Attribute visibility="private" xmi.id="433" value="" type="KisTileMediatorSingleton *" name="m_instance" />
+    <UML:Attribute visibility="private" xmi.id="434" value="" type="QMutex" name="m_mutex" />
+    <UML:Attribute visibility="private" xmi.id="435" value="" type="Q_INT32" name="m_ref" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="455" name="KisTileSwapInterface" >
+    <UML:Operation visibility="public" xmi.id="456" type="" name="KisTileSwapInterface" />
+    <UML:Operation visibility="public" xmi.id="457" type="virtual Q_INT32" isAbstract="true" name="add" >
+     <UML:Parameter visibility="private" xmi.id="458" value="" type="KisTileSP" name="tile" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="459" type="virtual void" isAbstract="true" name="remove" >
+     <UML:Parameter visibility="private" xmi.id="460" value="" type="Q_INT32" name="swapNo" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="461" type="virtual void" isAbstract="true" name="swapCompress" >
+     <UML:Parameter visibility="private" xmi.id="462" value="" type="KisTileSP" name="tile" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="463" type="virtual void" isAbstract="true" name="swapDel" >
+     <UML:Parameter visibility="private" xmi.id="464" value="" type="KisTileSP" name="tile" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="465" type="virtual void" isAbstract="true" name="swapIn" >
+     <UML:Parameter visibility="private" xmi.id="466" value="" type="KisTileSP" name="tile" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="467" type="virtual void" isAbstract="true" name="swapInAsync" >
+     <UML:Parameter visibility="private" xmi.id="468" value="" type="KisTileSP" name="tile" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="469" type="virtual void" isAbstract="true" name="swapOut" >
+     <UML:Parameter visibility="private" xmi.id="470" value="" type="KisTileSP" name="tile" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="471" type="virtual " name="~KisTileSwapInterface" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="472" name="KisTileCacheInterface" >
+    <UML:Operation visibility="public" xmi.id="473" type="" name="KisTileCacheInterface" />
+    <UML:Operation visibility="public" xmi.id="474" type="virtual void" isAbstract="true" name="flush" >
+     <UML:Parameter visibility="private" xmi.id="475" value="" type="KisTileSP" name="tile" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="476" type="virtual void" isAbstract="true" name="insert" >
+     <UML:Parameter visibility="private" xmi.id="477" value="" type="KisTileSP" name="tile" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="478" type="virtual void" isAbstract="true" name="tqsizeHint" >
+     <UML:Parameter visibility="private" xmi.id="479" value="" type="Q_INT32" name="nelements" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="480" type="virtual " name="~KisTileCacheInterface" />
+   </UML:Class>
+   <UML:Class stereotype="class" comment="Provides abstraction to a tile.  A tile tqcontains
+a part of a layer.  Layers form an image." visibility="public" xmi.id="481" name="KisTile" >
+    <UML:Operation visibility="protected" xmi.id="496" type="KisTile &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="497" value="" type="const KisTile &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="498" type="" name="KisTile" >
+     <UML:Parameter visibility="private" xmi.id="499" value="" type="KisTile &amp;" name="rhs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="500" type="" name="KisTile" >
+     <UML:Parameter visibility="private" xmi.id="501" value="" type="Q_INT32" name="depth" />
+     <UML:Parameter visibility="private" xmi.id="502" value="" type="KisTileCacheInterface *" name="cache" />
+     <UML:Parameter visibility="private" xmi.id="503" value="" type="KisTileSwapInterface *" name="swap" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="504" type="void" name="allocate" />
+    <UML:Operation visibility="public" xmi.id="505" type="QUANTUM *" name="data" >
+     <UML:Parameter visibility="private" xmi.id="506" value="" type="Q_INT32" name="xoff" />
+     <UML:Parameter visibility="private" xmi.id="507" value="" type="Q_INT32" name="yoff" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="508" type="Q_INT32" name="depth" />
+    <UML:Operation visibility="public" xmi.id="509" type="bool" name="dirty" />
+    <UML:Operation visibility="public" xmi.id="510" type="void" name="dirty" >
+     <UML:Parameter visibility="private" xmi.id="511" value="" type="bool" name="val" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="512" type="void" name="duplicate" >
+     <UML:Parameter visibility="private" xmi.id="513" value="" type="KisTile *" name="tile" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="514" type="Q_INT32" name="height" />
+    <UML:Operation visibility="public" xmi.id="515" type="void" name="height" >
+     <UML:Parameter visibility="private" xmi.id="516" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="517" type="void" name="init" >
+     <UML:Parameter visibility="private" xmi.id="518" value="" type="Q_INT32" name="depth" />
+     <UML:Parameter visibility="private" xmi.id="519" value="" type="KisTileCacheInterface *" name="cache" />
+     <UML:Parameter visibility="private" xmi.id="520" value="" type="KisTileSwapInterface *" name="swap" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="521" type="void" name="initRowHints" />
+    <UML:Operation visibility="public" xmi.id="522" type="void" name="lock" />
+    <UML:Operation visibility="public" xmi.id="523" type="void" name="lockAsync" />
+    <UML:Operation visibility="public" xmi.id="524" type="QMutex *" name="mutex" />
+    <UML:Operation visibility="public" xmi.id="525" type="void" name="ref" />
+    <UML:Operation visibility="public" xmi.id="526" type="Q_INT32" name="refCount" />
+    <UML:Operation visibility="public" xmi.id="527" type="void" name="release" />
+    <UML:Operation visibility="public" xmi.id="528" type="Q_INT32" name="rowHint" >
+     <UML:Parameter visibility="private" xmi.id="529" value="" type="Q_INT32" name="row" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="530" type="void" name="setRowHint" >
+     <UML:Parameter visibility="private" xmi.id="531" value="" type="Q_INT32" name="row" />
+     <UML:Parameter visibility="private" xmi.id="532" value="" type="drawingHints" name="hint" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="533" type="Q_INT32" name="shareCount" />
+    <UML:Operation visibility="public" xmi.id="534" type="void" name="shareRef" />
+    <UML:Operation visibility="public" xmi.id="535" type="void" name="shareRelease" />
+    <UML:Operation visibility="public" xmi.id="536" type="Q_INT32" name="size" />
+    <UML:Operation visibility="public" xmi.id="537" type="bool" name="valid" />
+    <UML:Operation visibility="public" xmi.id="538" type="void" name="valid" >
+     <UML:Parameter visibility="private" xmi.id="539" value="" type="bool" name="valid" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="540" type="Q_INT32" name="width" />
+    <UML:Operation visibility="public" xmi.id="541" type="void" name="width" >
+     <UML:Parameter visibility="private" xmi.id="542" value="" type="Q_INT32" name="w" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="543" type="Q_INT32" name="writeCount" />
+    <UML:Operation visibility="public" xmi.id="544" type="void" name="writeRef" />
+    <UML:Operation visibility="public" xmi.id="545" type="virtual " name="~KisTile" />
+    <UML:Attribute visibility="private" xmi.id="483" value="" type="QUANTUM *" name="m_data" />
+    <UML:Attribute visibility="private" xmi.id="484" value="" type="Q_INT32" name="m_depth" />
+    <UML:Attribute visibility="private" xmi.id="485" value="" type="bool" name="m_dirty" />
+    <UML:Attribute visibility="private" xmi.id="486" value="" type="Q_INT32" name="m_height" />
+    <UML:Attribute visibility="private" xmi.id="487" value="" type="QValueVector" name="m_hints" />
+    <UML:Attribute visibility="private" xmi.id="488" value="" type="QMutex" name="m_mutex" />
+    <UML:Attribute visibility="private" xmi.id="489" value="" type="Q_INT32" name="m_nref" />
+    <UML:Attribute visibility="private" xmi.id="490" value="" type="Q_INT32" name="m_nshare" />
+    <UML:Attribute visibility="private" xmi.id="491" value="" type="Q_INT32" name="m_nwrite" />
+    <UML:Attribute visibility="private" xmi.id="493" value="" type="Q_INT32" name="m_swapNo" />
+    <UML:Attribute visibility="private" xmi.id="494" value="" type="bool" name="m_valid" />
+    <UML:Attribute visibility="private" xmi.id="495" value="" type="Q_INT32" name="m_width" />
+   </UML:Class>
+   <UML:Enum stereotype="enum" visibility="public" xmi.id="546" name="drawingHints" >
+    <UML:EnumLiteral visibility="public" xmi.id="547" name="broken" />
+    <UML:EnumLiteral visibility="public" xmi.id="548" name="opaque" />
+    <UML:EnumLiteral visibility="public" xmi.id="549" name="transparent" />
+    <UML:EnumLiteral visibility="public" xmi.id="550" name="mixed" />
+    <UML:EnumLiteral visibility="public" xmi.id="551" name="outofrange" />
+    <UML:EnumLiteral visibility="public" xmi.id="552" name="undef" />
+    <UML:EnumLiteral visibility="public" xmi.id="553" name="unknown" />
+   </UML:Enum>
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="554" name="KisTileSPLst" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="555" name="vKisTileSPLst" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="556" name="KisTileSPLst_cit" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="557" name="vKisTileSPLst_cit" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="558" name="vKisTileSPLst_it" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="559" name="KisTileSPLst_it" />
+   <UML:Class stereotype="class" visibility="public" xmi.id="560" name="KisMerge" >
+    <UML:Operation visibility="public" xmi.id="565" type="" name="KisMerge" >
+     <UML:Parameter visibility="private" xmi.id="566" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="567" value="" type="bool" name="keepOld" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="568" type="virtual bool" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="569" value="" type="KisPainter &amp;" />
+     <UML:Parameter visibility="private" xmi.id="570" value="" type="KisPaintDeviceSP" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="571" type="virtual bool" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="572" value="" type="KisPainter &amp;" />
+     <UML:Parameter visibility="private" xmi.id="573" value="" type="KisSelectionSP" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="574" type="virtual bool" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="575" value="" type="KisPainter &amp;" />
+     <UML:Parameter visibility="private" xmi.id="576" value="" type="vKisPaintDeviceSP &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="577" type="virtual bool" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="578" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="579" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="580" type="virtual bool" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="581" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="582" value="" type="vKisLayerSP &amp;" name="layers" />
+    </UML:Operation>
+    <UML:Attribute visibility="private" xmi.id="561" value="" type="KisImageSP" name="m_img" />
+    <UML:Attribute visibility="private" xmi.id="562" value="" type="bool" name="m_keepOld" />
+    <UML:Attribute visibility="private" xmi.id="563" value="" type="QRect" name="m_rc" />
+    <UML:Attribute visibility="private" xmi.id="564" value="" type="cond_t" name="m_test" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="583" name="KisFlatten" >
+    <UML:Operation visibility="public" xmi.id="586" type="" name="KisFlatten" >
+     <UML:Parameter visibility="private" xmi.id="587" value="" type="QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="588" type="" name="KisFlatten" >
+     <UML:Parameter visibility="private" xmi.id="589" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="590" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="591" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="592" value="" type="Q_INT32" name="height" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="593" type="virtual bool" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="594" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="595" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="596" type="virtual bool" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="597" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="598" value="" type="KisPaintDeviceSP" name="dev" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="599" type="void" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="600" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="601" value="" type="KisPaintDeviceSP" name="dev" />
+     <UML:Parameter visibility="private" xmi.id="602" value="" type="Q_INT32" name="opacity" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="603" type="virtual bool" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="604" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="605" value="" type="KisSelectionSP" name="selection" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="606" type="virtual bool" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="607" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="608" value="" type="vKisLayerSP &amp;" name="layers" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="609" type="virtual bool" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="610" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="611" value="" type="vKisPaintDeviceSP &amp;" name="devs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="612" type="virtual " name="~KisFlatten" />
+    <UML:Attribute visibility="private" xmi.id="584" value="" type="QRect" name="m_rc" />
+    <UML:Attribute visibility="private" xmi.id="585" value="" type="cond_t" name="m_test" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="613" name="KIsDocIface" >
+    <UML:Operation visibility="protected" xmi.id="615" type="virtual int" name="redoLimit" />
+    <UML:Operation visibility="protected" xmi.id="616" type="virtual void" name="renameImage" >
+     <UML:Parameter visibility="private" xmi.id="617" value="" type="const QString &amp;" name="oldName" />
+     <UML:Parameter visibility="private" xmi.id="618" value="" type="const QString &amp;" name="newName" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="619" type="virtual void" name="setRedoLimit" >
+     <UML:Parameter visibility="private" xmi.id="620" value="" type="int" name="limit" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="621" type="virtual void" name="setUndoLimit" >
+     <UML:Parameter visibility="private" xmi.id="622" value="" type="int" name="limit" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="623" type="virtual int" name="undoLimit" />
+    <UML:Attribute visibility="private" xmi.id="614" value="" type="KisDoc *" name="m_doc" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="624" name="KisAlphaMask" >
+    <UML:Operation comment="Create an alpha tqmask based on the gray values of the
+specified QImage. If the QImage is not grayscale, you're
+buggered." visibility="public" xmi.id="629" type="" name="KisAlphaMask" >
+     <UML:Parameter visibility="private" xmi.id="630" value="" type="const QImage &amp;" name="img" />
+    </UML:Operation>
+    <UML:Operation comment="Create an alpha tqmask based on the gray values of the
+specified QImage. If the QImage is not grayscale, you're
+buggered. The QImage is scaled using QImage::smoothScale,
+where the target w and h are computed by taking scale as a
+percentage." visibility="public" xmi.id="631" type="" name="KisAlphaMask" >
+     <UML:Parameter visibility="private" xmi.id="632" value="" type="const QImage &amp;" name="img" />
+     <UML:Parameter visibility="private" xmi.id="633" value="" type="double" name="scale" />
+    </UML:Operation>
+    <UML:Operation comment="@return the alpha value at the specified position.
+Returns QUANTUM OPACITY_TRANSPARENT if the value is
+outside the bounds of the tqmask.
+XXX: this is, of course, not the best way of tqmasking.
+Better would be to let KisAlphaMask fill a chunk of memory
+with the alpha values at the right position, something like
+void applyMask(QUANTUM *pixeldata, Q_INT32 pixelWidth,
+Q_INT32 alphaPos). That would be fastest, or we could
+provide an iterator over the tqmask, that would be nice, too." visibility="public" xmi.id="634" type="QUANTUM" name="alphaAt" >
+     <UML:Parameter visibility="private" xmi.id="635" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="636" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="637" type="void" name="computeAlpha" >
+     <UML:Parameter visibility="private" xmi.id="638" value="" type="const QImage &amp;" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="639" type="void" name="copyAlpha" >
+     <UML:Parameter visibility="private" xmi.id="640" value="" type="const QImage &amp;" name="img" />
+    </UML:Operation>
+    <UML:Operation comment="@return the number of alpha values in a scanline." visibility="public" xmi.id="641" type="Q_INT32" name="height" />
+    <UML:Operation comment="@return the scale factor." visibility="public" xmi.id="642" type="double" name="scale" />
+    <UML:Operation comment="@return the number of lines in the tqmask." visibility="public" xmi.id="643" type="Q_INT32" name="width" />
+    <UML:Operation visibility="public" xmi.id="644" type="virtual " name="~KisAlphaMask" />
+    <UML:Attribute visibility="private" xmi.id="625" value="" type="QValueVector" name="m_data" />
+    <UML:Attribute visibility="private" xmi.id="626" value="" type="double" name="m_scale" />
+    <UML:Attribute visibility="private" xmi.id="627" value="" type="Q_INT32" name="m_scaledHeight" />
+    <UML:Attribute visibility="private" xmi.id="628" value="" type="Q_INT32" name="m_scaledWidth" />
+   </UML:Class>
+   <UML:Class stereotype="class" comment="This is the definition of the interface Chalk presents to
+dcop." visibility="public" xmi.id="645" name="KRayonViewIface" >
+    <UML:Operation visibility="protected" xmi.id="647" type="K_DCOP public :" name="KRayonViewIface" >
+     <UML:Parameter visibility="private" xmi.id="648" value="" type="KisView *" name="view_" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="649" type="k_dcop : void" name="copy" />
+    <UML:Operation visibility="protected" xmi.id="650" type="void" name="crop" />
+    <UML:Operation visibility="protected" xmi.id="651" type="void" name="cut" />
+    <UML:Operation visibility="protected" xmi.id="652" type="void" name="dialog_brushes" />
+    <UML:Operation visibility="protected" xmi.id="653" type="void" name="dialog_channels" />
+    <UML:Operation visibility="protected" xmi.id="654" type="void" name="dialog_colors" />
+    <UML:Operation visibility="protected" xmi.id="655" type="void" name="dialog_crayons" />
+    <UML:Operation visibility="protected" xmi.id="656" type="void" name="dialog_gradient" />
+    <UML:Operation visibility="protected" xmi.id="657" type="void" name="dialog_layers" />
+    <UML:Operation visibility="protected" xmi.id="658" type="void" name="dialog_patterns" />
+    <UML:Operation visibility="protected" xmi.id="659" type="void" name="hide_layer" />
+    <UML:Operation visibility="protected" xmi.id="660" type="void" name="insert_layer" />
+    <UML:Operation visibility="protected" xmi.id="661" type="void" name="layer_properties" />
+    <UML:Operation visibility="protected" xmi.id="662" type="void" name="link_layer" />
+    <UML:Operation visibility="protected" xmi.id="663" type="void" name="next_layer" />
+    <UML:Operation visibility="protected" xmi.id="664" type="void" name="paste" />
+    <UML:Operation visibility="protected" xmi.id="665" type="void" name="previous_layer" />
+    <UML:Operation visibility="protected" xmi.id="666" type="void" name="removeSelection" />
+    <UML:Operation visibility="protected" xmi.id="667" type="void" name="remove_layer" />
+    <UML:Operation visibility="protected" xmi.id="668" type="void" name="selectAll" />
+    <UML:Operation visibility="protected" xmi.id="669" type="void" name="unSelectAll" />
+    <UML:Attribute visibility="private" xmi.id="646" value="" type="KisView *" name="m_view" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="670" name="KIsImageIface" >
+    <UML:Operation visibility="protected" xmi.id="672" type="K_DCOP public :" name="KIsImageIface" >
+     <UML:Parameter visibility="private" xmi.id="673" value="" type="KisImage *" name="img_" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="674" type="bool" name="alpha" />
+    <UML:Operation visibility="protected" xmi.id="675" type="bool" name="empty" />
+    <UML:Operation visibility="protected" xmi.id="676" type="int" name="height" />
+    <UML:Operation visibility="protected" xmi.id="677" type="k_dcop : QString" name="name" />
+    <UML:Operation visibility="protected" xmi.id="678" type="void" name="setName" >
+     <UML:Parameter visibility="private" xmi.id="679" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="680" type="int" name="width" />
+    <UML:Attribute visibility="private" xmi.id="671" value="" type="KisImage *" name="m_img" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="681" name="KisBrush" >
+    <UML:Operation visibility="public" xmi.id="693" type="" name="KisBrush" >
+     <UML:Parameter visibility="private" xmi.id="694" value="" type="const QString &amp;" name="filename" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="695" type="" name="KisBrush" >
+     <UML:Parameter visibility="private" xmi.id="696" value="" type="const QString &amp;" name="filename" />
+     <UML:Parameter visibility="private" xmi.id="697" value="" type="const QValueVector &lt; Q_UINT8 > &amp;" name="data" />
+     <UML:Parameter visibility="private" xmi.id="698" value="" type="Q_UINT32 &amp;" name="dataPos" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="699" type="virtual enumBrushType" name="brushType" />
+    <UML:Operation visibility="protected" xmi.id="700" type="void" name="createMasks" >
+     <UML:Parameter visibility="private" xmi.id="701" value="" type="const QImage &amp;" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="702" type=TQPOINT_OBJECT_NAME_STRING name="hotSpot" />
+    <UML:Operation visibility="public" xmi.id="703" type="virtual QImage" name="img" />
+    <UML:Operation visibility="public" xmi.id="704" type="virtual bool" name="loadAsync" />
+    <UML:Operation comment="@return a tqmask computed from the grey-level values of the
+pixels in the brush." visibility="public" xmi.id="705" type="virtual KisAlphaMask *" name="tqmask" >
+     <UML:Parameter visibility="private" xmi.id="706" value="" type="Q_INT32" name="scale" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="707" type="virtual bool" name="saveAsync" />
+    <UML:Operation visibility="public" xmi.id="708" type="void" name="setHotSpot" >
+     <UML:Parameter visibility="private" xmi.id="709" value="" type=TQPOINT_OBJECT_NAME_STRING />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="710" type="virtual " name="~KisBrush" />
+    <UML:Attribute visibility="private" xmi.id="682" value="" type="enumBrushType" name="m_brushType" />
+    <UML:Attribute visibility="private" xmi.id="683" value="" type="Q_UINT32" name="m_bytes" />
+    <UML:Attribute visibility="private" xmi.id="684" value="" type="QValueVector" name="m_data" />
+    <UML:Attribute visibility="private" xmi.id="685" value="" type="Q_UINT32" name="m_header_size" />
+    <UML:Attribute visibility="private" xmi.id="686" value="" type="Q_UINT32" name="m_height" />
+    <UML:Attribute visibility="private" xmi.id="687" value="" type=TQPOINT_OBJECT_NAME_STRING name="m_hotSpot" />
+    <UML:Attribute visibility="private" xmi.id="688" value="" type="QImage" name="m_img" />
+    <UML:Attribute visibility="private" xmi.id="689" value="" type="Q_UINT32" name="m_magic_number" />
+    <UML:Attribute visibility="private" xmi.id="690" value="" type="QPtrList" name="m_tqmasks" />
+    <UML:Attribute visibility="private" xmi.id="691" value="" type="Q_UINT32" name="m_version" />
+    <UML:Attribute visibility="private" xmi.id="692" value="" type="Q_UINT32" name="m_width" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="711" name="KisBackground" >
+    <UML:Operation visibility="public" xmi.id="712" type="" name="KisBackground" >
+     <UML:Parameter visibility="private" xmi.id="713" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="714" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="715" value="" type="Q_INT32" name="height" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="716" type="virtual Q_INT32" name="tileNum" >
+     <UML:Parameter visibility="private" xmi.id="717" value="" type="Q_INT32" name="xpix" />
+     <UML:Parameter visibility="private" xmi.id="718" value="" type="Q_INT32" name="ypix" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="719" type="virtual " name="~KisBackground" />
+   </UML:Class>
+   <UML:Enum stereotype="enum" visibility="public" xmi.id="720" name="enumBrushType" >
+    <UML:EnumLiteral visibility="public" xmi.id="721" name="INVALID" />
+    <UML:EnumLiteral visibility="public" xmi.id="722" name="MASK" />
+    <UML:EnumLiteral visibility="public" xmi.id="723" name="IMAGE" />
+    <UML:EnumLiteral visibility="public" xmi.id="724" name="PIPE_MASK" />
+    <UML:EnumLiteral visibility="public" xmi.id="725" name="PIPE_IMAGE" />
+   </UML:Enum>
+   <UML:Class stereotype="class" visibility="public" xmi.id="727" name="KisCommand" >
+    <UML:Operation visibility="public" xmi.id="730" type="" name="KisCommand" >
+     <UML:Parameter visibility="private" xmi.id="731" value="" type="KisUndoAdapter *" name="undoAdapter" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="732" type="" name="KisCommand" >
+     <UML:Parameter visibility="private" xmi.id="733" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="734" value="" type="KisUndoAdapter *" name="undoAdapter" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="735" type="KisUndoAdapter *" name="adapter" />
+    <UML:Operation visibility="public" xmi.id="736" type="virtual void" isAbstract="true" name="execute" />
+    <UML:Operation visibility="public" xmi.id="737" type="virtual QString" name="name" />
+    <UML:Operation visibility="public" xmi.id="738" type="virtual void" isAbstract="true" name="unexecute" />
+    <UML:Operation visibility="public" xmi.id="739" type="virtual " name="~KisCommand" />
+    <UML:Attribute visibility="private" xmi.id="728" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_name" />
+    <UML:Attribute visibility="private" xmi.id="729" value="" type="KisUndoAdapter *" name="m_undoAdapter" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="740" name="KisGuide" >
+    <UML:Operation visibility="public" xmi.id="745" type="" name="KisGuide" >
+     <UML:Parameter visibility="private" xmi.id="746" value="" type="Qt :: Qt::Orientation" name="o" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="747" type="bool" name="isSelected" />
+    <UML:Operation visibility="public" xmi.id="748" type="double" name="position" />
+    <UML:Operation visibility="public" xmi.id="749" type="virtual " name="~KisGuide" />
+    <UML:Attribute visibility="public" xmi.id="741" value="" type=TQPIXMAP_OBJECT_NAME_STRING name="buffer" />
+    <UML:Attribute visibility="public" xmi.id="742" value="" type="bool" name="hasBuffer" />
+    <UML:Attribute visibility="public" xmi.id="743" value="" type="double" name="pos" />
+    <UML:Attribute visibility="public" xmi.id="744" value="" type="bool" name="selected" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="750" name="KisCanvasControllerInterface" >
+    <UML:Operation visibility="protected" xmi.id="751" type="KisCanvasControllerInterface &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="752" value="" type="const KisCanvasControllerInterface &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="753" type="" name="KisCanvasControllerInterface" />
+    <UML:Operation visibility="protected" xmi.id="754" type="" name="KisCanvasControllerInterface" >
+     <UML:Parameter visibility="private" xmi.id="755" value="" type="const KisCanvasControllerInterface &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="756" type="virtual QWidget *" isAbstract="true" name="canvas" />
+    <UML:Operation visibility="public" xmi.id="757" type="virtual Q_INT32" isAbstract="true" name="horzValue" />
+    <UML:Operation visibility="public" xmi.id="758" type="virtual void" isAbstract="true" name="updateCanvas" />
+    <UML:Operation visibility="public" xmi.id="759" type="virtual void" isAbstract="true" name="updateCanvas" >
+     <UML:Parameter visibility="private" xmi.id="760" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="761" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="762" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="763" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="764" type="virtual void" isAbstract="true" name="updateCanvas" >
+     <UML:Parameter visibility="private" xmi.id="765" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="766" type="virtual Q_INT32" isAbstract="true" name="vertValue" />
+    <UML:Operation visibility="public" xmi.id="767" type="virtual void" isAbstract="true" name="viewToWindow" >
+     <UML:Parameter visibility="private" xmi.id="768" value="" type="Q_INT32 *" name="x" />
+     <UML:Parameter visibility="private" xmi.id="769" value="" type="Q_INT32 *" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="770" type="virtual QPoint" isAbstract="true" name="viewToWindow" >
+     <UML:Parameter visibility="private" xmi.id="771" value="" type="const QPoint &amp;" name="pt" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="772" type="virtual QRect" isAbstract="true" name="viewToWindow" >
+     <UML:Parameter visibility="private" xmi.id="773" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="774" type="virtual void" isAbstract="true" name="windowToView" >
+     <UML:Parameter visibility="private" xmi.id="775" value="" type="Q_INT32 *" name="x" />
+     <UML:Parameter visibility="private" xmi.id="776" value="" type="Q_INT32 *" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="777" type="virtual QPoint" isAbstract="true" name="windowToView" >
+     <UML:Parameter visibility="private" xmi.id="778" value="" type="const QPoint &amp;" name="pt" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="779" type="virtual QRect" isAbstract="true" name="windowToView" >
+     <UML:Parameter visibility="private" xmi.id="780" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="781" type="virtual void" isAbstract="true" name="zoomIn" />
+    <UML:Operation visibility="public" xmi.id="782" type="virtual void" isAbstract="true" name="zoomIn" >
+     <UML:Parameter visibility="private" xmi.id="783" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="784" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="785" type="virtual void" isAbstract="true" name="zoomOut" />
+    <UML:Operation visibility="public" xmi.id="786" type="virtual void" isAbstract="true" name="zoomOut" >
+     <UML:Parameter visibility="private" xmi.id="787" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="788" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="789" type="virtual " name="~KisCanvasControllerInterface" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="790" name="KisGuideMgr" >
+    <UML:Operation visibility="public" xmi.id="802" type="" name="KisGuideMgr" />
+    <UML:Operation visibility="public" xmi.id="803" type="KisGuideSP" name="add" >
+     <UML:Parameter visibility="private" xmi.id="804" value="" type="double" name="pos" />
+     <UML:Parameter visibility="private" xmi.id="805" value="" type="Qt :: Qt::Orientation" name="o" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="806" type="void" name="erase" >
+     <UML:Parameter visibility="private" xmi.id="807" value="" type="QPaintDevice *" name="device" />
+     <UML:Parameter visibility="private" xmi.id="808" value="" type="QWidget *" name="w" />
+     <UML:Parameter visibility="private" xmi.id="809" value="" type="Q_INT32" name="xOffset" />
+     <UML:Parameter visibility="private" xmi.id="810" value="" type="Q_INT32" name="yOffset" />
+     <UML:Parameter visibility="private" xmi.id="811" value="" type="double" name="zoom" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="812" type="KisGuideSP" name="tqfind" >
+     <UML:Parameter visibility="private" xmi.id="813" value="" type="double" name="x" />
+     <UML:Parameter visibility="private" xmi.id="814" value="" type="double" name="y" />
+     <UML:Parameter visibility="private" xmi.id="815" value="" type="double" name="d" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="816" type="KisGuideSP" name="findHorizontal" >
+     <UML:Parameter visibility="private" xmi.id="817" value="" type="double" name="y" />
+     <UML:Parameter visibility="private" xmi.id="818" value="" type="double" name="d" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="819" type="KisGuideSP" name="findVertical" >
+     <UML:Parameter visibility="private" xmi.id="820" value="" type="double" name="x" />
+     <UML:Parameter visibility="private" xmi.id="821" value="" type="double" name="d" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="822" type="bool" name="hasSelected" />
+    <UML:Operation visibility="public" xmi.id="823" type="void" name="load" >
+     <UML:Parameter visibility="private" xmi.id="824" value="" type="const QDomElement &amp;" name="element" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="825" type="void" name="moveSelectedByX" >
+     <UML:Parameter visibility="private" xmi.id="826" value="" type="double" name="d" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="827" type="void" name="moveSelectedByY" >
+     <UML:Parameter visibility="private" xmi.id="828" value="" type="double" name="d" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="829" type="void" name="paint" >
+     <UML:Parameter visibility="private" xmi.id="830" value="" type="QPaintDevice *" name="device" />
+     <UML:Parameter visibility="private" xmi.id="831" value="" type="QWidget *" name="w" />
+     <UML:Parameter visibility="private" xmi.id="832" value="" type="Q_INT32" name="xOffset" />
+     <UML:Parameter visibility="private" xmi.id="833" value="" type="Q_INT32" name="yOffset" />
+     <UML:Parameter visibility="private" xmi.id="834" value="" type="double" name="zoom" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="835" type="void" name="remove" >
+     <UML:Parameter visibility="private" xmi.id="836" value="" type="KisGuideSP" name="gd" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="837" type="void" name="removeSelected" />
+    <UML:Operation visibility="public" xmi.id="838" type="void" name="resize" />
+    <UML:Operation visibility="public" xmi.id="839" type="void" name="resize" >
+     <UML:Parameter visibility="private" xmi.id="840" value="" type="const QSize &amp;" name="size" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="841" type="void" name="resizeLinesPixmap" >
+     <UML:Parameter visibility="private" xmi.id="842" value="" type="const QSize &amp;" name="size" />
+     <UML:Parameter visibility="private" xmi.id="843" value="" type="QPixmap *" name="vLine" />
+     <UML:Parameter visibility="private" xmi.id="844" value="" type="QPixmap *" name="hLine" />
+     <UML:Parameter visibility="private" xmi.id="845" value="" type="QPixmap *" name="linePattern" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="846" type="void" name="save" >
+     <UML:Parameter visibility="private" xmi.id="847" value="" type="QDomElement &amp;" name="element" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="848" type="void" name="select" >
+     <UML:Parameter visibility="private" xmi.id="849" value="" type="KisGuideSP" name="gd" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="850" type="void" name="selectAll" />
+    <UML:Operation visibility="public" xmi.id="851" type="Q_INT32" name="selectedCount" />
+    <UML:Operation visibility="public" xmi.id="852" type="void" name="unselect" >
+     <UML:Parameter visibility="private" xmi.id="853" value="" type="KisGuideSP" name="gd" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="854" type="void" name="unselectAll" />
+    <UML:Operation visibility="public" xmi.id="855" type="" name="~KisGuideMgr" />
+    <UML:Attribute visibility="private" xmi.id="791" value="" type=TQPIXMAP_OBJECT_NAME_STRING name="m_hGuideLines" />
+    <UML:Attribute visibility="private" xmi.id="792" value="" type=TQPIXMAP_OBJECT_NAME_STRING name="m_hGuideLinesSelected" />
+    <UML:Attribute visibility="private" xmi.id="793" value="" type="vKisGuideSP" name="m_lines" />
+    <UML:Attribute visibility="private" xmi.id="794" value="" type=TQPIXMAP_OBJECT_NAME_STRING name="m_pattern" />
+    <UML:Attribute visibility="private" xmi.id="795" value="" type=TQPIXMAP_OBJECT_NAME_STRING name="m_patternSelected" />
+    <UML:Attribute visibility="private" xmi.id="796" value="" type="QSize" name="m_size" />
+    <UML:Attribute visibility="private" xmi.id="797" value="" type="vKisGuideSP" name="m_slines" />
+    <UML:Attribute visibility="private" xmi.id="798" value="" type=TQPIXMAP_OBJECT_NAME_STRING name="m_vGuideLines" />
+    <UML:Attribute visibility="private" xmi.id="799" value="" type=TQPIXMAP_OBJECT_NAME_STRING name="m_vGuideLinesSelected" />
+    <UML:Attribute visibility="private" xmi.id="800" value="" type="const char * []" name="s_xbm" />
+    <UML:Attribute visibility="private" xmi.id="801" value="" type="const char * []" name="s_xbm_selected" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="856" name="KisGradient" >
+    <UML:Operation visibility="public" xmi.id="861" type="" name="KisGradient" />
+    <UML:Operation visibility="public" xmi.id="862" type="uint" name="arrayPixelValue" >
+     <UML:Parameter visibility="private" xmi.id="863" value="" type="int" name="x" />
+     <UML:Parameter visibility="private" xmi.id="864" value="" type="int" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="865" type="QImage &amp;" name="dither" >
+     <UML:Parameter visibility="private" xmi.id="866" value="" type="QImage &amp;" name="img" />
+     <UML:Parameter visibility="private" xmi.id="867" value="" type="const QColor *" name="palette" />
+     <UML:Parameter visibility="private" xmi.id="868" value="" type="int" name="size" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="869" type="QImage" name="gradient" >
+     <UML:Parameter visibility="private" xmi.id="870" value="" type="const QSize &amp;" name="size" />
+     <UML:Parameter visibility="private" xmi.id="871" value="" type="const QColor &amp;" name="ca" />
+     <UML:Parameter visibility="private" xmi.id="872" value="" type="const QColor &amp;" name="cb" />
+     <UML:Parameter visibility="private" xmi.id="873" value="" type="KImageEffect :: GradientType" name="eff" />
+     <UML:Parameter visibility="private" xmi.id="874" value="" type="int" name="ncols" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="875" type="const int" name="height" />
+    <UML:Operation visibility="public" xmi.id="876" type="uint" name="imagePixelValue" >
+     <UML:Parameter visibility="private" xmi.id="877" value="" type="int" name="x" />
+     <UML:Parameter visibility="private" xmi.id="878" value="" type="int" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="879" type="void" name="mapHorGradient" >
+     <UML:Parameter visibility="private" xmi.id="880" value="" type="QRect" name="gradR" />
+     <UML:Parameter visibility="private" xmi.id="881" value="" type="KoColor" name="startColor" />
+     <UML:Parameter visibility="private" xmi.id="882" value="" type="KoColor" name="endColor" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="883" type="void" name="mapKdeGradient" >
+     <UML:Parameter visibility="private" xmi.id="884" value="" type="QRect" name="gradR" />
+     <UML:Parameter visibility="private" xmi.id="885" value="" type="KoColor" name="startColor" />
+     <UML:Parameter visibility="private" xmi.id="886" value="" type="KoColor" name="endColor" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="887" type="void" name="mapVertGradient" >
+     <UML:Parameter visibility="private" xmi.id="888" value="" type="QRect" name="gradR" />
+     <UML:Parameter visibility="private" xmi.id="889" value="" type="KoColor" name="startColor" />
+     <UML:Parameter visibility="private" xmi.id="890" value="" type="KoColor" name="endColor" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="891" type="int" name="nearestColor" >
+     <UML:Parameter visibility="private" xmi.id="892" value="" type="int" name="r" />
+     <UML:Parameter visibility="private" xmi.id="893" value="" type="int" name="g" />
+     <UML:Parameter visibility="private" xmi.id="894" value="" type="int" name="b" />
+     <UML:Parameter visibility="private" xmi.id="895" value="" type="const QColor *" name="palette" />
+     <UML:Parameter visibility="private" xmi.id="896" value="" type="int" name="size" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="897" type="void" name="setEffect" >
+     <UML:Parameter visibility="private" xmi.id="898" value="" type="KImageEffect :: GradientType" name="_effect" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="899" type="void" name="setNull" />
+    <UML:Operation visibility="public" xmi.id="900" type="const int" name="width" />
+    <UML:Operation visibility="public" xmi.id="901" type="" name="~KisGradient" />
+    <UML:Attribute visibility="private" xmi.id="857" value="" type="QMemArray" name="gradArray" />
+    <UML:Attribute visibility="private" xmi.id="858" value="" type="QImage" name="gradImage" />
+    <UML:Attribute visibility="private" xmi.id="859" value="" type="int" name="mGradientHeight" />
+    <UML:Attribute visibility="private" xmi.id="860" value="" type="int" name="mGradientWidth" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="902" name="KisDoc" >
+    <UML:Operation visibility="public" xmi.id="914" type="" name="KisDoc" >
+     <UML:Parameter visibility="private" xmi.id="915" value="" type="QWidget *" name="tqparentWidget" />
+     <UML:Parameter visibility="private" xmi.id="916" value="" type="const char *" name="widgetName" />
+     <UML:Parameter visibility="private" xmi.id="917" value="" type="QObject *" name="tqparent" />
+     <UML:Parameter visibility="private" xmi.id="918" value="" type="const char *" name="name" />
+     <UML:Parameter visibility="private" xmi.id="919" value="" type="bool" name="singleViewMode" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="920" type="virtual void" name="addCommand" >
+     <UML:Parameter visibility="private" xmi.id="921" value="" type="KCommand *" name="cmd" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="922" type="void" name="addImage" >
+     <UML:Parameter visibility="private" xmi.id="923" value="" type="KisImageSP" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="924" type="virtual void" name="beginMacro" >
+     <UML:Parameter visibility="private" xmi.id="925" value="" type="const QString &amp;" name="macroName" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="926" type="KisSelectionSP" name="clipboardSelection" />
+    <UML:Operation visibility="public" xmi.id="927" type="virtual bool" name="completeLoading" >
+     <UML:Parameter visibility="private" xmi.id="928" value="" type="KoStore *" name="store" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="929" type="virtual bool" name="completeSaving" >
+     <UML:Parameter visibility="private" xmi.id="930" value="" type="KoStore *" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="931" type="bool" name="tqcontains" >
+     <UML:Parameter visibility="private" xmi.id="932" value="" type="KisImageSP" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="933" type="virtual KoView *" name="createViewInstance" >
+     <UML:Parameter visibility="private" xmi.id="934" value="" type="QWidget *" name="tqparent" />
+     <UML:Parameter visibility="private" xmi.id="935" value="" type="const char *" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="936" type="virtual DCOPObject *" name="dcopObject" />
+    <UML:Operation visibility="public" xmi.id="937" type="bool" name="empty" />
+    <UML:Operation visibility="protected" xmi.id="938" type="virtual void" name="endMacro" />
+    <UML:Operation visibility="public" xmi.id="939" type="KisImageSP" name="findImage" >
+     <UML:Parameter visibility="private" xmi.id="940" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="941" type="Q_INT32" name="imageIndex" >
+     <UML:Parameter visibility="private" xmi.id="942" value="" type="KisImageSP" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="943" type="KisImageSP" name="imageNum" >
+     <UML:Parameter visibility="private" xmi.id="944" value="" type="Q_UINT32" name="num" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="945" type=TQSTRINGLIST_OBJECT_NAME_STRING name="images" />
+    <UML:Operation visibility="public" xmi.id="946" type="bool" name="importImage" >
+     <UML:Parameter visibility="private" xmi.id="947" value="" type="const QString &amp;" name="filename" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="948" type="virtual bool" name="inMacro" />
+    <UML:Operation visibility="protected" xmi.id="949" type="bool" name="init" />
+    <UML:Operation visibility="public" xmi.id="950" type="virtual bool" name="initDoc" />
+    <UML:Operation visibility="public" xmi.id="951" type="virtual bool" name="isEmpty" />
+    <UML:Operation visibility="public" xmi.id="952" type="KisLayerSP" name="layerAdd" >
+     <UML:Parameter visibility="private" xmi.id="953" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="954" value="" type="KisLayerSP" name="layer" />
+     <UML:Parameter visibility="private" xmi.id="955" value="" type="Q_INT32" name="position" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="956" type="KisLayerSP" name="layerAdd" >
+     <UML:Parameter visibility="private" xmi.id="957" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="958" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="959" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="960" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="961" value="" type="CompositeOp" name="compositeOp" />
+     <UML:Parameter visibility="private" xmi.id="962" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="963" value="" type=TQPOINT_OBJECT_NAME_STRING name="pos" />
+     <UML:Parameter visibility="private" xmi.id="964" value="" type="enumImgType" name="type" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="965" type="KisLayerSP" name="layerAdd" >
+     <UML:Parameter visibility="private" xmi.id="966" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="967" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="968" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="969" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="970" value="" type="QUANTUM" name="devOpacity" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="971" type="KisLayerSP" name="layerAdd" >
+     <UML:Parameter visibility="private" xmi.id="972" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="973" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="974" value="" type="KisSelectionSP" name="selection" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="975" type="void" name="layerLower" >
+     <UML:Parameter visibility="private" xmi.id="976" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="977" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="978" type="void" name="layerNext" >
+     <UML:Parameter visibility="private" xmi.id="979" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="980" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="981" type="void" name="layerPrev" >
+     <UML:Parameter visibility="private" xmi.id="982" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="983" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="984" type="void" name="layerRaise" >
+     <UML:Parameter visibility="private" xmi.id="985" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="986" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="987" type="void" name="layerRemove" >
+     <UML:Parameter visibility="private" xmi.id="988" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="989" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="990" type="KisChannelSP" name="loadChannel" >
+     <UML:Parameter visibility="private" xmi.id="991" value="" type="const QDomElement &amp;" name="elem" />
+     <UML:Parameter visibility="private" xmi.id="992" value="" type="KisImageSP" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="993" type="KisImageSP" name="loadImage" >
+     <UML:Parameter visibility="private" xmi.id="994" value="" type="const QDomElement &amp;" name="elem" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="995" type="KisLayerSP" name="loadLayer" >
+     <UML:Parameter visibility="private" xmi.id="996" value="" type="const QDomElement &amp;" name="elem" />
+     <UML:Parameter visibility="private" xmi.id="997" value="" type="KisImageSP" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="998" type="virtual bool" name="loadOasis" >
+     <UML:Parameter visibility="private" xmi.id="999" value="" type="const QDomDocument &amp;" />
+     <UML:Parameter visibility="private" xmi.id="1000" value="" type="KoOasisStyles &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1001" type="virtual bool" name="loadXML" >
+     <UML:Parameter visibility="private" xmi.id="1002" value="" type="QIODevice *" />
+     <UML:Parameter visibility="private" xmi.id="1003" value="" type="const QDomDocument &amp;" name="doc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1004" type="virtual QCString" name="mimeType" />
+    <UML:Operation visibility="public" xmi.id="1005" type="bool" name="namePresent" >
+     <UML:Parameter visibility="private" xmi.id="1006" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1007" type="KisImageSP" name="newImage" >
+     <UML:Parameter visibility="private" xmi.id="1008" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="1009" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1010" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="1011" value="" type="enumImgType" name="type" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1012" type=TQSTRING_OBJECT_NAME_STRING name="nextImageName" />
+    <UML:Operation visibility="public" xmi.id="1013" type="Q_INT32" name="nimages" />
+    <UML:Operation visibility="public" xmi.id="1014" type="virtual void" name="paintContent" >
+     <UML:Parameter visibility="private" xmi.id="1015" value="" type="QPainter &amp;" name="painter" />
+     <UML:Parameter visibility="private" xmi.id="1016" value="" type="const QRect &amp;" name="rect" />
+     <UML:Parameter visibility="private" xmi.id="1017" value="" type="bool" name="transparent" />
+     <UML:Parameter visibility="private" xmi.id="1018" value="" type="double" name="zoomX" />
+     <UML:Parameter visibility="private" xmi.id="1019" value="" type="double" name="zoomY" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1020" type="Q_INT32" name="redoLimit" />
+    <UML:Operation visibility="public" xmi.id="1021" type="void" name="removeImage" >
+     <UML:Parameter visibility="private" xmi.id="1022" value="" type="KisImageSP" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1023" type="void" name="removeImage" >
+     <UML:Parameter visibility="private" xmi.id="1024" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1025" type="void" name="renameImage" >
+     <UML:Parameter visibility="private" xmi.id="1026" value="" type="const QString &amp;" name="oldName" />
+     <UML:Parameter visibility="private" xmi.id="1027" value="" type="const QString &amp;" name="newName" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1028" type="QDomElement" name="saveChannel" >
+     <UML:Parameter visibility="private" xmi.id="1029" value="" type="QDomDocument &amp;" name="doc" />
+     <UML:Parameter visibility="private" xmi.id="1030" value="" type="KisChannelSP" name="channel" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1031" type="QDomElement" name="saveImage" >
+     <UML:Parameter visibility="private" xmi.id="1032" value="" type="QDomDocument &amp;" name="doc" />
+     <UML:Parameter visibility="private" xmi.id="1033" value="" type="KisImageSP" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1034" type="QDomElement" name="saveLayer" >
+     <UML:Parameter visibility="private" xmi.id="1035" value="" type="QDomDocument &amp;" name="doc" />
+     <UML:Parameter visibility="private" xmi.id="1036" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1037" type="virtual QDomDocument" name="saveXML" />
+    <UML:Operation visibility="public" xmi.id="1038" type="void" name="setClipboardSelection" >
+     <UML:Parameter visibility="private" xmi.id="1039" value="" type="KisSelectionSP" name="selection" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1040" type="void" name="setLayerProperties" >
+     <UML:Parameter visibility="private" xmi.id="1041" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="1042" value="" type="KisLayerSP" name="layer" />
+     <UML:Parameter visibility="private" xmi.id="1043" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="1044" value="" type="CompositeOp" name="compositeOp" />
+     <UML:Parameter visibility="private" xmi.id="1045" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1046" type="void" name="setProjection" >
+     <UML:Parameter visibility="private" xmi.id="1047" value="" type="KisImageSP" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1048" type="void" name="setRedoLimit" >
+     <UML:Parameter visibility="private" xmi.id="1049" value="" type="Q_INT32" name="limit" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1050" type="virtual void" name="setUndo" >
+     <UML:Parameter visibility="private" xmi.id="1051" value="" type="bool" name="undo" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1052" type="void" name="setUndoLimit" >
+     <UML:Parameter visibility="private" xmi.id="1053" value="" type="Q_INT32" name="limit" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1054" type="void" name="setupColorspaces" />
+    <UML:Operation visibility="protected" xmi.id="1055" type="virtual bool" name="undo" />
+    <UML:Operation visibility="public" xmi.id="1056" type="Q_INT32" name="undoLimit" />
+    <UML:Operation visibility="public" xmi.id="1057" type="virtual " name="~KisDoc" />
+    <UML:Attribute visibility="private" xmi.id="903" value="" type="KisSelectionSP" name="m_clipboard" />
+    <UML:Attribute visibility="private" xmi.id="904" value="" type="KCommandHistory *" name="m_cmdHistory" />
+    <UML:Attribute visibility="private" xmi.id="905" value="" type="KisStrategyColorSpaceMap" name="m_colorspaces" />
+    <UML:Attribute visibility="private" xmi.id="906" value="" type="Q_INT32" name="m_conversionDepth" />
+    <UML:Attribute visibility="private" xmi.id="907" value="" type="KMacroCommand *" name="m_currentMacro" />
+    <UML:Attribute visibility="private" xmi.id="908" value="" type="DCOPObject *" name="m_dcop" />
+    <UML:Attribute visibility="private" xmi.id="909" value="" type="vKisImageSP" name="m_images" />
+    <UML:Attribute visibility="private" xmi.id="910" value="" type="KisNameServer *" name="m_nserver" />
+    <UML:Attribute visibility="private" xmi.id="911" value="" type="KisImageSP" name="m_projection" />
+    <UML:Attribute visibility="private" xmi.id="912" value="" type="bool" name="m_pushedClipboard" />
+    <UML:Attribute visibility="private" xmi.id="913" value="" type="bool" name="m_undo" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1058" name="KisCursor" >
+    <UML:Operation visibility="public" xmi.id="1059" type="" name="KisCursor" />
+    <UML:Operation visibility="public" xmi.id="1060" type="QCursor" name="airbrushCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1061" type="QCursor" name="arrowCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1062" type="QCursor" name="blankCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1063" type="QCursor" name="brushCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1064" type="QCursor" name="colorChangerCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1065" type="QCursor" name="crossCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1066" type="QCursor" name="eraserCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1067" type="QCursor" name="fillerCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1068" type="QCursor" name="handCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1069" type="QCursor" name="ibeamCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1070" type="QCursor" name="moveCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1071" type="QCursor" name="penCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1072" type="QCursor" name="pickerCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1073" type="QCursor" name="pointingHandCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1074" type="QCursor" name="selectCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1075" type="QCursor" name="sizeAllCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1076" type="QCursor" name="sizeBDiagCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1077" type="QCursor" name="sizeFDiagCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1078" type="QCursor" name="sizeHorCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1079" type="QCursor" name="sizeVerCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1080" type="QCursor" name="splitHCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1081" type="QCursor" name="splitVCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1082" type="QCursor" name="upArrowCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1083" type="QCursor" name="waitCursor" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1084" type="QCursor" name="zoomCursor" ownerScope="classifier" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1085" name="KisConfig" >
+    <UML:Operation visibility="protected" xmi.id="1087" type="KisConfig &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="1088" value="" type="const KisConfig &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1089" type="" name="KisConfig" />
+    <UML:Operation visibility="protected" xmi.id="1090" type="" name="KisConfig" >
+     <UML:Parameter visibility="private" xmi.id="1091" value="" type="const KisConfig &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1092" type="Q_INT32" name="defImgHeight" />
+    <UML:Operation visibility="public" xmi.id="1093" type="Q_INT32" name="defImgWidth" />
+    <UML:Operation visibility="public" xmi.id="1094" type="Q_INT32" name="defLayerHeight" />
+    <UML:Operation visibility="public" xmi.id="1095" type="Q_INT32" name="defLayerWidth" />
+    <UML:Operation visibility="public" xmi.id="1096" type="Q_INT32" name="maxImgHeight" />
+    <UML:Operation visibility="public" xmi.id="1097" type="Q_INT32" name="maxImgWidth" />
+    <UML:Operation visibility="public" xmi.id="1098" type="Q_INT32" name="maxLayerHeight" />
+    <UML:Operation visibility="public" xmi.id="1099" type="Q_INT32" name="maxLayerWidth" />
+    <UML:Operation visibility="public" xmi.id="1100" type="" name="~KisConfig" />
+    <UML:Attribute visibility="private" xmi.id="1086" value="" type="mutable KConfig *" name="m_cfg" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1101" name="KisCanvasObserver" >
+    <UML:Operation visibility="protected" xmi.id="1102" type="KisCanvasObserver &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="1103" value="" type="const KisCanvasObserver &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1104" type="" name="KisCanvasObserver" />
+    <UML:Operation visibility="protected" xmi.id="1105" type="" name="KisCanvasObserver" >
+     <UML:Parameter visibility="private" xmi.id="1106" value="" type="const KisCanvasObserver &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1107" type="virtual void" isAbstract="true" name="update" >
+     <UML:Parameter visibility="private" xmi.id="1108" value="" type="KisCanvasSubject *" name="subject" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1109" type="virtual " name="~KisCanvasObserver" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1110" name="KisFactory" >
+    <UML:Operation visibility="public" xmi.id="1115" type="" name="KisFactory" >
+     <UML:Parameter visibility="private" xmi.id="1116" value="" type="QObject *" name="tqparent" />
+     <UML:Parameter visibility="private" xmi.id="1117" value="" type="const char *" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1118" type="KAboutData *" name="aboutData" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1119" type="virtual KParts :: Part *" name="createPartObject" >
+     <UML:Parameter visibility="private" xmi.id="1120" value="" type="QWidget *" name="tqparentWidget" />
+     <UML:Parameter visibility="private" xmi.id="1121" value="" type="const char *" name="widgetName" />
+     <UML:Parameter visibility="private" xmi.id="1122" value="" type="QObject *" name="tqparent" />
+     <UML:Parameter visibility="private" xmi.id="1123" value="" type="const char *" name="name" />
+     <UML:Parameter visibility="private" xmi.id="1124" value="" type="const char *" name="classname" />
+     <UML:Parameter visibility="private" xmi.id="1125" value="" type="const QStringList &amp;" name="args" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1126" type="KInstance *" name="global" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1127" type="KisPluginServer *" name="pServer" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1128" type="KisResourceServer *" name="rServer" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="1129" type="" name="~KisFactory" />
+    <UML:Attribute visibility="private" xmi.id="1111" value="" type="KAboutData *" name="s_aboutData" />
+    <UML:Attribute visibility="private" xmi.id="1112" value="" type="KInstance *" name="s_global" />
+    <UML:Attribute visibility="private" xmi.id="1113" value="" type="KisPluginServer *" name="s_pserver" />
+    <UML:Attribute visibility="private" xmi.id="1114" value="" type="KisResourceServer *" name="s_rserver" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1130" name="KisChannel" >
+    <UML:Operation visibility="public" xmi.id="1131" type="" name="KisChannel" >
+     <UML:Parameter visibility="private" xmi.id="1132" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="1133" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1134" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="1135" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="1136" value="" type="const KoColor &amp;" name="color" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1137" type="" name="KisChannel" >
+     <UML:Parameter visibility="private" xmi.id="1138" value="" type="const KisChannel &amp;" name="rhs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1139" type="void" name="border" >
+     <UML:Parameter visibility="private" xmi.id="1140" value="" type="Q_INT32" name="xradius" />
+     <UML:Parameter visibility="private" xmi.id="1141" value="" type="Q_INT32" name="yradius" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1142" type="bool" name="bounds" >
+     <UML:Parameter visibility="private" xmi.id="1143" value="" type="QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1144" type="void" name="clear" />
+    <UML:Operation visibility="public" xmi.id="1145" type="KoColor" name="color" />
+    <UML:Operation visibility="public" xmi.id="1146" type="void" name="color" >
+     <UML:Parameter visibility="private" xmi.id="1147" value="" type="KoColor" name="clr" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1148" type="KisChannelSP" name="createMask" >
+     <UML:Parameter visibility="private" xmi.id="1149" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="1150" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1151" type="bool" name="empty" />
+    <UML:Operation visibility="public" xmi.id="1152" type="void" name="feather" />
+    <UML:Operation visibility="public" xmi.id="1153" type="void" name="grow" >
+     <UML:Parameter visibility="private" xmi.id="1154" value="" type="Q_INT32" name="xradius" />
+     <UML:Parameter visibility="private" xmi.id="1155" value="" type="Q_INT32" name="yradius" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1156" type="void" name="invert" />
+    <UML:Operation visibility="public" xmi.id="1157" type="QUANTUM" name="opacity" />
+    <UML:Operation visibility="public" xmi.id="1158" type="void" name="opacity" >
+     <UML:Parameter visibility="private" xmi.id="1159" value="" type="QUANTUM" name="val" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1160" type="void" name="shrink" >
+     <UML:Parameter visibility="private" xmi.id="1161" value="" type="Q_INT32" name="xradius" />
+     <UML:Parameter visibility="private" xmi.id="1162" value="" type="Q_INT32" name="yradius" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1163" type="void" name="translate" >
+     <UML:Parameter visibility="private" xmi.id="1164" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1165" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1166" type="Q_INT32" name="value" >
+     <UML:Parameter visibility="private" xmi.id="1167" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1168" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1169" type="virtual " name="~KisChannel" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1170" name="KisCanvasSubject" >
+    <UML:Operation visibility="protected" xmi.id="1171" type="KisCanvasSubject &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="1172" value="" type="const KisCanvasSubject &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1173" type="" name="KisCanvasSubject" />
+    <UML:Operation visibility="protected" xmi.id="1174" type="" name="KisCanvasSubject" >
+     <UML:Parameter visibility="private" xmi.id="1175" value="" type="const KisCanvasSubject &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1176" type="virtual void" isAbstract="true" name="attach" >
+     <UML:Parameter visibility="private" xmi.id="1177" value="" type="KisCanvasObserver *" name="observer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1178" type="virtual KoColor" isAbstract="true" name="bgColor" />
+    <UML:Operation visibility="public" xmi.id="1179" type="virtual KisCanvasControllerInterface *" isAbstract="true" name="canvasController" />
+    <UML:Operation visibility="public" xmi.id="1180" type="virtual KisBrush *" isAbstract="true" name="currentBrush" />
+    <UML:Operation visibility="public" xmi.id="1181" type="virtual KisGradient *" isAbstract="true" name="currentGradient" />
+    <UML:Operation visibility="public" xmi.id="1182" type="virtual KisImageSP" isAbstract="true" name="currentImg" />
+    <UML:Operation visibility="public" xmi.id="1183" type="virtual QString" isAbstract="true" name="currentImgName" />
+    <UML:Operation visibility="public" xmi.id="1184" type="virtual KisPattern *" isAbstract="true" name="currentPattern" />
+    <UML:Operation visibility="public" xmi.id="1185" type="virtual void" isAbstract="true" name="detach" >
+     <UML:Parameter visibility="private" xmi.id="1186" value="" type="KisCanvasObserver *" name="observer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1187" type="virtual KoDocument *" isAbstract="true" name="document" />
+    <UML:Operation visibility="public" xmi.id="1188" type="virtual KoColor" isAbstract="true" name="fgColor" />
+    <UML:Operation visibility="public" xmi.id="1189" type="virtual void" isAbstract="true" name="notify" />
+    <UML:Operation visibility="public" xmi.id="1190" type="virtual void" isAbstract="true" name="setBGColor" >
+     <UML:Parameter visibility="private" xmi.id="1191" value="" type="const KoColor &amp;" name="c" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1192" type="virtual void" isAbstract="true" name="setFGColor" >
+     <UML:Parameter visibility="private" xmi.id="1193" value="" type="const KoColor &amp;" name="c" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1194" type="virtual KisToolControllerInterface *" isAbstract="true" name="toolController" />
+    <UML:Operation visibility="public" xmi.id="1195" type="virtual KisUndoAdapter *" isAbstract="true" name="undoAdapter" />
+    <UML:Operation visibility="public" xmi.id="1196" type="virtual double" isAbstract="true" name="zoomFactor" />
+    <UML:Operation visibility="public" xmi.id="1197" type="virtual " name="~KisCanvasSubject" />
+   </UML:Class>
+   <UML:Enum stereotype="enum" visibility="public" xmi.id="1198" name="CompositeOp" >
+    <UML:EnumLiteral visibility="public" xmi.id="1199" name="COMPOSITE_UNDEF" />
+    <UML:EnumLiteral visibility="public" xmi.id="1200" name="COMPOSITE_OVER" />
+    <UML:EnumLiteral visibility="public" xmi.id="1201" name="COMPOSITE_IN" />
+    <UML:EnumLiteral visibility="public" xmi.id="1202" name="COMPOSITE_OUT" />
+    <UML:EnumLiteral visibility="public" xmi.id="1203" name="COMPOSITE_ATOP" />
+    <UML:EnumLiteral visibility="public" xmi.id="1204" name="COMPOSITE_XOR" />
+    <UML:EnumLiteral visibility="public" xmi.id="1205" name="COMPOSITE_PLUS" />
+    <UML:EnumLiteral visibility="public" xmi.id="1206" name="COMPOSITE_MINUS" />
+    <UML:EnumLiteral visibility="public" xmi.id="1207" name="COMPOSITE_ADD" />
+    <UML:EnumLiteral visibility="public" xmi.id="1208" name="COMPOSITE_SUBTRACT" />
+    <UML:EnumLiteral visibility="public" xmi.id="1209" name="COMPOSITE_DIFF" />
+    <UML:EnumLiteral visibility="public" xmi.id="1210" name="COMPOSITE_MULT" />
+    <UML:EnumLiteral visibility="public" xmi.id="1211" name="COMPOSITE_BUMPMAP" />
+    <UML:EnumLiteral visibility="public" xmi.id="1212" name="COMPOSITE_COPY" />
+    <UML:EnumLiteral visibility="public" xmi.id="1213" name="COMPOSITE_COPY_RED" />
+    <UML:EnumLiteral visibility="public" xmi.id="1214" name="COMPOSITE_COPY_GREEN" />
+    <UML:EnumLiteral visibility="public" xmi.id="1215" name="COMPOSITE_COPY_BLUE" />
+    <UML:EnumLiteral visibility="public" xmi.id="1216" name="COMPOSITE_COPY_OPACITY" />
+    <UML:EnumLiteral visibility="public" xmi.id="1217" name="COMPOSITE_CLEAR" />
+    <UML:EnumLiteral visibility="public" xmi.id="1218" name="COMPOSITE_DISSOLVE" />
+    <UML:EnumLiteral visibility="public" xmi.id="1219" name="COMPOSITE_DISPLACE" />
+    <UML:EnumLiteral visibility="public" xmi.id="1220" name="COMPOSITE_MODULATE" />
+    <UML:EnumLiteral visibility="public" xmi.id="1221" name="COMPOSITE_THRESHOLD" />
+    <UML:EnumLiteral visibility="public" xmi.id="1222" name="COMPOSITE_NO" />
+    <UML:EnumLiteral visibility="public" xmi.id="1223" name="COMPOSITE_DARKEN" />
+    <UML:EnumLiteral visibility="public" xmi.id="1224" name="COMPOSITE_LIGHTEN" />
+    <UML:EnumLiteral visibility="public" xmi.id="1225" name="COMPOSITE_HUE" />
+    <UML:EnumLiteral visibility="public" xmi.id="1226" name="COMPOSITE_SATURATE" />
+    <UML:EnumLiteral visibility="public" xmi.id="1227" name="COMPOSITE_COLORIZE" />
+    <UML:EnumLiteral visibility="public" xmi.id="1228" name="COMPOSITE_LUMINIZE" />
+    <UML:EnumLiteral visibility="public" xmi.id="1229" name="COMPOSITE_SCREEN" />
+    <UML:EnumLiteral visibility="public" xmi.id="1230" name="COMPOSITE_OVERLAY" />
+    <UML:EnumLiteral visibility="public" xmi.id="1231" name="COMPOSITE_COPY_CYAN" />
+    <UML:EnumLiteral visibility="public" xmi.id="1232" name="COMPOSITE_COPY_MAGENTA" />
+    <UML:EnumLiteral visibility="public" xmi.id="1233" name="COMPOSITE_COPY_YELLOW" />
+    <UML:EnumLiteral visibility="public" xmi.id="1234" name="COMPOSITE_COPY_BLACK" />
+    <UML:EnumLiteral visibility="public" xmi.id="1235" name="COMPOSITE_NORMAL" />
+    <UML:EnumLiteral visibility="public" xmi.id="1236" name="COMPOSITE_ERASE" />
+   </UML:Enum>
+   <UML:Enum stereotype="enum" visibility="public" xmi.id="1237" name="enumImgType" >
+    <UML:EnumLiteral visibility="public" xmi.id="1238" name="IMAGE_TYPE_UNKNOWN" />
+    <UML:EnumLiteral visibility="public" xmi.id="1239" name="IMAGE_TYPE_INDEXED" />
+    <UML:EnumLiteral visibility="public" xmi.id="1240" name="IMAGE_TYPE_INDEXEDA" />
+    <UML:EnumLiteral visibility="public" xmi.id="1241" name="IMAGE_TYPE_GREY" />
+    <UML:EnumLiteral visibility="public" xmi.id="1242" name="IMAGE_TYPE_GREYA" />
+    <UML:EnumLiteral visibility="public" xmi.id="1243" name="IMAGE_TYPE_RGB" />
+    <UML:EnumLiteral visibility="public" xmi.id="1244" name="IMAGE_TYPE_RGBA" />
+    <UML:EnumLiteral visibility="public" xmi.id="1245" name="IMAGE_TYPE_CMYK" />
+    <UML:EnumLiteral visibility="public" xmi.id="1246" name="IMAGE_TYPE_CMYKA" />
+    <UML:EnumLiteral visibility="public" xmi.id="1247" name="IMAGE_TYPE_LAB" />
+    <UML:EnumLiteral visibility="public" xmi.id="1248" name="IMAGE_TYPE_LABA" />
+    <UML:EnumLiteral visibility="public" xmi.id="1249" name="IMAGE_TYPE_YUV" />
+    <UML:EnumLiteral visibility="public" xmi.id="1250" name="IMAGE_TYPE_YUVA" />
+   </UML:Enum>
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="1251" name="KisGuideSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="1252" name="vKisGuideSP_it" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="1253" name="QUANTUM" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="1254" name="CHANNELTYPE" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="1255" name="PIXELTYPE" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="1256" name="vKisGuideSP_cit" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="1257" name="vKisGuideSP" />
+   <UML:Class stereotype="class" visibility="public" xmi.id="1259" name="KisImage" >
+    <UML:Operation visibility="protected" xmi.id="1292" type="KisImage &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="1293" value="" type="const KisImage &amp;" name="rhs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1294" type="" name="KisImage" >
+     <UML:Parameter visibility="private" xmi.id="1295" value="" type="KisUndoAdapter *" name="undoAdapter" />
+     <UML:Parameter visibility="private" xmi.id="1296" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1297" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="1298" value="" type="const enumImgType &amp;" name="imgType" />
+     <UML:Parameter visibility="private" xmi.id="1299" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1300" type="" name="KisImage" >
+     <UML:Parameter visibility="private" xmi.id="1301" value="" type="const KisImage &amp;" name="rhs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1302" type="KisChannelSP" name="activate" >
+     <UML:Parameter visibility="private" xmi.id="1303" value="" type="KisChannelSP" name="channel" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1304" type="KisLayerSP" name="activate" >
+     <UML:Parameter visibility="private" xmi.id="1305" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1306" type="KisChannelSP" name="activateChannel" >
+     <UML:Parameter visibility="private" xmi.id="1307" value="" type="Q_INT32" name="n" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1308" type="KisLayerSP" name="activateLayer" >
+     <UML:Parameter visibility="private" xmi.id="1309" value="" type="Q_INT32" name="n" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1310" type="KisChannelSP" name="activeChannel" />
+    <UML:Operation visibility="public" xmi.id="1311" type="bool" name="activeComponent" >
+     <UML:Parameter visibility="private" xmi.id="1312" value="" type="CHANNELTYPE" name="type" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1313" type="void" name="activeComponent" >
+     <UML:Parameter visibility="private" xmi.id="1314" value="" type="CHANNELTYPE" name="type" />
+     <UML:Parameter visibility="private" xmi.id="1315" value="" type="bool" name="active" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1316" type="KisPaintDeviceSP" name="activeDevice" />
+    <UML:Operation visibility="public" xmi.id="1317" type="const KisLayerSP" name="activeLayer" />
+    <UML:Operation visibility="public" xmi.id="1318" type="bool" name="add" >
+     <UML:Parameter visibility="private" xmi.id="1319" value="" type="KisChannelSP" name="channel" />
+     <UML:Parameter visibility="private" xmi.id="1320" value="" type="Q_INT32" name="position" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1321" type="bool" name="add" >
+     <UML:Parameter visibility="private" xmi.id="1322" value="" type="KisLayerSP" name="layer" />
+     <UML:Parameter visibility="private" xmi.id="1323" value="" type="Q_INT32" name="position" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1324" type="bool" name="alpha" />
+    <UML:Operation visibility="public" xmi.id="1325" type="bool" name="bottom" >
+     <UML:Parameter visibility="private" xmi.id="1326" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1327" type="QRect" name="bounds" />
+    <UML:Operation visibility="public" xmi.id="1328" type="bool" name="boundsLayer" />
+    <UML:Operation visibility="public" xmi.id="1329" type="KisChannelSP" name="channel" >
+     <UML:Parameter visibility="private" xmi.id="1330" value="" type="Q_UINT32" name="npos" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1331" type="KisChannelSP" name="channel" >
+     <UML:Parameter visibility="private" xmi.id="1332" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1333" type="const vKisChannelSP &amp;" name="channels" />
+    <UML:Operation visibility="public" xmi.id="1334" type="KoColor" name="color" />
+    <UML:Operation visibility="public" xmi.id="1335" type="bool" name="colorMap" >
+     <UML:Parameter visibility="private" xmi.id="1336" value="" type="KoColorMap &amp;" name="cm" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1337" type="KisLayerSP" name="correlateLayer" >
+     <UML:Parameter visibility="private" xmi.id="1338" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1339" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1340" type="Q_UINT32" name="depth" />
+    <UML:Operation visibility="public" xmi.id="1341" type="bool" name="empty" />
+    <UML:Operation visibility="public" xmi.id="1342" type="void" name="enableUndo" >
+     <UML:Parameter visibility="private" xmi.id="1343" value="" type="KCommandHistory *" name="history" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1344" type="void" name="expand" >
+     <UML:Parameter visibility="private" xmi.id="1345" value="" type="KisPaintDeviceSP" name="dev" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1346" type="void" name="flush" />
+    <UML:Operation visibility="public" xmi.id="1347" type="KisGuideMgr *" name="guides" />
+    <UML:Operation visibility="public" xmi.id="1348" type="Q_INT32" name="height" />
+    <UML:Operation visibility="public" xmi.id="1349" type="enumImgType" name="imgType" />
+    <UML:Operation visibility="public" xmi.id="1350" type="enumImgType" name="imgTypeWithAlpha" />
+    <UML:Operation visibility="public" xmi.id="1351" type="Q_INT32" name="index" >
+     <UML:Parameter visibility="private" xmi.id="1352" value="" type="KisChannelSP" name="channel" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1353" type="Q_INT32" name="index" >
+     <UML:Parameter visibility="private" xmi.id="1354" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1355" type="void" name="init" >
+     <UML:Parameter visibility="private" xmi.id="1356" value="" type="KisUndoAdapter *" name="adapter" />
+     <UML:Parameter visibility="private" xmi.id="1357" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1358" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="1359" value="" type="const enumImgType &amp;" name="imgType" />
+     <UML:Parameter visibility="private" xmi.id="1360" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1361" type="virtual void" name="tqinvalidate" />
+    <UML:Operation visibility="public" xmi.id="1362" type="virtual void" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="1363" value="" type="Q_INT32" name="tileno" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1364" type="virtual void" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="1365" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1366" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="1367" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="1368" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1369" type="virtual void" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="1370" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1371" type="KisLayerSP" name="layer" >
+     <UML:Parameter visibility="private" xmi.id="1372" value="" type="Q_UINT32" name="npos" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1373" type="KisLayerSP" name="layer" >
+     <UML:Parameter visibility="private" xmi.id="1374" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1375" type="const vKisLayerSP &amp;" name="layers" />
+    <UML:Operation visibility="public" xmi.id="1376" type="bool" name="lower" >
+     <UML:Parameter visibility="private" xmi.id="1377" value="" type="KisChannelSP" name="channel" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1378" type="bool" name="lower" >
+     <UML:Parameter visibility="private" xmi.id="1379" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1380" type="KisChannelSP" name="tqmask" />
+    <UML:Operation visibility="public" xmi.id="1381" type=TQSTRING_OBJECT_NAME_STRING name="name" />
+    <UML:Operation visibility="public" xmi.id="1382" type="enumImgType" name="nativeImgType" />
+    <UML:Operation visibility="public" xmi.id="1383" type="Q_INT32" name="nchannels" />
+    <UML:Operation visibility="public" xmi.id="1384" type=TQSTRING_OBJECT_NAME_STRING name="nextLayerName" />
+    <UML:Operation visibility="public" xmi.id="1385" type="Q_INT32" name="nlayers" />
+    <UML:Operation visibility="public" xmi.id="1386" type="void" name="notify" />
+    <UML:Operation visibility="public" xmi.id="1387" type="void" name="notify" >
+     <UML:Parameter visibility="private" xmi.id="1388" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1389" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="1390" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1391" value="" type="Q_INT32" name="height" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1392" type="void" name="notify" >
+     <UML:Parameter visibility="private" xmi.id="1393" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1394" type="PIXELTYPE" name="pixelFromChannel" >
+     <UML:Parameter visibility="private" xmi.id="1395" value="" type="CHANNELTYPE" name="type" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1396" type="bool" name="pos" >
+     <UML:Parameter visibility="private" xmi.id="1397" value="" type="KisChannelSP" name="channel" />
+     <UML:Parameter visibility="private" xmi.id="1398" value="" type="Q_INT32" name="position" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1399" type="bool" name="pos" >
+     <UML:Parameter visibility="private" xmi.id="1400" value="" type="KisLayerSP" name="layer" />
+     <UML:Parameter visibility="private" xmi.id="1401" value="" type="Q_INT32" name="position" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1402" type="bool" name="raise" >
+     <UML:Parameter visibility="private" xmi.id="1403" value="" type="KisChannelSP" name="channel" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1404" type="bool" name="raise" >
+     <UML:Parameter visibility="private" xmi.id="1405" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1406" type="void" name="resize" >
+     <UML:Parameter visibility="private" xmi.id="1407" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="1408" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1409" type="void" name="resize" >
+     <UML:Parameter visibility="private" xmi.id="1410" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1411" type="void" name="resolution" >
+     <UML:Parameter visibility="private" xmi.id="1412" value="" type="double *" name="xres" />
+     <UML:Parameter visibility="private" xmi.id="1413" value="" type="double *" name="yres" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1414" type="void" name="resolution" >
+     <UML:Parameter visibility="private" xmi.id="1415" value="" type="double" name="xres" />
+     <UML:Parameter visibility="private" xmi.id="1416" value="" type="double" name="yres" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1417" type="void" name="rm" >
+     <UML:Parameter visibility="private" xmi.id="1418" value="" type="KisChannelSP" name="channel" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1419" type="void" name="rm" >
+     <UML:Parameter visibility="private" xmi.id="1420" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1421" type="KisSelectionSP" name="selection" />
+    <UML:Operation visibility="public" xmi.id="1422" type="void" name="setName" >
+     <UML:Parameter visibility="private" xmi.id="1423" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1424" type="void" name="setSelection" >
+     <UML:Parameter visibility="private" xmi.id="1425" value="" type="KisSelectionSP" name="selection" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1426" type="KisTileMgrSP" name="shadow" />
+    <UML:Operation visibility="public" xmi.id="1427" type="virtual Q_INT32" name="tileNum" >
+     <UML:Parameter visibility="private" xmi.id="1428" value="" type="Q_INT32" name="xpix" />
+     <UML:Parameter visibility="private" xmi.id="1429" value="" type="Q_INT32" name="ypix" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1430" type="virtual KisTileMgrSP" name="tiles" />
+    <UML:Operation visibility="public" xmi.id="1431" type="bool" name="top" >
+     <UML:Parameter visibility="private" xmi.id="1432" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1433" type="KoColor" name="transformColor" />
+    <UML:Operation visibility="public" xmi.id="1434" type="KisUndoAdapter *" name="undoAdapter" />
+    <UML:Operation visibility="public" xmi.id="1435" type="void" name="unit" >
+     <UML:Parameter visibility="private" xmi.id="1436" value="" type="const KoUnit :: Unit &amp;" name="u" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1437" type="KisChannelSP" name="unsetActiveChannel" />
+    <UML:Operation visibility="public" xmi.id="1438" type="void" name="unsetSelection" >
+     <UML:Parameter visibility="private" xmi.id="1439" value="" type="bool" name="commit" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1440" type="KURL" name="uri" />
+    <UML:Operation visibility="public" xmi.id="1441" type="void" name="uri" >
+     <UML:Parameter visibility="private" xmi.id="1442" value="" type="const KURL &amp;" name="uri" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1443" type="virtual void" name="validate" >
+     <UML:Parameter visibility="private" xmi.id="1444" value="" type="Q_INT32" name="tileno" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1445" type="bool" name="visibleComponent" >
+     <UML:Parameter visibility="private" xmi.id="1446" value="" type="CHANNELTYPE" name="pixel" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1447" type="void" name="visibleComponent" >
+     <UML:Parameter visibility="private" xmi.id="1448" value="" type="CHANNELTYPE" name="pixel" />
+     <UML:Parameter visibility="private" xmi.id="1449" value="" type="bool" name="active" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1450" type="Q_INT32" name="width" />
+    <UML:Operation visibility="public" xmi.id="1451" type="virtual " name="~KisImage" />
+    <UML:Attribute visibility="private" xmi.id="1260" value="" type="QBitArray" name="m_active" />
+    <UML:Attribute visibility="private" xmi.id="1261" value="" type="KisChannelSP" name="m_activeChannel" />
+    <UML:Attribute visibility="private" xmi.id="1262" value="" type="KisLayerSP" name="m_activeLayer" />
+    <UML:Attribute visibility="private" xmi.id="1263" value="" type="KisUndoAdapter *" name="m_adapter" />
+    <UML:Attribute visibility="private" xmi.id="1264" value="" type="bool" name="m_alpha" />
+    <UML:Attribute visibility="private" xmi.id="1265" value="" type="KisBackgroundSP" name="m_bkg" />
+    <UML:Attribute visibility="private" xmi.id="1266" value="" type="vKisChannelSP" name="m_channels" />
+    <UML:Attribute visibility="private" xmi.id="1267" value="" type="KoColorMap" name="m_clrMap" />
+    <UML:Attribute visibility="private" xmi.id="1268" value="" type="Q_UINT32" name="m_depth" />
+    <UML:Attribute visibility="private" xmi.id="1269" value="" type="bool" name="m_dirty" />
+    <UML:Attribute visibility="private" xmi.id="1271" value="" type="Q_INT32" name="m_height" />
+    <UML:Attribute visibility="private" xmi.id="1272" value="" type="vKisLayerSP" name="m_layerStack" />
+    <UML:Attribute visibility="private" xmi.id="1273" value="" type="vKisLayerSP" name="m_layers" />
+    <UML:Attribute visibility="private" xmi.id="1274" value="" type="KoColor" name="m_tqmaskClr" />
+    <UML:Attribute visibility="private" xmi.id="1275" value="" type="bool" name="m_tqmaskEnabled" />
+    <UML:Attribute visibility="private" xmi.id="1276" value="" type="bool" name="m_tqmaskInverted" />
+    <UML:Attribute visibility="private" xmi.id="1277" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_name" />
+    <UML:Attribute visibility="private" xmi.id="1278" value="" type="KisNameServer *" name="m_nserver" />
+    <UML:Attribute visibility="private" xmi.id="1279" value="" type="Q_INT32" name="m_ntileCols" />
+    <UML:Attribute visibility="private" xmi.id="1280" value="" type="Q_INT32" name="m_ntileRows" />
+    <UML:Attribute visibility="private" xmi.id="1281" value="" type="KisLayerSP" name="m_projection" />
+    <UML:Attribute visibility="private" xmi.id="1282" value="" type="KisSelectionSP" name="m_selection" />
+    <UML:Attribute visibility="private" xmi.id="1283" value="" type="KisChannelSP" name="m_selectionMask" />
+    <UML:Attribute visibility="private" xmi.id="1284" value="" type="KisTileMgrSP" name="m_shadow" />
+    <UML:Attribute visibility="private" xmi.id="1286" value="" type="KCommandHistory *" name="m_undoHistory" />
+    <UML:Attribute visibility="private" xmi.id="1287" value="" type="KURL" name="m_uri" />
+    <UML:Attribute visibility="private" xmi.id="1288" value="" type="QBitArray" name="m_visible" />
+    <UML:Attribute visibility="private" xmi.id="1289" value="" type="Q_INT32" name="m_width" />
+    <UML:Attribute visibility="private" xmi.id="1290" value="" type="double" name="m_xres" />
+    <UML:Attribute visibility="private" xmi.id="1291" value="" type="double" name="m_yres" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1453" name="KisPaintDevice" >
+    <UML:Operation visibility="protected" xmi.id="1474" type="KisPaintDevice &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="1475" value="" type="const KisPaintDevice &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1476" type="" name="KisPaintDevice" >
+     <UML:Parameter visibility="private" xmi.id="1477" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="1478" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1479" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="1480" value="" type="const enumImgType &amp;" name="imgType" />
+     <UML:Parameter visibility="private" xmi.id="1481" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1482" type="" name="KisPaintDevice" >
+     <UML:Parameter visibility="private" xmi.id="1483" value="" type="KisTileMgrSP" name="tm" />
+     <UML:Parameter visibility="private" xmi.id="1484" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="1485" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1486" type="" name="KisPaintDevice" >
+     <UML:Parameter visibility="private" xmi.id="1487" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1488" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="1489" value="" type="const enumImgType &amp;" name="imgType" />
+     <UML:Parameter visibility="private" xmi.id="1490" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1491" type="" name="KisPaintDevice" >
+     <UML:Parameter visibility="private" xmi.id="1492" value="" type="const KisPaintDevice &amp;" name="rhs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1493" type="bool" name="alpha" />
+    <UML:Operation comment="Reimplemented by KisSelection; here it does nothing useful, but it
+cannot be abstract, because otherwise this class would be abstract." visibility="public" xmi.id="1494" type="virtual void" name="anchor" />
+    <UML:Operation visibility="public" xmi.id="1495" type="QRect" name="bounds" />
+    <UML:Operation visibility="public" xmi.id="1496" type="QRect" name="clip" />
+    <UML:Operation visibility="public" xmi.id="1497" type="void" name="clip" >
+     <UML:Parameter visibility="private" xmi.id="1498" value="" type="Q_INT32 *" name="offx" />
+     <UML:Parameter visibility="private" xmi.id="1499" value="" type="Q_INT32 *" name="offy" />
+     <UML:Parameter visibility="private" xmi.id="1500" value="" type="Q_INT32 *" name="offw" />
+     <UML:Parameter visibility="private" xmi.id="1501" value="" type="Q_INT32 *" name="offh" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1502" type="bool" name="cmap" >
+     <UML:Parameter visibility="private" xmi.id="1503" value="" type="KoColorMap &amp;" name="cm" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1504" type="KoColor" name="colorAt" />
+    <UML:Operation visibility="public" xmi.id="1505" type="CompositeOp" name="compositeOp" />
+    <UML:Operation visibility="public" xmi.id="1506" type="virtual void" name="configure" >
+     <UML:Parameter visibility="private" xmi.id="1507" value="" type="KisImageSP" name="image" />
+     <UML:Parameter visibility="private" xmi.id="1508" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1509" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="1510" value="" type="const enumImgType &amp;" name="imgType" />
+     <UML:Parameter visibility="private" xmi.id="1511" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="1512" value="" type="CompositeOp" name="compositeOp" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1513" type="bool" name="tqcontains" >
+     <UML:Parameter visibility="private" xmi.id="1514" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1515" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1516" type="bool" name="tqcontains" >
+     <UML:Parameter visibility="private" xmi.id="1517" value="" type="const QPoint &amp;" name="pt" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1518" type="virtual const KisTileMgrSP" name="data" />
+    <UML:Operation visibility="public" xmi.id="1519" type="void" name="data" >
+     <UML:Parameter visibility="private" xmi.id="1520" value="" type="KisTileMgrSP" name="mgr" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1521" type="void" name="expand" >
+     <UML:Parameter visibility="private" xmi.id="1522" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="1523" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1524" type="void" name="expand" >
+     <UML:Parameter visibility="private" xmi.id="1525" value="" type="const QSize &amp;" name="size" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1526" type="Q_INT32" name="height" />
+    <UML:Operation visibility="protected" xmi.id="1527" type="void" name="height" >
+     <UML:Parameter visibility="private" xmi.id="1528" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1529" type="const KisImageSP" name="image" />
+    <UML:Operation visibility="protected" xmi.id="1530" type="void" name="init" />
+    <UML:Operation visibility="public" xmi.id="1531" type="virtual void" name="tqinvalidate" />
+    <UML:Operation visibility="public" xmi.id="1532" type="virtual void" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="1533" value="" type="Q_INT32" name="tileno" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1534" type="virtual void" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="1535" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1536" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="1537" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="1538" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1539" type="virtual void" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="1540" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1541" type="void" name="tqmaskBounds" >
+     <UML:Parameter visibility="private" xmi.id="1542" value="" type="QRect *" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1543" type="void" name="tqmaskBounds" >
+     <UML:Parameter visibility="private" xmi.id="1544" value="" type="Q_INT32 *" name="x1" />
+     <UML:Parameter visibility="private" xmi.id="1545" value="" type="Q_INT32 *" name="y1" />
+     <UML:Parameter visibility="private" xmi.id="1546" value="" type="Q_INT32 *" name="x2" />
+     <UML:Parameter visibility="private" xmi.id="1547" value="" type="Q_INT32 *" name="y2" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1548" type="virtual void" name="move" >
+     <UML:Parameter visibility="private" xmi.id="1549" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1550" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1551" type="virtual void" name="move" >
+     <UML:Parameter visibility="private" xmi.id="1552" value="" type="const QPoint &amp;" name="pt" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1553" type=TQSTRING_OBJECT_NAME_STRING name="name" />
+    <UML:Operation visibility="public" xmi.id="1554" type="void" name="offsetBy" >
+     <UML:Parameter visibility="private" xmi.id="1555" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1556" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1557" type="bool" name="pixel" >
+     <UML:Parameter visibility="private" xmi.id="1558" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1559" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="1560" value="" type="KoColor *" name="c" />
+     <UML:Parameter visibility="private" xmi.id="1561" value="" type="QUANTUM *" name="opacity" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1562" type="Q_INT32" name="quantumSize" />
+    <UML:Operation visibility="public" xmi.id="1563" type="Q_INT32" name="quantumSizeWithAlpha" />
+    <UML:Operation visibility="public" xmi.id="1564" type="virtual bool" name="read" >
+     <UML:Parameter visibility="private" xmi.id="1565" value="" type="KoStore *" name="store" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1566" type="void" name="resize" />
+    <UML:Operation visibility="public" xmi.id="1567" type="void" name="resize" >
+     <UML:Parameter visibility="private" xmi.id="1568" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="1569" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1570" type="void" name="resize" >
+     <UML:Parameter visibility="private" xmi.id="1571" value="" type="const QSize &amp;" name="size" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1572" type="void" name="setClip" >
+     <UML:Parameter visibility="private" xmi.id="1573" value="" type="Q_INT32" name="offx" />
+     <UML:Parameter visibility="private" xmi.id="1574" value="" type="Q_INT32" name="offy" />
+     <UML:Parameter visibility="private" xmi.id="1575" value="" type="Q_INT32" name="offw" />
+     <UML:Parameter visibility="private" xmi.id="1576" value="" type="Q_INT32" name="offh" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1577" type="void" name="setCompositeOp" >
+     <UML:Parameter visibility="private" xmi.id="1578" value="" type="CompositeOp" name="compositeOp" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1579" type="void" name="setImage" >
+     <UML:Parameter visibility="private" xmi.id="1580" value="" type="KisImageSP" name="image" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1581" type="void" name="setName" >
+     <UML:Parameter visibility="private" xmi.id="1582" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1583" type="bool" name="setPixel" >
+     <UML:Parameter visibility="private" xmi.id="1584" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1585" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="1586" value="" type="const KoColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="1587" value="" type="QUANTUM" name="opacity" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1588" type="void" name="setX" >
+     <UML:Parameter visibility="private" xmi.id="1589" value="" type="Q_INT32" name="x" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1590" type="void" name="setY" >
+     <UML:Parameter visibility="private" xmi.id="1591" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1592" type="const KisTileMgrSP" name="shadow" />
+    <UML:Operation visibility="public" xmi.id="1593" type="virtual bool" name="shouldDrawBorder" />
+    <UML:Operation visibility="public" xmi.id="1594" type="virtual Q_INT32" name="tileNum" >
+     <UML:Parameter visibility="private" xmi.id="1595" value="" type="Q_INT32" name="xpix" />
+     <UML:Parameter visibility="private" xmi.id="1596" value="" type="Q_INT32" name="ypix" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1597" type="virtual KisTileMgrSP" name="tiles" />
+    <UML:Operation visibility="public" xmi.id="1598" type="enumImgType" name="type" />
+    <UML:Operation visibility="public" xmi.id="1599" type="enumImgType" name="typeWithAlpha" />
+    <UML:Operation visibility="public" xmi.id="1600" type="enumImgType" name="typeWithoutAlpha" />
+    <UML:Operation visibility="public" xmi.id="1601" type="virtual void" name="update" />
+    <UML:Operation visibility="public" xmi.id="1602" type="virtual void" name="update" >
+     <UML:Parameter visibility="private" xmi.id="1603" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1604" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="1605" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="1606" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1607" type="virtual void" name="validate" >
+     <UML:Parameter visibility="private" xmi.id="1608" value="" type="Q_INT32" name="tileno" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1609" type="virtual const bool" name="visible" />
+    <UML:Operation visibility="public" xmi.id="1610" type="virtual void" name="visible" >
+     <UML:Parameter visibility="private" xmi.id="1611" value="" type="bool" name="v" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1612" type="Q_INT32" name="width" />
+    <UML:Operation visibility="protected" xmi.id="1613" type="void" name="width" >
+     <UML:Parameter visibility="private" xmi.id="1614" value="" type="Q_INT32" name="w" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1615" type="virtual bool" name="write" >
+     <UML:Parameter visibility="private" xmi.id="1616" value="" type="KoStore *" name="store" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1617" type="Q_INT32" name="x" />
+    <UML:Operation visibility="public" xmi.id="1618" type="Q_INT32" name="y" />
+    <UML:Operation visibility="public" xmi.id="1619" type="virtual " name="~KisPaintDevice" />
+    <UML:Attribute visibility="private" xmi.id="1454" value="" type="bool" name="m_alpha" />
+    <UML:Attribute visibility="private" xmi.id="1456" value="" type="Q_INT32" name="m_depth" />
+    <UML:Attribute visibility="private" xmi.id="1457" value="" type="Q_INT32" name="m_height" />
+    <UML:Attribute visibility="private" xmi.id="1459" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_name" />
+    <UML:Attribute visibility="private" xmi.id="1460" value="" type="Q_INT32" name="m_offH" />
+    <UML:Attribute visibility="private" xmi.id="1461" value="" type="Q_INT32" name="m_offW" />
+    <UML:Attribute visibility="private" xmi.id="1462" value="" type="Q_INT32" name="m_offX" />
+    <UML:Attribute visibility="private" xmi.id="1463" value="" type="Q_INT32" name="m_offY" />
+    <UML:Attribute visibility="private" xmi.id="1464" value="" type="KisImageSP" name="m_owner" />
+    <UML:Attribute visibility="private" xmi.id="1465" value="" type=TQPIXMAP_OBJECT_NAME_STRING name="m_projection" />
+    <UML:Attribute visibility="private" xmi.id="1466" value="" type="bool" name="m_projectionValid" />
+    <UML:Attribute visibility="private" xmi.id="1467" value="" type="Q_INT32" name="m_quantumSize" />
+    <UML:Attribute visibility="private" xmi.id="1468" value="" type="KisTileMgrSP" name="m_shadow" />
+    <UML:Attribute visibility="private" xmi.id="1469" value="" type="KisTileMgrSP" name="m_tiles" />
+    <UML:Attribute visibility="private" xmi.id="1470" value="" type="bool" name="m_visible" />
+    <UML:Attribute visibility="private" xmi.id="1471" value="" type="Q_INT32" name="m_width" />
+    <UML:Attribute visibility="private" xmi.id="1472" value="" type="Q_INT32" name="m_x" />
+    <UML:Attribute visibility="private" xmi.id="1473" value="" type="Q_INT32" name="m_y" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1620" name="KisLayer" >
+    <UML:Operation visibility="public" xmi.id="1628" type="" name="KisLayer" >
+     <UML:Parameter visibility="private" xmi.id="1629" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="1630" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1631" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="1632" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="1633" value="" type="QUANTUM" name="opacity" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1634" type="" name="KisLayer" >
+     <UML:Parameter visibility="private" xmi.id="1635" value="" type="KisTileMgrSP" name="tiles" />
+     <UML:Parameter visibility="private" xmi.id="1636" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="1637" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="1638" value="" type="QUANTUM" name="opacity" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1639" type="" name="KisLayer" >
+     <UML:Parameter visibility="private" xmi.id="1640" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1641" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="1642" value="" type="const enumImgType &amp;" name="imgType" />
+     <UML:Parameter visibility="private" xmi.id="1643" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1644" type="" name="KisLayer" >
+     <UML:Parameter visibility="private" xmi.id="1645" value="" type="const KisLayer &amp;" name="rhs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1646" type="void" name="addAlpha" />
+    <UML:Operation visibility="public" xmi.id="1647" type="KisMaskSP" name="addMask" >
+     <UML:Parameter visibility="private" xmi.id="1648" value="" type="KisMaskSP" name="tqmask" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1649" type="void" name="applyMask" >
+     <UML:Parameter visibility="private" xmi.id="1650" value="" type="Q_INT32" name="mode" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1651" type="KisMaskSP" name="createMask" >
+     <UML:Parameter visibility="private" xmi.id="1652" value="" type="Q_INT32" name="tqmaskType" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1653" type="bool" name="linked" />
+    <UML:Operation visibility="public" xmi.id="1654" type="void" name="linked" >
+     <UML:Parameter visibility="private" xmi.id="1655" value="" type="bool" name="l" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1656" type="KisMaskSP" name="tqmask" />
+    <UML:Operation visibility="public" xmi.id="1657" type="QUANTUM" name="opacity" />
+    <UML:Operation visibility="public" xmi.id="1658" type="void" name="setOpacity" >
+     <UML:Parameter visibility="private" xmi.id="1659" value="" type="QUANTUM" name="val" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1660" type="void" name="translate" >
+     <UML:Parameter visibility="private" xmi.id="1661" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1662" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1663" type="virtual const bool" name="visible" />
+    <UML:Operation visibility="public" xmi.id="1664" type="virtual void" name="visible" >
+     <UML:Parameter visibility="private" xmi.id="1665" value="" type="bool" name="v" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1666" type="virtual " name="~KisLayer" />
+    <UML:Attribute visibility="private" xmi.id="1621" value="" type="Q_INT32" name="m_dx" />
+    <UML:Attribute visibility="private" xmi.id="1622" value="" type="Q_INT32" name="m_dy" />
+    <UML:Attribute visibility="private" xmi.id="1623" value="" type="bool" name="m_initial" />
+    <UML:Attribute visibility="private" xmi.id="1624" value="" type="bool" name="m_linked" />
+    <UML:Attribute visibility="private" xmi.id="1625" value="" type="KisMaskSP" name="m_tqmask" />
+    <UML:Attribute visibility="private" xmi.id="1626" value="" type="QUANTUM" name="m_opacity" />
+    <UML:Attribute visibility="private" xmi.id="1627" value="" type="bool" name="m_preserveTransparency" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1667" name="KisNameServer" >
+    <UML:Operation visibility="public" xmi.id="1670" type="" name="KisNameServer" >
+     <UML:Parameter visibility="private" xmi.id="1671" value="" type="const QString &amp;" name="prefix" />
+     <UML:Parameter visibility="private" xmi.id="1672" value="" type="Q_INT32" name="seed" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1673" type="Q_INT32" name="currentSeed" />
+    <UML:Operation visibility="public" xmi.id="1674" type=TQSTRING_OBJECT_NAME_STRING name="name" />
+    <UML:Operation visibility="public" xmi.id="1675" type="Q_INT32" name="number" />
+    <UML:Operation visibility="public" xmi.id="1676" type="" name="~KisNameServer" />
+    <UML:Attribute visibility="private" xmi.id="1668" value="" type="Q_INT32" name="m_generator" />
+    <UML:Attribute visibility="private" xmi.id="1669" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_prefix" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1677" name="KisMemento" >
+    <UML:Operation visibility="public" xmi.id="1678" type="virtual " name="~KisMemento" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1679" name="KisPaintDeviceVisitor" >
+    <UML:Operation visibility="public" xmi.id="1680" type="bool" name="()" >
+     <UML:Parameter visibility="private" xmi.id="1681" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="1682" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1683" type="bool" name="()" >
+     <UML:Parameter visibility="private" xmi.id="1684" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="1685" value="" type="KisPaintDeviceSP" name="dev" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1686" type="bool" name="()" >
+     <UML:Parameter visibility="private" xmi.id="1687" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="1688" value="" type="KisSelectionSP" name="selection" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1689" type="bool" name="()" >
+     <UML:Parameter visibility="private" xmi.id="1690" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="1691" value="" type="vKisLayerSP &amp;" name="layers" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1692" type="bool" name="()" >
+     <UML:Parameter visibility="private" xmi.id="1693" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="1694" value="" type="vKisPaintDeviceSP &amp;" name="devs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1695" type="" name="KisPaintDeviceVisitor" />
+    <UML:Operation visibility="public" xmi.id="1696" type="virtual bool" isAbstract="true" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="1697" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="1698" value="" type="KisLayerSP" name="layer" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1699" type="virtual bool" isAbstract="true" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="1700" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="1701" value="" type="KisPaintDeviceSP" name="dev" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1702" type="virtual bool" isAbstract="true" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="1703" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="1704" value="" type="KisSelectionSP" name="selection" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1705" type="virtual bool" isAbstract="true" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="1706" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="1707" value="" type="vKisLayerSP &amp;" name="layers" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1708" type="virtual bool" isAbstract="true" name="visit" >
+     <UML:Parameter visibility="private" xmi.id="1709" value="" type="KisPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="1710" value="" type="vKisPaintDeviceSP &amp;" name="devs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1711" type="virtual " name="~KisPaintDeviceVisitor" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1712" name="KisMementoOriginatorInterface" >
+    <UML:Operation visibility="protected" xmi.id="1713" type="KisMementoOriginatorInterface &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="1714" value="" type="const KisMementoOriginatorInterface &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1715" type="" name="KisMementoOriginatorInterface" />
+    <UML:Operation visibility="protected" xmi.id="1716" type="" name="KisMementoOriginatorInterface" >
+     <UML:Parameter visibility="private" xmi.id="1717" value="" type="const KisMementoOriginatorInterface &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1718" type="virtual void" isAbstract="true" name="restore" >
+     <UML:Parameter visibility="private" xmi.id="1719" value="" type="KisMementoSP" name="memento" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1720" type="virtual KisMementoSP" isAbstract="true" name="save" />
+    <UML:Operation visibility="public" xmi.id="1721" type="virtual " name="~KisMementoOriginatorInterface" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1722" name="KisMask" >
+    <UML:Operation visibility="public" xmi.id="1723" type="" name="KisMask" >
+     <UML:Parameter visibility="private" xmi.id="1724" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="1725" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1726" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="1727" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="1728" value="" type="const KoColor &amp;" name="color" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1729" type="" name="KisMask" >
+     <UML:Parameter visibility="private" xmi.id="1730" value="" type="const KisMask &amp;" name="rhs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1731" type="Q_INT32" name="apply" />
+    <UML:Operation visibility="public" xmi.id="1732" type="void" name="apply" >
+     <UML:Parameter visibility="private" xmi.id="1733" value="" type="Q_INT32" name="tqmask" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1734" type="bool" name="edit" />
+    <UML:Operation visibility="public" xmi.id="1735" type="void" name="edit" >
+     <UML:Parameter visibility="private" xmi.id="1736" value="" type="bool" name="val" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1737" type="KisLayerSP" name="layer" />
+    <UML:Operation visibility="public" xmi.id="1738" type="void" name="layer" >
+     <UML:Parameter visibility="private" xmi.id="1739" value="" type="KisLayerSP" name="owner" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1740" type="virtual " name="~KisMask" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1741" name="KisImagePipeBrush" >
+    <UML:Operation visibility="public" xmi.id="1750" type="" name="KisImagePipeBrush" >
+     <UML:Parameter visibility="private" xmi.id="1751" value="" type="const QString &amp;" name="filename" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1752" type="virtual enumBrushType" name="brushType" />
+    <UML:Operation visibility="public" xmi.id="1753" type=TQPOINT_OBJECT_NAME_STRING name="hotSpot" />
+    <UML:Operation comment="@return the next image in the pipe." visibility="public" xmi.id="1754" type="virtual QImage" name="img" />
+    <UML:Operation visibility="public" xmi.id="1755" type="virtual bool" name="loadAsync" />
+    <UML:Operation comment="@return the next tqmask in the pipe." visibility="public" xmi.id="1756" type="virtual KisAlphaMask *" name="tqmask" >
+     <UML:Parameter visibility="private" xmi.id="1757" value="" type="Q_INT32" name="scale" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1758" type="virtual bool" name="saveAsync" />
+    <UML:Operation visibility="public" xmi.id="1759" type="void" name="setHotSpot" >
+     <UML:Parameter visibility="private" xmi.id="1760" value="" type=TQPOINT_OBJECT_NAME_STRING />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1761" type="void" name="setParasite" >
+     <UML:Parameter visibility="private" xmi.id="1762" value="" type="const QString &amp;" name="parasite" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1763" type="virtual " name="~KisImagePipeBrush" />
+    <UML:Attribute visibility="private" xmi.id="1743" value="" type="QPtrList" name="m_brushes" />
+    <UML:Attribute visibility="private" xmi.id="1744" value="" type="Q_UINT32" name="m_currentBrush" />
+    <UML:Attribute visibility="private" xmi.id="1745" value="" type="QValueVector" name="m_data" />
+    <UML:Attribute visibility="private" xmi.id="1746" value="" type=TQPOINT_OBJECT_NAME_STRING name="m_hotSpot" />
+    <UML:Attribute visibility="private" xmi.id="1747" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_name" />
+    <UML:Attribute visibility="private" xmi.id="1748" value="" type="Q_UINT32" name="m_numOfBrushes" />
+    <UML:Attribute visibility="private" xmi.id="1749" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_parasite" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1767" name="KisPainter" >
+    <UML:Operation visibility="protected" xmi.id="1784" type="KisPainter &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="1785" value="" type="const KisPainter &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1786" type="" name="KisPainter" />
+    <UML:Operation visibility="public" xmi.id="1787" type="" name="KisPainter" >
+     <UML:Parameter visibility="private" xmi.id="1788" value="" type="KisPaintDeviceSP" name="device" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1789" type="" name="KisPainter" >
+     <UML:Parameter visibility="private" xmi.id="1790" value="" type="const KisPainter &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1791" type="void" name="begin" >
+     <UML:Parameter visibility="private" xmi.id="1792" value="" type="KisPaintDeviceSP" name="device" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1793" type="void" name="beginTransaction" >
+     <UML:Parameter visibility="private" xmi.id="1794" value="" type="const QString &amp;" name="customName" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1795" type="void" name="bitBlt" >
+     <UML:Parameter visibility="private" xmi.id="1796" value="" type="Q_INT32" name="dx" />
+     <UML:Parameter visibility="private" xmi.id="1797" value="" type="Q_INT32" name="dy" />
+     <UML:Parameter visibility="private" xmi.id="1798" value="" type="CompositeOp" name="op" />
+     <UML:Parameter visibility="private" xmi.id="1799" value="" type="KisPaintDeviceSP" name="src" />
+     <UML:Parameter visibility="private" xmi.id="1800" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="1801" value="" type="Q_INT32" name="sx" />
+     <UML:Parameter visibility="private" xmi.id="1802" value="" type="Q_INT32" name="sy" />
+     <UML:Parameter visibility="private" xmi.id="1803" value="" type="Q_INT32" name="sw" />
+     <UML:Parameter visibility="private" xmi.id="1804" value="" type="Q_INT32" name="sh" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1805" type="void" name="bitBlt" >
+     <UML:Parameter visibility="private" xmi.id="1806" value="" type="Q_INT32" name="dx" />
+     <UML:Parameter visibility="private" xmi.id="1807" value="" type="Q_INT32" name="dy" />
+     <UML:Parameter visibility="private" xmi.id="1808" value="" type="CompositeOp" name="op" />
+     <UML:Parameter visibility="private" xmi.id="1809" value="" type="KisPaintDeviceSP" name="src" />
+     <UML:Parameter visibility="private" xmi.id="1810" value="" type="Q_INT32" name="sx" />
+     <UML:Parameter visibility="private" xmi.id="1811" value="" type="Q_INT32" name="sy" />
+     <UML:Parameter visibility="private" xmi.id="1812" value="" type="Q_INT32" name="sw" />
+     <UML:Parameter visibility="private" xmi.id="1813" value="" type="Q_INT32" name="sh" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1814" type="void" name="computeDab" >
+     <UML:Parameter visibility="private" xmi.id="1815" value="" type="KisAlphaMask *" name="tqmask" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1816" type="KisPaintDeviceSP" name="device" />
+    <UML:Operation visibility="public" xmi.id="1817" type="QRect" name="dirtyRect" />
+    <UML:Operation visibility="public" xmi.id="1818" type="KCommand *" name="end" />
+    <UML:Operation visibility="public" xmi.id="1819" type="KCommand *" name="endTransaction" />
+    <UML:Operation visibility="public" xmi.id="1820" type="void" name="eraseAt" >
+     <UML:Parameter visibility="private" xmi.id="1821" value="" type="const QPoint &amp;" name="pos" />
+     <UML:Parameter visibility="private" xmi.id="1822" value="" type="const Q_INT32" name="pressure" />
+     <UML:Parameter visibility="private" xmi.id="1823" value="" type="const Q_INT32" />
+     <UML:Parameter visibility="private" xmi.id="1824" value="" type="const Q_INT32" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1825" type="float" name="eraseLine" >
+     <UML:Parameter visibility="private" xmi.id="1826" value="" type="const QPoint &amp;" name="pos1" />
+     <UML:Parameter visibility="private" xmi.id="1827" value="" type="const QPoint &amp;" name="pos2" />
+     <UML:Parameter visibility="private" xmi.id="1828" value="" type="const Q_INT32" name="pressure" />
+     <UML:Parameter visibility="private" xmi.id="1829" value="" type="const Q_INT32" name="xTilt" />
+     <UML:Parameter visibility="private" xmi.id="1830" value="" type="const Q_INT32" name="yTilt" />
+     <UML:Parameter visibility="private" xmi.id="1831" value="" type="const float" name="savedDist" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1832" type="void" name="eraseRect" >
+     <UML:Parameter visibility="private" xmi.id="1833" value="" type="Q_INT32" name="x1" />
+     <UML:Parameter visibility="private" xmi.id="1834" value="" type="Q_INT32" name="y1" />
+     <UML:Parameter visibility="private" xmi.id="1835" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="1836" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1837" type="void" name="eraseRect" >
+     <UML:Parameter visibility="private" xmi.id="1838" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1839" type="void" name="fillRect" >
+     <UML:Parameter visibility="private" xmi.id="1840" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1841" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="1842" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="1843" value="" type="Q_INT32" name="h" />
+     <UML:Parameter visibility="private" xmi.id="1844" value="" type="const KoColor &amp;" name="c" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1845" type="void" name="fillRect" >
+     <UML:Parameter visibility="private" xmi.id="1846" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1847" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="1848" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="1849" value="" type="Q_INT32" name="h" />
+     <UML:Parameter visibility="private" xmi.id="1850" value="" type="const KoColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="1851" value="" type="QUANTUM" name="opacity" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1852" type="void" name="fillRect" >
+     <UML:Parameter visibility="private" xmi.id="1853" value="" type="const QRect &amp;" name="rc" />
+     <UML:Parameter visibility="private" xmi.id="1854" value="" type="const KoColor &amp;" name="c" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1855" type="void" name="fillRect" >
+     <UML:Parameter visibility="private" xmi.id="1856" value="" type="const QRect &amp;" name="rc" />
+     <UML:Parameter visibility="private" xmi.id="1857" value="" type="const KoColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="1858" value="" type="QUANTUM" name="opacity" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1859" type="void" name="paintAt" >
+     <UML:Parameter visibility="private" xmi.id="1860" value="" type="const QPoint &amp;" name="pos" />
+     <UML:Parameter visibility="private" xmi.id="1861" value="" type="const Q_INT32" name="pressure" />
+     <UML:Parameter visibility="private" xmi.id="1862" value="" type="const Q_INT32" />
+     <UML:Parameter visibility="private" xmi.id="1863" value="" type="const Q_INT32" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1864" type="float" name="paintLine" >
+     <UML:Parameter visibility="private" xmi.id="1865" value="" type="const QPoint &amp;" name="pos1" />
+     <UML:Parameter visibility="private" xmi.id="1866" value="" type="const QPoint &amp;" name="pos2" />
+     <UML:Parameter visibility="private" xmi.id="1867" value="" type="const Q_INT32" name="pressure" />
+     <UML:Parameter visibility="private" xmi.id="1868" value="" type="const Q_INT32" name="xTilt" />
+     <UML:Parameter visibility="private" xmi.id="1869" value="" type="const Q_INT32" name="yTilt" />
+     <UML:Parameter visibility="private" xmi.id="1870" value="" type="const float" name="savedDist" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1871" type="void" name="setBackgroundColor" >
+     <UML:Parameter visibility="private" xmi.id="1872" value="" type="const KoColor &amp;" name="color" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1873" type="void" name="setBrush" >
+     <UML:Parameter visibility="private" xmi.id="1874" value="" type="KisBrush *" name="brush" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1875" type="void" name="setFillColor" >
+     <UML:Parameter visibility="private" xmi.id="1876" value="" type="const KoColor &amp;" name="color" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1877" type="void" name="setGradient" >
+     <UML:Parameter visibility="private" xmi.id="1878" value="" type="KisGradient &amp;" name="gradient" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1879" type="void" name="setOpacity" >
+     <UML:Parameter visibility="private" xmi.id="1880" value="" type="QUANTUM" name="opacity" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1881" type="void" name="setPaintColor" >
+     <UML:Parameter visibility="private" xmi.id="1882" value="" type="const KoColor &amp;" name="color" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1883" type="void" name="setPattern" >
+     <UML:Parameter visibility="private" xmi.id="1884" value="" type="KisPattern &amp;" name="pattern" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1885" type="void" name="tileBlt" >
+     <UML:Parameter visibility="private" xmi.id="1886" value="" type="QUANTUM *" name="dst" />
+     <UML:Parameter visibility="private" xmi.id="1887" value="" type="KisTileSP" name="dsttile" />
+     <UML:Parameter visibility="private" xmi.id="1888" value="" type="QUANTUM *" name="src" />
+     <UML:Parameter visibility="private" xmi.id="1889" value="" type="KisTileSP" name="srctile" />
+     <UML:Parameter visibility="private" xmi.id="1890" value="" type="QUANTUM" name="opacity" />
+     <UML:Parameter visibility="private" xmi.id="1891" value="" type="Q_INT32" name="rows" />
+     <UML:Parameter visibility="private" xmi.id="1892" value="" type="Q_INT32" name="cols" />
+     <UML:Parameter visibility="private" xmi.id="1893" value="" type="CompositeOp" name="op" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1894" type="void" name="tileBlt" >
+     <UML:Parameter visibility="private" xmi.id="1895" value="" type="QUANTUM *" name="dst" />
+     <UML:Parameter visibility="private" xmi.id="1896" value="" type="KisTileSP" name="dsttile" />
+     <UML:Parameter visibility="private" xmi.id="1897" value="" type="QUANTUM *" name="src" />
+     <UML:Parameter visibility="private" xmi.id="1898" value="" type="KisTileSP" name="srctile" />
+     <UML:Parameter visibility="private" xmi.id="1899" value="" type="Q_INT32" name="rows" />
+     <UML:Parameter visibility="private" xmi.id="1900" value="" type="Q_INT32" name="cols" />
+     <UML:Parameter visibility="private" xmi.id="1901" value="" type="CompositeOp" name="op" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1902" type="" name="~KisPainter" />
+    <UML:Attribute visibility="private" xmi.id="1768" value="" type="KoColor" name="m_backgroundColor" />
+    <UML:Attribute visibility="private" xmi.id="1770" value="" type="Q_INT32" name="m_brushHeight" />
+    <UML:Attribute visibility="private" xmi.id="1771" value="" type="Q_INT32" name="m_brushWidth" />
+    <UML:Attribute visibility="private" xmi.id="1772" value="" type="KisLayerSP" name="m_dab" />
+    <UML:Attribute visibility="private" xmi.id="1773" value="" type="KisPaintDeviceSP" name="m_device" />
+    <UML:Attribute visibility="private" xmi.id="1774" value="" type="QRect" name="m_dirtyRect" />
+    <UML:Attribute visibility="private" xmi.id="1775" value="" type="KoColor" name="m_fillColor" />
+    <UML:Attribute visibility="private" xmi.id="1777" value="" type=TQPOINT_OBJECT_NAME_STRING name="m_hotSpot" />
+    <UML:Attribute visibility="private" xmi.id="1778" value="" type="Q_INT32" name="m_hotSpotX" />
+    <UML:Attribute visibility="private" xmi.id="1779" value="" type="Q_INT32" name="m_hotSpotY" />
+    <UML:Attribute visibility="private" xmi.id="1780" value="" type="QUANTUM" name="m_opacity" />
+    <UML:Attribute visibility="private" xmi.id="1781" value="" type="KoColor" name="m_paintColor" />
+    <UML:Attribute visibility="private" xmi.id="1782" value="" type="KisPattern *" name="m_pattern" />
+    <UML:Attribute visibility="private" xmi.id="1783" value="" type="KisTileCommand *" name="m_transaction" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1903" name="KisSelection" >
+    <UML:Operation visibility="public" xmi.id="1911" type="" name="KisSelection" >
+     <UML:Parameter visibility="private" xmi.id="1912" value="" type="KisPaintDeviceSP" name="tqparent" />
+     <UML:Parameter visibility="private" xmi.id="1913" value="" type="KisImageSP" name="img" />
+     <UML:Parameter visibility="private" xmi.id="1914" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="1915" value="" type="QUANTUM" name="opacity" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1916" type="" name="KisSelection" >
+     <UML:Parameter visibility="private" xmi.id="1917" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1918" value="" type="Q_INT32" name="height" />
+     <UML:Parameter visibility="private" xmi.id="1919" value="" type="const enumImgType &amp;" name="imgType" />
+     <UML:Parameter visibility="private" xmi.id="1920" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1921" type="virtual void" name="anchor" />
+    <UML:Operation visibility="public" xmi.id="1922" type="void" name="clearParentOnMove" >
+     <UML:Parameter visibility="private" xmi.id="1923" value="" type="bool" name="f" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1924" type="void" name="commit" />
+    <UML:Operation visibility="public" xmi.id="1925" type="void" name="fromImage" >
+     <UML:Parameter visibility="private" xmi.id="1926" value="" type="const QImage &amp;" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1927" type="virtual void" name="move" >
+     <UML:Parameter visibility="private" xmi.id="1928" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="1929" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1930" type="KisPaintDeviceSP" name="tqparent" />
+    <UML:Operation visibility="public" xmi.id="1931" type="void" name="setBounds" >
+     <UML:Parameter visibility="private" xmi.id="1932" value="" type="Q_INT32" name="tqparentX" />
+     <UML:Parameter visibility="private" xmi.id="1933" value="" type="Q_INT32" name="tqparentY" />
+     <UML:Parameter visibility="private" xmi.id="1934" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="1935" value="" type="Q_INT32" name="height" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1936" type="void" name="setBounds" >
+     <UML:Parameter visibility="private" xmi.id="1937" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1938" type="void" name="setParent" >
+     <UML:Parameter visibility="private" xmi.id="1939" value="" type="KisPaintDeviceSP" name="tqparent" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1940" type="virtual bool" name="shouldDrawBorder" />
+    <UML:Operation visibility="public" xmi.id="1941" type="QImage" name="toImage" />
+    <UML:Operation visibility="public" xmi.id="1942" type="virtual " name="~KisSelection" />
+    <UML:Attribute visibility="private" xmi.id="1904" value="" type="bool" name="m_clearOnMove" />
+    <UML:Attribute visibility="private" xmi.id="1905" value="" type="QImage" name="m_clipImg" />
+    <UML:Attribute visibility="private" xmi.id="1906" value="" type="bool" name="m_firstMove" />
+    <UML:Attribute visibility="private" xmi.id="1907" value="" type="KisImageSP" name="m_img" />
+    <UML:Attribute visibility="private" xmi.id="1908" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_name" />
+    <UML:Attribute visibility="private" xmi.id="1909" value="" type="KisPaintDeviceSP" name="m_parent" />
+    <UML:Attribute visibility="private" xmi.id="1910" value="" type="QRect" name="m_rc" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1943" name="KisResourceMediator" >
+    <UML:Operation visibility="public" xmi.id="1947" type="" name="KisResourceMediator" >
+     <UML:Parameter visibility="private" xmi.id="1948" value="" type="Q_INT32" name="mediateOn" />
+     <UML:Parameter visibility="private" xmi.id="1949" value="" type="KisResourceServer *" name="rserver" />
+     <UML:Parameter visibility="private" xmi.id="1950" value="" type="const QString &amp;" name="chooserCaption" />
+     <UML:Parameter visibility="private" xmi.id="1951" value="" type="QWidget *" name="chooserParent" />
+     <UML:Parameter visibility="private" xmi.id="1952" value="" type="const char *" name="chooserName" />
+     <UML:Parameter visibility="private" xmi.id="1953" value="" type="QObject *" name="tqparent" />
+     <UML:Parameter visibility="private" xmi.id="1954" value="" type="const char *" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1955" type="QWidget *" name="chooserWidget" />
+    <UML:Operation visibility="public" xmi.id="1956" type="KisResource *" name="currentResource" />
+    <UML:Operation visibility="public" xmi.id="1957" type="KisIconItem *" name="itemFor" >
+     <UML:Parameter visibility="private" xmi.id="1958" value="" type="KisResource *" name="r" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1959" type="KisResource *" name="resourceFor" >
+     <UML:Parameter visibility="private" xmi.id="1960" value="" type="KisIconItem *" name="item" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1961" type="KisResource *" name="resourceFor" >
+     <UML:Parameter visibility="private" xmi.id="1962" value="" type="KoIconItem *" name="item" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1963" type="virtual " name="~KisResourceMediator" />
+    <UML:Attribute visibility="private" xmi.id="1944" value="" type="KoIconItem *" name="m_activeItem" />
+    <UML:Attribute visibility="private" xmi.id="1945" value="" type="KisItemChooser *" name="m_chooser" />
+    <UML:Attribute visibility="private" xmi.id="1946" value="" type="QMap" name="m_items" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1964" name="KisResourceServer" >
+    <UML:Operation visibility="public" xmi.id="1971" type="" name="KisResourceServer" />
+    <UML:Operation visibility="public" xmi.id="1972" type="Q_INT32" name="brushCount" />
+    <UML:Operation visibility="public" xmi.id="1973" type="QPtrList" name="brushes" />
+    <UML:Operation visibility="protected" xmi.id="1974" type="void" name="loadBrush" />
+    <UML:Operation visibility="public" xmi.id="1975" type="void" name="loadBrushes" />
+    <UML:Operation visibility="protected" xmi.id="1976" type="void" name="loadPattern" />
+    <UML:Operation visibility="public" xmi.id="1977" type="void" name="loadPatterns" />
+    <UML:Operation visibility="protected" xmi.id="1978" type="void" name="loadpipeBrush" />
+    <UML:Operation visibility="public" xmi.id="1979" type="void" name="loadpipeBrushes" />
+    <UML:Operation visibility="public" xmi.id="1980" type="Q_INT32" name="patternCount" />
+    <UML:Operation visibility="public" xmi.id="1981" type="QPtrList" name="patterns" />
+    <UML:Operation visibility="public" xmi.id="1982" type="Q_INT32" name="pipebrushCount" />
+    <UML:Operation visibility="public" xmi.id="1983" type="QPtrList" name="pipebrushes" />
+    <UML:Operation visibility="public" xmi.id="1984" type="virtual " name="~KisResourceServer" />
+    <UML:Attribute visibility="private" xmi.id="1965" value="" type=TQSTRINGLIST_OBJECT_NAME_STRING name="m_brushFilenames" />
+    <UML:Attribute visibility="private" xmi.id="1966" value="" type="QPtrList" name="m_brushes" />
+    <UML:Attribute visibility="private" xmi.id="1967" value="" type=TQSTRINGLIST_OBJECT_NAME_STRING name="m_patternFilenames" />
+    <UML:Attribute visibility="private" xmi.id="1968" value="" type="QPtrList" name="m_patterns" />
+    <UML:Attribute visibility="private" xmi.id="1969" value="" type=TQSTRINGLIST_OBJECT_NAME_STRING name="m_pipebrushFilenames" />
+    <UML:Attribute visibility="private" xmi.id="1970" value="" type="QPtrList" name="m_pipebrushes" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1985" name="KisPluginServer" >
+    <UML:Operation visibility="public" xmi.id="1988" type="" name="KisPluginServer" />
+    <UML:Operation visibility="public" xmi.id="1989" type="void" name="activatePlugin" >
+     <UML:Parameter visibility="private" xmi.id="1990" value="" type="int" name="id" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1991" type="void" name="buildFilterMenu" >
+     <UML:Parameter visibility="private" xmi.id="1992" value="" type="QPopupMenu *" name="menu" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="1993" type="void" name="findPlugins" >
+     <UML:Parameter visibility="private" xmi.id="1994" value="" type="const QString &amp;" name="directory" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="1995" type="" name="~KisPluginServer" />
+    <UML:Attribute visibility="private" xmi.id="1986" value="" type="int" name="m_count" />
+    <UML:Attribute visibility="private" xmi.id="1987" value="" type="PluginInfoList" name="m_plugins" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="1996" name="KisTileCommand" >
+    <UML:Operation visibility="public" xmi.id="2002" type="" name="KisTileCommand" >
+     <UML:Parameter visibility="private" xmi.id="2003" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="2004" value="" type="KisPaintDeviceSP" name="device" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2005" type="" name="KisTileCommand" >
+     <UML:Parameter visibility="private" xmi.id="2006" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="2007" value="" type="KisPaintDeviceSP" name="device" />
+     <UML:Parameter visibility="private" xmi.id="2008" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="2009" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="2010" value="" type="Q_INT32" name="width" />
+     <UML:Parameter visibility="private" xmi.id="2011" value="" type="Q_INT32" name="height" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2012" type="" name="KisTileCommand" >
+     <UML:Parameter visibility="private" xmi.id="2013" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="2014" value="" type="KisPaintDeviceSP" name="device" />
+     <UML:Parameter visibility="private" xmi.id="2015" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2016" type="void" name="addTile" >
+     <UML:Parameter visibility="private" xmi.id="2017" value="" type="Q_INT32" name="tileNo" />
+     <UML:Parameter visibility="private" xmi.id="2018" value="" type="KisTileSP" name="tile" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2019" type="virtual void" name="execute" />
+    <UML:Operation visibility="public" xmi.id="2020" type="virtual QString" name="name" />
+    <UML:Operation visibility="public" xmi.id="2021" type="virtual void" name="unexecute" />
+    <UML:Operation visibility="public" xmi.id="2022" type="virtual " name="~KisTileCommand" />
+    <UML:Attribute visibility="private" xmi.id="1997" value="" type="KisPaintDeviceSP" name="m_device" />
+    <UML:Attribute visibility="private" xmi.id="1998" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_name" />
+    <UML:Attribute visibility="private" xmi.id="1999" value="" type="TileMap" name="m_originals" />
+    <UML:Attribute visibility="private" xmi.id="2000" value="" type="QRect" name="m_rc" />
+    <UML:Attribute visibility="private" xmi.id="2001" value="" type="TileMap" name="m_tiles" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="2023" name="PluginInfo" >
+    <UML:Operation visibility="public" xmi.id="2031" type="" name="PluginInfo" >
+     <UML:Parameter visibility="private" xmi.id="2032" value="" type="const QString &amp;" name="name" />
+     <UML:Parameter visibility="private" xmi.id="2033" value="" type="const QString &amp;" name="comment" />
+     <UML:Parameter visibility="private" xmi.id="2034" value="" type="const QString &amp;" name="dir" />
+     <UML:Parameter visibility="private" xmi.id="2035" value="" type="const QString &amp;" name="lib" />
+     <UML:Parameter visibility="private" xmi.id="2036" value="" type="const QString &amp;" name="category" />
+     <UML:Parameter visibility="private" xmi.id="2037" value="" type="PluginType" name="type" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2038" type=TQSTRING_OBJECT_NAME_STRING name="category" />
+    <UML:Operation visibility="public" xmi.id="2039" type=TQSTRING_OBJECT_NAME_STRING name="comment" />
+    <UML:Operation visibility="public" xmi.id="2040" type=TQSTRING_OBJECT_NAME_STRING name="dir" />
+    <UML:Operation visibility="public" xmi.id="2041" type="int" name="id" />
+    <UML:Operation visibility="public" xmi.id="2042" type=TQSTRING_OBJECT_NAME_STRING name="library" />
+    <UML:Operation visibility="public" xmi.id="2043" type=TQSTRING_OBJECT_NAME_STRING name="name" />
+    <UML:Operation visibility="public" xmi.id="2044" type="void" name="setId" >
+     <UML:Parameter visibility="private" xmi.id="2045" value="" type="int" name="id" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2046" type="PluginType" name="type" />
+    <UML:Attribute visibility="private" xmi.id="2024" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_category" />
+    <UML:Attribute visibility="private" xmi.id="2025" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_comment" />
+    <UML:Attribute visibility="private" xmi.id="2026" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_dir" />
+    <UML:Attribute visibility="private" xmi.id="2027" value="" type="int" name="m_id" />
+    <UML:Attribute visibility="private" xmi.id="2028" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_library" />
+    <UML:Attribute visibility="private" xmi.id="2029" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_name" />
+    <UML:Attribute visibility="private" xmi.id="2030" value="" type="PluginType" name="m_type" />
+   </UML:Class>
+   <UML:Class stereotype="class" comment="The KisResource class provides a representation of Chalk image resources.  This
+includes, but not limited to, brushes and patterns.
+
+This replaces the KisKrayon facility that used to be present in Krayon." visibility="public" xmi.id="2047" name="KisResource" >
+    <UML:Operation visibility="protected" xmi.id="2055" type="KisResource &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="2056" value="" type="const KisResource &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2057" type="" name="KisResource" >
+     <UML:Parameter visibility="private" xmi.id="2058" value="" type="const KisResource &amp;" />
+    </UML:Operation>
+    <UML:Operation comment="Creates a new KisResource object using @p filename.  No file is opened
+in the constructor, you have to call loadAsync.
+
+@param filename the file name to save and load from." visibility="public" xmi.id="2059" type="" name="KisResource" >
+     <UML:Parameter visibility="private" xmi.id="2060" value="" type="const QString &amp;" name="filename" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2061" type="bool" name="dirty" />
+    <UML:Operation visibility="public" xmi.id="2062" type=TQSTRING_OBJECT_NAME_STRING name="filename" />
+    <UML:Operation visibility="public" xmi.id="2063" type="Q_INT32" name="height" />
+    <UML:Operation comment="Returns a QImage representing this resource.  This image could be null." visibility="public" xmi.id="2064" type="virtual QImage" isAbstract="true" name="img" />
+    <UML:Operation comment="Load this resource asynchronously.  The signal loadComplete is emitted when
+the resource has been loaded and valid flag is set to true." visibility="public" xmi.id="2065" type="virtual bool" isAbstract="true" name="loadAsync" />
+    <UML:Operation visibility="public" xmi.id="2066" type=TQSTRING_OBJECT_NAME_STRING name="name" />
+    <UML:Operation comment="Save this resource asynchronously.  The signal saveComplete is emitted when
+the resource has been saved." visibility="public" xmi.id="2067" type="virtual bool" isAbstract="true" name="saveAsync" />
+    <UML:Operation visibility="public" xmi.id="2068" type="void" name="setDirty" >
+     <UML:Parameter visibility="private" xmi.id="2069" value="" type="bool" name="dirt" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2070" type="void" name="setFilename" >
+     <UML:Parameter visibility="private" xmi.id="2071" value="" type="const QString &amp;" name="filename" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2072" type="void" name="setHeight" >
+     <UML:Parameter visibility="private" xmi.id="2073" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2074" type="void" name="setName" >
+     <UML:Parameter visibility="private" xmi.id="2075" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2076" type="void" name="setSpacing" >
+     <UML:Parameter visibility="private" xmi.id="2077" value="" type="Q_INT32" name="s" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2078" type="void" name="setValid" >
+     <UML:Parameter visibility="private" xmi.id="2079" value="" type="bool" name="valid" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2080" type="void" name="setWidth" >
+     <UML:Parameter visibility="private" xmi.id="2081" value="" type="Q_INT32" name="w" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2082" type="Q_INT32" name="spacing" />
+    <UML:Operation visibility="public" xmi.id="2083" type="bool" name="valid" />
+    <UML:Operation visibility="public" xmi.id="2084" type="Q_INT32" name="width" />
+    <UML:Operation comment="Creates a new KisResource object using @p filename.  No file is opened
+in the constructor, you have to call loadAsync.
+
+@param filename the file name to save and load from." visibility="public" xmi.id="2085" type="virtual " name="~KisResource" />
+    <UML:Attribute visibility="private" xmi.id="2048" value="" type="bool" name="m_dirty" />
+    <UML:Attribute visibility="private" xmi.id="2049" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_filename" />
+    <UML:Attribute visibility="private" xmi.id="2050" value="" type="Q_INT32" name="m_height" />
+    <UML:Attribute visibility="private" xmi.id="2051" value="" type=TQSTRING_OBJECT_NAME_STRING name="m_name" />
+    <UML:Attribute visibility="private" xmi.id="2052" value="" type="Q_INT32" name="m_spacing" />
+    <UML:Attribute visibility="private" xmi.id="2053" value="" type="bool" name="m_valid" />
+    <UML:Attribute visibility="private" xmi.id="2054" value="" type="Q_INT32" name="m_width" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="2086" name="KisRenderInterface" >
+    <UML:Operation visibility="public" xmi.id="2087" type="KisRenderInterface &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="2088" value="" type="const KisRenderInterface &amp;" name="rhs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2089" type="" name="KisRenderInterface" />
+    <UML:Operation visibility="public" xmi.id="2090" type="" name="KisRenderInterface" >
+     <UML:Parameter visibility="private" xmi.id="2091" value="" type="const KisRenderInterface &amp;" name="rhs" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2092" type="virtual void" isAbstract="true" name="tqinvalidate" />
+    <UML:Operation visibility="public" xmi.id="2093" type="virtual void" isAbstract="true" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="2094" value="" type="Q_INT32" name="tileno" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2095" type="virtual void" isAbstract="true" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="2096" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="2097" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="2098" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="2099" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2100" type="virtual void" isAbstract="true" name="tqinvalidate" >
+     <UML:Parameter visibility="private" xmi.id="2101" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2102" type="virtual Q_INT32" isAbstract="true" name="tileNum" >
+     <UML:Parameter visibility="private" xmi.id="2103" value="" type="Q_INT32" name="xpix" />
+     <UML:Parameter visibility="private" xmi.id="2104" value="" type="Q_INT32" name="ypix" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2105" type="virtual KisTileMgrSP" isAbstract="true" name="tiles" />
+    <UML:Operation visibility="public" xmi.id="2106" type="virtual void" isAbstract="true" name="validate" >
+     <UML:Parameter visibility="private" xmi.id="2107" value="" type="Q_INT32" name="tileno" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2108" type="virtual " name="~KisRenderInterface" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="2109" name="KisPattern" >
+    <UML:Operation visibility="public" xmi.id="2117" type="" name="KisPattern" >
+     <UML:Parameter visibility="private" xmi.id="2118" value="" type="const QString &amp;" name="file" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2119" type=TQPOINT_OBJECT_NAME_STRING name="hotSpot" />
+    <UML:Operation visibility="public" xmi.id="2120" type="virtual QImage" name="img" />
+    <UML:Operation visibility="public" xmi.id="2121" type="bool" name="isValid" />
+    <UML:Operation visibility="public" xmi.id="2122" type="virtual bool" name="loadAsync" />
+    <UML:Operation visibility="public" xmi.id="2123" type="QPixmap &amp;" name="pixmap" />
+    <UML:Operation visibility="public" xmi.id="2124" type="virtual bool" name="saveAsync" />
+    <UML:Operation visibility="public" xmi.id="2125" type="QPixmap &amp;" name="thumbPixmap" />
+    <UML:Operation visibility="public" xmi.id="2126" type="virtual " name="~KisPattern" />
+    <UML:Attribute visibility="private" xmi.id="2110" value="" type=TQBYTEARRAY_OBJECT_NAME_STRING name="m_data" />
+    <UML:Attribute visibility="private" xmi.id="2111" value="" type=TQPOINT_OBJECT_NAME_STRING name="m_hotSpot" />
+    <UML:Attribute visibility="private" xmi.id="2112" value="" type="QImage" name="m_img" />
+    <UML:Attribute visibility="private" xmi.id="2113" value="" type="QPixmap *" name="m_pixmap" />
+    <UML:Attribute visibility="private" xmi.id="2114" value="" type="QPixmap *" name="m_thumbPixmap" />
+    <UML:Attribute visibility="private" xmi.id="2115" value="" type="bool" name="m_valid" />
+    <UML:Attribute visibility="private" xmi.id="2116" value="" type="bool" name="m_validThumb" />
+   </UML:Class>
+   <UML:Enum stereotype="enum" visibility="public" xmi.id="2129" name="PluginType" >
+    <UML:EnumLiteral visibility="public" xmi.id="2130" name="PLUGIN_FILTER" />
+    <UML:EnumLiteral visibility="public" xmi.id="2131" name="PLUGIN_TOOL" />
+   </UML:Enum>
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2132" name="PluginInfoList" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2133" name="TileMap" />
+   <UML:Class stereotype="class" visibility="public" xmi.id="2135" name="KisTool" >
+    <UML:Operation visibility="protected" xmi.id="2136" type="KisTool &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="2137" value="" type="const KisTool &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2138" type="" name="KisTool" />
+    <UML:Operation visibility="protected" xmi.id="2139" type="" name="KisTool" >
+     <UML:Parameter visibility="private" xmi.id="2140" value="" type="const KisTool &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2141" type="virtual void" isAbstract="true" name="clear" />
+    <UML:Operation visibility="public" xmi.id="2142" type="virtual void" isAbstract="true" name="clear" >
+     <UML:Parameter visibility="private" xmi.id="2143" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2144" type="virtual void" isAbstract="true" name="cursor" >
+     <UML:Parameter visibility="private" xmi.id="2145" value="" type="QWidget *" name="w" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2146" type="virtual void" isAbstract="true" name="enter" >
+     <UML:Parameter visibility="private" xmi.id="2147" value="" type="QEvent *" name="e" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2148" type="virtual void" isAbstract="true" name="keyPress" >
+     <UML:Parameter visibility="private" xmi.id="2149" value="" type="QKeyEvent *" name="e" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2150" type="virtual void" isAbstract="true" name="keyRelease" >
+     <UML:Parameter visibility="private" xmi.id="2151" value="" type="QKeyEvent *" name="e" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2152" type="virtual void" isAbstract="true" name="leave" >
+     <UML:Parameter visibility="private" xmi.id="2153" value="" type="QEvent *" name="e" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2154" type="virtual void" isAbstract="true" name="mouseMove" >
+     <UML:Parameter visibility="private" xmi.id="2155" value="" type="QMouseEvent *" name="e" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2156" type="virtual void" isAbstract="true" name="mousePress" >
+     <UML:Parameter visibility="private" xmi.id="2157" value="" type="QMouseEvent *" name="e" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2158" type="virtual void" isAbstract="true" name="mouseRelease" >
+     <UML:Parameter visibility="private" xmi.id="2159" value="" type="QMouseEvent *" name="e" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2160" type="virtual KDialog *" isAbstract="true" name="options" >
+     <UML:Parameter visibility="private" xmi.id="2161" value="" type="QWidget *" name="tqparent" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2162" type="virtual void" isAbstract="true" name="paint" >
+     <UML:Parameter visibility="private" xmi.id="2163" value="" type="QPainter &amp;" name="gc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2164" type="virtual void" isAbstract="true" name="paint" >
+     <UML:Parameter visibility="private" xmi.id="2165" value="" type="QPainter &amp;" name="gc" />
+     <UML:Parameter visibility="private" xmi.id="2166" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2167" type="virtual void" isAbstract="true" name="setCursor" >
+     <UML:Parameter visibility="private" xmi.id="2168" value="" type="const QCursor &amp;" name="cursor" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2169" type="virtual void" isAbstract="true" name="setup" >
+     <UML:Parameter visibility="private" xmi.id="2170" value="" type="KActionCollection *" name="collection" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2171" type="virtual void" isAbstract="true" name="tabletEvent" >
+     <UML:Parameter visibility="private" xmi.id="2172" value="" type="QTabletEvent *" name="e" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2173" type="virtual " name="~KisTool" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="2174" name="KisUndoAdapter" >
+    <UML:Operation visibility="protected" xmi.id="2175" type="KisUndoAdapter &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="2176" value="" type="const KisUndoAdapter &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2177" type="" name="KisUndoAdapter" />
+    <UML:Operation visibility="protected" xmi.id="2178" type="" name="KisUndoAdapter" >
+     <UML:Parameter visibility="private" xmi.id="2179" value="" type="const KisUndoAdapter &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2180" type="virtual void" isAbstract="true" name="addCommand" >
+     <UML:Parameter visibility="private" xmi.id="2181" value="" type="KCommand *" name="cmd" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2182" type="virtual void" isAbstract="true" name="beginMacro" >
+     <UML:Parameter visibility="private" xmi.id="2183" value="" type="const QString &amp;" name="macroName" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2184" type="virtual void" isAbstract="true" name="endMacro" />
+    <UML:Operation visibility="public" xmi.id="2185" type="virtual bool" isAbstract="true" name="inMacro" />
+    <UML:Operation visibility="public" xmi.id="2186" type="virtual void" isAbstract="true" name="setUndo" >
+     <UML:Parameter visibility="private" xmi.id="2187" value="" type="bool" name="undo" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2188" type="virtual bool" isAbstract="true" name="undo" />
+    <UML:Operation visibility="public" xmi.id="2189" type="virtual " name="~KisUndoAdapter" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="2190" name="KisToolFactory" >
+    <UML:Operation visibility="protected" xmi.id="2193" type="KisToolFactory &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="2194" value="" type="const KisToolFactory &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2195" type="" name="KisToolFactory" />
+    <UML:Operation visibility="protected" xmi.id="2196" type="" name="KisToolFactory" >
+     <UML:Parameter visibility="private" xmi.id="2197" value="" type="const KisToolFactory &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2198" type="void" name="create" >
+     <UML:Parameter visibility="private" xmi.id="2199" value="" type="KActionCollection *" name="actionCollection" />
+     <UML:Parameter visibility="private" xmi.id="2200" value="" type="KisCanvasSubject *" name="subject" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2201" type="KisToolFactory *" name="singleton" ownerScope="classifier" />
+    <UML:Operation visibility="public" xmi.id="2202" type="" name="~KisToolFactory" />
+    <UML:Attribute visibility="private" xmi.id="2192" value="" type="vKisTool" name="m_tools" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="2203" name="KisToolControllerInterface" >
+    <UML:Operation visibility="protected" xmi.id="2204" type="KisToolControllerInterface &amp;" name="=" >
+     <UML:Parameter visibility="private" xmi.id="2205" value="" type="const KisToolControllerInterface &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2206" type="" name="KisToolControllerInterface" />
+    <UML:Operation visibility="protected" xmi.id="2207" type="" name="KisToolControllerInterface" >
+     <UML:Parameter visibility="private" xmi.id="2208" value="" type="const KisToolControllerInterface &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2209" type="virtual KisTool *" isAbstract="true" name="currentTool" />
+    <UML:Operation visibility="public" xmi.id="2210" type="virtual void" isAbstract="true" name="setCurrentTool" >
+     <UML:Parameter visibility="private" xmi.id="2211" value="" type="KisTool *" name="tool" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2212" type="virtual " name="~KisToolControllerInterface" />
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="2218" name="KisUtil" >
+    <UML:Operation visibility="public" xmi.id="2219" type="void" name="enlargeRectToContainPoint" ownerScope="classifier" >
+     <UML:Parameter visibility="private" xmi.id="2220" value="" type="QRect &amp;" name="r" />
+     <UML:Parameter visibility="private" xmi.id="2221" value="" type=TQPOINT_OBJECT_NAME_STRING name="p" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2222" type="QRect" name="findBoundingTiles" ownerScope="classifier" >
+     <UML:Parameter visibility="private" xmi.id="2223" value="" type="const QRect &amp;" name="area" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2224" type="QRect" name="findTileExtents" ownerScope="classifier" >
+     <UML:Parameter visibility="private" xmi.id="2225" value="" type="QRect" name="r" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2226" type="void" name="printPoint" ownerScope="classifier" >
+     <UML:Parameter visibility="private" xmi.id="2227" value="" type="const QPoint &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2228" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2229" type="void" name="printRect" ownerScope="classifier" >
+     <UML:Parameter visibility="private" xmi.id="2230" value="" type="const QRect &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2231" value="" type="const QString &amp;" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2232" type="QImage" name="roughScaleQImage" ownerScope="classifier" >
+     <UML:Parameter visibility="private" xmi.id="2233" value="" type="QImage &amp;" name="src" />
+     <UML:Parameter visibility="private" xmi.id="2234" value="" type="int" name="width" />
+     <UML:Parameter visibility="private" xmi.id="2235" value="" type="int" name="height" />
+    </UML:Operation>
+   </UML:Class>
+   <UML:Class stereotype="class" visibility="public" xmi.id="2236" name="KisVector" >
+    <UML:Operation visibility="public" xmi.id="2240" type="bool" name="!=" >
+     <UML:Parameter visibility="private" xmi.id="2241" value="" type="const KisVector &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2242" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2243" type="KisVector" name="*" >
+     <UML:Parameter visibility="private" xmi.id="2244" value="" type="const KisVector &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2245" value="" type="double" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2246" type="KisVector" name="*" >
+     <UML:Parameter visibility="private" xmi.id="2247" value="" type="const KisVector &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2248" value="" type="int" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2249" type="KisVector" name="*" >
+     <UML:Parameter visibility="private" xmi.id="2250" value="" type="const KisVector &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2251" value="" type="long" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2252" type="KisVector" name="*" >
+     <UML:Parameter visibility="private" xmi.id="2253" value="" type="double" />
+     <UML:Parameter visibility="private" xmi.id="2254" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2255" type="KisVector" name="*" >
+     <UML:Parameter visibility="private" xmi.id="2256" value="" type="int" />
+     <UML:Parameter visibility="private" xmi.id="2257" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2258" type="KisVector" name="*" >
+     <UML:Parameter visibility="private" xmi.id="2259" value="" type="long" />
+     <UML:Parameter visibility="private" xmi.id="2260" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2261" type="KisVector &amp;" name="*=" >
+     <UML:Parameter visibility="private" xmi.id="2262" value="" type="double" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2263" type="KisVector &amp;" name="*=" >
+     <UML:Parameter visibility="private" xmi.id="2264" value="" type="int" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2265" type="KisVector &amp;" name="*=" >
+     <UML:Parameter visibility="private" xmi.id="2266" value="" type="long" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2267" type="KisVector" name="+" >
+     <UML:Parameter visibility="private" xmi.id="2268" value="" type="const KisVector &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2269" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2270" type="KisVector &amp;" name="+=" >
+     <UML:Parameter visibility="private" xmi.id="2271" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2272" type="KisVector" name="-" >
+     <UML:Parameter visibility="private" xmi.id="2273" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2274" type="KisVector" name="-" >
+     <UML:Parameter visibility="private" xmi.id="2275" value="" type="const KisVector &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2276" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2277" type="KisVector &amp;" name="-=" >
+     <UML:Parameter visibility="private" xmi.id="2278" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2279" type="KisVector" name="/" >
+     <UML:Parameter visibility="private" xmi.id="2280" value="" type="const KisVector &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2281" value="" type="double" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2282" type="KisVector" name="/" >
+     <UML:Parameter visibility="private" xmi.id="2283" value="" type="const KisVector &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2284" value="" type="int" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2285" type="KisVector" name="/" >
+     <UML:Parameter visibility="private" xmi.id="2286" value="" type="const KisVector &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2287" value="" type="long" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2288" type="KisVector &amp;" name="/=" >
+     <UML:Parameter visibility="private" xmi.id="2289" value="" type="double" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2290" type="KisVector &amp;" name="/=" >
+     <UML:Parameter visibility="private" xmi.id="2291" value="" type="int" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2292" type="KisVector &amp;" name="/=" >
+     <UML:Parameter visibility="private" xmi.id="2293" value="" type="long" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2294" type="bool" name="==" >
+     <UML:Parameter visibility="private" xmi.id="2295" value="" type="const KisVector &amp;" />
+     <UML:Parameter visibility="private" xmi.id="2296" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2297" type="" name="KisVector" />
+    <UML:Operation visibility="public" xmi.id="2298" type="" name="KisVector" >
+     <UML:Parameter visibility="private" xmi.id="2299" value="" type="double" name="x" />
+     <UML:Parameter visibility="private" xmi.id="2300" value="" type="double" name="y" />
+     <UML:Parameter visibility="private" xmi.id="2301" value="" type="double" name="z" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2302" type="" name="KisVector" >
+     <UML:Parameter visibility="private" xmi.id="2303" value="" type="int" name="x" />
+     <UML:Parameter visibility="private" xmi.id="2304" value="" type="int" name="y" />
+     <UML:Parameter visibility="private" xmi.id="2305" value="" type="int" name="z" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2306" type="" name="KisVector" >
+     <UML:Parameter visibility="private" xmi.id="2307" value="" type="long" name="x" />
+     <UML:Parameter visibility="private" xmi.id="2308" value="" type="long" name="y" />
+     <UML:Parameter visibility="private" xmi.id="2309" value="" type="long" name="z" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2310" type="KisVector &amp;" name="crossProduct" >
+     <UML:Parameter visibility="private" xmi.id="2311" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2312" type="double" name="dotProduct" >
+     <UML:Parameter visibility="private" xmi.id="2313" value="" type="const KisVector &amp;" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2314" type="bool" name="isNull" />
+    <UML:Operation visibility="public" xmi.id="2315" type="double" name="length" />
+    <UML:Operation visibility="public" xmi.id="2316" type="KisVector &amp;" name="normalize" />
+    <UML:Operation visibility="public" xmi.id="2317" type="void" name="setX" >
+     <UML:Parameter visibility="private" xmi.id="2318" value="" type="double" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2319" type="void" name="setY" >
+     <UML:Parameter visibility="private" xmi.id="2320" value="" type="double" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2321" type="void" name="setZ" >
+     <UML:Parameter visibility="private" xmi.id="2322" value="" type="double" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2323" type="double" name="x" />
+    <UML:Operation visibility="public" xmi.id="2324" type="double" name="y" />
+    <UML:Operation visibility="public" xmi.id="2325" type="double" name="z" />
+    <UML:Attribute visibility="private" xmi.id="2237" value="" type="double" name="m_x" />
+    <UML:Attribute visibility="private" xmi.id="2238" value="" type="double" name="m_y" />
+    <UML:Attribute visibility="private" xmi.id="2239" value="" type="double" name="m_z" />
+   </UML:Class>
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2327" name="vKisTool" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2328" name="vKisChannelSP_it" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2329" name="KisMementoSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2330" name="vKisLayerSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2331" name="vKisChannelSP_cit" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2332" name="vKisPaintDeviceSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2333" name="vKisImageSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2334" name="vKisTool_it" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2335" name="vKisChannelSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2336" name="KisDabSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2337" name="KisStrategyColorSpaceSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2338" name="vKisTileSP_it" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2339" name="KisChannelSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2340" name="KisTileSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2341" name="vKisSegments" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2342" name="KisSelectionSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2343" name="vKisMaskSP_it" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2344" name="vKisLayerSP_cit" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2345" name="KisStrategyColorSpaceMap" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2346" name="KisBackgroundSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2347" name="vKisLayerSP_it" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2348" name="vKisMaskSP_cit" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2349" name="vKisPaintDeviceSP_cit" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2350" name="vKisPaintDeviceSP_it" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2351" name="vKisImageSP_cit" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2352" name="vKisImageSP_it" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2353" name="vKisMaskSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2354" name="KisMaskSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2355" name="KisImageSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2356" name="vKisTileSP_cit" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2357" name="vKisTool_cit" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2358" name="KisTileMgrSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2359" name="KisPixelDataSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2360" name="KisLayerSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2361" name="vKisTileSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2362" name="KisPaintDeviceSP" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2363" name="KoColorMap" />
+   <UML:Class stereotype="class" visibility="public" xmi.id="2365" name="KisView" >
+    <UML:Operation visibility="public" xmi.id="2448" type="" name="KisView" >
+     <UML:Parameter visibility="private" xmi.id="2449" value="" type="KisDoc *" name="doc" />
+     <UML:Parameter visibility="private" xmi.id="2450" value="" type="KisUndoAdapter *" name="adapter" />
+     <UML:Parameter visibility="private" xmi.id="2451" value="" type="QWidget *" name="tqparent" />
+     <UML:Parameter visibility="private" xmi.id="2452" value="" type="const char *" name="name" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2453" type="virtual void" name="attach" >
+     <UML:Parameter visibility="private" xmi.id="2454" value="" type="KisCanvasObserver *" name="observer" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2455" type="virtual KoColor" name="bgColor" />
+    <UML:Operation visibility="protected" xmi.id="2456" type="virtual QWidget *" name="canvas" />
+    <UML:Operation visibility="protected" xmi.id="2457" type="virtual KisCanvasControllerInterface *" name="canvasController" />
+    <UML:Operation visibility="public" xmi.id="2458" type="virtual int" name="canvasXOffset" />
+    <UML:Operation visibility="public" xmi.id="2459" type="virtual int" name="canvasYOffset" />
+    <UML:Operation visibility="protected" xmi.id="2460" type="void" name="clearCanvas" >
+     <UML:Parameter visibility="private" xmi.id="2461" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2462" type="void" name="connectCurrentImg" />
+    <UML:Operation visibility="protected" xmi.id="2463" type="virtual KisBrush *" name="currentBrush" />
+    <UML:Operation visibility="protected" xmi.id="2464" type="virtual KisGradient *" name="currentGradient" />
+    <UML:Operation visibility="protected" xmi.id="2465" type="virtual KisImageSP" name="currentImg" />
+    <UML:Operation visibility="protected" xmi.id="2466" type="virtual QString" name="currentImgName" />
+    <UML:Operation visibility="protected" xmi.id="2467" type="virtual KisPattern *" name="currentPattern" />
+    <UML:Operation visibility="protected" xmi.id="2468" type="virtual KisTool *" name="currentTool" />
+    <UML:Operation visibility="public" xmi.id="2469" type="virtual DCOPObject *" name="dcopObject" />
+    <UML:Operation visibility="protected" xmi.id="2470" type="virtual void" name="detach" >
+     <UML:Parameter visibility="private" xmi.id="2471" value="" type="KisCanvasObserver *" name="observer" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2472" type="void" name="disconnectCurrentImg" />
+    <UML:Operation visibility="public" xmi.id="2473" type="Q_INT32" name="docHeight" />
+    <UML:Operation visibility="public" xmi.id="2474" type="Q_INT32" name="docWidth" />
+    <UML:Operation visibility="protected" xmi.id="2475" type="virtual KoDocument *" name="document" />
+    <UML:Operation visibility="protected" xmi.id="2476" type="void" name="eraseGuides" />
+    <UML:Operation visibility="public" xmi.id="2477" type="virtual bool" name="eventFilter" >
+     <UML:Parameter visibility="private" xmi.id="2478" value="" type="QObject *" name="o" />
+     <UML:Parameter visibility="private" xmi.id="2479" value="" type="QEvent *" name="e" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2480" type="virtual KoColor" name="fgColor" />
+    <UML:Operation visibility="protected" xmi.id="2481" type="void" name="fillSelection" >
+     <UML:Parameter visibility="private" xmi.id="2482" value="" type="const KoColor &amp;" name="c" />
+     <UML:Parameter visibility="private" xmi.id="2483" value="" type="QUANTUM" name="opacity" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2484" type="virtual void" name="guiActivateEvent" >
+     <UML:Parameter visibility="private" xmi.id="2485" value="" type="KParts :: GUIActivateEvent *" name="event" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2486" type="virtual Q_INT32" name="horzValue" />
+    <UML:Operation visibility="protected" xmi.id="2487" type="void" name="imgUpdateGUI" />
+    <UML:Operation visibility="public" xmi.id="2488" type="Q_INT32" name="importImage" >
+     <UML:Parameter visibility="private" xmi.id="2489" value="" type="bool" name="createLayer" />
+     <UML:Parameter visibility="private" xmi.id="2490" value="" type="bool" name="modal" />
+     <UML:Parameter visibility="private" xmi.id="2491" value="" type="const QString &amp;" name="filename" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2492" type="void" name="layerUpdateGUI" >
+     <UML:Parameter visibility="private" xmi.id="2493" value="" type="bool" name="enable" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2494" type="virtual void" name="notify" />
+    <UML:Operation visibility="protected" xmi.id="2495" type="void" name="paintGuides" />
+    <UML:Operation visibility="protected" xmi.id="2496" type="void" name="paintView" >
+     <UML:Parameter visibility="private" xmi.id="2497" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2498" type="virtual void" name="print" >
+     <UML:Parameter visibility="private" xmi.id="2499" value="" type="KPrinter &amp;" name="printer" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2500" type="virtual void" name="resizeEvent" >
+     <UML:Parameter visibility="private" xmi.id="2501" value="" type="QResizeEvent *" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2502" type="bool" name="selectColor" >
+     <UML:Parameter visibility="private" xmi.id="2503" value="" type="KoColor &amp;" name="result" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2504" type="void" name="selectImage" >
+     <UML:Parameter visibility="private" xmi.id="2505" value="" type="KisImageSP" name="img" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2506" type="void" name="selectionUpdateGUI" >
+     <UML:Parameter visibility="private" xmi.id="2507" value="" type="bool" name="enable" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2508" type="virtual void" name="setBGColor" >
+     <UML:Parameter visibility="private" xmi.id="2509" value="" type="const KoColor &amp;" name="c" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2510" type="virtual void" name="setCurrentTool" >
+     <UML:Parameter visibility="private" xmi.id="2511" value="" type="KisTool *" name="tool" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2512" type="virtual void" name="setFGColor" >
+     <UML:Parameter visibility="private" xmi.id="2513" value="" type="const KoColor &amp;" name="c" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2514" type="void" name="setupActions" />
+    <UML:Operation visibility="protected" xmi.id="2515" type="void" name="setupCanvas" />
+    <UML:Operation visibility="protected" xmi.id="2516" type="void" name="setupClipboard" />
+    <UML:Operation visibility="public" xmi.id="2517" type="virtual void" name="setupPrinter" >
+     <UML:Parameter visibility="private" xmi.id="2518" value="" type="KPrinter &amp;" name="printer" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2519" type="void" name="setupRulers" />
+    <UML:Operation visibility="protected" xmi.id="2520" type="void" name="setupScrollBars" />
+    <UML:Operation visibility="protected" xmi.id="2521" type="void" name="setupSideBar" />
+    <UML:Operation visibility="protected" xmi.id="2522" type="void" name="setupStatusBar" />
+    <UML:Operation visibility="protected" xmi.id="2523" type="void" name="setupTabBar" />
+    <UML:Operation visibility="protected" xmi.id="2524" type="void" name="setupTools" />
+    <UML:Operation visibility="protected" xmi.id="2525" type="virtual KisToolControllerInterface *" name="toolController" />
+    <UML:Operation visibility="protected" xmi.id="2526" type="virtual KisUndoAdapter *" name="undoAdapter" />
+    <UML:Operation visibility="protected" xmi.id="2527" type="virtual void" name="updateCanvas" />
+    <UML:Operation visibility="protected" xmi.id="2528" type="virtual void" name="updateCanvas" >
+     <UML:Parameter visibility="private" xmi.id="2529" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="2530" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="2531" value="" type="Q_INT32" name="w" />
+     <UML:Parameter visibility="private" xmi.id="2532" value="" type="Q_INT32" name="h" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2533" type="virtual void" name="updateCanvas" >
+     <UML:Parameter visibility="private" xmi.id="2534" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2535" type="void" name="updateGuides" />
+    <UML:Operation visibility="public" xmi.id="2536" type="virtual void" name="updateReadWrite" >
+     <UML:Parameter visibility="private" xmi.id="2537" value="" type="bool" name="readwrite" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2538" type="virtual Q_INT32" name="vertValue" />
+    <UML:Operation visibility="protected" xmi.id="2539" type="virtual void" name="viewToWindow" >
+     <UML:Parameter visibility="private" xmi.id="2540" value="" type="Q_INT32 *" name="x" />
+     <UML:Parameter visibility="private" xmi.id="2541" value="" type="Q_INT32 *" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2542" type="virtual QPoint" name="viewToWindow" >
+     <UML:Parameter visibility="private" xmi.id="2543" value="" type="const QPoint &amp;" name="pt" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2544" type="virtual QRect" name="viewToWindow" >
+     <UML:Parameter visibility="private" xmi.id="2545" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2546" type="virtual void" name="windowToView" >
+     <UML:Parameter visibility="private" xmi.id="2547" value="" type="Q_INT32 *" name="x" />
+     <UML:Parameter visibility="private" xmi.id="2548" value="" type="Q_INT32 *" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2549" type="virtual QPoint" name="windowToView" >
+     <UML:Parameter visibility="private" xmi.id="2550" value="" type="const QPoint &amp;" name="pt" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2551" type="virtual QRect" name="windowToView" >
+     <UML:Parameter visibility="private" xmi.id="2552" value="" type="const QRect &amp;" name="rc" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2553" type="virtual double" name="zoomFactor" />
+    <UML:Operation visibility="protected" xmi.id="2554" type="virtual void" name="zoomIn" />
+    <UML:Operation visibility="protected" xmi.id="2555" type="virtual void" name="zoomIn" >
+     <UML:Parameter visibility="private" xmi.id="2556" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="2557" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2558" type="virtual void" name="zoomOut" />
+    <UML:Operation visibility="protected" xmi.id="2559" type="virtual void" name="zoomOut" >
+     <UML:Parameter visibility="private" xmi.id="2560" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="2561" value="" type="Q_INT32" name="y" />
+    </UML:Operation>
+    <UML:Operation visibility="protected" xmi.id="2562" type="void" name="zoomUpdateGUI" >
+     <UML:Parameter visibility="private" xmi.id="2563" value="" type="Q_INT32" name="x" />
+     <UML:Parameter visibility="private" xmi.id="2564" value="" type="Q_INT32" name="y" />
+     <UML:Parameter visibility="private" xmi.id="2565" value="" type="double" name="zf" />
+    </UML:Operation>
+    <UML:Operation visibility="public" xmi.id="2566" type="virtual " name="~KisView" />
+    <UML:Attribute visibility="private" xmi.id="2367" value="" type="KoColor" name="m_bg" />
+    <UML:Attribute visibility="private" xmi.id="2370" value="" type="KisLabelBuilderProgress *" name="m_buildProgress" />
+    <UML:Attribute visibility="private" xmi.id="2371" value="" type="KisCanvas *" name="m_canvas" />
+    <UML:Attribute visibility="private" xmi.id="2372" value="" type="KisChannelView *" name="m_channelView" />
+    <UML:Attribute visibility="private" xmi.id="2373" value="" type="bool" name="m_clipboardHasImage" />
+    <UML:Attribute visibility="private" xmi.id="2374" value="" type="mutable KisImageSP" name="m_current" />
+    <UML:Attribute visibility="private" xmi.id="2375" value="" type="KisGuideSP" name="m_currentGuide" />
+    <UML:Attribute visibility="private" xmi.id="2376" value="" type="DCOPObject *" name="m_dcop" />
+    <UML:Attribute visibility="private" xmi.id="2377" value="" type="KToggleAction *" name="m_dlgBrushToggle" />
+    <UML:Attribute visibility="private" xmi.id="2378" value="" type="KToggleAction *" name="m_dlgChannelsToggle" />
+    <UML:Attribute visibility="private" xmi.id="2379" value="" type="KToggleAction *" name="m_dlgColorsToggle" />
+    <UML:Attribute visibility="private" xmi.id="2380" value="" type="KToggleAction *" name="m_dlgLayersToggle" />
+    <UML:Attribute visibility="private" xmi.id="2381" value="" type="KToggleAction *" name="m_dlgPatternToggle" />
+    <UML:Attribute visibility="private" xmi.id="2383" value="" type="KoColor" name="m_fg" />
+    <UML:Attribute visibility="private" xmi.id="2384" value="" type="KToggleAction *" name="m_floatsidebarToggle" />
+    <UML:Attribute visibility="private" xmi.id="2386" value="" type="QWidget *" name="m_gradientChooser" />
+    <UML:Attribute visibility="private" xmi.id="2387" value="" type="KisRuler *" name="m_hRuler" />
+    <UML:Attribute visibility="private" xmi.id="2388" value="" type="QScrollBar *" name="m_hScroll" />
+    <UML:Attribute visibility="private" xmi.id="2389" value="" type="QWidget *" name="m_imageChooser" />
+    <UML:Attribute visibility="private" xmi.id="2391" value="" type="KAction *" name="m_imgDup" />
+    <UML:Attribute visibility="private" xmi.id="2392" value="" type="KAction *" name="m_imgExport" />
+    <UML:Attribute visibility="private" xmi.id="2393" value="" type="KAction *" name="m_imgImport" />
+    <UML:Attribute visibility="private" xmi.id="2394" value="" type="KAction *" name="m_imgMergeAll" />
+    <UML:Attribute visibility="private" xmi.id="2395" value="" type="KAction *" name="m_imgMergeLinked" />
+    <UML:Attribute visibility="private" xmi.id="2396" value="" type="KAction *" name="m_imgMergeVisible" />
+    <UML:Attribute visibility="private" xmi.id="2397" value="" type="KAction *" name="m_imgResize" />
+    <UML:Attribute visibility="private" xmi.id="2398" value="" type="KAction *" name="m_imgResizeToLayer" />
+    <UML:Attribute visibility="private" xmi.id="2399" value="" type="KAction *" name="m_imgRm" />
+    <UML:Attribute visibility="private" xmi.id="2400" value="" type="KAction *" name="m_imgScan" />
+    <UML:Attribute visibility="private" xmi.id="2401" value="" type=TQPOINT_OBJECT_NAME_STRING name="m_lastGuidePoint" />
+    <UML:Attribute visibility="private" xmi.id="2402" value="" type="KAction *" name="m_layerAdd" />
+    <UML:Attribute visibility="private" xmi.id="2403" value="" type="KAction *" name="m_layerBottom" />
+    <UML:Attribute visibility="private" xmi.id="2404" value="" type="KisListBox *" name="m_layerBox" />
+    <UML:Attribute visibility="private" xmi.id="2405" value="" type="KAction *" name="m_layerDup" />
+    <UML:Attribute visibility="private" xmi.id="2406" value="" type="KAction *" name="m_layerHide" />
+    <UML:Attribute visibility="private" xmi.id="2407" value="" type="KAction *" name="m_layerLink" />
+    <UML:Attribute visibility="private" xmi.id="2408" value="" type="KAction *" name="m_layerLower" />
+    <UML:Attribute visibility="private" xmi.id="2409" value="" type="KAction *" name="m_layerProperties" />
+    <UML:Attribute visibility="private" xmi.id="2410" value="" type="KAction *" name="m_layerRaise" />
+    <UML:Attribute visibility="private" xmi.id="2411" value="" type="KAction *" name="m_layerResize" />
+    <UML:Attribute visibility="private" xmi.id="2412" value="" type="KAction *" name="m_layerResizeToImage" />
+    <UML:Attribute visibility="private" xmi.id="2413" value="" type="KAction *" name="m_layerRm" />
+    <UML:Attribute visibility="private" xmi.id="2414" value="" type="KAction *" name="m_layerSaveAs" />
+    <UML:Attribute visibility="private" xmi.id="2415" value="" type="KAction *" name="m_layerScale" />
+    <UML:Attribute visibility="private" xmi.id="2416" value="" type="KAction *" name="m_layerToImage" />
+    <UML:Attribute visibility="private" xmi.id="2417" value="" type="KAction *" name="m_layerTop" />
+    <UML:Attribute visibility="private" xmi.id="2418" value="" type="KToggleAction *" name="m_lsidebarToggle" />
+    <UML:Attribute visibility="private" xmi.id="2419" value="" type="vKisCanvasObserver" name="m_observers" />
+    <UML:Attribute visibility="private" xmi.id="2420" value="" type="QWidget *" name="m_paletteChooser" />
+    <UML:Attribute visibility="private" xmi.id="2421" value="" type="QWidget *" name="m_pathView" />
+    <UML:Attribute visibility="private" xmi.id="2424" value="" type="KAction *" name="m_selectionCopy" />
+    <UML:Attribute visibility="private" xmi.id="2425" value="" type="KAction *" name="m_selectionCrop" />
+    <UML:Attribute visibility="private" xmi.id="2426" value="" type="KAction *" name="m_selectionCut" />
+    <UML:Attribute visibility="private" xmi.id="2427" value="" type="KAction *" name="m_selectionFillBg" />
+    <UML:Attribute visibility="private" xmi.id="2428" value="" type="KAction *" name="m_selectionFillFg" />
+    <UML:Attribute visibility="private" xmi.id="2429" value="" type="KAction *" name="m_selectionPaste" />
+    <UML:Attribute visibility="private" xmi.id="2430" value="" type="KAction *" name="m_selectionPasteInto" />
+    <UML:Attribute visibility="private" xmi.id="2431" value="" type="KAction *" name="m_selectionRm" />
+    <UML:Attribute visibility="private" xmi.id="2432" value="" type="KAction *" name="m_selectionSelectAll" />
+    <UML:Attribute visibility="private" xmi.id="2433" value="" type="KAction *" name="m_selectionSelectNone" />
+    <UML:Attribute visibility="private" xmi.id="2434" value="" type="KisSideBar *" name="m_sideBar" />
+    <UML:Attribute visibility="private" xmi.id="2435" value="" type="KToggleAction *" name="m_sidebarToggle" />
+    <UML:Attribute visibility="private" xmi.id="2436" value="" type="KoTabBar *" name="m_tabBar" />
+    <UML:Attribute visibility="private" xmi.id="2437" value="" type="QButton *" name="m_tabFirst" />
+    <UML:Attribute visibility="private" xmi.id="2438" value="" type="QButton *" name="m_tabLast" />
+    <UML:Attribute visibility="private" xmi.id="2439" value="" type="QButton *" name="m_tabLeft" />
+    <UML:Attribute visibility="private" xmi.id="2440" value="" type="QButton *" name="m_tabRight" />
+    <UML:Attribute visibility="private" xmi.id="2442" value="" type="KisRuler *" name="m_vRuler" />
+    <UML:Attribute visibility="private" xmi.id="2443" value="" type="QScrollBar *" name="m_vScroll" />
+    <UML:Attribute visibility="private" xmi.id="2444" value="" type="Q_INT32" name="m_xoff" />
+    <UML:Attribute visibility="private" xmi.id="2445" value="" type="Q_INT32" name="m_yoff" />
+    <UML:Attribute visibility="private" xmi.id="2446" value="" type="KAction *" name="m_zoomIn" />
+    <UML:Attribute visibility="private" xmi.id="2447" value="" type="KAction *" name="m_zoomOut" />
+   </UML:Class>
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2570" name="vKisCanvasObserver_it" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2571" name="vKisCanvasObserver" />
+   <UML:DataType stereotype="datatype" visibility="public" xmi.id="2572" name="vKisCanvasObserver_cit" />
+   <UML:Generalization child="12" visibility="public" xmi.id="54" tqparent="9" />
+   <UML:Association visibility="public" xmi.id="194" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="none" type="193" />
+     <UML:AssociationEndRole visibility="private" type="193" name="m_singleton" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Generalization child="81" visibility="public" xmi.id="276" tqparent="139" />
+   <UML:Generalization child="206" visibility="public" xmi.id="277" tqparent="139" />
+   <UML:Generalization child="266" visibility="public" xmi.id="278" tqparent="193" />
+   <UML:Association visibility="public" xmi.id="329" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="325" />
+     <UML:AssociationEndRole visibility="private" type="328" name="m_mediator" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="482" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="481" />
+     <UML:AssociationEndRole visibility="private" type="472" name="m_cache" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="492" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="481" />
+     <UML:AssociationEndRole visibility="private" type="455" name="m_swap" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="1270" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="composite" type="1259" />
+     <UML:AssociationEndRole visibility="private" type="790" name="m_guides" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="1285" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="composite" type="1259" />
+     <UML:AssociationEndRole visibility="private" type="1237" name="m_type" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="1455" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="composite" type="1453" />
+     <UML:AssociationEndRole visibility="private" type="1198" name="m_compositeOp" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="1458" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="composite" type="1453" />
+     <UML:AssociationEndRole visibility="private" type="1237" name="m_imgType" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="1742" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="composite" type="1741" />
+     <UML:AssociationEndRole visibility="private" type="720" name="m_brushType" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Generalization child="1620" visibility="public" xmi.id="1764" tqparent="1453" />
+   <UML:Generalization child="1722" visibility="public" xmi.id="1765" tqparent="1130" />
+   <UML:Generalization child="1741" visibility="public" xmi.id="1766" tqparent="681" />
+   <UML:Association visibility="public" xmi.id="1769" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="1767" />
+     <UML:AssociationEndRole visibility="private" type="681" name="m_brush" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="1776" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="1767" />
+     <UML:AssociationEndRole visibility="private" type="856" name="m_gradient" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Generalization child="1903" visibility="public" xmi.id="2127" tqparent="1620" />
+   <UML:Generalization child="2109" visibility="public" xmi.id="2128" tqparent="2047" />
+   <UML:Association visibility="public" xmi.id="2191" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="none" type="2190" />
+     <UML:AssociationEndRole visibility="private" type="2190" name="m_singleton" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Generalization child="2135" visibility="public" xmi.id="2326" tqparent="1101" />
+   <UML:Association visibility="public" xmi.id="2366" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="2365" />
+     <UML:AssociationEndRole visibility="private" type="2174" name="m_adapter" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="2368" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="2365" />
+     <UML:AssociationEndRole visibility="private" type="681" name="m_brush" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="2369" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="2365" />
+     <UML:AssociationEndRole visibility="private" type="1943" name="m_brushMediator" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="2382" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="2365" />
+     <UML:AssociationEndRole visibility="private" type="902" name="m_doc" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="2385" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="2365" />
+     <UML:AssociationEndRole visibility="private" type="856" name="m_gradient" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="2390" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="2365" />
+     <UML:AssociationEndRole visibility="private" type="44" name="m_imgBuilderMgr" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="2422" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="2365" />
+     <UML:AssociationEndRole visibility="private" type="2109" name="m_pattern" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="2423" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="2365" />
+     <UML:AssociationEndRole visibility="private" type="1943" name="m_patternMediator" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Association visibility="public" xmi.id="2441" >
+    <UML:Association.connection>
+     <UML:AssociationEndRole visibility="public" aggregation="shared" type="2365" />
+     <UML:AssociationEndRole visibility="private" type="2135" name="m_tool" />
+    </UML:Association.connection>
+   </UML:Association>
+   <UML:Generalization child="2365" visibility="public" xmi.id="2567" tqparent="1170" />
+   <UML:Generalization child="2365" visibility="public" xmi.id="2568" tqparent="750" />
+   <UML:Generalization child="2365" visibility="public" xmi.id="2569" tqparent="2203" />
+   <UML:Generalization child="681" visibility="public" xmi.id="2578" tqparent="2047" />
+  </UML:Model>
+  <diagrams>
+   <diagram snapgrid="1" showattsig="1" fillcolor="#ffffc0" zoom="75" showgrid="1" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1285" snapy="10" showatts="1" xmi.id="1" documentation="" type="402" showops="1" showpackage="0" name="Chalk Core" localid="30000" showstereotype="0" showscope="1" snapcsgrid="1" font="Bitstream Vera Sans,14,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1221" >
+    <widgets>
+     <UML:ClassWidget usesdiagramfillcolour="1" width="90" showattsigs="603" usesdiagramusefillcolour="1" x="1010" linecolour="none" y="170" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="613" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Arial,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="110" showattsigs="603" usesdiagramusefillcolour="1" x="1010" linecolour="none" y="130" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="670" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Arial,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="130" showattsigs="603" usesdiagramusefillcolour="1" x="130" linecolour="none" y="210" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="645" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Arial,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="210" showattsigs="603" usesdiagramusefillcolour="1" x="1010" linecolour="none" y="90" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="750" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Arial,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="150" showattsigs="603" usesdiagramusefillcolour="1" x="100" linecolour="none" y="530" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1101" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Arial,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="100" showattsigs="603" usesdiagramusefillcolour="1" x="560" linecolour="none" y="440" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="2109" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="110" showattsigs="603" usesdiagramusefillcolour="1" x="680" linecolour="none" y="620" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="2047" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="80" showattsigs="603" usesdiagramusefillcolour="1" x="920" linecolour="none" y="480" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="681" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="70" showattsigs="603" usesdiagramusefillcolour="1" x="220" linecolour="none" y="730" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="135" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="90" showattsigs="603" usesdiagramusefillcolour="1" x="100" linecolour="none" y="630" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="2023" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="80" showattsigs="603" usesdiagramusefillcolour="1" x="540" linecolour="none" y="600" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="2365" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="90" showattsigs="603" usesdiagramusefillcolour="1" x="20" linecolour="none" y="400" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="2236" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="70" showattsigs="603" usesdiagramusefillcolour="1" x="60" linecolour="none" y="380" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="2218" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="150" showattsigs="603" usesdiagramusefillcolour="1" x="420" linecolour="none" y="780" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="2174" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="130" showattsigs="603" usesdiagramusefillcolour="1" x="180" linecolour="none" y="400" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="2190" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="230" showattsigs="603" usesdiagramusefillcolour="1" x="30" linecolour="none" y="330" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="2203" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="70" showattsigs="603" usesdiagramusefillcolour="1" x="30" linecolour="none" y="290" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="2135" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="180" showattsigs="603" usesdiagramusefillcolour="1" x="1040" linecolour="none" y="1160" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="455" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="100" showattsigs="603" usesdiagramusefillcolour="1" x="700" linecolour="none" y="1160" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="325" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="140" showattsigs="603" usesdiagramusefillcolour="1" x="880" linecolour="none" y="1160" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="328" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="150" showattsigs="603" usesdiagramusefillcolour="1" x="620" linecolour="none" y="1090" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1996" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="190" showattsigs="603" usesdiagramusefillcolour="1" x="920" linecolour="none" y="1090" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="472" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="70" showattsigs="603" usesdiagramusefillcolour="1" x="810" linecolour="none" y="1090" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="481" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="150" showattsigs="603" usesdiagramusefillcolour="1" x="1030" linecolour="none" y="910" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="292" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="230" showattsigs="603" usesdiagramusefillcolour="1" x="300" linecolour="none" y="1170" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="206" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="250" showattsigs="603" usesdiagramusefillcolour="1" x="30" linecolour="none" y="1170" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="81" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="200" showattsigs="603" usesdiagramusefillcolour="1" x="180" linecolour="none" y="1080" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="139" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="110" showattsigs="603" usesdiagramusefillcolour="1" x="100" linecolour="none" y="480" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1903" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="140" showattsigs="603" usesdiagramusefillcolour="1" x="370" linecolour="none" y="670" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="283" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="170" showattsigs="603" usesdiagramusefillcolour="1" x="40" linecolour="none" y="660" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1964" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="190" showattsigs="603" usesdiagramusefillcolour="1" x="460" linecolour="none" y="190" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1943" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="170" showattsigs="603" usesdiagramusefillcolour="1" x="510" linecolour="none" y="110" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="2086" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="140" showattsigs="603" usesdiagramusefillcolour="1" x="430" linecolour="none" y="70" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1985" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="100" showattsigs="603" usesdiagramusefillcolour="1" x="990" linecolour="none" y="310" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1767" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="190" showattsigs="603" usesdiagramusefillcolour="1" x="390" linecolour="none" y="330" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1679" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="130" showattsigs="603" usesdiagramusefillcolour="1" x="500" linecolour="none" y="280" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1453" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="140" showattsigs="603" usesdiagramusefillcolour="1" x="410" linecolour="none" y="260" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1667" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="90" showattsigs="603" usesdiagramusefillcolour="1" x="380" linecolour="none" y="230" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="560" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="270" showattsigs="603" usesdiagramusefillcolour="1" x="40" linecolour="none" y="70" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1712" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="110" showattsigs="603" usesdiagramusefillcolour="1" x="40" linecolour="none" y="30" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1677" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="80" showattsigs="603" usesdiagramusefillcolour="1" x="700" linecolour="none" y="170" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1722" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="80" showattsigs="603" usesdiagramusefillcolour="1" x="730" linecolour="none" y="340" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1620" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="170" showattsigs="603" usesdiagramusefillcolour="1" x="40" linecolour="none" y="750" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1741" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="230" showattsigs="603" usesdiagramusefillcolour="1" x="130" linecolour="none" y="820" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="12" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="90" showattsigs="603" usesdiagramusefillcolour="1" x="410" linecolour="none" y="860" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1259" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="120" showattsigs="603" usesdiagramusefillcolour="1" x="660" linecolour="none" y="770" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="790" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="80" showattsigs="603" usesdiagramusefillcolour="1" x="790" linecolour="none" y="710" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="740" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="110" showattsigs="603" usesdiagramusefillcolour="1" x="660" linecolour="none" y="870" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="856" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="100" showattsigs="603" usesdiagramusefillcolour="1" x="840" linecolour="none" y="820" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="583" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="100" showattsigs="603" usesdiagramusefillcolour="1" x="870" linecolour="none" y="660" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1110" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="70" showattsigs="603" usesdiagramusefillcolour="1" x="880" linecolour="none" y="600" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="902" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="90" showattsigs="603" usesdiagramusefillcolour="1" x="860" linecolour="none" y="560" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1058" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="90" showattsigs="603" usesdiagramusefillcolour="1" x="990" linecolour="none" y="610" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1085" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="120" showattsigs="603" usesdiagramusefillcolour="1" x="780" linecolour="none" y="70" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="727" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="260" showattsigs="603" usesdiagramusefillcolour="1" x="1010" linecolour="none" y="40" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="193" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="270" showattsigs="603" usesdiagramusefillcolour="1" x="680" linecolour="none" y="40" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="266" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="100" showattsigs="603" usesdiagramusefillcolour="1" x="400" linecolour="none" y="430" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1130" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="160" showattsigs="603" usesdiagramusefillcolour="1" x="80" linecolour="none" y="880" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="1170" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="160" showattsigs="603" usesdiagramusefillcolour="1" x="310" linecolour="none" y="460" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="9" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="160" showattsigs="603" usesdiagramusefillcolour="1" x="410" linecolour="none" y="150" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="44" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="130" showattsigs="603" usesdiagramusefillcolour="1" x="410" linecolour="none" y="120" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="711" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="130" showattsigs="603" usesdiagramusefillcolour="1" x="920" linecolour="none" y="430" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="624" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="1" width="70" showattsigs="603" usesdiagramusefillcolour="1" x="220" linecolour="none" y="600" showopsigs="603" instancename="" usesdiagramlinecolour="1" fillcolour="none" height="30" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="259" showoperations="0" showpackage="0" showscope="0" showstereotype="0" font="Bitstream Vera Sans,14,-1,5,75,0,0,0,0,0" />
+    </widgets>
+    <messages/>
+    <associations>
+     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="3" indexb="1" widgetbid="2047" widgetaid="2109" xmi.id="2128" >
+      <linepath>
+       <startpoint startx="610" starty="470" />
+       <endpoint endx="716" endy="620" />
+      </linepath>
+     </UML:AssocWidget>
+     <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="3" indexb="2" widgetbid="2047" widgetaid="681" xmi.id="2578" >
+      <linepath>
+       <startpoint startx="960" starty="510" />
+       <endpoint endx="753" endy="620" />
+      </linepath>
+     </UML:AssocWidget>
+    </associations>
+   </diagram>
+  </diagrams>
+  <listview>
+   <listitem open="1" type="800" id="-1" label="Views" >
+    <listitem open="1" type="801" id="-1" label="Logical View" >
+     <listitem open="0" type="807" id="1" label="Chalk Core" />
+     <listitem open="0" type="813" id="259" label="CMYK" >
+      <listitem open="0" type="814" id="260" label="c" />
+      <listitem open="0" type="814" id="261" label="k" />
+      <listitem open="0" type="814" id="262" label="m" />
+      <listitem open="0" type="814" id="263" label="y" />
+      <listitem open="0" type="815" id="264" label="&lt;" />
+     </listitem>
+     <listitem open="0" type="813" id="613" label="KIsDocIface" >
+      <listitem open="0" type="814" id="614" label="m_doc" />
+      <listitem open="0" type="815" id="615" label="redoLimit" />
+      <listitem open="0" type="815" id="616" label="renameImage" />
+      <listitem open="0" type="815" id="619" label="setRedoLimit" />
+      <listitem open="0" type="815" id="621" label="setUndoLimit" />
+      <listitem open="0" type="815" id="623" label="undoLimit" />
+     </listitem>
+     <listitem open="0" type="813" id="670" label="KIsImageIface" >
+      <listitem open="0" type="814" id="671" label="m_img" />
+      <listitem open="0" type="815" id="672" label="KIsImageIface" />
+      <listitem open="0" type="815" id="674" label="alpha" />
+      <listitem open="0" type="815" id="675" label="empty" />
+      <listitem open="0" type="815" id="676" label="height" />
+      <listitem open="0" type="815" id="677" label="name" />
+      <listitem open="0" type="815" id="678" label="setName" />
+      <listitem open="0" type="815" id="680" label="width" />
+     </listitem>
+     <listitem open="0" type="813" id="645" label="KRayonViewIface" >
+      <listitem open="0" type="814" id="646" label="m_view" />
+      <listitem open="0" type="815" id="647" label="KRayonViewIface" />
+      <listitem open="0" type="815" id="649" label="copy" />
+      <listitem open="0" type="815" id="650" label="crop" />
+      <listitem open="0" type="815" id="651" label="cut" />
+      <listitem open="0" type="815" id="652" label="dialog_brushes" />
+      <listitem open="0" type="815" id="653" label="dialog_channels" />
+      <listitem open="0" type="815" id="654" label="dialog_colors" />
+      <listitem open="0" type="815" id="655" label="dialog_crayons" />
+      <listitem open="0" type="815" id="656" label="dialog_gradient" />
+      <listitem open="0" type="815" id="657" label="dialog_layers" />
+      <listitem open="0" type="815" id="658" label="dialog_patterns" />
+      <listitem open="0" type="815" id="659" label="hide_layer" />
+      <listitem open="0" type="815" id="660" label="insert_layer" />
+      <listitem open="0" type="815" id="661" label="layer_properties" />
+      <listitem open="0" type="815" id="662" label="link_layer" />
+      <listitem open="0" type="815" id="663" label="next_layer" />
+      <listitem open="0" type="815" id="664" label="paste" />
+      <listitem open="0" type="815" id="665" label="previous_layer" />
+      <listitem open="0" type="815" id="666" label="removeSelection" />
+      <listitem open="0" type="815" id="667" label="remove_layer" />
+      <listitem open="0" type="815" id="668" label="selectAll" />
+      <listitem open="0" type="815" id="669" label="unSelectAll" />
+     </listitem>
+     <listitem open="0" type="813" id="624" label="KisAlphaMask" >
+      <listitem open="0" type="814" id="625" label="m_data" />
+      <listitem open="0" type="814" id="626" label="m_scale" />
+      <listitem open="0" type="814" id="627" label="m_scaledHeight" />
+      <listitem open="0" type="814" id="628" label="m_scaledWidth" />
+      <listitem open="0" type="815" id="629" label="KisAlphaMask" />
+      <listitem open="0" type="815" id="631" label="KisAlphaMask" />
+      <listitem open="0" type="815" id="634" label="alphaAt" />
+      <listitem open="0" type="815" id="637" label="computeAlpha" />
+      <listitem open="0" type="815" id="639" label="copyAlpha" />
+      <listitem open="0" type="815" id="641" label="height" />
+      <listitem open="0" type="815" id="642" label="scale" />
+      <listitem open="0" type="815" id="643" label="width" />
+      <listitem open="0" type="815" id="644" label="~KisAlphaMask" />
+     </listitem>
+     <listitem open="0" type="813" id="711" label="KisBackground" >
+      <listitem open="0" type="815" id="712" label="KisBackground" />
+      <listitem open="0" type="815" id="716" label="tileNum" />
+      <listitem open="0" type="815" id="719" label="~KisBackground" />
+     </listitem>
+     <listitem open="0" type="813" id="681" label="KisBrush" >
+      <listitem open="0" type="814" id="682" label="m_brushType" />
+      <listitem open="0" type="814" id="683" label="m_bytes" />
+      <listitem open="0" type="814" id="684" label="m_data" />
+      <listitem open="0" type="814" id="685" label="m_header_size" />
+      <listitem open="0" type="814" id="686" label="m_height" />
+      <listitem open="0" type="814" id="687" label="m_hotSpot" />
+      <listitem open="0" type="814" id="688" label="m_img" />
+      <listitem open="0" type="814" id="689" label="m_magic_number" />
+      <listitem open="0" type="814" id="690" label="m_tqmasks" />
+      <listitem open="0" type="814" id="691" label="m_version" />
+      <listitem open="0" type="814" id="692" label="m_width" />
+      <listitem open="0" type="815" id="695" label="KisBrush" />
+      <listitem open="0" type="815" id="693" label="KisBrush" />
+      <listitem open="0" type="815" id="699" label="brushType" />
+      <listitem open="0" type="815" id="700" label="createMasks" />
+      <listitem open="0" type="815" id="702" label="hotSpot" />
+      <listitem open="0" type="815" id="703" label="img" />
+      <listitem open="0" type="815" id="704" label="loadAsync" />
+      <listitem open="0" type="815" id="705" label="tqmask" />
+      <listitem open="0" type="815" id="707" label="saveAsync" />
+      <listitem open="0" type="815" id="708" label="setHotSpot" />
+      <listitem open="0" type="815" id="710" label="~KisBrush" />
+     </listitem>
+     <listitem open="0" type="813" id="44" label="KisBuilderMonitor" >
+      <listitem open="0" type="814" id="45" label="m_subjects" />
+      <listitem open="0" type="815" id="46" label="KisBuilderMonitor" />
+      <listitem open="0" type="815" id="49" label="attach" />
+      <listitem open="0" type="815" id="51" label="detach" />
+      <listitem open="0" type="815" id="53" label="~KisBuilderMonitor" />
+     </listitem>
+     <listitem open="0" type="813" id="9" label="KisBuilderSubject" >
+      <listitem open="0" type="815" id="10" label="intr" />
+      <listitem open="0" type="815" id="11" label="~KisBuilderSubject" />
+     </listitem>
+     <listitem open="0" type="813" id="750" label="KisCanvasControllerInterface" >
+      <listitem open="0" type="815" id="751" label="=" />
+      <listitem open="0" type="815" id="754" label="KisCanvasControllerInterface" />
+      <listitem open="0" type="815" id="753" label="KisCanvasControllerInterface" />
+      <listitem open="0" type="815" id="756" label="canvas" />
+      <listitem open="0" type="815" id="757" label="horzValue" />
+      <listitem open="0" type="815" id="759" label="updateCanvas" />
+      <listitem open="0" type="815" id="758" label="updateCanvas" />
+      <listitem open="0" type="815" id="764" label="updateCanvas" />
+      <listitem open="0" type="815" id="766" label="vertValue" />
+      <listitem open="0" type="815" id="772" label="viewToWindow" />
+      <listitem open="0" type="815" id="767" label="viewToWindow" />
+      <listitem open="0" type="815" id="770" label="viewToWindow" />
+      <listitem open="0" type="815" id="777" label="windowToView" />
+      <listitem open="0" type="815" id="774" label="windowToView" />
+      <listitem open="0" type="815" id="779" label="windowToView" />
+      <listitem open="0" type="815" id="782" label="zoomIn" />
+      <listitem open="0" type="815" id="781" label="zoomIn" />
+      <listitem open="0" type="815" id="785" label="zoomOut" />
+      <listitem open="0" type="815" id="786" label="zoomOut" />
+      <listitem open="0" type="815" id="789" label="~KisCanvasControllerInterface" />
+     </listitem>
+     <listitem open="0" type="813" id="1101" label="KisCanvasObserver" >
+      <listitem open="0" type="815" id="1102" label="=" />
+      <listitem open="0" type="815" id="1104" label="KisCanvasObserver" />
+      <listitem open="0" type="815" id="1105" label="KisCanvasObserver" />
+      <listitem open="0" type="815" id="1107" label="update" />
+      <listitem open="0" type="815" id="1109" label="~KisCanvasObserver" />
+     </listitem>
+     <listitem open="0" type="813" id="1170" label="KisCanvasSubject" >
+      <listitem open="0" type="815" id="1171" label="=" />
+      <listitem open="0" type="815" id="1173" label="KisCanvasSubject" />
+      <listitem open="0" type="815" id="1174" label="KisCanvasSubject" />
+      <listitem open="0" type="815" id="1176" label="attach" />
+      <listitem open="0" type="815" id="1178" label="bgColor" />
+      <listitem open="0" type="815" id="1179" label="canvasController" />
+      <listitem open="0" type="815" id="1180" label="currentBrush" />
+      <listitem open="0" type="815" id="1181" label="currentGradient" />
+      <listitem open="0" type="815" id="1182" label="currentImg" />
+      <listitem open="0" type="815" id="1183" label="currentImgName" />
+      <listitem open="0" type="815" id="1184" label="currentPattern" />
+      <listitem open="0" type="815" id="1185" label="detach" />
+      <listitem open="0" type="815" id="1187" label="document" />
+      <listitem open="0" type="815" id="1188" label="fgColor" />
+      <listitem open="0" type="815" id="1189" label="notify" />
+      <listitem open="0" type="815" id="1190" label="setBGColor" />
+      <listitem open="0" type="815" id="1192" label="setFGColor" />
+      <listitem open="0" type="815" id="1194" label="toolController" />
+      <listitem open="0" type="815" id="1195" label="undoAdapter" />
+      <listitem open="0" type="815" id="1196" label="zoomFactor" />
+      <listitem open="0" type="815" id="1197" label="~KisCanvasSubject" />
+     </listitem>
+     <listitem open="0" type="813" id="1130" label="KisChannel" >
+      <listitem open="0" type="815" id="1137" label="KisChannel" />
+      <listitem open="0" type="815" id="1131" label="KisChannel" />
+      <listitem open="0" type="815" id="1139" label="border" />
+      <listitem open="0" type="815" id="1142" label="bounds" />
+      <listitem open="0" type="815" id="1144" label="clear" />
+      <listitem open="0" type="815" id="1146" label="color" />
+      <listitem open="0" type="815" id="1145" label="color" />
+      <listitem open="0" type="815" id="1148" label="createMask" />
+      <listitem open="0" type="815" id="1151" label="empty" />
+      <listitem open="0" type="815" id="1152" label="feather" />
+      <listitem open="0" type="815" id="1153" label="grow" />
+      <listitem open="0" type="815" id="1156" label="invert" />
+      <listitem open="0" type="815" id="1158" label="opacity" />
+      <listitem open="0" type="815" id="1157" label="opacity" />
+      <listitem open="0" type="815" id="1160" label="shrink" />
+      <listitem open="0" type="815" id="1163" label="translate" />
+      <listitem open="0" type="815" id="1166" label="value" />
+      <listitem open="0" type="815" id="1169" label="~KisChannel" />
+     </listitem>
+     <listitem open="0" type="813" id="266" label="KisColorSpaceFactoryFlyweight" >
+      <listitem open="0" type="814" id="267" label="m_flyweights" />
+      <listitem open="0" type="815" id="268" label="KisColorSpaceFactoryFlyweight" />
+      <listitem open="0" type="815" id="269" label="create" />
+      <listitem open="0" type="815" id="271" label="create" />
+      <listitem open="0" type="815" id="273" label="tqfind" />
+      <listitem open="0" type="815" id="275" label="~KisColorSpaceFactoryFlyweight" />
+     </listitem>
+     <listitem open="0" type="813" id="193" label="KisColorSpaceFactoryInterface" >
+      <listitem open="0" type="815" id="195" label="=" />
+      <listitem open="0" type="815" id="197" label="KisColorSpaceFactoryInterface" />
+      <listitem open="0" type="815" id="198" label="KisColorSpaceFactoryInterface" />
+      <listitem open="0" type="815" id="200" label="create" />
+      <listitem open="0" type="815" id="202" label="create" />
+      <listitem open="0" type="815" id="204" label="singleton" />
+      <listitem open="0" type="815" id="205" label="~KisColorSpaceFactoryInterface" />
+     </listitem>
+     <listitem open="0" type="813" id="727" label="KisCommand" >
+      <listitem open="0" type="814" id="728" label="m_name" />
+      <listitem open="0" type="814" id="729" label="m_undoAdapter" />
+      <listitem open="0" type="815" id="732" label="KisCommand" />
+      <listitem open="0" type="815" id="730" label="KisCommand" />
+      <listitem open="0" type="815" id="735" label="adapter" />
+      <listitem open="0" type="815" id="736" label="execute" />
+      <listitem open="0" type="815" id="737" label="name" />
+      <listitem open="0" type="815" id="738" label="unexecute" />
+      <listitem open="0" type="815" id="739" label="~KisCommand" />
+     </listitem>
+     <listitem open="0" type="813" id="1085" label="KisConfig" >
+      <listitem open="0" type="814" id="1086" label="m_cfg" />
+      <listitem open="0" type="815" id="1087" label="=" />
+      <listitem open="0" type="815" id="1089" label="KisConfig" />
+      <listitem open="0" type="815" id="1090" label="KisConfig" />
+      <listitem open="0" type="815" id="1092" label="defImgHeight" />
+      <listitem open="0" type="815" id="1093" label="defImgWidth" />
+      <listitem open="0" type="815" id="1094" label="defLayerHeight" />
+      <listitem open="0" type="815" id="1095" label="defLayerWidth" />
+      <listitem open="0" type="815" id="1096" label="maxImgHeight" />
+      <listitem open="0" type="815" id="1097" label="maxImgWidth" />
+      <listitem open="0" type="815" id="1098" label="maxLayerHeight" />
+      <listitem open="0" type="815" id="1099" label="maxLayerWidth" />
+      <listitem open="0" type="815" id="1100" label="~KisConfig" />
+     </listitem>
+     <listitem open="0" type="813" id="1058" label="KisCursor" >
+      <listitem open="0" type="815" id="1059" label="KisCursor" />
+      <listitem open="0" type="815" id="1060" label="airbrushCursor" />
+      <listitem open="0" type="815" id="1061" label="arrowCursor" />
+      <listitem open="0" type="815" id="1062" label="blankCursor" />
+      <listitem open="0" type="815" id="1063" label="brushCursor" />
+      <listitem open="0" type="815" id="1064" label="colorChangerCursor" />
+      <listitem open="0" type="815" id="1065" label="crossCursor" />
+      <listitem open="0" type="815" id="1066" label="eraserCursor" />
+      <listitem open="0" type="815" id="1067" label="fillerCursor" />
+      <listitem open="0" type="815" id="1068" label="handCursor" />
+      <listitem open="0" type="815" id="1069" label="ibeamCursor" />
+      <listitem open="0" type="815" id="1070" label="moveCursor" />
+      <listitem open="0" type="815" id="1071" label="penCursor" />
+      <listitem open="0" type="815" id="1072" label="pickerCursor" />
+      <listitem open="0" type="815" id="1073" label="pointingHandCursor" />
+      <listitem open="0" type="815" id="1074" label="selectCursor" />
+      <listitem open="0" type="815" id="1075" label="sizeAllCursor" />
+      <listitem open="0" type="815" id="1076" label="sizeBDiagCursor" />
+      <listitem open="0" type="815" id="1077" label="sizeFDiagCursor" />
+      <listitem open="0" type="815" id="1078" label="sizeHorCursor" />
+      <listitem open="0" type="815" id="1079" label="sizeVerCursor" />
+      <listitem open="0" type="815" id="1080" label="splitHCursor" />
+      <listitem open="0" type="815" id="1081" label="splitVCursor" />
+      <listitem open="0" type="815" id="1082" label="upArrowCursor" />
+      <listitem open="0" type="815" id="1083" label="waitCursor" />
+      <listitem open="0" type="815" id="1084" label="zoomCursor" />
+     </listitem>
+     <listitem open="0" type="813" id="902" label="KisDoc" >
+      <listitem open="0" type="814" id="903" label="m_clipboard" />
+      <listitem open="0" type="814" id="904" label="m_cmdHistory" />
+      <listitem open="0" type="814" id="905" label="m_colorspaces" />
+      <listitem open="0" type="814" id="906" label="m_conversionDepth" />
+      <listitem open="0" type="814" id="907" label="m_currentMacro" />
+      <listitem open="0" type="814" id="908" label="m_dcop" />
+      <listitem open="0" type="814" id="909" label="m_images" />
+      <listitem open="0" type="814" id="910" label="m_nserver" />
+      <listitem open="0" type="814" id="911" label="m_projection" />
+      <listitem open="0" type="814" id="912" label="m_pushedClipboard" />
+      <listitem open="0" type="814" id="913" label="m_undo" />
+      <listitem open="0" type="815" id="914" label="KisDoc" />
+      <listitem open="0" type="815" id="920" label="addCommand" />
+      <listitem open="0" type="815" id="922" label="addImage" />
+      <listitem open="0" type="815" id="924" label="beginMacro" />
+      <listitem open="0" type="815" id="926" label="clipboardSelection" />
+      <listitem open="0" type="815" id="927" label="completeLoading" />
+      <listitem open="0" type="815" id="929" label="completeSaving" />
+      <listitem open="0" type="815" id="931" label="tqcontains" />
+      <listitem open="0" type="815" id="933" label="createViewInstance" />
+      <listitem open="0" type="815" id="936" label="dcopObject" />
+      <listitem open="0" type="815" id="937" label="empty" />
+      <listitem open="0" type="815" id="938" label="endMacro" />
+      <listitem open="0" type="815" id="939" label="findImage" />
+      <listitem open="0" type="815" id="941" label="imageIndex" />
+      <listitem open="0" type="815" id="943" label="imageNum" />
+      <listitem open="0" type="815" id="945" label="images" />
+      <listitem open="0" type="815" id="946" label="importImage" />
+      <listitem open="0" type="815" id="948" label="inMacro" />
+      <listitem open="0" type="815" id="949" label="init" />
+      <listitem open="0" type="815" id="950" label="initDoc" />
+      <listitem open="0" type="815" id="951" label="isEmpty" />
+      <listitem open="0" type="815" id="956" label="layerAdd" />
+      <listitem open="0" type="815" id="971" label="layerAdd" />
+      <listitem open="0" type="815" id="965" label="layerAdd" />
+      <listitem open="0" type="815" id="952" label="layerAdd" />
+      <listitem open="0" type="815" id="975" label="layerLower" />
+      <listitem open="0" type="815" id="978" label="layerNext" />
+      <listitem open="0" type="815" id="981" label="layerPrev" />
+      <listitem open="0" type="815" id="984" label="layerRaise" />
+      <listitem open="0" type="815" id="987" label="layerRemove" />
+      <listitem open="0" type="815" id="990" label="loadChannel" />
+      <listitem open="0" type="815" id="993" label="loadImage" />
+      <listitem open="0" type="815" id="995" label="loadLayer" />
+      <listitem open="0" type="815" id="998" label="loadOasis" />
+      <listitem open="0" type="815" id="1001" label="loadXML" />
+      <listitem open="0" type="815" id="1004" label="mimeType" />
+      <listitem open="0" type="815" id="1005" label="namePresent" />
+      <listitem open="0" type="815" id="1007" label="newImage" />
+      <listitem open="0" type="815" id="1012" label="nextImageName" />
+      <listitem open="0" type="815" id="1013" label="nimages" />
+      <listitem open="0" type="815" id="1014" label="paintContent" />
+      <listitem open="0" type="815" id="1020" label="redoLimit" />
+      <listitem open="0" type="815" id="1021" label="removeImage" />
+      <listitem open="0" type="815" id="1023" label="removeImage" />
+      <listitem open="0" type="815" id="1025" label="renameImage" />
+      <listitem open="0" type="815" id="1028" label="saveChannel" />
+      <listitem open="0" type="815" id="1031" label="saveImage" />
+      <listitem open="0" type="815" id="1034" label="saveLayer" />
+      <listitem open="0" type="815" id="1037" label="saveXML" />
+      <listitem open="0" type="815" id="1038" label="setClipboardSelection" />
+      <listitem open="0" type="815" id="1040" label="setLayerProperties" />
+      <listitem open="0" type="815" id="1046" label="setProjection" />
+      <listitem open="0" type="815" id="1048" label="setRedoLimit" />
+      <listitem open="0" type="815" id="1050" label="setUndo" />
+      <listitem open="0" type="815" id="1052" label="setUndoLimit" />
+      <listitem open="0" type="815" id="1054" label="setupColorspaces" />
+      <listitem open="0" type="815" id="1055" label="undo" />
+      <listitem open="0" type="815" id="1056" label="undoLimit" />
+      <listitem open="0" type="815" id="1057" label="~KisDoc" />
+     </listitem>
+     <listitem open="0" type="813" id="1110" label="KisFactory" >
+      <listitem open="0" type="814" id="1111" label="s_aboutData" />
+      <listitem open="0" type="814" id="1112" label="s_global" />
+      <listitem open="0" type="814" id="1113" label="s_pserver" />
+      <listitem open="0" type="814" id="1114" label="s_rserver" />
+      <listitem open="0" type="815" id="1115" label="KisFactory" />
+      <listitem open="0" type="815" id="1118" label="aboutData" />
+      <listitem open="0" type="815" id="1119" label="createPartObject" />
+      <listitem open="0" type="815" id="1126" label="global" />
+      <listitem open="0" type="815" id="1127" label="pServer" />
+      <listitem open="0" type="815" id="1128" label="rServer" />
+      <listitem open="0" type="815" id="1129" label="~KisFactory" />
+     </listitem>
+     <listitem open="0" type="813" id="583" label="KisFlatten" >
+      <listitem open="0" type="814" id="584" label="m_rc" />
+      <listitem open="0" type="814" id="585" label="m_test" />
+      <listitem open="0" type="815" id="588" label="KisFlatten" />
+      <listitem open="0" type="815" id="586" label="KisFlatten" />
+      <listitem open="0" type="815" id="606" label="visit" />
+      <listitem open="0" type="815" id="596" label="visit" />
+      <listitem open="0" type="815" id="593" label="visit" />
+      <listitem open="0" type="815" id="609" label="visit" />
+      <listitem open="0" type="815" id="603" label="visit" />
+      <listitem open="0" type="815" id="599" label="visit" />
+      <listitem open="0" type="815" id="612" label="~KisFlatten" />
+     </listitem>
+     <listitem open="0" type="813" id="856" label="KisGradient" >
+      <listitem open="0" type="814" id="857" label="gradArray" />
+      <listitem open="0" type="814" id="858" label="gradImage" />
+      <listitem open="0" type="814" id="859" label="mGradientHeight" />
+      <listitem open="0" type="814" id="860" label="mGradientWidth" />
+      <listitem open="0" type="815" id="861" label="KisGradient" />
+      <listitem open="0" type="815" id="862" label="arrayPixelValue" />
+      <listitem open="0" type="815" id="865" label="dither" />
+      <listitem open="0" type="815" id="869" label="gradient" />
+      <listitem open="0" type="815" id="875" label="height" />
+      <listitem open="0" type="815" id="876" label="imagePixelValue" />
+      <listitem open="0" type="815" id="879" label="mapHorGradient" />
+      <listitem open="0" type="815" id="883" label="mapKdeGradient" />
+      <listitem open="0" type="815" id="887" label="mapVertGradient" />
+      <listitem open="0" type="815" id="891" label="nearestColor" />
+      <listitem open="0" type="815" id="897" label="setEffect" />
+      <listitem open="0" type="815" id="899" label="setNull" />
+      <listitem open="0" type="815" id="900" label="width" />
+      <listitem open="0" type="815" id="901" label="~KisGradient" />
+     </listitem>
+     <listitem open="0" type="813" id="740" label="KisGuide" >
+      <listitem open="0" type="814" id="741" label="buffer" />
+      <listitem open="0" type="814" id="742" label="hasBuffer" />
+      <listitem open="0" type="814" id="743" label="pos" />
+      <listitem open="0" type="814" id="744" label="selected" />
+      <listitem open="0" type="815" id="745" label="KisGuide" />
+      <listitem open="0" type="815" id="747" label="isSelected" />
+      <listitem open="0" type="815" id="748" label="position" />
+      <listitem open="0" type="815" id="749" label="~KisGuide" />
+     </listitem>
+     <listitem open="0" type="813" id="790" label="KisGuideMgr" >
+      <listitem open="0" type="814" id="791" label="m_hGuideLines" />
+      <listitem open="0" type="814" id="792" label="m_hGuideLinesSelected" />
+      <listitem open="0" type="814" id="793" label="m_lines" />
+      <listitem open="0" type="814" id="794" label="m_pattern" />
+      <listitem open="0" type="814" id="795" label="m_patternSelected" />
+      <listitem open="0" type="814" id="796" label="m_size" />
+      <listitem open="0" type="814" id="797" label="m_slines" />
+      <listitem open="0" type="814" id="798" label="m_vGuideLines" />
+      <listitem open="0" type="814" id="799" label="m_vGuideLinesSelected" />
+      <listitem open="0" type="814" id="800" label="s_xbm" />
+      <listitem open="0" type="814" id="801" label="s_xbm_selected" />
+      <listitem open="0" type="815" id="802" label="KisGuideMgr" />
+      <listitem open="0" type="815" id="803" label="add" />
+      <listitem open="0" type="815" id="806" label="erase" />
+      <listitem open="0" type="815" id="812" label="tqfind" />
+      <listitem open="0" type="815" id="816" label="findHorizontal" />
+      <listitem open="0" type="815" id="819" label="findVertical" />
+      <listitem open="0" type="815" id="822" label="hasSelected" />
+      <listitem open="0" type="815" id="823" label="load" />
+      <listitem open="0" type="815" id="825" label="moveSelectedByX" />
+      <listitem open="0" type="815" id="827" label="moveSelectedByY" />
+      <listitem open="0" type="815" id="829" label="paint" />
+      <listitem open="0" type="815" id="835" label="remove" />
+      <listitem open="0" type="815" id="837" label="removeSelected" />
+      <listitem open="0" type="815" id="839" label="resize" />
+      <listitem open="0" type="815" id="838" label="resize" />
+      <listitem open="0" type="815" id="841" label="resizeLinesPixmap" />
+      <listitem open="0" type="815" id="846" label="save" />
+      <listitem open="0" type="815" id="848" label="select" />
+      <listitem open="0" type="815" id="850" label="selectAll" />
+      <listitem open="0" type="815" id="851" label="selectedCount" />
+      <listitem open="0" type="815" id="852" label="unselect" />
+      <listitem open="0" type="815" id="854" label="unselectAll" />
+      <listitem open="0" type="815" id="855" label="~KisGuideMgr" />
+     </listitem>
+     <listitem open="0" type="813" id="1259" label="KisImage" >
+      <listitem open="0" type="814" id="1260" label="m_active" />
+      <listitem open="0" type="814" id="1261" label="m_activeChannel" />
+      <listitem open="0" type="814" id="1262" label="m_activeLayer" />
+      <listitem open="0" type="814" id="1263" label="m_adapter" />
+      <listitem open="0" type="814" id="1264" label="m_alpha" />
+      <listitem open="0" type="814" id="1265" label="m_bkg" />
+      <listitem open="0" type="814" id="1266" label="m_channels" />
+      <listitem open="0" type="814" id="1267" label="m_clrMap" />
+      <listitem open="0" type="814" id="1268" label="m_depth" />
+      <listitem open="0" type="814" id="1269" label="m_dirty" />
+      <listitem open="0" type="814" id="1271" label="m_height" />
+      <listitem open="0" type="814" id="1272" label="m_layerStack" />
+      <listitem open="0" type="814" id="1273" label="m_layers" />
+      <listitem open="0" type="814" id="1274" label="m_tqmaskClr" />
+      <listitem open="0" type="814" id="1275" label="m_tqmaskEnabled" />
+      <listitem open="0" type="814" id="1276" label="m_tqmaskInverted" />
+      <listitem open="0" type="814" id="1277" label="m_name" />
+      <listitem open="0" type="814" id="1278" label="m_nserver" />
+      <listitem open="0" type="814" id="1279" label="m_ntileCols" />
+      <listitem open="0" type="814" id="1280" label="m_ntileRows" />
+      <listitem open="0" type="814" id="1281" label="m_projection" />
+      <listitem open="0" type="814" id="1282" label="m_selection" />
+      <listitem open="0" type="814" id="1283" label="m_selectionMask" />
+      <listitem open="0" type="814" id="1284" label="m_shadow" />
+      <listitem open="0" type="814" id="1286" label="m_undoHistory" />
+      <listitem open="0" type="814" id="1287" label="m_uri" />
+      <listitem open="0" type="814" id="1288" label="m_visible" />
+      <listitem open="0" type="814" id="1289" label="m_width" />
+      <listitem open="0" type="814" id="1290" label="m_xres" />
+      <listitem open="0" type="814" id="1291" label="m_yres" />
+      <listitem open="0" type="815" id="1292" label="=" />
+      <listitem open="0" type="815" id="1300" label="KisImage" />
+      <listitem open="0" type="815" id="1294" label="KisImage" />
+      <listitem open="0" type="815" id="1304" label="activate" />
+      <listitem open="0" type="815" id="1302" label="activate" />
+      <listitem open="0" type="815" id="1306" label="activateChannel" />
+      <listitem open="0" type="815" id="1308" label="activateLayer" />
+      <listitem open="0" type="815" id="1310" label="activeChannel" />
+      <listitem open="0" type="815" id="1311" label="activeComponent" />
+      <listitem open="0" type="815" id="1313" label="activeComponent" />
+      <listitem open="0" type="815" id="1316" label="activeDevice" />
+      <listitem open="0" type="815" id="1317" label="activeLayer" />
+      <listitem open="0" type="815" id="1318" label="add" />
+      <listitem open="0" type="815" id="1321" label="add" />
+      <listitem open="0" type="815" id="1324" label="alpha" />
+      <listitem open="0" type="815" id="1325" label="bottom" />
+      <listitem open="0" type="815" id="1327" label="bounds" />
+      <listitem open="0" type="815" id="1328" label="boundsLayer" />
+      <listitem open="0" type="815" id="1331" label="channel" />
+      <listitem open="0" type="815" id="1329" label="channel" />
+      <listitem open="0" type="815" id="1333" label="channels" />
+      <listitem open="0" type="815" id="1334" label="color" />
+      <listitem open="0" type="815" id="1335" label="colorMap" />
+      <listitem open="0" type="815" id="1337" label="correlateLayer" />
+      <listitem open="0" type="815" id="1340" label="depth" />
+      <listitem open="0" type="815" id="1341" label="empty" />
+      <listitem open="0" type="815" id="1342" label="enableUndo" />
+      <listitem open="0" type="815" id="1344" label="expand" />
+      <listitem open="0" type="815" id="1346" label="flush" />
+      <listitem open="0" type="815" id="1347" label="guides" />
+      <listitem open="0" type="815" id="1348" label="height" />
+      <listitem open="0" type="815" id="1349" label="imgType" />
+      <listitem open="0" type="815" id="1350" label="imgTypeWithAlpha" />
+      <listitem open="0" type="815" id="1353" label="index" />
+      <listitem open="0" type="815" id="1351" label="index" />
+      <listitem open="0" type="815" id="1355" label="init" />
+      <listitem open="0" type="815" id="1362" label="tqinvalidate" />
+      <listitem open="0" type="815" id="1361" label="tqinvalidate" />
+      <listitem open="0" type="815" id="1369" label="tqinvalidate" />
+      <listitem open="0" type="815" id="1364" label="tqinvalidate" />
+      <listitem open="0" type="815" id="1371" label="layer" />
+      <listitem open="0" type="815" id="1373" label="layer" />
+      <listitem open="0" type="815" id="1375" label="layers" />
+      <listitem open="0" type="815" id="1378" label="lower" />
+      <listitem open="0" type="815" id="1376" label="lower" />
+      <listitem open="0" type="815" id="1380" label="tqmask" />
+      <listitem open="0" type="815" id="1381" label="name" />
+      <listitem open="0" type="815" id="1382" label="nativeImgType" />
+      <listitem open="0" type="815" id="1383" label="nchannels" />
+      <listitem open="0" type="815" id="1384" label="nextLayerName" />
+      <listitem open="0" type="815" id="1385" label="nlayers" />
+      <listitem open="0" type="815" id="1386" label="notify" />
+      <listitem open="0" type="815" id="1387" label="notify" />
+      <listitem open="0" type="815" id="1392" label="notify" />
+      <listitem open="0" type="815" id="1394" label="pixelFromChannel" />
+      <listitem open="0" type="815" id="1399" label="pos" />
+      <listitem open="0" type="815" id="1396" label="pos" />
+      <listitem open="0" type="815" id="1404" label="raise" />
+      <listitem open="0" type="815" id="1402" label="raise" />
+      <listitem open="0" type="815" id="1409" label="resize" />
+      <listitem open="0" type="815" id="1406" label="resize" />
+      <listitem open="0" type="815" id="1414" label="resolution" />
+      <listitem open="0" type="815" id="1411" label="resolution" />
+      <listitem open="0" type="815" id="1419" label="rm" />
+      <listitem open="0" type="815" id="1417" label="rm" />
+      <listitem open="0" type="815" id="1421" label="selection" />
+      <listitem open="0" type="815" id="1422" label="setName" />
+      <listitem open="0" type="815" id="1424" label="setSelection" />
+      <listitem open="0" type="815" id="1426" label="shadow" />
+      <listitem open="0" type="815" id="1427" label="tileNum" />
+      <listitem open="0" type="815" id="1430" label="tiles" />
+      <listitem open="0" type="815" id="1431" label="top" />
+      <listitem open="0" type="815" id="1433" label="transformColor" />
+      <listitem open="0" type="815" id="1434" label="undoAdapter" />
+      <listitem open="0" type="815" id="1435" label="unit" />
+      <listitem open="0" type="815" id="1437" label="unsetActiveChannel" />
+      <listitem open="0" type="815" id="1438" label="unsetSelection" />
+      <listitem open="0" type="815" id="1441" label="uri" />
+      <listitem open="0" type="815" id="1440" label="uri" />
+      <listitem open="0" type="815" id="1443" label="validate" />
+      <listitem open="0" type="815" id="1447" label="visibleComponent" />
+      <listitem open="0" type="815" id="1445" label="visibleComponent" />
+      <listitem open="0" type="815" id="1450" label="width" />
+      <listitem open="0" type="815" id="1451" label="~KisImage" />
+     </listitem>
+     <listitem open="0" type="813" id="12" label="KisImageMagickConverter" >
+      <listitem open="0" type="814" id="13" label="m_adapter" />
+      <listitem open="0" type="814" id="14" label="m_data" />
+      <listitem open="0" type="814" id="15" label="m_doc" />
+      <listitem open="0" type="814" id="16" label="m_img" />
+      <listitem open="0" type="814" id="17" label="m_stop" />
+      <listitem open="0" type="815" id="18" label="=" />
+      <listitem open="0" type="815" id="23" label="KisImageMagickConverter" />
+      <listitem open="0" type="815" id="20" label="KisImageMagickConverter" />
+      <listitem open="0" type="815" id="28" label="buildFile" />
+      <listitem open="0" type="815" id="25" label="buildFile" />
+      <listitem open="0" type="815" id="31" label="buildImage" />
+      <listitem open="0" type="815" id="33" label="decode" />
+      <listitem open="0" type="815" id="36" label="image" />
+      <listitem open="0" type="815" id="37" label="init" />
+      <listitem open="0" type="815" id="40" label="intr" />
+      <listitem open="0" type="815" id="41" label="readFilters" />
+      <listitem open="0" type="815" id="42" label="writeFilters" />
+      <listitem open="0" type="815" id="43" label="~KisImageMagickConverter" />
+     </listitem>
+     <listitem open="0" type="813" id="1741" label="KisImagePipeBrush" >
+      <listitem open="0" type="814" id="1743" label="m_brushes" />
+      <listitem open="0" type="814" id="1744" label="m_currentBrush" />
+      <listitem open="0" type="814" id="1745" label="m_data" />
+      <listitem open="0" type="814" id="1746" label="m_hotSpot" />
+      <listitem open="0" type="814" id="1747" label="m_name" />
+      <listitem open="0" type="814" id="1748" label="m_numOfBrushes" />
+      <listitem open="0" type="814" id="1749" label="m_parasite" />
+      <listitem open="0" type="815" id="1750" label="KisImagePipeBrush" />
+      <listitem open="0" type="815" id="1752" label="brushType" />
+      <listitem open="0" type="815" id="1753" label="hotSpot" />
+      <listitem open="0" type="815" id="1754" label="img" />
+      <listitem open="0" type="815" id="1755" label="loadAsync" />
+      <listitem open="0" type="815" id="1756" label="tqmask" />
+      <listitem open="0" type="815" id="1758" label="saveAsync" />
+      <listitem open="0" type="815" id="1759" label="setHotSpot" />
+      <listitem open="0" type="815" id="1761" label="setParasite" />
+      <listitem open="0" type="815" id="1763" label="~KisImagePipeBrush" />
+     </listitem>
+     <listitem open="0" type="813" id="1620" label="KisLayer" >
+      <listitem open="0" type="814" id="1621" label="m_dx" />
+      <listitem open="0" type="814" id="1622" label="m_dy" />
+      <listitem open="0" type="814" id="1623" label="m_initial" />
+      <listitem open="0" type="814" id="1624" label="m_linked" />
+      <listitem open="0" type="814" id="1625" label="m_tqmask" />
+      <listitem open="0" type="814" id="1626" label="m_opacity" />
+      <listitem open="0" type="814" id="1627" label="m_preserveTransparency" />
+      <listitem open="0" type="815" id="1644" label="KisLayer" />
+      <listitem open="0" type="815" id="1639" label="KisLayer" />
+      <listitem open="0" type="815" id="1628" label="KisLayer" />
+      <listitem open="0" type="815" id="1634" label="KisLayer" />
+      <listitem open="0" type="815" id="1646" label="addAlpha" />
+      <listitem open="0" type="815" id="1647" label="addMask" />
+      <listitem open="0" type="815" id="1649" label="applyMask" />
+      <listitem open="0" type="815" id="1651" label="createMask" />
+      <listitem open="0" type="815" id="1654" label="linked" />
+      <listitem open="0" type="815" id="1653" label="linked" />
+      <listitem open="0" type="815" id="1656" label="tqmask" />
+      <listitem open="0" type="815" id="1657" label="opacity" />
+      <listitem open="0" type="815" id="1658" label="setOpacity" />
+      <listitem open="0" type="815" id="1660" label="translate" />
+      <listitem open="0" type="815" id="1664" label="visible" />
+      <listitem open="0" type="815" id="1663" label="visible" />
+      <listitem open="0" type="815" id="1666" label="~KisLayer" />
+     </listitem>
+     <listitem open="0" type="813" id="1722" label="KisMask" >
+      <listitem open="0" type="815" id="1729" label="KisMask" />
+      <listitem open="0" type="815" id="1723" label="KisMask" />
+      <listitem open="0" type="815" id="1732" label="apply" />
+      <listitem open="0" type="815" id="1731" label="apply" />
+      <listitem open="0" type="815" id="1734" label="edit" />
+      <listitem open="0" type="815" id="1735" label="edit" />
+      <listitem open="0" type="815" id="1738" label="layer" />
+      <listitem open="0" type="815" id="1737" label="layer" />
+      <listitem open="0" type="815" id="1740" label="~KisMask" />
+     </listitem>
+     <listitem open="0" type="813" id="1677" label="KisMemento" >
+      <listitem open="0" type="815" id="1678" label="~KisMemento" />
+     </listitem>
+     <listitem open="0" type="813" id="1712" label="KisMementoOriginatorInterface" >
+      <listitem open="0" type="815" id="1713" label="=" />
+      <listitem open="0" type="815" id="1716" label="KisMementoOriginatorInterface" />
+      <listitem open="0" type="815" id="1715" label="KisMementoOriginatorInterface" />
+      <listitem open="0" type="815" id="1718" label="restore" />
+      <listitem open="0" type="815" id="1720" label="save" />
+      <listitem open="0" type="815" id="1721" label="~KisMementoOriginatorInterface" />
+     </listitem>
+     <listitem open="0" type="813" id="560" label="KisMerge" >
+      <listitem open="0" type="814" id="561" label="m_img" />
+      <listitem open="0" type="814" id="562" label="m_keepOld" />
+      <listitem open="0" type="814" id="563" label="m_rc" />
+      <listitem open="0" type="814" id="564" label="m_test" />
+      <listitem open="0" type="815" id="565" label="KisMerge" />
+      <listitem open="0" type="815" id="568" label="visit" />
+      <listitem open="0" type="815" id="571" label="visit" />
+      <listitem open="0" type="815" id="577" label="visit" />
+      <listitem open="0" type="815" id="574" label="visit" />
+      <listitem open="0" type="815" id="580" label="visit" />
+     </listitem>
+     <listitem open="0" type="813" id="1667" label="KisNameServer" >
+      <listitem open="0" type="814" id="1668" label="m_generator" />
+      <listitem open="0" type="814" id="1669" label="m_prefix" />
+      <listitem open="0" type="815" id="1670" label="KisNameServer" />
+      <listitem open="0" type="815" id="1673" label="currentSeed" />
+      <listitem open="0" type="815" id="1674" label="name" />
+      <listitem open="0" type="815" id="1675" label="number" />
+      <listitem open="0" type="815" id="1676" label="~KisNameServer" />
+     </listitem>
+     <listitem open="0" type="813" id="1453" label="KisPaintDevice" >
+      <listitem open="0" type="814" id="1454" label="m_alpha" />
+      <listitem open="0" type="814" id="1456" label="m_depth" />
+      <listitem open="0" type="814" id="1457" label="m_height" />
+      <listitem open="0" type="814" id="1459" label="m_name" />
+      <listitem open="0" type="814" id="1460" label="m_offH" />
+      <listitem open="0" type="814" id="1461" label="m_offW" />
+      <listitem open="0" type="814" id="1462" label="m_offX" />
+      <listitem open="0" type="814" id="1463" label="m_offY" />
+      <listitem open="0" type="814" id="1464" label="m_owner" />
+      <listitem open="0" type="814" id="1465" label="m_projection" />
+      <listitem open="0" type="814" id="1466" label="m_projectionValid" />
+      <listitem open="0" type="814" id="1467" label="m_quantumSize" />
+      <listitem open="0" type="814" id="1468" label="m_shadow" />
+      <listitem open="0" type="814" id="1469" label="m_tiles" />
+      <listitem open="0" type="814" id="1470" label="m_visible" />
+      <listitem open="0" type="814" id="1471" label="m_width" />
+      <listitem open="0" type="814" id="1472" label="m_x" />
+      <listitem open="0" type="814" id="1473" label="m_y" />
+      <listitem open="0" type="815" id="1474" label="=" />
+      <listitem open="0" type="815" id="1491" label="KisPaintDevice" />
+      <listitem open="0" type="815" id="1486" label="KisPaintDevice" />
+      <listitem open="0" type="815" id="1476" label="KisPaintDevice" />
+      <listitem open="0" type="815" id="1482" label="KisPaintDevice" />
+      <listitem open="0" type="815" id="1493" label="alpha" />
+      <listitem open="0" type="815" id="1494" label="anchor" />
+      <listitem open="0" type="815" id="1495" label="bounds" />
+      <listitem open="0" type="815" id="1497" label="clip" />
+      <listitem open="0" type="815" id="1496" label="clip" />
+      <listitem open="0" type="815" id="1502" label="cmap" />
+      <listitem open="0" type="815" id="1504" label="colorAt" />
+      <listitem open="0" type="815" id="1505" label="compositeOp" />
+      <listitem open="0" type="815" id="1506" label="configure" />
+      <listitem open="0" type="815" id="1513" label="tqcontains" />
+      <listitem open="0" type="815" id="1516" label="tqcontains" />
+      <listitem open="0" type="815" id="1519" label="data" />
+      <listitem open="0" type="815" id="1518" label="data" />
+      <listitem open="0" type="815" id="1524" label="expand" />
+      <listitem open="0" type="815" id="1521" label="expand" />
+      <listitem open="0" type="815" id="1527" label="height" />
+      <listitem open="0" type="815" id="1526" label="height" />
+      <listitem open="0" type="815" id="1529" label="image" />
+      <listitem open="0" type="815" id="1530" label="init" />
+      <listitem open="0" type="815" id="1532" label="tqinvalidate" />
+      <listitem open="0" type="815" id="1531" label="tqinvalidate" />
+      <listitem open="0" type="815" id="1539" label="tqinvalidate" />
+      <listitem open="0" type="815" id="1534" label="tqinvalidate" />
+      <listitem open="0" type="815" id="1541" label="tqmaskBounds" />
+      <listitem open="0" type="815" id="1543" label="tqmaskBounds" />
+      <listitem open="0" type="815" id="1548" label="move" />
+      <listitem open="0" type="815" id="1551" label="move" />
+      <listitem open="0" type="815" id="1553" label="name" />
+      <listitem open="0" type="815" id="1554" label="offsetBy" />
+      <listitem open="0" type="815" id="1557" label="pixel" />
+      <listitem open="0" type="815" id="1562" label="quantumSize" />
+      <listitem open="0" type="815" id="1563" label="quantumSizeWithAlpha" />
+      <listitem open="0" type="815" id="1564" label="read" />
+      <listitem open="0" type="815" id="1570" label="resize" />
+      <listitem open="0" type="815" id="1566" label="resize" />
+      <listitem open="0" type="815" id="1567" label="resize" />
+      <listitem open="0" type="815" id="1572" label="setClip" />
+      <listitem open="0" type="815" id="1577" label="setCompositeOp" />
+      <listitem open="0" type="815" id="1579" label="setImage" />
+      <listitem open="0" type="815" id="1581" label="setName" />
+      <listitem open="0" type="815" id="1583" label="setPixel" />
+      <listitem open="0" type="815" id="1588" label="setX" />
+      <listitem open="0" type="815" id="1590" label="setY" />
+      <listitem open="0" type="815" id="1592" label="shadow" />
+      <listitem open="0" type="815" id="1593" label="shouldDrawBorder" />
+      <listitem open="0" type="815" id="1594" label="tileNum" />
+      <listitem open="0" type="815" id="1597" label="tiles" />
+      <listitem open="0" type="815" id="1598" label="type" />
+      <listitem open="0" type="815" id="1599" label="typeWithAlpha" />
+      <listitem open="0" type="815" id="1600" label="typeWithoutAlpha" />
+      <listitem open="0" type="815" id="1602" label="update" />
+      <listitem open="0" type="815" id="1601" label="update" />
+      <listitem open="0" type="815" id="1607" label="validate" />
+      <listitem open="0" type="815" id="1609" label="visible" />
+      <listitem open="0" type="815" id="1610" label="visible" />
+      <listitem open="0" type="815" id="1612" label="width" />
+      <listitem open="0" type="815" id="1613" label="width" />
+      <listitem open="0" type="815" id="1615" label="write" />
+      <listitem open="0" type="815" id="1617" label="x" />
+      <listitem open="0" type="815" id="1618" label="y" />
+      <listitem open="0" type="815" id="1619" label="~KisPaintDevice" />
+     </listitem>
+     <listitem open="0" type="813" id="1679" label="KisPaintDeviceVisitor" >
+      <listitem open="0" type="815" id="1692" label="()" />
+      <listitem open="0" type="815" id="1680" label="()" />
+      <listitem open="0" type="815" id="1686" label="()" />
+      <listitem open="0" type="815" id="1683" label="()" />
+      <listitem open="0" type="815" id="1689" label="()" />
+      <listitem open="0" type="815" id="1695" label="KisPaintDeviceVisitor" />
+      <listitem open="0" type="815" id="1699" label="visit" />
+      <listitem open="0" type="815" id="1696" label="visit" />
+      <listitem open="0" type="815" id="1702" label="visit" />
+      <listitem open="0" type="815" id="1705" label="visit" />
+      <listitem open="0" type="815" id="1708" label="visit" />
+      <listitem open="0" type="815" id="1711" label="~KisPaintDeviceVisitor" />
+     </listitem>
+     <listitem open="0" type="813" id="1767" label="KisPainter" >
+      <listitem open="0" type="814" id="1768" label="m_backgroundColor" />
+      <listitem open="0" type="814" id="1770" label="m_brushHeight" />
+      <listitem open="0" type="814" id="1771" label="m_brushWidth" />
+      <listitem open="0" type="814" id="1772" label="m_dab" />
+      <listitem open="0" type="814" id="1773" label="m_device" />
+      <listitem open="0" type="814" id="1774" label="m_dirtyRect" />
+      <listitem open="0" type="814" id="1775" label="m_fillColor" />
+      <listitem open="0" type="814" id="1777" label="m_hotSpot" />
+      <listitem open="0" type="814" id="1778" label="m_hotSpotX" />
+      <listitem open="0" type="814" id="1779" label="m_hotSpotY" />
+      <listitem open="0" type="814" id="1780" label="m_opacity" />
+      <listitem open="0" type="814" id="1781" label="m_paintColor" />
+      <listitem open="0" type="814" id="1782" label="m_pattern" />
+      <listitem open="0" type="814" id="1783" label="m_transaction" />
+      <listitem open="0" type="815" id="1784" label="=" />
+      <listitem open="0" type="815" id="1787" label="KisPainter" />
+      <listitem open="0" type="815" id="1789" label="KisPainter" />
+      <listitem open="0" type="815" id="1786" label="KisPainter" />
+      <listitem open="0" type="815" id="1791" label="begin" />
+      <listitem open="0" type="815" id="1793" label="beginTransaction" />
+      <listitem open="0" type="815" id="1795" label="bitBlt" />
+      <listitem open="0" type="815" id="1805" label="bitBlt" />
+      <listitem open="0" type="815" id="1814" label="computeDab" />
+      <listitem open="0" type="815" id="1816" label="device" />
+      <listitem open="0" type="815" id="1817" label="dirtyRect" />
+      <listitem open="0" type="815" id="1818" label="end" />
+      <listitem open="0" type="815" id="1819" label="endTransaction" />
+      <listitem open="0" type="815" id="1820" label="eraseAt" />
+      <listitem open="0" type="815" id="1825" label="eraseLine" />
+      <listitem open="0" type="815" id="1837" label="eraseRect" />
+      <listitem open="0" type="815" id="1832" label="eraseRect" />
+      <listitem open="0" type="815" id="1839" label="fillRect" />
+      <listitem open="0" type="815" id="1852" label="fillRect" />
+      <listitem open="0" type="815" id="1855" label="fillRect" />
+      <listitem open="0" type="815" id="1845" label="fillRect" />
+      <listitem open="0" type="815" id="1859" label="paintAt" />
+      <listitem open="0" type="815" id="1864" label="paintLine" />
+      <listitem open="0" type="815" id="1871" label="setBackgroundColor" />
+      <listitem open="0" type="815" id="1873" label="setBrush" />
+      <listitem open="0" type="815" id="1875" label="setFillColor" />
+      <listitem open="0" type="815" id="1877" label="setGradient" />
+      <listitem open="0" type="815" id="1879" label="setOpacity" />
+      <listitem open="0" type="815" id="1881" label="setPaintColor" />
+      <listitem open="0" type="815" id="1883" label="setPattern" />
+      <listitem open="0" type="815" id="1894" label="tileBlt" />
+      <listitem open="0" type="815" id="1885" label="tileBlt" />
+      <listitem open="0" type="815" id="1902" label="~KisPainter" />
+     </listitem>
+     <listitem open="0" type="813" id="2109" label="KisPattern" >
+      <listitem open="0" type="814" id="2110" label="m_data" />
+      <listitem open="0" type="814" id="2111" label="m_hotSpot" />
+      <listitem open="0" type="814" id="2112" label="m_img" />
+      <listitem open="0" type="814" id="2113" label="m_pixmap" />
+      <listitem open="0" type="814" id="2114" label="m_thumbPixmap" />
+      <listitem open="0" type="814" id="2115" label="m_valid" />
+      <listitem open="0" type="814" id="2116" label="m_validThumb" />
+      <listitem open="0" type="815" id="2117" label="KisPattern" />
+      <listitem open="0" type="815" id="2119" label="hotSpot" />
+      <listitem open="0" type="815" id="2120" label="img" />
+      <listitem open="0" type="815" id="2121" label="isValid" />
+      <listitem open="0" type="815" id="2122" label="loadAsync" />
+      <listitem open="0" type="815" id="2123" label="pixmap" />
+      <listitem open="0" type="815" id="2124" label="saveAsync" />
+      <listitem open="0" type="815" id="2125" label="thumbPixmap" />
+      <listitem open="0" type="815" id="2126" label="~KisPattern" />
+     </listitem>
+     <listitem open="0" type="813" id="1985" label="KisPluginServer" >
+      <listitem open="0" type="814" id="1986" label="m_count" />
+      <listitem open="0" type="814" id="1987" label="m_plugins" />
+      <listitem open="0" type="815" id="1988" label="KisPluginServer" />
+      <listitem open="0" type="815" id="1989" label="activatePlugin" />
+      <listitem open="0" type="815" id="1991" label="buildFilterMenu" />
+      <listitem open="0" type="815" id="1993" label="findPlugins" />
+      <listitem open="0" type="815" id="1995" label="~KisPluginServer" />
+     </listitem>
+     <listitem open="0" type="813" id="2086" label="KisRenderInterface" >
+      <listitem open="0" type="815" id="2087" label="=" />
+      <listitem open="0" type="815" id="2089" label="KisRenderInterface" />
+      <listitem open="0" type="815" id="2090" label="KisRenderInterface" />
+      <listitem open="0" type="815" id="2093" label="tqinvalidate" />
+      <listitem open="0" type="815" id="2095" label="tqinvalidate" />
+      <listitem open="0" type="815" id="2092" label="tqinvalidate" />
+      <listitem open="0" type="815" id="2100" label="tqinvalidate" />
+      <listitem open="0" type="815" id="2102" label="tileNum" />
+      <listitem open="0" type="815" id="2105" label="tiles" />
+      <listitem open="0" type="815" id="2106" label="validate" />
+      <listitem open="0" type="815" id="2108" label="~KisRenderInterface" />
+     </listitem>
+     <listitem open="0" type="813" id="2047" label="KisResource" >
+      <listitem open="0" type="814" id="2048" label="m_dirty" />
+      <listitem open="0" type="814" id="2049" label="m_filename" />
+      <listitem open="0" type="814" id="2050" label="m_height" />
+      <listitem open="0" type="814" id="2051" label="m_name" />
+      <listitem open="0" type="814" id="2052" label="m_spacing" />
+      <listitem open="0" type="814" id="2053" label="m_valid" />
+      <listitem open="0" type="814" id="2054" label="m_width" />
+      <listitem open="0" type="815" id="2055" label="=" />
+      <listitem open="0" type="815" id="2057" label="KisResource" />
+      <listitem open="0" type="815" id="2059" label="KisResource" />
+      <listitem open="0" type="815" id="2061" label="dirty" />
+      <listitem open="0" type="815" id="2062" label="filename" />
+      <listitem open="0" type="815" id="2063" label="height" />
+      <listitem open="0" type="815" id="2064" label="img" />
+      <listitem open="0" type="815" id="2065" label="loadAsync" />
+      <listitem open="0" type="815" id="2066" label="name" />
+      <listitem open="0" type="815" id="2067" label="saveAsync" />
+      <listitem open="0" type="815" id="2068" label="setDirty" />
+      <listitem open="0" type="815" id="2070" label="setFilename" />
+      <listitem open="0" type="815" id="2072" label="setHeight" />
+      <listitem open="0" type="815" id="2074" label="setName" />
+      <listitem open="0" type="815" id="2076" label="setSpacing" />
+      <listitem open="0" type="815" id="2078" label="setValid" />
+      <listitem open="0" type="815" id="2080" label="setWidth" />
+      <listitem open="0" type="815" id="2082" label="spacing" />
+      <listitem open="0" type="815" id="2083" label="valid" />
+      <listitem open="0" type="815" id="2084" label="width" />
+      <listitem open="0" type="815" id="2085" label="~KisResource" />
+     </listitem>
+     <listitem open="0" type="813" id="1943" label="KisResourceMediator" >
+      <listitem open="0" type="814" id="1944" label="m_activeItem" />
+      <listitem open="0" type="814" id="1945" label="m_chooser" />
+      <listitem open="0" type="814" id="1946" label="m_items" />
+      <listitem open="0" type="815" id="1947" label="KisResourceMediator" />
+      <listitem open="0" type="815" id="1955" label="chooserWidget" />
+      <listitem open="0" type="815" id="1956" label="currentResource" />
+      <listitem open="0" type="815" id="1957" label="itemFor" />
+      <listitem open="0" type="815" id="1959" label="resourceFor" />
+      <listitem open="0" type="815" id="1961" label="resourceFor" />
+      <listitem open="0" type="815" id="1963" label="~KisResourceMediator" />
+     </listitem>
+     <listitem open="0" type="813" id="1964" label="KisResourceServer" >
+      <listitem open="0" type="814" id="1965" label="m_brushFilenames" />
+      <listitem open="0" type="814" id="1966" label="m_brushes" />
+      <listitem open="0" type="814" id="1967" label="m_patternFilenames" />
+      <listitem open="0" type="814" id="1968" label="m_patterns" />
+      <listitem open="0" type="814" id="1969" label="m_pipebrushFilenames" />
+      <listitem open="0" type="814" id="1970" label="m_pipebrushes" />
+      <listitem open="0" type="815" id="1971" label="KisResourceServer" />
+      <listitem open="0" type="815" id="1972" label="brushCount" />
+      <listitem open="0" type="815" id="1973" label="brushes" />
+      <listitem open="0" type="815" id="1974" label="loadBrush" />
+      <listitem open="0" type="815" id="1975" label="loadBrushes" />
+      <listitem open="0" type="815" id="1976" label="loadPattern" />
+      <listitem open="0" type="815" id="1977" label="loadPatterns" />
+      <listitem open="0" type="815" id="1978" label="loadpipeBrush" />
+      <listitem open="0" type="815" id="1979" label="loadpipeBrushes" />
+      <listitem open="0" type="815" id="1980" label="patternCount" />
+      <listitem open="0" type="815" id="1981" label="patterns" />
+      <listitem open="0" type="815" id="1982" label="pipebrushCount" />
+      <listitem open="0" type="815" id="1983" label="pipebrushes" />
+      <listitem open="0" type="815" id="1984" label="~KisResourceServer" />
+     </listitem>
+     <listitem open="0" type="813" id="283" label="KisScopedLock" >
+      <listitem open="0" type="814" id="284" label="m_mutex" />
+      <listitem open="0" type="815" id="285" label="KisScopedLock" />
+      <listitem open="0" type="815" id="288" label="lock" />
+      <listitem open="0" type="815" id="289" label="trylock" />
+      <listitem open="0" type="815" id="290" label="unlock" />
+      <listitem open="0" type="815" id="291" label="~KisScopedLock" />
+     </listitem>
+     <listitem open="0" type="813" id="1903" label="KisSelection" >
+      <listitem open="0" type="814" id="1904" label="m_clearOnMove" />
+      <listitem open="0" type="814" id="1905" label="m_clipImg" />
+      <listitem open="0" type="814" id="1906" label="m_firstMove" />
+      <listitem open="0" type="814" id="1907" label="m_img" />
+      <listitem open="0" type="814" id="1908" label="m_name" />
+      <listitem open="0" type="814" id="1909" label="m_parent" />
+      <listitem open="0" type="814" id="1910" label="m_rc" />
+      <listitem open="0" type="815" id="1916" label="KisSelection" />
+      <listitem open="0" type="815" id="1911" label="KisSelection" />
+      <listitem open="0" type="815" id="1921" label="anchor" />
+      <listitem open="0" type="815" id="1922" label="clearParentOnMove" />
+      <listitem open="0" type="815" id="1924" label="commit" />
+      <listitem open="0" type="815" id="1925" label="fromImage" />
+      <listitem open="0" type="815" id="1927" label="move" />
+      <listitem open="0" type="815" id="1930" label="tqparent" />
+      <listitem open="0" type="815" id="1936" label="setBounds" />
+      <listitem open="0" type="815" id="1931" label="setBounds" />
+      <listitem open="0" type="815" id="1938" label="setParent" />
+      <listitem open="0" type="815" id="1940" label="shouldDrawBorder" />
+      <listitem open="0" type="815" id="1941" label="toImage" />
+      <listitem open="0" type="815" id="1942" label="~KisSelection" />
+     </listitem>
+     <listitem open="0" type="813" id="139" label="KisStrategyColorSpace" >
+      <listitem open="0" type="815" id="140" label="=" />
+      <listitem open="0" type="815" id="142" label="KisStrategyColorSpace" />
+      <listitem open="0" type="815" id="143" label="KisStrategyColorSpace" />
+      <listitem open="0" type="815" id="152" label="nativeColor" />
+      <listitem open="0" type="815" id="162" label="nativeColor" />
+      <listitem open="0" type="815" id="155" label="nativeColor" />
+      <listitem open="0" type="815" id="148" label="nativeColor" />
+      <listitem open="0" type="815" id="145" label="nativeColor" />
+      <listitem open="0" type="815" id="159" label="nativeColor" />
+      <listitem open="0" type="815" id="166" label="render" />
+      <listitem open="0" type="815" id="173" label="tileBlt" />
+      <listitem open="0" type="815" id="183" label="tileBlt" />
+      <listitem open="0" type="815" id="192" label="~KisStrategyColorSpace" />
+     </listitem>
+     <listitem open="0" type="813" id="81" label="KisStrategyColorSpaceCMYK" >
+      <listitem open="0" type="814" id="82" label="m_buf" />
+      <listitem open="0" type="814" id="83" label="m_pixio" />
+      <listitem open="0" type="814" id="84" label="m_pixmap" />
+      <listitem open="0" type="814" id="85" label="m_rgbLUT" />
+      <listitem open="0" type="815" id="86" label="KisStrategyColorSpaceCMYK" />
+      <listitem open="0" type="815" id="90" label="nativeColor" />
+      <listitem open="0" type="815" id="97" label="nativeColor" />
+      <listitem open="0" type="815" id="101" label="nativeColor" />
+      <listitem open="0" type="815" id="104" label="nativeColor" />
+      <listitem open="0" type="815" id="94" label="nativeColor" />
+      <listitem open="0" type="815" id="87" label="nativeColor" />
+      <listitem open="0" type="815" id="108" label="render" />
+      <listitem open="0" type="815" id="125" label="tileBlt" />
+      <listitem open="0" type="815" id="115" label="tileBlt" />
+      <listitem open="0" type="815" id="134" label="~KisStrategyColorSpaceCMYK" />
+     </listitem>
+     <listitem open="0" type="813" id="206" label="KisStrategyColorSpaceRGB" >
+      <listitem open="0" type="814" id="207" label="m_buf" />
+      <listitem open="0" type="814" id="208" label="m_pixio" />
+      <listitem open="0" type="814" id="209" label="m_pixmap" />
+      <listitem open="0" type="815" id="210" label="KisStrategyColorSpaceRGB" />
+      <listitem open="0" type="815" id="221" label="nativeColor" />
+      <listitem open="0" type="815" id="211" label="nativeColor" />
+      <listitem open="0" type="815" id="225" label="nativeColor" />
+      <listitem open="0" type="815" id="214" label="nativeColor" />
+      <listitem open="0" type="815" id="218" label="nativeColor" />
+      <listitem open="0" type="815" id="228" label="nativeColor" />
+      <listitem open="0" type="815" id="232" label="render" />
+      <listitem open="0" type="815" id="249" label="tileBlt" />
+      <listitem open="0" type="815" id="239" label="tileBlt" />
+      <listitem open="0" type="815" id="258" label="~KisStrategyColorSpaceRGB" />
+     </listitem>
+     <listitem open="0" type="813" id="292" label="KisStrategyMove" >
+      <listitem open="0" type="814" id="293" label="m_controller" />
+      <listitem open="0" type="814" id="294" label="m_doc" />
+      <listitem open="0" type="814" id="295" label="m_dragStart" />
+      <listitem open="0" type="814" id="296" label="m_dragging" />
+      <listitem open="0" type="814" id="297" label="m_layerPosition" />
+      <listitem open="0" type="814" id="298" label="m_layerStart" />
+      <listitem open="0" type="814" id="299" label="m_subject" />
+      <listitem open="0" type="815" id="300" label="=" />
+      <listitem open="0" type="815" id="305" label="KisStrategyMove" />
+      <listitem open="0" type="815" id="302" label="KisStrategyMove" />
+      <listitem open="0" type="815" id="303" label="KisStrategyMove" />
+      <listitem open="0" type="815" id="307" label="drag" />
+      <listitem open="0" type="815" id="309" label="endDrag" />
+      <listitem open="0" type="815" id="312" label="reset" />
+      <listitem open="0" type="815" id="319" label="simpleMove" />
+      <listitem open="0" type="815" id="314" label="simpleMove" />
+      <listitem open="0" type="815" id="322" label="startDrag" />
+      <listitem open="0" type="815" id="324" label="~KisStrategyMove" />
+     </listitem>
+     <listitem open="0" type="813" id="481" label="KisTile" >
+      <listitem open="0" type="814" id="483" label="m_data" />
+      <listitem open="0" type="814" id="484" label="m_depth" />
+      <listitem open="0" type="814" id="485" label="m_dirty" />
+      <listitem open="0" type="814" id="486" label="m_height" />
+      <listitem open="0" type="814" id="487" label="m_hints" />
+      <listitem open="0" type="814" id="488" label="m_mutex" />
+      <listitem open="0" type="814" id="489" label="m_nref" />
+      <listitem open="0" type="814" id="490" label="m_nshare" />
+      <listitem open="0" type="814" id="491" label="m_nwrite" />
+      <listitem open="0" type="814" id="493" label="m_swapNo" />
+      <listitem open="0" type="814" id="494" label="m_valid" />
+      <listitem open="0" type="814" id="495" label="m_width" />
+      <listitem open="0" type="815" id="496" label="=" />
+      <listitem open="0" type="815" id="500" label="KisTile" />
+      <listitem open="0" type="815" id="498" label="KisTile" />
+      <listitem open="0" type="815" id="504" label="allocate" />
+      <listitem open="0" type="815" id="505" label="data" />
+      <listitem open="0" type="815" id="508" label="depth" />
+      <listitem open="0" type="815" id="509" label="dirty" />
+      <listitem open="0" type="815" id="510" label="dirty" />
+      <listitem open="0" type="815" id="512" label="duplicate" />
+      <listitem open="0" type="815" id="514" label="height" />
+      <listitem open="0" type="815" id="515" label="height" />
+      <listitem open="0" type="815" id="517" label="init" />
+      <listitem open="0" type="815" id="521" label="initRowHints" />
+      <listitem open="0" type="815" id="522" label="lock" />
+      <listitem open="0" type="815" id="523" label="lockAsync" />
+      <listitem open="0" type="815" id="524" label="mutex" />
+      <listitem open="0" type="815" id="525" label="ref" />
+      <listitem open="0" type="815" id="526" label="refCount" />
+      <listitem open="0" type="815" id="527" label="release" />
+      <listitem open="0" type="815" id="528" label="rowHint" />
+      <listitem open="0" type="815" id="530" label="setRowHint" />
+      <listitem open="0" type="815" id="533" label="shareCount" />
+      <listitem open="0" type="815" id="534" label="shareRef" />
+      <listitem open="0" type="815" id="535" label="shareRelease" />
+      <listitem open="0" type="815" id="536" label="size" />
+      <listitem open="0" type="815" id="538" label="valid" />
+      <listitem open="0" type="815" id="537" label="valid" />
+      <listitem open="0" type="815" id="540" label="width" />
+      <listitem open="0" type="815" id="541" label="width" />
+      <listitem open="0" type="815" id="543" label="writeCount" />
+      <listitem open="0" type="815" id="544" label="writeRef" />
+      <listitem open="0" type="815" id="545" label="~KisTile" />
+     </listitem>
+     <listitem open="0" type="813" id="472" label="KisTileCacheInterface" >
+      <listitem open="0" type="815" id="473" label="KisTileCacheInterface" />
+      <listitem open="0" type="815" id="474" label="flush" />
+      <listitem open="0" type="815" id="476" label="insert" />
+      <listitem open="0" type="815" id="478" label="tqsizeHint" />
+      <listitem open="0" type="815" id="480" label="~KisTileCacheInterface" />
+     </listitem>
+     <listitem open="0" type="813" id="1996" label="KisTileCommand" >
+      <listitem open="0" type="814" id="1997" label="m_device" />
+      <listitem open="0" type="814" id="1998" label="m_name" />
+      <listitem open="0" type="814" id="1999" label="m_originals" />
+      <listitem open="0" type="814" id="2000" label="m_rc" />
+      <listitem open="0" type="814" id="2001" label="m_tiles" />
+      <listitem open="0" type="815" id="2005" label="KisTileCommand" />
+      <listitem open="0" type="815" id="2012" label="KisTileCommand" />
+      <listitem open="0" type="815" id="2002" label="KisTileCommand" />
+      <listitem open="0" type="815" id="2016" label="addTile" />
+      <listitem open="0" type="815" id="2019" label="execute" />
+      <listitem open="0" type="815" id="2020" label="name" />
+      <listitem open="0" type="815" id="2021" label="unexecute" />
+      <listitem open="0" type="815" id="2022" label="~KisTileCommand" />
+     </listitem>
+     <listitem open="0" type="813" id="328" label="KisTileMediator" >
+      <listitem open="0" type="814" id="433" label="m_instance" />
+      <listitem open="0" type="814" id="434" label="m_mutex" />
+      <listitem open="0" type="814" id="435" label="m_ref" />
+      <listitem open="0" type="815" id="436" label="=" />
+      <listitem open="0" type="815" id="438" label="KisTileMediator" />
+      <listitem open="0" type="815" id="439" label="KisTileMediator" />
+      <listitem open="0" type="815" id="441" label="attach" />
+      <listitem open="0" type="815" id="445" label="detach" />
+      <listitem open="0" type="815" id="449" label="detachAll" />
+      <listitem open="0" type="815" id="451" label="tileNum" />
+      <listitem open="0" type="815" id="454" label="~KisTileMediator" />
+     </listitem>
+     <listitem open="0" type="813" id="325" label="KisTileMgr" >
+      <listitem open="0" type="814" id="326" label="m_depth" />
+      <listitem open="0" type="814" id="327" label="m_height" />
+      <listitem open="0" type="814" id="330" label="m_mutex" />
+      <listitem open="0" type="814" id="331" label="m_ntileCols" />
+      <listitem open="0" type="814" id="332" label="m_ntileRows" />
+      <listitem open="0" type="814" id="333" label="m_tiles" />
+      <listitem open="0" type="814" id="334" label="m_width" />
+      <listitem open="0" type="815" id="335" label="=" />
+      <listitem open="0" type="815" id="346" label="KisTileMgr" />
+      <listitem open="0" type="815" id="337" label="KisTileMgr" />
+      <listitem open="0" type="815" id="342" label="KisTileMgr" />
+      <listitem open="0" type="815" id="348" label="allocate" />
+      <listitem open="0" type="815" id="350" label="attach" />
+      <listitem open="0" type="815" id="354" label="depth" />
+      <listitem open="0" type="815" id="355" label="detach" />
+      <listitem open="0" type="815" id="359" label="duplicate" />
+      <listitem open="0" type="815" id="362" label="empty" />
+      <listitem open="0" type="815" id="363" label="height" />
+      <listitem open="0" type="815" id="364" label="tqinvalidate" />
+      <listitem open="0" type="815" id="370" label="tqinvalidate" />
+      <listitem open="0" type="815" id="368" label="tqinvalidate" />
+      <listitem open="0" type="815" id="373" label="tqinvalidateTile" />
+      <listitem open="0" type="815" id="376" label="tqinvalidateTiles" />
+      <listitem open="0" type="815" id="378" label="memSize" />
+      <listitem open="0" type="815" id="379" label="ncols" />
+      <listitem open="0" type="815" id="380" label="nrows" />
+      <listitem open="0" type="815" id="381" label="pixelData" />
+      <listitem open="0" type="815" id="387" label="readPixelData" />
+      <listitem open="0" type="815" id="389" label="readPixelData" />
+      <listitem open="0" type="815" id="396" label="releasePixelData" />
+      <listitem open="0" type="815" id="401" label="tile" />
+      <listitem open="0" type="815" id="398" label="tile" />
+      <listitem open="0" type="815" id="408" label="tileCoord" />
+      <listitem open="0" type="815" id="405" label="tileCoord" />
+      <listitem open="0" type="815" id="412" label="tileMap" />
+      <listitem open="0" type="815" id="415" label="tileMap" />
+      <listitem open="0" type="815" id="419" label="tileNum" />
+      <listitem open="0" type="815" id="422" label="width" />
+      <listitem open="0" type="815" id="425" label="writePixelData" />
+      <listitem open="0" type="815" id="423" label="writePixelData" />
+      <listitem open="0" type="815" id="432" label="~KisTileMgr" />
+     </listitem>
+     <listitem open="0" type="813" id="455" label="KisTileSwapInterface" >
+      <listitem open="0" type="815" id="456" label="KisTileSwapInterface" />
+      <listitem open="0" type="815" id="457" label="add" />
+      <listitem open="0" type="815" id="459" label="remove" />
+      <listitem open="0" type="815" id="461" label="swapCompress" />
+      <listitem open="0" type="815" id="463" label="swapDel" />
+      <listitem open="0" type="815" id="465" label="swapIn" />
+      <listitem open="0" type="815" id="467" label="swapInAsync" />
+      <listitem open="0" type="815" id="469" label="swapOut" />
+      <listitem open="0" type="815" id="471" label="~KisTileSwapInterface" />
+     </listitem>
+     <listitem open="0" type="813" id="2135" label="KisTool" >
+      <listitem open="0" type="815" id="2136" label="=" />
+      <listitem open="0" type="815" id="2139" label="KisTool" />
+      <listitem open="0" type="815" id="2138" label="KisTool" />
+      <listitem open="0" type="815" id="2141" label="clear" />
+      <listitem open="0" type="815" id="2142" label="clear" />
+      <listitem open="0" type="815" id="2144" label="cursor" />
+      <listitem open="0" type="815" id="2146" label="enter" />
+      <listitem open="0" type="815" id="2148" label="keyPress" />
+      <listitem open="0" type="815" id="2150" label="keyRelease" />
+      <listitem open="0" type="815" id="2152" label="leave" />
+      <listitem open="0" type="815" id="2154" label="mouseMove" />
+      <listitem open="0" type="815" id="2156" label="mousePress" />
+      <listitem open="0" type="815" id="2158" label="mouseRelease" />
+      <listitem open="0" type="815" id="2160" label="options" />
+      <listitem open="0" type="815" id="2164" label="paint" />
+      <listitem open="0" type="815" id="2162" label="paint" />
+      <listitem open="0" type="815" id="2167" label="setCursor" />
+      <listitem open="0" type="815" id="2169" label="setup" />
+      <listitem open="0" type="815" id="2171" label="tabletEvent" />
+      <listitem open="0" type="815" id="2173" label="~KisTool" />
+     </listitem>
+     <listitem open="0" type="813" id="2203" label="KisToolControllerInterface" >
+      <listitem open="0" type="815" id="2204" label="=" />
+      <listitem open="0" type="815" id="2207" label="KisToolControllerInterface" />
+      <listitem open="0" type="815" id="2206" label="KisToolControllerInterface" />
+      <listitem open="0" type="815" id="2209" label="currentTool" />
+      <listitem open="0" type="815" id="2210" label="setCurrentTool" />
+      <listitem open="0" type="815" id="2212" label="~KisToolControllerInterface" />
+     </listitem>
+     <listitem open="0" type="813" id="2190" label="KisToolFactory" >
+      <listitem open="0" type="814" id="2192" label="m_tools" />
+      <listitem open="0" type="815" id="2193" label="=" />
+      <listitem open="0" type="815" id="2196" label="KisToolFactory" />
+      <listitem open="0" type="815" id="2195" label="KisToolFactory" />
+      <listitem open="0" type="815" id="2198" label="create" />
+      <listitem open="0" type="815" id="2201" label="singleton" />
+      <listitem open="0" type="815" id="2202" label="~KisToolFactory" />
+     </listitem>
+     <listitem open="0" type="813" id="2174" label="KisUndoAdapter" >
+      <listitem open="0" type="815" id="2175" label="=" />
+      <listitem open="0" type="815" id="2178" label="KisUndoAdapter" />
+      <listitem open="0" type="815" id="2177" label="KisUndoAdapter" />
+      <listitem open="0" type="815" id="2180" label="addCommand" />
+      <listitem open="0" type="815" id="2182" label="beginMacro" />
+      <listitem open="0" type="815" id="2184" label="endMacro" />
+      <listitem open="0" type="815" id="2185" label="inMacro" />
+      <listitem open="0" type="815" id="2186" label="setUndo" />
+      <listitem open="0" type="815" id="2188" label="undo" />
+      <listitem open="0" type="815" id="2189" label="~KisUndoAdapter" />
+     </listitem>
+     <listitem open="0" type="813" id="2218" label="KisUtil" >
+      <listitem open="0" type="815" id="2219" label="enlargeRectToContainPoint" />
+      <listitem open="0" type="815" id="2222" label="findBoundingTiles" />
+      <listitem open="0" type="815" id="2224" label="findTileExtents" />
+      <listitem open="0" type="815" id="2226" label="printPoint" />
+      <listitem open="0" type="815" id="2229" label="printRect" />
+      <listitem open="0" type="815" id="2232" label="roughScaleQImage" />
+     </listitem>
+     <listitem open="0" type="813" id="2236" label="KisVector" >
+      <listitem open="0" type="814" id="2237" label="m_x" />
+      <listitem open="0" type="814" id="2238" label="m_y" />
+      <listitem open="0" type="814" id="2239" label="m_z" />
+      <listitem open="0" type="815" id="2240" label="!=" />
+      <listitem open="0" type="815" id="2255" label="*" />
+      <listitem open="0" type="815" id="2258" label="*" />
+      <listitem open="0" type="815" id="2252" label="*" />
+      <listitem open="0" type="815" id="2246" label="*" />
+      <listitem open="0" type="815" id="2249" label="*" />
+      <listitem open="0" type="815" id="2243" label="*" />
+      <listitem open="0" type="815" id="2263" label="*=" />
+      <listitem open="0" type="815" id="2261" label="*=" />
+      <listitem open="0" type="815" id="2265" label="*=" />
+      <listitem open="0" type="815" id="2267" label="+" />
+      <listitem open="0" type="815" id="2270" label="+=" />
+      <listitem open="0" type="815" id="2274" label="-" />
+      <listitem open="0" type="815" id="2272" label="-" />
+      <listitem open="0" type="815" id="2277" label="-=" />
+      <listitem open="0" type="815" id="2279" label="/" />
+      <listitem open="0" type="815" id="2282" label="/" />
+      <listitem open="0" type="815" id="2285" label="/" />
+      <listitem open="0" type="815" id="2292" label="/=" />
+      <listitem open="0" type="815" id="2288" label="/=" />
+      <listitem open="0" type="815" id="2290" label="/=" />
+      <listitem open="0" type="815" id="2294" label="==" />
+      <listitem open="0" type="815" id="2298" label="KisVector" />
+      <listitem open="0" type="815" id="2302" label="KisVector" />
+      <listitem open="0" type="815" id="2306" label="KisVector" />
+      <listitem open="0" type="815" id="2297" label="KisVector" />
+      <listitem open="0" type="815" id="2310" label="crossProduct" />
+      <listitem open="0" type="815" id="2312" label="dotProduct" />
+      <listitem open="0" type="815" id="2314" label="isNull" />
+      <listitem open="0" type="815" id="2315" label="length" />
+      <listitem open="0" type="815" id="2316" label="normalize" />
+      <listitem open="0" type="815" id="2317" label="setX" />
+      <listitem open="0" type="815" id="2319" label="setY" />
+      <listitem open="0" type="815" id="2321" label="setZ" />
+      <listitem open="0" type="815" id="2323" label="x" />
+      <listitem open="0" type="815" id="2324" label="y" />
+      <listitem open="0" type="815" id="2325" label="z" />
+     </listitem>
+     <listitem open="0" type="813" id="2365" label="KisView" >
+      <listitem open="0" type="814" id="2367" label="m_bg" />
+      <listitem open="0" type="814" id="2370" label="m_buildProgress" />
+      <listitem open="0" type="814" id="2371" label="m_canvas" />
+      <listitem open="0" type="814" id="2372" label="m_channelView" />
+      <listitem open="0" type="814" id="2373" label="m_clipboardHasImage" />
+      <listitem open="0" type="814" id="2374" label="m_current" />
+      <listitem open="0" type="814" id="2375" label="m_currentGuide" />
+      <listitem open="0" type="814" id="2376" label="m_dcop" />
+      <listitem open="0" type="814" id="2377" label="m_dlgBrushToggle" />
+      <listitem open="0" type="814" id="2378" label="m_dlgChannelsToggle" />
+      <listitem open="0" type="814" id="2379" label="m_dlgColorsToggle" />
+      <listitem open="0" type="814" id="2380" label="m_dlgLayersToggle" />
+      <listitem open="0" type="814" id="2381" label="m_dlgPatternToggle" />
+      <listitem open="0" type="814" id="2383" label="m_fg" />
+      <listitem open="0" type="814" id="2384" label="m_floatsidebarToggle" />
+      <listitem open="0" type="814" id="2386" label="m_gradientChooser" />
+      <listitem open="0" type="814" id="2387" label="m_hRuler" />
+      <listitem open="0" type="814" id="2388" label="m_hScroll" />
+      <listitem open="0" type="814" id="2389" label="m_imageChooser" />
+      <listitem open="0" type="814" id="2391" label="m_imgDup" />
+      <listitem open="0" type="814" id="2392" label="m_imgExport" />
+      <listitem open="0" type="814" id="2393" label="m_imgImport" />
+      <listitem open="0" type="814" id="2394" label="m_imgMergeAll" />
+      <listitem open="0" type="814" id="2395" label="m_imgMergeLinked" />
+      <listitem open="0" type="814" id="2396" label="m_imgMergeVisible" />
+      <listitem open="0" type="814" id="2397" label="m_imgResize" />
+      <listitem open="0" type="814" id="2398" label="m_imgResizeToLayer" />
+      <listitem open="0" type="814" id="2399" label="m_imgRm" />
+      <listitem open="0" type="814" id="2400" label="m_imgScan" />
+      <listitem open="0" type="814" id="2401" label="m_lastGuidePoint" />
+      <listitem open="0" type="814" id="2402" label="m_layerAdd" />
+      <listitem open="0" type="814" id="2403" label="m_layerBottom" />
+      <listitem open="0" type="814" id="2404" label="m_layerBox" />
+      <listitem open="0" type="814" id="2405" label="m_layerDup" />
+      <listitem open="0" type="814" id="2406" label="m_layerHide" />
+      <listitem open="0" type="814" id="2407" label="m_layerLink" />
+      <listitem open="0" type="814" id="2408" label="m_layerLower" />
+      <listitem open="0" type="814" id="2409" label="m_layerProperties" />
+      <listitem open="0" type="814" id="2410" label="m_layerRaise" />
+      <listitem open="0" type="814" id="2411" label="m_layerResize" />
+      <listitem open="0" type="814" id="2412" label="m_layerResizeToImage" />
+      <listitem open="0" type="814" id="2413" label="m_layerRm" />
+      <listitem open="0" type="814" id="2414" label="m_layerSaveAs" />
+      <listitem open="0" type="814" id="2415" label="m_layerScale" />
+      <listitem open="0" type="814" id="2416" label="m_layerToImage" />
+      <listitem open="0" type="814" id="2417" label="m_layerTop" />
+      <listitem open="0" type="814" id="2418" label="m_lsidebarToggle" />
+      <listitem open="0" type="814" id="2419" label="m_observers" />
+      <listitem open="0" type="814" id="2420" label="m_paletteChooser" />
+      <listitem open="0" type="814" id="2421" label="m_pathView" />
+      <listitem open="0" type="814" id="2424" label="m_selectionCopy" />
+      <listitem open="0" type="814" id="2425" label="m_selectionCrop" />
+      <listitem open="0" type="814" id="2426" label="m_selectionCut" />
+      <listitem open="0" type="814" id="2427" label="m_selectionFillBg" />
+      <listitem open="0" type="814" id="2428" label="m_selectionFillFg" />
+      <listitem open="0" type="814" id="2429" label="m_selectionPaste" />
+      <listitem open="0" type="814" id="2430" label="m_selectionPasteInto" />
+      <listitem open="0" type="814" id="2431" label="m_selectionRm" />
+      <listitem open="0" type="814" id="2432" label="m_selectionSelectAll" />
+      <listitem open="0" type="814" id="2433" label="m_selectionSelectNone" />
+      <listitem open="0" type="814" id="2434" label="m_sideBar" />
+      <listitem open="0" type="814" id="2435" label="m_sidebarToggle" />
+      <listitem open="0" type="814" id="2436" label="m_tabBar" />
+      <listitem open="0" type="814" id="2437" label="m_tabFirst" />
+      <listitem open="0" type="814" id="2438" label="m_tabLast" />
+      <listitem open="0" type="814" id="2439" label="m_tabLeft" />
+      <listitem open="0" type="814" id="2440" label="m_tabRight" />
+      <listitem open="0" type="814" id="2442" label="m_vRuler" />
+      <listitem open="0" type="814" id="2443" label="m_vScroll" />
+      <listitem open="0" type="814" id="2444" label="m_xoff" />
+      <listitem open="0" type="814" id="2445" label="m_yoff" />
+      <listitem open="0" type="814" id="2446" label="m_zoomIn" />
+      <listitem open="0" type="814" id="2447" label="m_zoomOut" />
+      <listitem open="0" type="815" id="2448" label="KisView" />
+      <listitem open="0" type="815" id="2453" label="attach" />
+      <listitem open="0" type="815" id="2455" label="bgColor" />
+      <listitem open="0" type="815" id="2456" label="canvas" />
+      <listitem open="0" type="815" id="2457" label="canvasController" />
+      <listitem open="0" type="815" id="2458" label="canvasXOffset" />
+      <listitem open="0" type="815" id="2459" label="canvasYOffset" />
+      <listitem open="0" type="815" id="2460" label="clearCanvas" />
+      <listitem open="0" type="815" id="2462" label="connectCurrentImg" />
+      <listitem open="0" type="815" id="2463" label="currentBrush" />
+      <listitem open="0" type="815" id="2464" label="currentGradient" />
+      <listitem open="0" type="815" id="2465" label="currentImg" />
+      <listitem open="0" type="815" id="2466" label="currentImgName" />
+      <listitem open="0" type="815" id="2467" label="currentPattern" />
+      <listitem open="0" type="815" id="2468" label="currentTool" />
+      <listitem open="0" type="815" id="2469" label="dcopObject" />
+      <listitem open="0" type="815" id="2470" label="detach" />
+      <listitem open="0" type="815" id="2472" label="disconnectCurrentImg" />
+      <listitem open="0" type="815" id="2473" label="docHeight" />
+      <listitem open="0" type="815" id="2474" label="docWidth" />
+      <listitem open="0" type="815" id="2475" label="document" />
+      <listitem open="0" type="815" id="2476" label="eraseGuides" />
+      <listitem open="0" type="815" id="2477" label="eventFilter" />
+      <listitem open="0" type="815" id="2480" label="fgColor" />
+      <listitem open="0" type="815" id="2481" label="fillSelection" />
+      <listitem open="0" type="815" id="2484" label="guiActivateEvent" />
+      <listitem open="0" type="815" id="2486" label="horzValue" />
+      <listitem open="0" type="815" id="2487" label="imgUpdateGUI" />
+      <listitem open="0" type="815" id="2488" label="importImage" />
+      <listitem open="0" type="815" id="2492" label="layerUpdateGUI" />
+      <listitem open="0" type="815" id="2494" label="notify" />
+      <listitem open="0" type="815" id="2495" label="paintGuides" />
+      <listitem open="0" type="815" id="2496" label="paintView" />
+      <listitem open="0" type="815" id="2498" label="print" />
+      <listitem open="0" type="815" id="2500" label="resizeEvent" />
+      <listitem open="0" type="815" id="2502" label="selectColor" />
+      <listitem open="0" type="815" id="2504" label="selectImage" />
+      <listitem open="0" type="815" id="2506" label="selectionUpdateGUI" />
+      <listitem open="0" type="815" id="2508" label="setBGColor" />
+      <listitem open="0" type="815" id="2510" label="setCurrentTool" />
+      <listitem open="0" type="815" id="2512" label="setFGColor" />
+      <listitem open="0" type="815" id="2514" label="setupActions" />
+      <listitem open="0" type="815" id="2515" label="setupCanvas" />
+      <listitem open="0" type="815" id="2516" label="setupClipboard" />
+      <listitem open="0" type="815" id="2517" label="setupPrinter" />
+      <listitem open="0" type="815" id="2519" label="setupRulers" />
+      <listitem open="0" type="815" id="2520" label="setupScrollBars" />
+      <listitem open="0" type="815" id="2521" label="setupSideBar" />
+      <listitem open="0" type="815" id="2522" label="setupStatusBar" />
+      <listitem open="0" type="815" id="2523" label="setupTabBar" />
+      <listitem open="0" type="815" id="2524" label="setupTools" />
+      <listitem open="0" type="815" id="2525" label="toolController" />
+      <listitem open="0" type="815" id="2526" label="undoAdapter" />
+      <listitem open="0" type="815" id="2528" label="updateCanvas" />
+      <listitem open="0" type="815" id="2527" label="updateCanvas" />
+      <listitem open="0" type="815" id="2533" label="updateCanvas" />
+      <listitem open="0" type="815" id="2535" label="updateGuides" />
+      <listitem open="0" type="815" id="2536" label="updateReadWrite" />
+      <listitem open="0" type="815" id="2538" label="vertValue" />
+      <listitem open="0" type="815" id="2539" label="viewToWindow" />
+      <listitem open="0" type="815" id="2544" label="viewToWindow" />
+      <listitem open="0" type="815" id="2542" label="viewToWindow" />
+      <listitem open="0" type="815" id="2551" label="windowToView" />
+      <listitem open="0" type="815" id="2546" label="windowToView" />
+      <listitem open="0" type="815" id="2549" label="windowToView" />
+      <listitem open="0" type="815" id="2553" label="zoomFactor" />
+      <listitem open="0" type="815" id="2555" label="zoomIn" />
+      <listitem open="0" type="815" id="2554" label="zoomIn" />
+      <listitem open="0" type="815" id="2559" label="zoomOut" />
+      <listitem open="0" type="815" id="2558" label="zoomOut" />
+      <listitem open="0" type="815" id="2562" label="zoomUpdateGUI" />
+      <listitem open="0" type="815" id="2566" label="~KisView" />
+     </listitem>
+     <listitem open="0" type="813" id="2023" label="PluginInfo" >
+      <listitem open="0" type="814" id="2024" label="m_category" />
+      <listitem open="0" type="814" id="2025" label="m_comment" />
+      <listitem open="0" type="814" id="2026" label="m_dir" />
+      <listitem open="0" type="814" id="2027" label="m_id" />
+      <listitem open="0" type="814" id="2028" label="m_library" />
+      <listitem open="0" type="814" id="2029" label="m_name" />
+      <listitem open="0" type="814" id="2030" label="m_type" />
+      <listitem open="0" type="815" id="2031" label="PluginInfo" />
+      <listitem open="0" type="815" id="2038" label="category" />
+      <listitem open="0" type="815" id="2039" label="comment" />
+      <listitem open="0" type="815" id="2040" label="dir" />
+      <listitem open="0" type="815" id="2041" label="id" />
+      <listitem open="0" type="815" id="2042" label="library" />
+      <listitem open="0" type="815" id="2043" label="name" />
+      <listitem open="0" type="815" id="2044" label="setId" />
+      <listitem open="0" type="815" id="2046" label="type" />
+     </listitem>
+     <listitem open="0" type="813" id="135" label="RGB" >
+      <listitem open="0" type="814" id="136" label="b" />
+      <listitem open="0" type="814" id="137" label="g" />
+      <listitem open="0" type="814" id="138" label="r" />
+     </listitem>
+     <listitem open="0" type="830" id="-1" label="Datatypes" >
+      <listitem open="1" type="829" id="1254" label="CHANNELTYPE" />
+      <listitem open="1" type="829" id="280" label="ColorLUT" />
+      <listitem open="1" type="829" id="2346" label="KisBackgroundSP" />
+      <listitem open="1" type="829" id="2339" label="KisChannelSP" />
+      <listitem open="1" type="829" id="2336" label="KisDabSP" />
+      <listitem open="1" type="829" id="1251" label="KisGuideSP" />
+      <listitem open="1" type="829" id="2355" label="KisImageSP" />
+      <listitem open="1" type="829" id="2360" label="KisLayerSP" />
+      <listitem open="1" type="829" id="2354" label="KisMaskSP" />
+      <listitem open="1" type="829" id="2329" label="KisMementoSP" />
+      <listitem open="1" type="829" id="2362" label="KisPaintDeviceSP" />
+      <listitem open="1" type="829" id="2359" label="KisPixelDataSP" />
+      <listitem open="1" type="829" id="2342" label="KisSelectionSP" />
+      <listitem open="1" type="829" id="2345" label="KisStrategyColorSpaceMap" />
+      <listitem open="1" type="829" id="2337" label="KisStrategyColorSpaceSP" />
+      <listitem open="1" type="829" id="2358" label="KisTileMgrSP" />
+      <listitem open="1" type="829" id="2340" label="KisTileSP" />
+      <listitem open="1" type="829" id="554" label="KisTileSPLst" />
+      <listitem open="1" type="829" id="556" label="KisTileSPLst_cit" />
+      <listitem open="1" type="829" id="559" label="KisTileSPLst_it" />
+      <listitem open="1" type="829" id="2363" label="KoColorMap" />
+      <listitem open="1" type="829" id="1255" label="PIXELTYPE" />
+      <listitem open="1" type="829" id="2132" label="PluginInfoList" />
+      <listitem open="1" type="829" id="1253" label="QUANTUM" />
+      <listitem open="1" type="829" id="2133" label="TileMap" />
+      <listitem open="1" type="829" id="282" label="acFlyweights" />
+      <listitem open="1" type="829" id="281" label="acFlyweights_cit" />
+      <listitem open="1" type="829" id="279" label="acFlyweights_it" />
+      <listitem open="1" type="829" id="4" label="bool" />
+      <listitem open="1" type="829" id="3" label="char" />
+      <listitem open="1" type="829" id="6" label="double" />
+      <listitem open="1" type="829" id="5" label="float" />
+      <listitem open="1" type="829" id="2" label="int" />
+      <listitem open="1" type="829" id="7" label="long" />
+      <listitem open="1" type="829" id="8" label="short" />
+      <listitem open="1" type="829" id="78" label="super" />
+      <listitem open="1" type="829" id="79" label="vKisBuilderSubject" />
+      <listitem open="1" type="829" id="80" label="vKisBuilderSubject_cit" />
+      <listitem open="1" type="829" id="77" label="vKisBuilderSubject_it" />
+      <listitem open="1" type="829" id="2571" label="vKisCanvasObserver" />
+      <listitem open="1" type="829" id="2572" label="vKisCanvasObserver_cit" />
+      <listitem open="1" type="829" id="2570" label="vKisCanvasObserver_it" />
+      <listitem open="1" type="829" id="2335" label="vKisChannelSP" />
+      <listitem open="1" type="829" id="2331" label="vKisChannelSP_cit" />
+      <listitem open="1" type="829" id="2328" label="vKisChannelSP_it" />
+      <listitem open="1" type="829" id="1257" label="vKisGuideSP" />
+      <listitem open="1" type="829" id="1256" label="vKisGuideSP_cit" />
+      <listitem open="1" type="829" id="1252" label="vKisGuideSP_it" />
+      <listitem open="1" type="829" id="2333" label="vKisImageSP" />
+      <listitem open="1" type="829" id="2351" label="vKisImageSP_cit" />
+      <listitem open="1" type="829" id="2352" label="vKisImageSP_it" />
+      <listitem open="1" type="829" id="2330" label="vKisLayerSP" />
+      <listitem open="1" type="829" id="2344" label="vKisLayerSP_cit" />
+      <listitem open="1" type="829" id="2347" label="vKisLayerSP_it" />
+      <listitem open="1" type="829" id="2353" label="vKisMaskSP" />
+      <listitem open="1" type="829" id="2348" label="vKisMaskSP_cit" />
+      <listitem open="1" type="829" id="2343" label="vKisMaskSP_it" />
+      <listitem open="1" type="829" id="2332" label="vKisPaintDeviceSP" />
+      <listitem open="1" type="829" id="2349" label="vKisPaintDeviceSP_cit" />
+      <listitem open="1" type="829" id="2350" label="vKisPaintDeviceSP_it" />
+      <listitem open="1" type="829" id="2341" label="vKisSegments" />
+      <listitem open="1" type="829" id="2361" label="vKisTileSP" />
+      <listitem open="1" type="829" id="555" label="vKisTileSPLst" />
+      <listitem open="1" type="829" id="557" label="vKisTileSPLst_cit" />
+      <listitem open="1" type="829" id="558" label="vKisTileSPLst_it" />
+      <listitem open="1" type="829" id="2356" label="vKisTileSP_cit" />
+      <listitem open="1" type="829" id="2338" label="vKisTileSP_it" />
+      <listitem open="1" type="829" id="2327" label="vKisTool" />
+      <listitem open="1" type="829" id="2357" label="vKisTool_cit" />
+      <listitem open="1" type="829" id="2334" label="vKisTool_it" />
+     </listitem>
+     <listitem open="1" type="831" id="1198" label="CompositeOp" />
+     <listitem open="1" type="831" id="55" label="KisImageBuilder_Result" />
+     <listitem open="1" type="831" id="69" label="KisImageBuilder_Step" />
+     <listitem open="1" type="831" id="2129" label="PluginType" />
+     <listitem open="1" type="831" id="546" label="drawingHints" />
+     <listitem open="1" type="831" id="720" label="enumBrushType" />
+     <listitem open="1" type="831" id="1237" label="enumImgType" />
+    </listitem>
+    <listitem open="1" type="802" id="-1" label="Use Case View" />
+    <listitem open="1" type="821" id="-1" label="Component View" />
+    <listitem open="1" type="827" id="-1" label="Deployment View" />
+   </listitem>
+  </listview>
+  <codegeneration>
+   <codegenerator language="Perl" />
+   <codegenerator language="Cpp" >
+    <classifiercodedocument writeOutCode="true" package="" id="9" tqparent_class="9" fileExt=".cpp" fileName="kisbuildersubject" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="10" tag="operation_10" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="11" tag="operation_11" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisbuildersubject.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="12" tqparent_class="12" fileExt=".cpp" fileName="kisimagemagickconverter" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kisimagebuilder_result.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="13" tag="hblock_tag_0" canDelete="false" classfield_id="13" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="13" tag="hblock_tag_1" canDelete="false" classfield_id="13" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="14" tag="hblock_tag_2" canDelete="false" classfield_id="14" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="14" tag="hblock_tag_3" canDelete="false" classfield_id="14" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="15" tag="hblock_tag_4" canDelete="false" classfield_id="15" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="15" tag="hblock_tag_5" canDelete="false" classfield_id="15" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="16" tag="hblock_tag_6" canDelete="false" classfield_id="16" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="16" tag="hblock_tag_7" canDelete="false" classfield_id="16" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="17" tag="hblock_tag_8" canDelete="false" classfield_id="17" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="17" tag="hblock_tag_9" canDelete="false" classfield_id="17" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="18" tag="operation_18" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="20" tag="operation_20" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="23" tag="operation_23" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="25" tag="operation_25" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="28" tag="operation_28" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="31" tag="operation_31" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="33" tag="operation_33" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="36" tag="operation_36" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="37" tag="operation_37" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="40" tag="operation_40" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="41" tag="operation_41" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="42" tag="operation_42" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="43" tag="operation_43" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisimagemagickconverter.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="13" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="13" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="13" tag="hblock_tag_0" canDelete="false" classfield_id="13" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="13" tag="hblock_tag_1" canDelete="false" classfield_id="13" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="14" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="14" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="14" tag="hblock_tag_2" canDelete="false" classfield_id="14" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="14" tag="hblock_tag_3" canDelete="false" classfield_id="14" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="15" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="15" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="15" tag="hblock_tag_4" canDelete="false" classfield_id="15" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="15" tag="hblock_tag_5" canDelete="false" classfield_id="15" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="16" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="16" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="16" tag="hblock_tag_6" canDelete="false" classfield_id="16" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="16" tag="hblock_tag_7" canDelete="false" classfield_id="16" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="17" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="17" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="17" tag="hblock_tag_8" canDelete="false" classfield_id="17" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="17" tag="hblock_tag_9" canDelete="false" classfield_id="17" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="44" tqparent_class="44" fileExt=".cpp" fileName="kisbuildermonitor" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;vkisbuildersubject.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="45" tag="hblock_tag_0" canDelete="false" classfield_id="45" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="45" tag="hblock_tag_1" canDelete="false" classfield_id="45" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2390" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="2390" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2390" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="2390" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2390" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="2390" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2390" tag="hblock_tag_5" canDelete="false" writeOutText="false" classfield_id="2390" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2390" tag="hblock_tag_6" canDelete="false" writeOutText="false" classfield_id="2390" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="46" tag="operation_46" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="49" tag="operation_49" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="51" tag="operation_51" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="53" tag="operation_53" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisbuildermonitor.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="45" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="45" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="45" tag="hblock_tag_0" canDelete="false" classfield_id="45" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="45" tag="hblock_tag_1" canDelete="false" classfield_id="45" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2390" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2390" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2390" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="2390" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2390" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="2390" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2390" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="2390" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2390" tag="hblock_tag_5" canDelete="false" writeOutText="false" classfield_id="2390" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2390" tag="hblock_tag_6" canDelete="false" writeOutText="false" classfield_id="2390" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="55" tqparent_class="55" fileExt=".cpp" fileName="kisimagebuilder_result" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisimagebuilder_result.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="69" tqparent_class="69" fileExt=".cpp" fileName="kisimagebuilder_step" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisimagebuilder_step.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="81" tqparent_class="81" fileExt=".cpp" fileName="kisstrategycolorspacecmyk" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;compositeop.h&quot;&amp;#010;#include &quot;colorlut.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="82" tag="hblock_tag_0" canDelete="false" classfield_id="82" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="82" tag="hblock_tag_1" canDelete="false" classfield_id="82" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="83" tag="hblock_tag_2" canDelete="false" classfield_id="83" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="83" tag="hblock_tag_3" canDelete="false" classfield_id="83" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="84" tag="hblock_tag_4" canDelete="false" classfield_id="84" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="84" tag="hblock_tag_5" canDelete="false" classfield_id="84" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="85" tag="hblock_tag_6" canDelete="false" classfield_id="85" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="85" tag="hblock_tag_7" canDelete="false" classfield_id="85" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="86" tag="operation_86" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="87" tag="operation_87" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="90" tag="operation_90" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="94" tag="operation_94" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="97" tag="operation_97" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="101" tag="operation_101" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="104" tag="operation_104" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="108" tag="operation_108" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="115" tag="operation_115" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="125" tag="operation_125" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="134" tag="operation_134" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisstrategycolorspacecmyk.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="82" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="82" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="82" tag="hblock_tag_0" canDelete="false" classfield_id="82" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="82" tag="hblock_tag_1" canDelete="false" classfield_id="82" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="83" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="83" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="83" tag="hblock_tag_2" canDelete="false" classfield_id="83" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="83" tag="hblock_tag_3" canDelete="false" classfield_id="83" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="84" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="84" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="84" tag="hblock_tag_4" canDelete="false" classfield_id="84" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="84" tag="hblock_tag_5" canDelete="false" classfield_id="84" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="85" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="85" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="85" tag="hblock_tag_6" canDelete="false" classfield_id="85" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="85" tag="hblock_tag_7" canDelete="false" classfield_id="85" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="135" tqparent_class="135" fileExt=".cpp" fileName="rgb" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="136" tag="hblock_tag_0" canDelete="false" classfield_id="136" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="136" tag="hblock_tag_1" canDelete="false" classfield_id="136" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="137" tag="hblock_tag_2" canDelete="false" classfield_id="137" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="137" tag="hblock_tag_3" canDelete="false" classfield_id="137" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="138" tag="hblock_tag_4" canDelete="false" classfield_id="138" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="138" tag="hblock_tag_5" canDelete="false" classfield_id="138" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			rgb.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="136" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="136" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="136" tag="hblock_tag_0" canDelete="false" classfield_id="136" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="136" tag="hblock_tag_1" canDelete="false" classfield_id="136" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="137" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="137" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="137" tag="hblock_tag_2" canDelete="false" classfield_id="137" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="137" tag="hblock_tag_3" canDelete="false" classfield_id="137" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="138" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="138" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="138" tag="hblock_tag_4" canDelete="false" classfield_id="138" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="138" tag="hblock_tag_5" canDelete="false" classfield_id="138" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="139" tqparent_class="139" fileExt=".cpp" fileName="kisstrategycolorspace" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;compositeop.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="140" tag="operation_140" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="142" tag="operation_142" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="143" tag="operation_143" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="145" tag="operation_145" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="148" tag="operation_148" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="152" tag="operation_152" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="155" tag="operation_155" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="159" tag="operation_159" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="162" tag="operation_162" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="166" tag="operation_166" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="173" tag="operation_173" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="183" tag="operation_183" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="192" tag="operation_192" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisstrategycolorspace.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="193" tqparent_class="193" fileExt=".cpp" fileName="kiscolorspacefactoryinterface" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kiscolorspacefactoryinterface.h&quot;&amp;#010;#include &quot;enumimgtype.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="194" tag="hblock_tag_5" canDelete="false" classfield_id="194" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="194" tag="hblock_tag_6" canDelete="false" classfield_id="194" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="194" tag="hblock_tag_7" canDelete="false" writeOutText="false" classfield_id="194" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="194" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="194" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="194" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="194" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="195" tag="operation_195" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="197" tag="operation_197" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="198" tag="operation_198" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="200" tag="operation_200" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="202" tag="operation_202" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="204" tag="operation_204" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="205" tag="operation_205" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kiscolorspacefactoryinterface.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:49:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="194" field_type="1" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="194" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="194" tag="hblock_tag_5" canDelete="false" classfield_id="194" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="194" tag="hblock_tag_6" canDelete="false" classfield_id="194" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="194" tag="hblock_tag_7" canDelete="false" writeOutText="false" classfield_id="194" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="194" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="194" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="194" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="194" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="194" field_type="1" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="194" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="194" tag="hblock_tag_5" canDelete="false" writeOutText="false" classfield_id="194" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="194" tag="hblock_tag_6" canDelete="false" writeOutText="false" classfield_id="194" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="194" tag="hblock_tag_7" canDelete="false" writeOutText="false" classfield_id="194" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="194" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="194" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="194" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="194" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="206" tqparent_class="206" fileExt=".cpp" fileName="kisstrategycolorspacergb" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;compositeop.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="207" tag="hblock_tag_0" canDelete="false" classfield_id="207" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="207" tag="hblock_tag_1" canDelete="false" classfield_id="207" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="208" tag="hblock_tag_2" canDelete="false" classfield_id="208" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="208" tag="hblock_tag_3" canDelete="false" classfield_id="208" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="209" tag="hblock_tag_4" canDelete="false" classfield_id="209" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="209" tag="hblock_tag_5" canDelete="false" classfield_id="209" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="210" tag="operation_210" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="211" tag="operation_211" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="214" tag="operation_214" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="218" tag="operation_218" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="221" tag="operation_221" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="225" tag="operation_225" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="228" tag="operation_228" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="232" tag="operation_232" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="239" tag="operation_239" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="249" tag="operation_249" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="258" tag="operation_258" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisstrategycolorspacergb.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="207" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="207" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="207" tag="hblock_tag_0" canDelete="false" classfield_id="207" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="207" tag="hblock_tag_1" canDelete="false" classfield_id="207" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="208" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="208" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="208" tag="hblock_tag_2" canDelete="false" classfield_id="208" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="208" tag="hblock_tag_3" canDelete="false" classfield_id="208" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="209" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="209" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="209" tag="hblock_tag_4" canDelete="false" classfield_id="209" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="209" tag="hblock_tag_5" canDelete="false" classfield_id="209" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="259" tqparent_class="259" fileExt=".cpp" fileName="cmyk" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="260" tag="hblock_tag_0" canDelete="false" classfield_id="260" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="260" tag="hblock_tag_1" canDelete="false" classfield_id="260" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="261" tag="hblock_tag_2" canDelete="false" classfield_id="261" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="261" tag="hblock_tag_3" canDelete="false" classfield_id="261" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="262" tag="hblock_tag_4" canDelete="false" classfield_id="262" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="262" tag="hblock_tag_5" canDelete="false" classfield_id="262" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="263" tag="hblock_tag_6" canDelete="false" classfield_id="263" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="263" tag="hblock_tag_7" canDelete="false" classfield_id="263" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="264" tag="operation_264" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			cmyk.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="260" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="260" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="260" tag="hblock_tag_0" canDelete="false" classfield_id="260" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="260" tag="hblock_tag_1" canDelete="false" classfield_id="260" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="261" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="261" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="261" tag="hblock_tag_2" canDelete="false" classfield_id="261" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="261" tag="hblock_tag_3" canDelete="false" classfield_id="261" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="262" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="262" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="262" tag="hblock_tag_4" canDelete="false" classfield_id="262" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="262" tag="hblock_tag_5" canDelete="false" classfield_id="262" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="263" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="263" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="263" tag="hblock_tag_6" canDelete="false" classfield_id="263" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="263" tag="hblock_tag_7" canDelete="false" classfield_id="263" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="266" tqparent_class="266" fileExt=".cpp" fileName="kiscolorspacefactoryflyweight" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;enumimgtype.h&quot;&amp;#010;#include &quot;kisstrategycolorspacesp.h&quot;&amp;#010;#include &quot;acflyweights.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="267" tag="hblock_tag_0" canDelete="false" classfield_id="267" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="267" tag="hblock_tag_1" canDelete="false" classfield_id="267" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="268" tag="operation_268" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="269" tag="operation_269" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="271" tag="operation_271" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="273" tag="operation_273" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="275" tag="operation_275" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kiscolorspacefactoryflyweight.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="267" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="267" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="267" tag="hblock_tag_0" canDelete="false" classfield_id="267" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="267" tag="hblock_tag_1" canDelete="false" classfield_id="267" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="283" tqparent_class="283" fileExt=".cpp" fileName="kisscopedlock" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="284" tag="hblock_tag_0" canDelete="false" classfield_id="284" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="284" tag="hblock_tag_1" canDelete="false" classfield_id="284" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="285" tag="operation_285" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="288" tag="operation_288" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="289" tag="operation_289" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="290" tag="operation_290" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="291" tag="operation_291" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisscopedlock.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:49:09&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="284" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="284" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="284" tag="hblock_tag_0" canDelete="false" classfield_id="284" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="284" tag="hblock_tag_1" canDelete="false" classfield_id="284" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="292" tqparent_class="292" fileExt=".cpp" fileName="kisstrategymove" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="293" tag="hblock_tag_0" canDelete="false" classfield_id="293" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="293" tag="hblock_tag_1" canDelete="false" classfield_id="293" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="294" tag="hblock_tag_2" canDelete="false" classfield_id="294" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="294" tag="hblock_tag_3" canDelete="false" classfield_id="294" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="295" tag="hblock_tag_4" canDelete="false" classfield_id="295" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="295" tag="hblock_tag_5" canDelete="false" classfield_id="295" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="296" tag="hblock_tag_6" canDelete="false" classfield_id="296" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="296" tag="hblock_tag_7" canDelete="false" classfield_id="296" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="297" tag="hblock_tag_8" canDelete="false" classfield_id="297" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="297" tag="hblock_tag_9" canDelete="false" classfield_id="297" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="298" tag="hblock_tag_10" canDelete="false" classfield_id="298" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="298" tag="hblock_tag_11" canDelete="false" classfield_id="298" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="299" tag="hblock_tag_12" canDelete="false" classfield_id="299" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="299" tag="hblock_tag_13" canDelete="false" classfield_id="299" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="300" tag="operation_300" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="302" tag="operation_302" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="303" tag="operation_303" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="305" tag="operation_305" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="307" tag="operation_307" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="309" tag="operation_309" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="312" tag="operation_312" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="314" tag="operation_314" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="319" tag="operation_319" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="322" tag="operation_322" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="324" tag="operation_324" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisstrategymove.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:47:15&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="293" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="293" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="293" tag="hblock_tag_0" canDelete="false" classfield_id="293" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="293" tag="hblock_tag_1" canDelete="false" classfield_id="293" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="294" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="294" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="294" tag="hblock_tag_2" canDelete="false" classfield_id="294" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="294" tag="hblock_tag_3" canDelete="false" classfield_id="294" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="295" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="295" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="295" tag="hblock_tag_4" canDelete="false" classfield_id="295" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="295" tag="hblock_tag_5" canDelete="false" classfield_id="295" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="296" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="296" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="296" tag="hblock_tag_6" canDelete="false" classfield_id="296" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="296" tag="hblock_tag_7" canDelete="false" classfield_id="296" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="297" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="297" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="297" tag="hblock_tag_8" canDelete="false" classfield_id="297" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="297" tag="hblock_tag_9" canDelete="false" classfield_id="297" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="298" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="298" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="298" tag="hblock_tag_10" canDelete="false" classfield_id="298" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="298" tag="hblock_tag_11" canDelete="false" classfield_id="298" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="299" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="299" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="299" tag="hblock_tag_12" canDelete="false" classfield_id="299" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="299" tag="hblock_tag_13" canDelete="false" classfield_id="299" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="325" tqparent_class="325" fileExt=".cpp" fileName="kistilemgr" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kistilesp.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;kispixeldatasp.h&quot;&amp;#010;#include &quot;vkistilesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="326" tag="hblock_tag_0" canDelete="false" classfield_id="326" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="326" tag="hblock_tag_1" canDelete="false" classfield_id="326" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="327" tag="hblock_tag_2" canDelete="false" classfield_id="327" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="327" tag="hblock_tag_3" canDelete="false" classfield_id="327" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="330" tag="hblock_tag_4" canDelete="false" classfield_id="330" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="330" tag="hblock_tag_5" canDelete="false" classfield_id="330" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="331" tag="hblock_tag_6" canDelete="false" classfield_id="331" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="331" tag="hblock_tag_7" canDelete="false" classfield_id="331" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="332" tag="hblock_tag_8" canDelete="false" classfield_id="332" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="332" tag="hblock_tag_9" canDelete="false" classfield_id="332" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="333" tag="hblock_tag_10" canDelete="false" classfield_id="333" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="333" tag="hblock_tag_11" canDelete="false" classfield_id="333" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="334" tag="hblock_tag_12" canDelete="false" classfield_id="334" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="334" tag="hblock_tag_13" canDelete="false" classfield_id="334" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="329" tag="hblock_tag_14" canDelete="false" classfield_id="329" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="329" tag="hblock_tag_15" canDelete="false" classfield_id="329" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="329" tag="hblock_tag_16" canDelete="false" writeOutText="false" classfield_id="329" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="329" tag="hblock_tag_17" canDelete="false" writeOutText="false" classfield_id="329" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="329" tag="hblock_tag_18" canDelete="false" writeOutText="false" classfield_id="329" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="335" tag="operation_335" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="337" tag="operation_337" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Create a new KisTileMgr of width and height with the&amp;#010;specified colour depth. Deep copies the tiles of tm to the&amp;#010;new KisTileMgr.&amp;#010;&amp;#010;XXX: I am not sure what happens when tm is bigger or smaller&amp;#010;than width and height, nor what happens when tm has a&amp;#010;different depth." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="342" tag="operation_342" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Create a KisTileMgr of width and height with the specified&amp;#010;colour depth." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="346" tag="operation_346" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Creates a new KisTileMgr based on rhs, shares a reference&amp;#010;to the tiles of rhs." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="348" tag="operation_348" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="350" tag="operation_350" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="XXX?" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="354" tag="operation_354" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Color-depth of the KisRenderInterface implementation&amp;#010;managed by this KisTileMgr" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="355" tag="operation_355" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="XXX?" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="359" tag="operation_359" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="362" tag="operation_362" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Returns true if this KisTileMgr does not manage any&amp;#010;tiles." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="363" tag="operation_363" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Height in pixels of the total area managed by this KisTileMgr" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="364" tag="operation_364" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="XXX" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="368" tag="operation_368" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="XXX" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="370" tag="operation_370" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="XXX" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="373" tag="operation_373" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="376" tag="operation_376" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="XXX" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="378" tag="operation_378" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Total size in memory the data managed by this KisTileMgr " />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="379" tag="operation_379" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Number of columns of tiles managed by this KisTileMgr" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="380" tag="operation_380" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Number of rows of tiles managed by this KisTileMgr" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="381" tag="operation_381" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Returns the KisPixelData defined by the rectangle x1, y1,&amp;#010;x2, y2. Depending on mode, this data is readable, writable&amp;#010;or both." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="387" tag="operation_387" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="389" tag="operation_389" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Read the area defined by x1, y2, x2, y2 into the buffer. Stride is number of bytes&amp;#010;that a pixel takes in the buffer." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="396" tag="operation_396" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Not sure what this does... Perhaps write changed data if&amp;#010;owner, else mark something invalid. XXX" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="398" tag="operation_398" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Create or duplicate a tile with identity tilenum; tilenum&amp;#010;is computed from the x/y coordinates of the tile in the&amp;#010;image&amp;#010;&amp;#010;XXX: Not sure what 'mode' is. Presumbly related to the&amp;#010;TILEMODE constants." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="401" tag="operation_401" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Create or duplicate a tile at location xpix/ypix.&amp;#010;&amp;#010;XXX: Not sure what 'mode' is. Presumbly related to the&amp;#010;TILEMODE constants." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="405" tag="operation_405" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Puts the x/y coordinates of the top left (?) corner&amp;#010;of tile in coord." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="408" tag="operation_408" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Puts the x/y coordinates of the top left (?) corner&amp;#010;of tile in x and y." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="412" tag="operation_412" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="XXX" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="415" tag="operation_415" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="XXX" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="419" tag="operation_419" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="422" tag="operation_422" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Width in pixels of the total area managed by this KisTileMgr" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="423" tag="operation_423" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="425" tag="operation_425" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Commit the pixel data in buffer." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="432" tag="operation_432" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistilemgr.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="326" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="326" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="326" tag="hblock_tag_0" canDelete="false" classfield_id="326" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="326" tag="hblock_tag_1" canDelete="false" classfield_id="326" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="327" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="327" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="327" tag="hblock_tag_2" canDelete="false" classfield_id="327" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="327" tag="hblock_tag_3" canDelete="false" classfield_id="327" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="330" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="330" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="330" tag="hblock_tag_4" canDelete="false" classfield_id="330" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="330" tag="hblock_tag_5" canDelete="false" classfield_id="330" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="331" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="331" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="331" tag="hblock_tag_6" canDelete="false" classfield_id="331" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="331" tag="hblock_tag_7" canDelete="false" classfield_id="331" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="332" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="332" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="332" tag="hblock_tag_8" canDelete="false" classfield_id="332" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="332" tag="hblock_tag_9" canDelete="false" classfield_id="332" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="333" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="333" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="333" tag="hblock_tag_10" canDelete="false" classfield_id="333" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="333" tag="hblock_tag_11" canDelete="false" classfield_id="333" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="334" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="334" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="334" tag="hblock_tag_12" canDelete="false" classfield_id="334" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="334" tag="hblock_tag_13" canDelete="false" classfield_id="334" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="329" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="329" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="329" tag="hblock_tag_14" canDelete="false" classfield_id="329" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="329" tag="hblock_tag_15" canDelete="false" classfield_id="329" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="329" tag="hblock_tag_16" canDelete="false" writeOutText="false" classfield_id="329" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="329" tag="hblock_tag_17" canDelete="false" writeOutText="false" classfield_id="329" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="329" tag="hblock_tag_18" canDelete="false" writeOutText="false" classfield_id="329" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="328" tqparent_class="328" fileExt=".cpp" fileName="kistilemediator" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kistilesp.h&quot;&amp;#010;#include &quot;kistilemgrsp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="433" tag="hblock_tag_0" canDelete="false" classfield_id="433" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="433" tag="hblock_tag_1" canDelete="false" classfield_id="433" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="434" tag="hblock_tag_2" canDelete="false" classfield_id="434" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="434" tag="hblock_tag_3" canDelete="false" classfield_id="434" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="435" tag="hblock_tag_4" canDelete="false" classfield_id="435" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="435" tag="hblock_tag_5" canDelete="false" classfield_id="435" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="329" tag="hblock_tag_6" canDelete="false" writeOutText="false" classfield_id="329" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="329" tag="hblock_tag_7" canDelete="false" writeOutText="false" classfield_id="329" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="329" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="329" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="329" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="329" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="329" tag="hblock_tag_10" canDelete="false" writeOutText="false" classfield_id="329" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="436" tag="operation_436" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="438" tag="operation_438" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="439" tag="operation_439" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="441" tag="operation_441" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="445" tag="operation_445" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="449" tag="operation_449" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="451" tag="operation_451" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="454" tag="operation_454" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistilemediator.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="433" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="433" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="433" tag="hblock_tag_0" canDelete="false" classfield_id="433" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="433" tag="hblock_tag_1" canDelete="false" classfield_id="433" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="434" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="434" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="434" tag="hblock_tag_2" canDelete="false" classfield_id="434" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="434" tag="hblock_tag_3" canDelete="false" classfield_id="434" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="435" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="435" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="435" tag="hblock_tag_4" canDelete="false" classfield_id="435" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="435" tag="hblock_tag_5" canDelete="false" classfield_id="435" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="329" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="329" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="329" tag="hblock_tag_6" canDelete="false" writeOutText="false" classfield_id="329" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="329" tag="hblock_tag_7" canDelete="false" writeOutText="false" classfield_id="329" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="329" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="329" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="329" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="329" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="329" tag="hblock_tag_10" canDelete="false" writeOutText="false" classfield_id="329" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="455" tqparent_class="455" fileExt=".cpp" fileName="kistileswapinterface" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kistilesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="492" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="492" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="492" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="492" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="492" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="492" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="492" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="492" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="492" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="492" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="456" tag="operation_456" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="457" tag="operation_457" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="459" tag="operation_459" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="461" tag="operation_461" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="463" tag="operation_463" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="465" tag="operation_465" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="467" tag="operation_467" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="469" tag="operation_469" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="471" tag="operation_471" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistileswapinterface.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="492" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="492" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="492" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="492" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="492" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="492" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="492" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="492" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="492" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="492" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="492" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="492" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="472" tqparent_class="472" fileExt=".cpp" fileName="kistilecacheinterface" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kistilesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="482" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="482" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="482" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="482" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="482" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="482" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="482" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="482" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="482" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="482" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="473" tag="operation_473" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="474" tag="operation_474" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="476" tag="operation_476" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="478" tag="operation_478" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="480" tag="operation_480" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistilecacheinterface.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:47:01&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="482" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="482" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="482" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="482" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="482" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="482" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="482" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="482" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="482" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="482" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="482" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="482" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="481" tqparent_class="481" fileExt=".cpp" fileName="kistile" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;drawinghints.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="483" tag="hblock_tag_0" canDelete="false" classfield_id="483" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="483" tag="hblock_tag_1" canDelete="false" classfield_id="483" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="484" tag="hblock_tag_2" canDelete="false" classfield_id="484" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="484" tag="hblock_tag_3" canDelete="false" classfield_id="484" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="485" tag="hblock_tag_4" canDelete="false" classfield_id="485" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="485" tag="hblock_tag_5" canDelete="false" classfield_id="485" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="486" tag="hblock_tag_6" canDelete="false" classfield_id="486" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="486" tag="hblock_tag_7" canDelete="false" classfield_id="486" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="487" tag="hblock_tag_8" canDelete="false" classfield_id="487" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="487" tag="hblock_tag_9" canDelete="false" classfield_id="487" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="488" tag="hblock_tag_10" canDelete="false" classfield_id="488" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="488" tag="hblock_tag_11" canDelete="false" classfield_id="488" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="489" tag="hblock_tag_12" canDelete="false" classfield_id="489" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="489" tag="hblock_tag_13" canDelete="false" classfield_id="489" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="490" tag="hblock_tag_14" canDelete="false" classfield_id="490" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="490" tag="hblock_tag_15" canDelete="false" classfield_id="490" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="491" tag="hblock_tag_16" canDelete="false" classfield_id="491" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="491" tag="hblock_tag_17" canDelete="false" classfield_id="491" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="493" tag="hblock_tag_18" canDelete="false" classfield_id="493" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="493" tag="hblock_tag_19" canDelete="false" classfield_id="493" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="494" tag="hblock_tag_20" canDelete="false" classfield_id="494" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="494" tag="hblock_tag_21" canDelete="false" classfield_id="494" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="495" tag="hblock_tag_22" canDelete="false" classfield_id="495" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="495" tag="hblock_tag_23" canDelete="false" classfield_id="495" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="482" tag="hblock_tag_24" canDelete="false" classfield_id="482" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="482" tag="hblock_tag_25" canDelete="false" classfield_id="482" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="482" tag="hblock_tag_26" canDelete="false" writeOutText="false" classfield_id="482" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="482" tag="hblock_tag_27" canDelete="false" writeOutText="false" classfield_id="482" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="482" tag="hblock_tag_28" canDelete="false" writeOutText="false" classfield_id="482" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="492" tag="hblock_tag_29" canDelete="false" classfield_id="492" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="492" tag="hblock_tag_30" canDelete="false" classfield_id="492" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="492" tag="hblock_tag_31" canDelete="false" writeOutText="false" classfield_id="492" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="492" tag="hblock_tag_32" canDelete="false" writeOutText="false" classfield_id="492" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="492" tag="hblock_tag_33" canDelete="false" writeOutText="false" classfield_id="492" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="496" tag="operation_496" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="498" tag="operation_498" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="500" tag="operation_500" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="504" tag="operation_504" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="505" tag="operation_505" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="508" tag="operation_508" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="509" tag="operation_509" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="510" tag="operation_510" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="512" tag="operation_512" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="514" tag="operation_514" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="515" tag="operation_515" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="517" tag="operation_517" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="521" tag="operation_521" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="522" tag="operation_522" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="523" tag="operation_523" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="524" tag="operation_524" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="525" tag="operation_525" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="526" tag="operation_526" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="527" tag="operation_527" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="528" tag="operation_528" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="530" tag="operation_530" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="533" tag="operation_533" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="534" tag="operation_534" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="535" tag="operation_535" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="536" tag="operation_536" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="537" tag="operation_537" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="538" tag="operation_538" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="540" tag="operation_540" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="541" tag="operation_541" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="543" tag="operation_543" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="544" tag="operation_544" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="545" tag="operation_545" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistile.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:47:10&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="483" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="483" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="483" tag="hblock_tag_0" canDelete="false" classfield_id="483" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="483" tag="hblock_tag_1" canDelete="false" classfield_id="483" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="484" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="484" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="484" tag="hblock_tag_2" canDelete="false" classfield_id="484" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="484" tag="hblock_tag_3" canDelete="false" classfield_id="484" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="485" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="485" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="485" tag="hblock_tag_4" canDelete="false" classfield_id="485" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="485" tag="hblock_tag_5" canDelete="false" classfield_id="485" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="486" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="486" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="486" tag="hblock_tag_6" canDelete="false" classfield_id="486" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="486" tag="hblock_tag_7" canDelete="false" classfield_id="486" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="487" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="487" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="487" tag="hblock_tag_8" canDelete="false" classfield_id="487" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="487" tag="hblock_tag_9" canDelete="false" classfield_id="487" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="488" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="488" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="488" tag="hblock_tag_10" canDelete="false" classfield_id="488" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="488" tag="hblock_tag_11" canDelete="false" classfield_id="488" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="489" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="489" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="489" tag="hblock_tag_12" canDelete="false" classfield_id="489" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="489" tag="hblock_tag_13" canDelete="false" classfield_id="489" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="490" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="490" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="490" tag="hblock_tag_14" canDelete="false" classfield_id="490" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="490" tag="hblock_tag_15" canDelete="false" classfield_id="490" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="491" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="491" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="491" tag="hblock_tag_16" canDelete="false" classfield_id="491" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="491" tag="hblock_tag_17" canDelete="false" classfield_id="491" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="493" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="493" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="493" tag="hblock_tag_18" canDelete="false" classfield_id="493" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="493" tag="hblock_tag_19" canDelete="false" classfield_id="493" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="494" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="494" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="494" tag="hblock_tag_20" canDelete="false" classfield_id="494" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="494" tag="hblock_tag_21" canDelete="false" classfield_id="494" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="495" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="495" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="495" tag="hblock_tag_22" canDelete="false" classfield_id="495" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="495" tag="hblock_tag_23" canDelete="false" classfield_id="495" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="482" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="482" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="482" tag="hblock_tag_24" canDelete="false" classfield_id="482" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="482" tag="hblock_tag_25" canDelete="false" classfield_id="482" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="482" tag="hblock_tag_26" canDelete="false" writeOutText="false" classfield_id="482" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="482" tag="hblock_tag_27" canDelete="false" writeOutText="false" classfield_id="482" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="482" tag="hblock_tag_28" canDelete="false" writeOutText="false" classfield_id="482" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="492" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="492" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="492" tag="hblock_tag_29" canDelete="false" classfield_id="492" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="492" tag="hblock_tag_30" canDelete="false" classfield_id="492" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="492" tag="hblock_tag_31" canDelete="false" writeOutText="false" classfield_id="492" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="492" tag="hblock_tag_32" canDelete="false" writeOutText="false" classfield_id="492" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="492" tag="hblock_tag_33" canDelete="false" writeOutText="false" classfield_id="492" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="546" tqparent_class="546" fileExt=".cpp" fileName="drawinghints" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			drawinghints.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="560" tqparent_class="560" fileExt=".cpp" fileName="kismerge" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;kispaintdevicesp.h&quot;&amp;#010;#include &quot;kisselectionsp.h&quot;&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="561" tag="hblock_tag_0" canDelete="false" classfield_id="561" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="561" tag="hblock_tag_1" canDelete="false" classfield_id="561" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="562" tag="hblock_tag_2" canDelete="false" classfield_id="562" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="562" tag="hblock_tag_3" canDelete="false" classfield_id="562" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="563" tag="hblock_tag_4" canDelete="false" classfield_id="563" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="563" tag="hblock_tag_5" canDelete="false" classfield_id="563" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="564" tag="hblock_tag_6" canDelete="false" classfield_id="564" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="564" tag="hblock_tag_7" canDelete="false" classfield_id="564" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="565" tag="operation_565" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="568" tag="operation_568" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="571" tag="operation_571" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="574" tag="operation_574" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="577" tag="operation_577" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="580" tag="operation_580" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kismerge.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="561" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="561" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="561" tag="hblock_tag_0" canDelete="false" classfield_id="561" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="561" tag="hblock_tag_1" canDelete="false" classfield_id="561" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="562" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="562" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="562" tag="hblock_tag_2" canDelete="false" classfield_id="562" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="562" tag="hblock_tag_3" canDelete="false" classfield_id="562" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="563" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="563" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="563" tag="hblock_tag_4" canDelete="false" classfield_id="563" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="563" tag="hblock_tag_5" canDelete="false" classfield_id="563" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="564" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="564" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="564" tag="hblock_tag_6" canDelete="false" classfield_id="564" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="564" tag="hblock_tag_7" canDelete="false" classfield_id="564" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="583" tqparent_class="583" fileExt=".cpp" fileName="kisflatten" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;#include &quot;kispaintdevicesp.h&quot;&amp;#010;#include &quot;kisselectionsp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="584" tag="hblock_tag_0" canDelete="false" classfield_id="584" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="584" tag="hblock_tag_1" canDelete="false" classfield_id="584" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="585" tag="hblock_tag_2" canDelete="false" classfield_id="585" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="585" tag="hblock_tag_3" canDelete="false" classfield_id="585" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="586" tag="operation_586" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="588" tag="operation_588" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="593" tag="operation_593" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="596" tag="operation_596" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="599" tag="operation_599" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="603" tag="operation_603" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="606" tag="operation_606" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="609" tag="operation_609" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="612" tag="operation_612" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisflatten.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="584" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="584" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="584" tag="hblock_tag_0" canDelete="false" classfield_id="584" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="584" tag="hblock_tag_1" canDelete="false" classfield_id="584" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="585" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="585" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="585" tag="hblock_tag_2" canDelete="false" classfield_id="585" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="585" tag="hblock_tag_3" canDelete="false" classfield_id="585" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="613" tqparent_class="613" fileExt=".cpp" fileName="kisdociface" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;int.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="614" tag="hblock_tag_0" canDelete="false" classfield_id="614" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="614" tag="hblock_tag_1" canDelete="false" classfield_id="614" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="615" tag="operation_615" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="616" tag="operation_616" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="619" tag="operation_619" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="621" tag="operation_621" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="623" tag="operation_623" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisdociface.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:49:51&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="614" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="614" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="614" tag="hblock_tag_0" canDelete="false" classfield_id="614" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="614" tag="hblock_tag_1" canDelete="false" classfield_id="614" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="624" tqparent_class="624" fileExt=".cpp" fileName="kisalphatqmask" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;double.h&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="625" tag="hblock_tag_0" canDelete="false" classfield_id="625" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="625" tag="hblock_tag_1" canDelete="false" classfield_id="625" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="626" tag="hblock_tag_2" canDelete="false" classfield_id="626" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="626" tag="hblock_tag_3" canDelete="false" classfield_id="626" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="627" tag="hblock_tag_4" canDelete="false" classfield_id="627" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="627" tag="hblock_tag_5" canDelete="false" classfield_id="627" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="628" tag="hblock_tag_6" canDelete="false" classfield_id="628" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="628" tag="hblock_tag_7" canDelete="false" classfield_id="628" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="629" tag="operation_629" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Create an alpha tqmask based on the gray values of the&amp;#010;specified QImage. If the QImage is not grayscale, you're&amp;#010;buggered." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="631" tag="operation_631" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Create an alpha tqmask based on the gray values of the&amp;#010;specified QImage. If the QImage is not grayscale, you're&amp;#010;buggered. The QImage is scaled using QImage::smoothScale,&amp;#010;where the target w and h are computed by taking scale as a&amp;#010;percentage." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="634" tag="operation_634" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="@return the alpha value at the specified position.&amp;#010;Returns QUANTUM OPACITY_TRANSPARENT if the value is&amp;#010;outside the bounds of the tqmask.&amp;#010;XXX: this is, of course, not the best way of tqmasking.&amp;#010;Better would be to let KisAlphaMask fill a chunk of memory&amp;#010;with the alpha values at the right position, something like&amp;#010;void applyMask(QUANTUM *pixeldata, Q_INT32 pixelWidth,&amp;#010;Q_INT32 alphaPos). That would be fastest, or we could&amp;#010;provide an iterator over the tqmask, that would be nice, too." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="637" tag="operation_637" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="639" tag="operation_639" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="641" tag="operation_641" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="@return the number of alpha values in a scanline." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="642" tag="operation_642" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="@return the scale factor." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="643" tag="operation_643" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="@return the number of lines in the tqmask." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="644" tag="operation_644" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisalphatqmask.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:52:01&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="625" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="625" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="625" tag="hblock_tag_0" canDelete="false" classfield_id="625" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="625" tag="hblock_tag_1" canDelete="false" classfield_id="625" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="626" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="626" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="626" tag="hblock_tag_2" canDelete="false" classfield_id="626" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="626" tag="hblock_tag_3" canDelete="false" classfield_id="626" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="627" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="627" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="627" tag="hblock_tag_4" canDelete="false" classfield_id="627" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="627" tag="hblock_tag_5" canDelete="false" classfield_id="627" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="628" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="628" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="628" tag="hblock_tag_6" canDelete="false" classfield_id="628" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="628" tag="hblock_tag_7" canDelete="false" classfield_id="628" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="645" tqparent_class="645" fileExt=".cpp" fileName="krayonviewiface" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="646" tag="hblock_tag_0" canDelete="false" classfield_id="646" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="646" tag="hblock_tag_1" canDelete="false" classfield_id="646" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="647" tag="operation_647" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="649" tag="operation_649" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="650" tag="operation_650" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="651" tag="operation_651" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="652" tag="operation_652" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="653" tag="operation_653" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="654" tag="operation_654" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="655" tag="operation_655" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="656" tag="operation_656" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="657" tag="operation_657" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="658" tag="operation_658" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="659" tag="operation_659" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="660" tag="operation_660" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="661" tag="operation_661" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="662" tag="operation_662" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="663" tag="operation_663" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="664" tag="operation_664" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="665" tag="operation_665" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="666" tag="operation_666" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="667" tag="operation_667" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="668" tag="operation_668" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="669" tag="operation_669" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			krayonviewiface.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="646" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="646" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="646" tag="hblock_tag_0" canDelete="false" classfield_id="646" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="646" tag="hblock_tag_1" canDelete="false" classfield_id="646" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="670" tqparent_class="670" fileExt=".cpp" fileName="kisimageiface" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;int.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="671" tag="hblock_tag_0" canDelete="false" classfield_id="671" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="671" tag="hblock_tag_1" canDelete="false" classfield_id="671" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="672" tag="operation_672" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="674" tag="operation_674" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="675" tag="operation_675" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="676" tag="operation_676" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="677" tag="operation_677" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="678" tag="operation_678" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="680" tag="operation_680" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisimageiface.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:49:42&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="671" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="671" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="671" tag="hblock_tag_0" canDelete="false" classfield_id="671" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="671" tag="hblock_tag_1" canDelete="false" classfield_id="671" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="681" tqparent_class="681" fileExt=".cpp" fileName="kisbrush" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kisresource.h&quot;&amp;#010;#include &quot;enumbrushtype.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="682" tag="hblock_tag_0" canDelete="false" classfield_id="682" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="682" tag="hblock_tag_1" canDelete="false" classfield_id="682" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="683" tag="hblock_tag_2" canDelete="false" classfield_id="683" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="683" tag="hblock_tag_3" canDelete="false" classfield_id="683" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="684" tag="hblock_tag_4" canDelete="false" classfield_id="684" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="684" tag="hblock_tag_5" canDelete="false" classfield_id="684" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="685" tag="hblock_tag_6" canDelete="false" classfield_id="685" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="685" tag="hblock_tag_7" canDelete="false" classfield_id="685" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="686" tag="hblock_tag_8" canDelete="false" classfield_id="686" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="686" tag="hblock_tag_9" canDelete="false" classfield_id="686" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="687" tag="hblock_tag_10" canDelete="false" classfield_id="687" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="687" tag="hblock_tag_11" canDelete="false" classfield_id="687" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="688" tag="hblock_tag_12" canDelete="false" classfield_id="688" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="688" tag="hblock_tag_13" canDelete="false" classfield_id="688" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="689" tag="hblock_tag_14" canDelete="false" classfield_id="689" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="689" tag="hblock_tag_15" canDelete="false" classfield_id="689" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="690" tag="hblock_tag_16" canDelete="false" classfield_id="690" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="690" tag="hblock_tag_17" canDelete="false" classfield_id="690" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="691" tag="hblock_tag_18" canDelete="false" classfield_id="691" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="691" tag="hblock_tag_19" canDelete="false" classfield_id="691" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="692" tag="hblock_tag_20" canDelete="false" classfield_id="692" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="692" tag="hblock_tag_21" canDelete="false" classfield_id="692" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1769" tag="hblock_tag_22" canDelete="false" writeOutText="false" classfield_id="1769" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1769" tag="hblock_tag_23" canDelete="false" writeOutText="false" classfield_id="1769" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1769" tag="hblock_tag_24" canDelete="false" writeOutText="false" classfield_id="1769" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1769" tag="hblock_tag_25" canDelete="false" writeOutText="false" classfield_id="1769" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1769" tag="hblock_tag_26" canDelete="false" writeOutText="false" classfield_id="1769" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2368" tag="hblock_tag_27" canDelete="false" writeOutText="false" classfield_id="2368" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2368" tag="hblock_tag_28" canDelete="false" writeOutText="false" classfield_id="2368" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2368" tag="hblock_tag_29" canDelete="false" writeOutText="false" classfield_id="2368" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2368" tag="hblock_tag_30" canDelete="false" writeOutText="false" classfield_id="2368" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2368" tag="hblock_tag_31" canDelete="false" writeOutText="false" classfield_id="2368" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="693" tag="operation_693" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="695" tag="operation_695" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="699" tag="operation_699" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="700" tag="operation_700" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="702" tag="operation_702" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="703" tag="operation_703" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="704" tag="operation_704" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="705" tag="operation_705" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="@return a tqmask computed from the grey-level values of the&amp;#010;pixels in the brush." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="707" tag="operation_707" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="708" tag="operation_708" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="710" tag="operation_710" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisbrush.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="682" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="682" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="682" tag="hblock_tag_0" canDelete="false" classfield_id="682" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="682" tag="hblock_tag_1" canDelete="false" classfield_id="682" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="683" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="683" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="683" tag="hblock_tag_2" canDelete="false" classfield_id="683" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="683" tag="hblock_tag_3" canDelete="false" classfield_id="683" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="684" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="684" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="684" tag="hblock_tag_4" canDelete="false" classfield_id="684" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="684" tag="hblock_tag_5" canDelete="false" classfield_id="684" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="685" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="685" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="685" tag="hblock_tag_6" canDelete="false" classfield_id="685" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="685" tag="hblock_tag_7" canDelete="false" classfield_id="685" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="686" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="686" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="686" tag="hblock_tag_8" canDelete="false" classfield_id="686" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="686" tag="hblock_tag_9" canDelete="false" classfield_id="686" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="687" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="687" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="687" tag="hblock_tag_10" canDelete="false" classfield_id="687" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="687" tag="hblock_tag_11" canDelete="false" classfield_id="687" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="688" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="688" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="688" tag="hblock_tag_12" canDelete="false" classfield_id="688" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="688" tag="hblock_tag_13" canDelete="false" classfield_id="688" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="689" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="689" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="689" tag="hblock_tag_14" canDelete="false" classfield_id="689" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="689" tag="hblock_tag_15" canDelete="false" classfield_id="689" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="690" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="690" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="690" tag="hblock_tag_16" canDelete="false" classfield_id="690" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="690" tag="hblock_tag_17" canDelete="false" classfield_id="690" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="691" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="691" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="691" tag="hblock_tag_18" canDelete="false" classfield_id="691" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="691" tag="hblock_tag_19" canDelete="false" classfield_id="691" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="692" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="692" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="692" tag="hblock_tag_20" canDelete="false" classfield_id="692" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="692" tag="hblock_tag_21" canDelete="false" classfield_id="692" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1769" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1769" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1769" tag="hblock_tag_22" canDelete="false" writeOutText="false" classfield_id="1769" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1769" tag="hblock_tag_23" canDelete="false" writeOutText="false" classfield_id="1769" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1769" tag="hblock_tag_24" canDelete="false" writeOutText="false" classfield_id="1769" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1769" tag="hblock_tag_25" canDelete="false" writeOutText="false" classfield_id="1769" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1769" tag="hblock_tag_26" canDelete="false" writeOutText="false" classfield_id="1769" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2368" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2368" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2368" tag="hblock_tag_27" canDelete="false" writeOutText="false" classfield_id="2368" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2368" tag="hblock_tag_28" canDelete="false" writeOutText="false" classfield_id="2368" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2368" tag="hblock_tag_29" canDelete="false" writeOutText="false" classfield_id="2368" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2368" tag="hblock_tag_30" canDelete="false" writeOutText="false" classfield_id="2368" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2368" tag="hblock_tag_31" canDelete="false" writeOutText="false" classfield_id="2368" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="711" tqparent_class="711" fileExt=".cpp" fileName="kisbackground" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="712" tag="operation_712" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="716" tag="operation_716" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="719" tag="operation_719" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisbackground.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="720" tqparent_class="720" fileExt=".cpp" fileName="enumbrushtype" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1742" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="1742" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1742" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="1742" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1742" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="1742" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1742" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="1742" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1742" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="1742" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			enumbrushtype.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1742" field_type="4" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1742" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1742" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="1742" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1742" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="1742" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1742" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="1742" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1742" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="1742" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1742" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="1742" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="727" tqparent_class="727" fileExt=".cpp" fileName="kiscommand" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="728" tag="hblock_tag_0" canDelete="false" classfield_id="728" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="728" tag="hblock_tag_1" canDelete="false" classfield_id="728" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="729" tag="hblock_tag_2" canDelete="false" classfield_id="729" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="729" tag="hblock_tag_3" canDelete="false" classfield_id="729" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="730" tag="operation_730" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="732" tag="operation_732" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="735" tag="operation_735" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="736" tag="operation_736" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="737" tag="operation_737" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="738" tag="operation_738" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="739" tag="operation_739" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kiscommand.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="728" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="728" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="728" tag="hblock_tag_0" canDelete="false" classfield_id="728" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="728" tag="hblock_tag_1" canDelete="false" classfield_id="728" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="729" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="729" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="729" tag="hblock_tag_2" canDelete="false" classfield_id="729" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="729" tag="hblock_tag_3" canDelete="false" classfield_id="729" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="740" tqparent_class="740" fileExt=".cpp" fileName="kisguide" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;double.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="741" tag="hblock_tag_0" canDelete="false" classfield_id="741" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="741" tag="hblock_tag_1" canDelete="false" classfield_id="741" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="742" tag="hblock_tag_2" canDelete="false" classfield_id="742" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="742" tag="hblock_tag_3" canDelete="false" classfield_id="742" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="743" tag="hblock_tag_4" canDelete="false" classfield_id="743" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="743" tag="hblock_tag_5" canDelete="false" classfield_id="743" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="744" tag="hblock_tag_6" canDelete="false" classfield_id="744" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="744" tag="hblock_tag_7" canDelete="false" classfield_id="744" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="745" tag="operation_745" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="747" tag="operation_747" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="748" tag="operation_748" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="749" tag="operation_749" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisguide.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="741" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="741" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="741" tag="hblock_tag_0" canDelete="false" classfield_id="741" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="741" tag="hblock_tag_1" canDelete="false" classfield_id="741" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="742" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="742" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="742" tag="hblock_tag_2" canDelete="false" classfield_id="742" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="742" tag="hblock_tag_3" canDelete="false" classfield_id="742" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="743" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="743" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="743" tag="hblock_tag_4" canDelete="false" classfield_id="743" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="743" tag="hblock_tag_5" canDelete="false" classfield_id="743" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="744" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="744" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="744" tag="hblock_tag_6" canDelete="false" classfield_id="744" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="744" tag="hblock_tag_7" canDelete="false" classfield_id="744" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="750" tqparent_class="750" fileExt=".cpp" fileName="kiscanvascontrollerinterface" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="751" tag="operation_751" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="753" tag="operation_753" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="754" tag="operation_754" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="756" tag="operation_756" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="757" tag="operation_757" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="758" tag="operation_758" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="759" tag="operation_759" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="764" tag="operation_764" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="766" tag="operation_766" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="767" tag="operation_767" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="770" tag="operation_770" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="772" tag="operation_772" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="774" tag="operation_774" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="777" tag="operation_777" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="779" tag="operation_779" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="781" tag="operation_781" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="782" tag="operation_782" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="785" tag="operation_785" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="786" tag="operation_786" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="789" tag="operation_789" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kiscanvascontrollerinterface.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:49:33&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="790" tqparent_class="790" fileExt=".cpp" fileName="kisguidemgr" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kisguidesp.h&quot;&amp;#010;#include &quot;double.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;vkisguidesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="791" tag="hblock_tag_0" canDelete="false" classfield_id="791" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="791" tag="hblock_tag_1" canDelete="false" classfield_id="791" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="792" tag="hblock_tag_2" canDelete="false" classfield_id="792" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="792" tag="hblock_tag_3" canDelete="false" classfield_id="792" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="793" tag="hblock_tag_4" canDelete="false" classfield_id="793" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="793" tag="hblock_tag_5" canDelete="false" classfield_id="793" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="794" tag="hblock_tag_6" canDelete="false" classfield_id="794" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="794" tag="hblock_tag_7" canDelete="false" classfield_id="794" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="795" tag="hblock_tag_8" canDelete="false" classfield_id="795" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="795" tag="hblock_tag_9" canDelete="false" classfield_id="795" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="796" tag="hblock_tag_10" canDelete="false" classfield_id="796" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="796" tag="hblock_tag_11" canDelete="false" classfield_id="796" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="797" tag="hblock_tag_12" canDelete="false" classfield_id="797" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="797" tag="hblock_tag_13" canDelete="false" classfield_id="797" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="798" tag="hblock_tag_14" canDelete="false" classfield_id="798" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="798" tag="hblock_tag_15" canDelete="false" classfield_id="798" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="799" tag="hblock_tag_16" canDelete="false" classfield_id="799" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="799" tag="hblock_tag_17" canDelete="false" classfield_id="799" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="800" tag="hblock_tag_18" canDelete="false" classfield_id="800" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="800" tag="hblock_tag_19" canDelete="false" classfield_id="800" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="801" tag="hblock_tag_20" canDelete="false" classfield_id="801" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="801" tag="hblock_tag_21" canDelete="false" classfield_id="801" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1270" tag="hblock_tag_22" canDelete="false" writeOutText="false" classfield_id="1270" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1270" tag="hblock_tag_23" canDelete="false" writeOutText="false" classfield_id="1270" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1270" tag="hblock_tag_24" canDelete="false" writeOutText="false" classfield_id="1270" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1270" tag="hblock_tag_25" canDelete="false" writeOutText="false" classfield_id="1270" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1270" tag="hblock_tag_26" canDelete="false" writeOutText="false" classfield_id="1270" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="802" tag="operation_802" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="803" tag="operation_803" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="806" tag="operation_806" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="812" tag="operation_812" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="816" tag="operation_816" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="819" tag="operation_819" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="822" tag="operation_822" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="823" tag="operation_823" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="825" tag="operation_825" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="827" tag="operation_827" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="829" tag="operation_829" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="835" tag="operation_835" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="837" tag="operation_837" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="838" tag="operation_838" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="839" tag="operation_839" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="841" tag="operation_841" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="846" tag="operation_846" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="848" tag="operation_848" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="850" tag="operation_850" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="851" tag="operation_851" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="852" tag="operation_852" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="854" tag="operation_854" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="855" tag="operation_855" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisguidemgr.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="791" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="791" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="791" tag="hblock_tag_0" canDelete="false" classfield_id="791" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="791" tag="hblock_tag_1" canDelete="false" classfield_id="791" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="792" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="792" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="792" tag="hblock_tag_2" canDelete="false" classfield_id="792" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="792" tag="hblock_tag_3" canDelete="false" classfield_id="792" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="793" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="793" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="793" tag="hblock_tag_4" canDelete="false" classfield_id="793" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="793" tag="hblock_tag_5" canDelete="false" classfield_id="793" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="794" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="794" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="794" tag="hblock_tag_6" canDelete="false" classfield_id="794" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="794" tag="hblock_tag_7" canDelete="false" classfield_id="794" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="795" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="795" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="795" tag="hblock_tag_8" canDelete="false" classfield_id="795" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="795" tag="hblock_tag_9" canDelete="false" classfield_id="795" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="796" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="796" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="796" tag="hblock_tag_10" canDelete="false" classfield_id="796" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="796" tag="hblock_tag_11" canDelete="false" classfield_id="796" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="797" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="797" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="797" tag="hblock_tag_12" canDelete="false" classfield_id="797" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="797" tag="hblock_tag_13" canDelete="false" classfield_id="797" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="798" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="798" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="798" tag="hblock_tag_14" canDelete="false" classfield_id="798" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="798" tag="hblock_tag_15" canDelete="false" classfield_id="798" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="799" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="799" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="799" tag="hblock_tag_16" canDelete="false" classfield_id="799" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="799" tag="hblock_tag_17" canDelete="false" classfield_id="799" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="800" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="800" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="800" tag="hblock_tag_18" canDelete="false" classfield_id="800" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="800" tag="hblock_tag_19" canDelete="false" classfield_id="800" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="801" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="801" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="801" tag="hblock_tag_20" canDelete="false" classfield_id="801" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="801" tag="hblock_tag_21" canDelete="false" classfield_id="801" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1270" field_type="4" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1270" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1270" tag="hblock_tag_22" canDelete="false" writeOutText="false" classfield_id="1270" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1270" tag="hblock_tag_23" canDelete="false" writeOutText="false" classfield_id="1270" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1270" tag="hblock_tag_24" canDelete="false" writeOutText="false" classfield_id="1270" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1270" tag="hblock_tag_25" canDelete="false" writeOutText="false" classfield_id="1270" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1270" tag="hblock_tag_26" canDelete="false" writeOutText="false" classfield_id="1270" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="856" tqparent_class="856" fileExt=".cpp" fileName="kisgradient" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;int.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="857" tag="hblock_tag_0" canDelete="false" classfield_id="857" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="857" tag="hblock_tag_1" canDelete="false" classfield_id="857" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="858" tag="hblock_tag_2" canDelete="false" classfield_id="858" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="858" tag="hblock_tag_3" canDelete="false" classfield_id="858" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="859" tag="hblock_tag_4" canDelete="false" classfield_id="859" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="859" tag="hblock_tag_5" canDelete="false" classfield_id="859" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="860" tag="hblock_tag_6" canDelete="false" classfield_id="860" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="860" tag="hblock_tag_7" canDelete="false" classfield_id="860" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1776" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="1776" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1776" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="1776" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1776" tag="hblock_tag_10" canDelete="false" writeOutText="false" classfield_id="1776" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1776" tag="hblock_tag_11" canDelete="false" writeOutText="false" classfield_id="1776" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1776" tag="hblock_tag_12" canDelete="false" writeOutText="false" classfield_id="1776" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2385" tag="hblock_tag_13" canDelete="false" writeOutText="false" classfield_id="2385" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2385" tag="hblock_tag_14" canDelete="false" writeOutText="false" classfield_id="2385" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2385" tag="hblock_tag_15" canDelete="false" writeOutText="false" classfield_id="2385" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2385" tag="hblock_tag_16" canDelete="false" writeOutText="false" classfield_id="2385" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2385" tag="hblock_tag_17" canDelete="false" writeOutText="false" classfield_id="2385" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="861" tag="operation_861" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="862" tag="operation_862" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="865" tag="operation_865" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="869" tag="operation_869" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="875" tag="operation_875" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="876" tag="operation_876" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="879" tag="operation_879" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="883" tag="operation_883" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="887" tag="operation_887" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="891" tag="operation_891" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="897" tag="operation_897" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="899" tag="operation_899" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="900" tag="operation_900" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="901" tag="operation_901" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisgradient.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="857" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="857" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="857" tag="hblock_tag_0" canDelete="false" classfield_id="857" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="857" tag="hblock_tag_1" canDelete="false" classfield_id="857" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="858" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="858" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="858" tag="hblock_tag_2" canDelete="false" classfield_id="858" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="858" tag="hblock_tag_3" canDelete="false" classfield_id="858" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="859" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="859" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="859" tag="hblock_tag_4" canDelete="false" classfield_id="859" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="859" tag="hblock_tag_5" canDelete="false" classfield_id="859" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="860" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="860" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="860" tag="hblock_tag_6" canDelete="false" classfield_id="860" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="860" tag="hblock_tag_7" canDelete="false" classfield_id="860" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1776" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1776" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1776" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="1776" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1776" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="1776" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1776" tag="hblock_tag_10" canDelete="false" writeOutText="false" classfield_id="1776" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1776" tag="hblock_tag_11" canDelete="false" writeOutText="false" classfield_id="1776" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1776" tag="hblock_tag_12" canDelete="false" writeOutText="false" classfield_id="1776" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2385" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2385" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2385" tag="hblock_tag_13" canDelete="false" writeOutText="false" classfield_id="2385" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2385" tag="hblock_tag_14" canDelete="false" writeOutText="false" classfield_id="2385" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2385" tag="hblock_tag_15" canDelete="false" writeOutText="false" classfield_id="2385" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2385" tag="hblock_tag_16" canDelete="false" writeOutText="false" classfield_id="2385" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2385" tag="hblock_tag_17" canDelete="false" writeOutText="false" classfield_id="2385" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="902" tqparent_class="902" fileExt=".cpp" fileName="kisdoc" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;kisselectionsp.h&quot;&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;#include &quot;compositeop.h&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;enumimgtype.h&quot;&amp;#010;#include &quot;kischannelsp.h&quot;&amp;#010;#include &quot;double.h&quot;&amp;#010;#include &quot;kisstrategycolorspacemap.h&quot;&amp;#010;#include &quot;vkisimagesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="903" tag="hblock_tag_0" canDelete="false" classfield_id="903" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="903" tag="hblock_tag_1" canDelete="false" classfield_id="903" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="904" tag="hblock_tag_2" canDelete="false" classfield_id="904" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="904" tag="hblock_tag_3" canDelete="false" classfield_id="904" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="905" tag="hblock_tag_4" canDelete="false" classfield_id="905" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="905" tag="hblock_tag_5" canDelete="false" classfield_id="905" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="906" tag="hblock_tag_6" canDelete="false" classfield_id="906" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="906" tag="hblock_tag_7" canDelete="false" classfield_id="906" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="907" tag="hblock_tag_8" canDelete="false" classfield_id="907" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="907" tag="hblock_tag_9" canDelete="false" classfield_id="907" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="908" tag="hblock_tag_10" canDelete="false" classfield_id="908" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="908" tag="hblock_tag_11" canDelete="false" classfield_id="908" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="909" tag="hblock_tag_12" canDelete="false" classfield_id="909" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="909" tag="hblock_tag_13" canDelete="false" classfield_id="909" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="910" tag="hblock_tag_14" canDelete="false" classfield_id="910" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="910" tag="hblock_tag_15" canDelete="false" classfield_id="910" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="911" tag="hblock_tag_16" canDelete="false" classfield_id="911" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="911" tag="hblock_tag_17" canDelete="false" classfield_id="911" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="912" tag="hblock_tag_18" canDelete="false" classfield_id="912" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="912" tag="hblock_tag_19" canDelete="false" classfield_id="912" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="913" tag="hblock_tag_20" canDelete="false" classfield_id="913" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="913" tag="hblock_tag_21" canDelete="false" classfield_id="913" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2382" tag="hblock_tag_22" canDelete="false" writeOutText="false" classfield_id="2382" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2382" tag="hblock_tag_23" canDelete="false" writeOutText="false" classfield_id="2382" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2382" tag="hblock_tag_24" canDelete="false" writeOutText="false" classfield_id="2382" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2382" tag="hblock_tag_25" canDelete="false" writeOutText="false" classfield_id="2382" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2382" tag="hblock_tag_26" canDelete="false" writeOutText="false" classfield_id="2382" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="914" tag="operation_914" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="920" tag="operation_920" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="922" tag="operation_922" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="924" tag="operation_924" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="926" tag="operation_926" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="927" tag="operation_927" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="929" tag="operation_929" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="931" tag="operation_931" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="933" tag="operation_933" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="936" tag="operation_936" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="937" tag="operation_937" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="938" tag="operation_938" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="939" tag="operation_939" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="941" tag="operation_941" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="943" tag="operation_943" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="945" tag="operation_945" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="946" tag="operation_946" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="948" tag="operation_948" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="949" tag="operation_949" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="950" tag="operation_950" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="951" tag="operation_951" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="952" tag="operation_952" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="956" tag="operation_956" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="965" tag="operation_965" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="971" tag="operation_971" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="975" tag="operation_975" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="978" tag="operation_978" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="981" tag="operation_981" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="984" tag="operation_984" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="987" tag="operation_987" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="990" tag="operation_990" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="993" tag="operation_993" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="995" tag="operation_995" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="998" tag="operation_998" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1001" tag="operation_1001" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1004" tag="operation_1004" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1005" tag="operation_1005" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1007" tag="operation_1007" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1012" tag="operation_1012" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1013" tag="operation_1013" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1014" tag="operation_1014" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1020" tag="operation_1020" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1021" tag="operation_1021" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1023" tag="operation_1023" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1025" tag="operation_1025" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1028" tag="operation_1028" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1031" tag="operation_1031" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1034" tag="operation_1034" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1037" tag="operation_1037" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1038" tag="operation_1038" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1040" tag="operation_1040" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1046" tag="operation_1046" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1048" tag="operation_1048" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1050" tag="operation_1050" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1052" tag="operation_1052" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1054" tag="operation_1054" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1055" tag="operation_1055" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1056" tag="operation_1056" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1057" tag="operation_1057" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisdoc.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="903" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="903" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="903" tag="hblock_tag_0" canDelete="false" classfield_id="903" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="903" tag="hblock_tag_1" canDelete="false" classfield_id="903" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="904" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="904" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="904" tag="hblock_tag_2" canDelete="false" classfield_id="904" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="904" tag="hblock_tag_3" canDelete="false" classfield_id="904" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="905" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="905" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="905" tag="hblock_tag_4" canDelete="false" classfield_id="905" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="905" tag="hblock_tag_5" canDelete="false" classfield_id="905" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="906" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="906" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="906" tag="hblock_tag_6" canDelete="false" classfield_id="906" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="906" tag="hblock_tag_7" canDelete="false" classfield_id="906" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="907" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="907" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="907" tag="hblock_tag_8" canDelete="false" classfield_id="907" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="907" tag="hblock_tag_9" canDelete="false" classfield_id="907" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="908" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="908" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="908" tag="hblock_tag_10" canDelete="false" classfield_id="908" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="908" tag="hblock_tag_11" canDelete="false" classfield_id="908" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="909" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="909" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="909" tag="hblock_tag_12" canDelete="false" classfield_id="909" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="909" tag="hblock_tag_13" canDelete="false" classfield_id="909" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="910" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="910" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="910" tag="hblock_tag_14" canDelete="false" classfield_id="910" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="910" tag="hblock_tag_15" canDelete="false" classfield_id="910" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="911" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="911" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="911" tag="hblock_tag_16" canDelete="false" classfield_id="911" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="911" tag="hblock_tag_17" canDelete="false" classfield_id="911" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="912" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="912" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="912" tag="hblock_tag_18" canDelete="false" classfield_id="912" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="912" tag="hblock_tag_19" canDelete="false" classfield_id="912" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="913" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="913" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="913" tag="hblock_tag_20" canDelete="false" classfield_id="913" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="913" tag="hblock_tag_21" canDelete="false" classfield_id="913" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2382" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2382" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2382" tag="hblock_tag_22" canDelete="false" writeOutText="false" classfield_id="2382" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2382" tag="hblock_tag_23" canDelete="false" writeOutText="false" classfield_id="2382" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2382" tag="hblock_tag_24" canDelete="false" writeOutText="false" classfield_id="2382" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2382" tag="hblock_tag_25" canDelete="false" writeOutText="false" classfield_id="2382" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2382" tag="hblock_tag_26" canDelete="false" writeOutText="false" classfield_id="2382" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1058" tqparent_class="1058" fileExt=".cpp" fileName="kiscursor" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="1059" tag="operation_1059" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1060" tag="operation_1060" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1061" tag="operation_1061" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1062" tag="operation_1062" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1063" tag="operation_1063" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1064" tag="operation_1064" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1065" tag="operation_1065" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1066" tag="operation_1066" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1067" tag="operation_1067" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1068" tag="operation_1068" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1069" tag="operation_1069" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1070" tag="operation_1070" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1071" tag="operation_1071" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1072" tag="operation_1072" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1073" tag="operation_1073" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1074" tag="operation_1074" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1075" tag="operation_1075" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1076" tag="operation_1076" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1077" tag="operation_1077" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1078" tag="operation_1078" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1079" tag="operation_1079" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1080" tag="operation_1080" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1081" tag="operation_1081" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1082" tag="operation_1082" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1083" tag="operation_1083" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1084" tag="operation_1084" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kiscursor.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1085" tqparent_class="1085" fileExt=".cpp" fileName="kisconfig" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1086" tag="hblock_tag_0" canDelete="false" classfield_id="1086" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1086" tag="hblock_tag_1" canDelete="false" classfield_id="1086" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1087" tag="operation_1087" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1089" tag="operation_1089" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1090" tag="operation_1090" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1092" tag="operation_1092" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1093" tag="operation_1093" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1094" tag="operation_1094" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1095" tag="operation_1095" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1096" tag="operation_1096" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1097" tag="operation_1097" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1098" tag="operation_1098" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1099" tag="operation_1099" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1100" tag="operation_1100" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisconfig.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1086" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1086" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1086" tag="hblock_tag_0" canDelete="false" classfield_id="1086" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1086" tag="hblock_tag_1" canDelete="false" classfield_id="1086" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1101" tqparent_class="1101" fileExt=".cpp" fileName="kiscanvasobserver" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="1102" tag="operation_1102" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1104" tag="operation_1104" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1105" tag="operation_1105" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1107" tag="operation_1107" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1109" tag="operation_1109" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kiscanvasobserver.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1110" tqparent_class="1110" fileExt=".cpp" fileName="kisfactory" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1111" tag="hblock_tag_0" canDelete="false" classfield_id="1111" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1111" tag="hblock_tag_1" canDelete="false" classfield_id="1111" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1112" tag="hblock_tag_2" canDelete="false" classfield_id="1112" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1112" tag="hblock_tag_3" canDelete="false" classfield_id="1112" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1113" tag="hblock_tag_4" canDelete="false" classfield_id="1113" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1113" tag="hblock_tag_5" canDelete="false" classfield_id="1113" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1114" tag="hblock_tag_6" canDelete="false" classfield_id="1114" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1114" tag="hblock_tag_7" canDelete="false" classfield_id="1114" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1115" tag="operation_1115" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1118" tag="operation_1118" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1119" tag="operation_1119" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1126" tag="operation_1126" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1127" tag="operation_1127" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1128" tag="operation_1128" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1129" tag="operation_1129" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisfactory.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1111" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1111" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1111" tag="hblock_tag_0" canDelete="false" classfield_id="1111" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1111" tag="hblock_tag_1" canDelete="false" classfield_id="1111" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1112" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1112" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1112" tag="hblock_tag_2" canDelete="false" classfield_id="1112" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1112" tag="hblock_tag_3" canDelete="false" classfield_id="1112" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1113" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1113" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1113" tag="hblock_tag_4" canDelete="false" classfield_id="1113" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1113" tag="hblock_tag_5" canDelete="false" classfield_id="1113" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1114" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1114" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1114" tag="hblock_tag_6" canDelete="false" classfield_id="1114" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1114" tag="hblock_tag_7" canDelete="false" classfield_id="1114" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1130" tqparent_class="1130" fileExt=".cpp" fileName="kischannel" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;kischannelsp.h&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="1131" tag="operation_1131" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1137" tag="operation_1137" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1139" tag="operation_1139" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1142" tag="operation_1142" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1144" tag="operation_1144" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1145" tag="operation_1145" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1146" tag="operation_1146" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1148" tag="operation_1148" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1151" tag="operation_1151" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1152" tag="operation_1152" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1153" tag="operation_1153" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1156" tag="operation_1156" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1157" tag="operation_1157" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1158" tag="operation_1158" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1160" tag="operation_1160" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1163" tag="operation_1163" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1166" tag="operation_1166" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1169" tag="operation_1169" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kischannel.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1170" tqparent_class="1170" fileExt=".cpp" fileName="kiscanvassubject" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="1171" tag="operation_1171" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1173" tag="operation_1173" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1174" tag="operation_1174" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1176" tag="operation_1176" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1178" tag="operation_1178" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1179" tag="operation_1179" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1180" tag="operation_1180" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1181" tag="operation_1181" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1182" tag="operation_1182" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1183" tag="operation_1183" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1184" tag="operation_1184" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1185" tag="operation_1185" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1187" tag="operation_1187" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1188" tag="operation_1188" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1189" tag="operation_1189" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1190" tag="operation_1190" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1192" tag="operation_1192" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1194" tag="operation_1194" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1195" tag="operation_1195" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1196" tag="operation_1196" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1197" tag="operation_1197" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kiscanvassubject.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1198" tqparent_class="1198" fileExt=".cpp" fileName="compositeop" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1455" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="1455" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1455" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="1455" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1455" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="1455" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1455" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="1455" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1455" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="1455" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			compositeop.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1455" field_type="4" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1455" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1455" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="1455" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1455" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="1455" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1455" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="1455" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1455" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="1455" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1455" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="1455" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1237" tqparent_class="1237" fileExt=".cpp" fileName="enumimgtype" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1285" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="1285" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1285" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="1285" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1285" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="1285" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1285" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="1285" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1285" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="1285" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1458" tag="hblock_tag_5" canDelete="false" writeOutText="false" classfield_id="1458" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1458" tag="hblock_tag_6" canDelete="false" writeOutText="false" classfield_id="1458" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1458" tag="hblock_tag_7" canDelete="false" writeOutText="false" classfield_id="1458" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1458" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="1458" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1458" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="1458" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			enumimgtype.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1285" field_type="4" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1285" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1285" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="1285" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1285" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="1285" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1285" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="1285" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1285" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="1285" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1285" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="1285" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1458" field_type="4" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1458" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1458" tag="hblock_tag_5" canDelete="false" writeOutText="false" classfield_id="1458" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1458" tag="hblock_tag_6" canDelete="false" writeOutText="false" classfield_id="1458" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1458" tag="hblock_tag_7" canDelete="false" writeOutText="false" classfield_id="1458" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1458" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="1458" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1458" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="1458" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1259" tqparent_class="1259" fileExt=".cpp" fileName="kisimage" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kischannelsp.h&quot;&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;channeltype.h&quot;&amp;#010;#include &quot;kispaintdevicesp.h&quot;&amp;#010;#include &quot;enumimgtype.h&quot;&amp;#010;#include &quot;pixeltype.h&quot;&amp;#010;#include &quot;double.h&quot;&amp;#010;#include &quot;kisselectionsp.h&quot;&amp;#010;#include &quot;kistilemgrsp.h&quot;&amp;#010;#include &quot;kisbackgroundsp.h&quot;&amp;#010;#include &quot;vkischannelsp.h&quot;&amp;#010;#include &quot;kocolormap.h&quot;&amp;#010;#include &quot;vkislayersp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1260" tag="hblock_tag_0" canDelete="false" classfield_id="1260" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1260" tag="hblock_tag_1" canDelete="false" classfield_id="1260" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1261" tag="hblock_tag_2" canDelete="false" classfield_id="1261" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1261" tag="hblock_tag_3" canDelete="false" classfield_id="1261" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1262" tag="hblock_tag_4" canDelete="false" classfield_id="1262" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1262" tag="hblock_tag_5" canDelete="false" classfield_id="1262" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1263" tag="hblock_tag_6" canDelete="false" classfield_id="1263" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1263" tag="hblock_tag_7" canDelete="false" classfield_id="1263" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1264" tag="hblock_tag_8" canDelete="false" classfield_id="1264" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1264" tag="hblock_tag_9" canDelete="false" classfield_id="1264" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1265" tag="hblock_tag_10" canDelete="false" classfield_id="1265" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1265" tag="hblock_tag_11" canDelete="false" classfield_id="1265" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1266" tag="hblock_tag_12" canDelete="false" classfield_id="1266" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1266" tag="hblock_tag_13" canDelete="false" classfield_id="1266" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1267" tag="hblock_tag_14" canDelete="false" classfield_id="1267" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1267" tag="hblock_tag_15" canDelete="false" classfield_id="1267" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1268" tag="hblock_tag_16" canDelete="false" classfield_id="1268" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1268" tag="hblock_tag_17" canDelete="false" classfield_id="1268" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1269" tag="hblock_tag_18" canDelete="false" classfield_id="1269" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1269" tag="hblock_tag_19" canDelete="false" classfield_id="1269" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1271" tag="hblock_tag_20" canDelete="false" classfield_id="1271" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1271" tag="hblock_tag_21" canDelete="false" classfield_id="1271" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1272" tag="hblock_tag_22" canDelete="false" classfield_id="1272" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1272" tag="hblock_tag_23" canDelete="false" classfield_id="1272" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1273" tag="hblock_tag_24" canDelete="false" classfield_id="1273" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1273" tag="hblock_tag_25" canDelete="false" classfield_id="1273" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1274" tag="hblock_tag_26" canDelete="false" classfield_id="1274" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1274" tag="hblock_tag_27" canDelete="false" classfield_id="1274" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1275" tag="hblock_tag_28" canDelete="false" classfield_id="1275" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1275" tag="hblock_tag_29" canDelete="false" classfield_id="1275" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1276" tag="hblock_tag_30" canDelete="false" classfield_id="1276" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1276" tag="hblock_tag_31" canDelete="false" classfield_id="1276" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1277" tag="hblock_tag_32" canDelete="false" classfield_id="1277" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1277" tag="hblock_tag_33" canDelete="false" classfield_id="1277" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1278" tag="hblock_tag_34" canDelete="false" classfield_id="1278" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1278" tag="hblock_tag_35" canDelete="false" classfield_id="1278" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1279" tag="hblock_tag_36" canDelete="false" classfield_id="1279" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1279" tag="hblock_tag_37" canDelete="false" classfield_id="1279" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1280" tag="hblock_tag_38" canDelete="false" classfield_id="1280" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1280" tag="hblock_tag_39" canDelete="false" classfield_id="1280" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1281" tag="hblock_tag_40" canDelete="false" classfield_id="1281" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1281" tag="hblock_tag_41" canDelete="false" classfield_id="1281" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1282" tag="hblock_tag_42" canDelete="false" classfield_id="1282" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1282" tag="hblock_tag_43" canDelete="false" classfield_id="1282" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1283" tag="hblock_tag_44" canDelete="false" classfield_id="1283" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1283" tag="hblock_tag_45" canDelete="false" classfield_id="1283" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1284" tag="hblock_tag_46" canDelete="false" classfield_id="1284" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1284" tag="hblock_tag_47" canDelete="false" classfield_id="1284" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1286" tag="hblock_tag_48" canDelete="false" classfield_id="1286" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1286" tag="hblock_tag_49" canDelete="false" classfield_id="1286" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1287" tag="hblock_tag_50" canDelete="false" classfield_id="1287" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1287" tag="hblock_tag_51" canDelete="false" classfield_id="1287" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1288" tag="hblock_tag_52" canDelete="false" classfield_id="1288" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1288" tag="hblock_tag_53" canDelete="false" classfield_id="1288" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1289" tag="hblock_tag_54" canDelete="false" classfield_id="1289" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1289" tag="hblock_tag_55" canDelete="false" classfield_id="1289" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1290" tag="hblock_tag_56" canDelete="false" classfield_id="1290" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1290" tag="hblock_tag_57" canDelete="false" classfield_id="1290" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1291" tag="hblock_tag_58" canDelete="false" classfield_id="1291" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1291" tag="hblock_tag_59" canDelete="false" classfield_id="1291" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1270" tag="hblock_tag_60" canDelete="false" classfield_id="1270" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1270" tag="hblock_tag_61" canDelete="false" classfield_id="1270" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1270" tag="hblock_tag_62" canDelete="false" writeOutText="false" classfield_id="1270" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1270" tag="hblock_tag_63" canDelete="false" writeOutText="false" classfield_id="1270" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1270" tag="hblock_tag_64" canDelete="false" writeOutText="false" classfield_id="1270" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1285" tag="hblock_tag_65" canDelete="false" classfield_id="1285" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1285" tag="hblock_tag_66" canDelete="false" classfield_id="1285" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1285" tag="hblock_tag_67" canDelete="false" writeOutText="false" classfield_id="1285" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1285" tag="hblock_tag_68" canDelete="false" writeOutText="false" classfield_id="1285" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1285" tag="hblock_tag_69" canDelete="false" writeOutText="false" classfield_id="1285" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1292" tag="operation_1292" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1294" tag="operation_1294" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1300" tag="operation_1300" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1302" tag="operation_1302" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1304" tag="operation_1304" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1306" tag="operation_1306" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1308" tag="operation_1308" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1310" tag="operation_1310" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1311" tag="operation_1311" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1313" tag="operation_1313" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1316" tag="operation_1316" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1317" tag="operation_1317" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1318" tag="operation_1318" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1321" tag="operation_1321" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1324" tag="operation_1324" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1325" tag="operation_1325" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1327" tag="operation_1327" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1328" tag="operation_1328" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1329" tag="operation_1329" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1331" tag="operation_1331" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1333" tag="operation_1333" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1334" tag="operation_1334" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1335" tag="operation_1335" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1337" tag="operation_1337" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1340" tag="operation_1340" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1341" tag="operation_1341" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1342" tag="operation_1342" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1344" tag="operation_1344" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1346" tag="operation_1346" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1347" tag="operation_1347" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1348" tag="operation_1348" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1349" tag="operation_1349" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1350" tag="operation_1350" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1351" tag="operation_1351" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1353" tag="operation_1353" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1355" tag="operation_1355" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1361" tag="operation_1361" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1362" tag="operation_1362" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1364" tag="operation_1364" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1369" tag="operation_1369" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1371" tag="operation_1371" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1373" tag="operation_1373" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1375" tag="operation_1375" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1376" tag="operation_1376" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1378" tag="operation_1378" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1380" tag="operation_1380" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1381" tag="operation_1381" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1382" tag="operation_1382" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1383" tag="operation_1383" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1384" tag="operation_1384" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1385" tag="operation_1385" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1386" tag="operation_1386" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1387" tag="operation_1387" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1392" tag="operation_1392" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1394" tag="operation_1394" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1396" tag="operation_1396" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1399" tag="operation_1399" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1402" tag="operation_1402" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1404" tag="operation_1404" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1406" tag="operation_1406" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1409" tag="operation_1409" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1411" tag="operation_1411" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1414" tag="operation_1414" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1417" tag="operation_1417" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1419" tag="operation_1419" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1421" tag="operation_1421" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1422" tag="operation_1422" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1424" tag="operation_1424" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1426" tag="operation_1426" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1427" tag="operation_1427" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1430" tag="operation_1430" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1431" tag="operation_1431" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1433" tag="operation_1433" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1434" tag="operation_1434" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1435" tag="operation_1435" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1437" tag="operation_1437" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1438" tag="operation_1438" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1440" tag="operation_1440" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1441" tag="operation_1441" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1443" tag="operation_1443" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1445" tag="operation_1445" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1447" tag="operation_1447" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1450" tag="operation_1450" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1451" tag="operation_1451" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisimage.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1260" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1260" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1260" tag="hblock_tag_0" canDelete="false" classfield_id="1260" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1260" tag="hblock_tag_1" canDelete="false" classfield_id="1260" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1261" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1261" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1261" tag="hblock_tag_2" canDelete="false" classfield_id="1261" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1261" tag="hblock_tag_3" canDelete="false" classfield_id="1261" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1262" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1262" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1262" tag="hblock_tag_4" canDelete="false" classfield_id="1262" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1262" tag="hblock_tag_5" canDelete="false" classfield_id="1262" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1263" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1263" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1263" tag="hblock_tag_6" canDelete="false" classfield_id="1263" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1263" tag="hblock_tag_7" canDelete="false" classfield_id="1263" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1264" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1264" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1264" tag="hblock_tag_8" canDelete="false" classfield_id="1264" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1264" tag="hblock_tag_9" canDelete="false" classfield_id="1264" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1265" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1265" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1265" tag="hblock_tag_10" canDelete="false" classfield_id="1265" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1265" tag="hblock_tag_11" canDelete="false" classfield_id="1265" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1266" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1266" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1266" tag="hblock_tag_12" canDelete="false" classfield_id="1266" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1266" tag="hblock_tag_13" canDelete="false" classfield_id="1266" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1267" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1267" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1267" tag="hblock_tag_14" canDelete="false" classfield_id="1267" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1267" tag="hblock_tag_15" canDelete="false" classfield_id="1267" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1268" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1268" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1268" tag="hblock_tag_16" canDelete="false" classfield_id="1268" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1268" tag="hblock_tag_17" canDelete="false" classfield_id="1268" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1269" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1269" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1269" tag="hblock_tag_18" canDelete="false" classfield_id="1269" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1269" tag="hblock_tag_19" canDelete="false" classfield_id="1269" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1271" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1271" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1271" tag="hblock_tag_20" canDelete="false" classfield_id="1271" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1271" tag="hblock_tag_21" canDelete="false" classfield_id="1271" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1272" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1272" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1272" tag="hblock_tag_22" canDelete="false" classfield_id="1272" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1272" tag="hblock_tag_23" canDelete="false" classfield_id="1272" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1273" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1273" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1273" tag="hblock_tag_24" canDelete="false" classfield_id="1273" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1273" tag="hblock_tag_25" canDelete="false" classfield_id="1273" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1274" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1274" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1274" tag="hblock_tag_26" canDelete="false" classfield_id="1274" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1274" tag="hblock_tag_27" canDelete="false" classfield_id="1274" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1275" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1275" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1275" tag="hblock_tag_28" canDelete="false" classfield_id="1275" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1275" tag="hblock_tag_29" canDelete="false" classfield_id="1275" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1276" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1276" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1276" tag="hblock_tag_30" canDelete="false" classfield_id="1276" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1276" tag="hblock_tag_31" canDelete="false" classfield_id="1276" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1277" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1277" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1277" tag="hblock_tag_32" canDelete="false" classfield_id="1277" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1277" tag="hblock_tag_33" canDelete="false" classfield_id="1277" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1278" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1278" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1278" tag="hblock_tag_34" canDelete="false" classfield_id="1278" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1278" tag="hblock_tag_35" canDelete="false" classfield_id="1278" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1279" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1279" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1279" tag="hblock_tag_36" canDelete="false" classfield_id="1279" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1279" tag="hblock_tag_37" canDelete="false" classfield_id="1279" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1280" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1280" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1280" tag="hblock_tag_38" canDelete="false" classfield_id="1280" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1280" tag="hblock_tag_39" canDelete="false" classfield_id="1280" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1281" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1281" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1281" tag="hblock_tag_40" canDelete="false" classfield_id="1281" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1281" tag="hblock_tag_41" canDelete="false" classfield_id="1281" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1282" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1282" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1282" tag="hblock_tag_42" canDelete="false" classfield_id="1282" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1282" tag="hblock_tag_43" canDelete="false" classfield_id="1282" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1283" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1283" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1283" tag="hblock_tag_44" canDelete="false" classfield_id="1283" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1283" tag="hblock_tag_45" canDelete="false" classfield_id="1283" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1284" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1284" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1284" tag="hblock_tag_46" canDelete="false" classfield_id="1284" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1284" tag="hblock_tag_47" canDelete="false" classfield_id="1284" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1286" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1286" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1286" tag="hblock_tag_48" canDelete="false" classfield_id="1286" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1286" tag="hblock_tag_49" canDelete="false" classfield_id="1286" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1287" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1287" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1287" tag="hblock_tag_50" canDelete="false" classfield_id="1287" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1287" tag="hblock_tag_51" canDelete="false" classfield_id="1287" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1288" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1288" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1288" tag="hblock_tag_52" canDelete="false" classfield_id="1288" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1288" tag="hblock_tag_53" canDelete="false" classfield_id="1288" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1289" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1289" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1289" tag="hblock_tag_54" canDelete="false" classfield_id="1289" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1289" tag="hblock_tag_55" canDelete="false" classfield_id="1289" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1290" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1290" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1290" tag="hblock_tag_56" canDelete="false" classfield_id="1290" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1290" tag="hblock_tag_57" canDelete="false" classfield_id="1290" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1291" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1291" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1291" tag="hblock_tag_58" canDelete="false" classfield_id="1291" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1291" tag="hblock_tag_59" canDelete="false" classfield_id="1291" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1270" field_type="4" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1270" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1270" tag="hblock_tag_60" canDelete="false" classfield_id="1270" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1270" tag="hblock_tag_61" canDelete="false" classfield_id="1270" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1270" tag="hblock_tag_62" canDelete="false" writeOutText="false" classfield_id="1270" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1270" tag="hblock_tag_63" canDelete="false" writeOutText="false" classfield_id="1270" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1270" tag="hblock_tag_64" canDelete="false" writeOutText="false" classfield_id="1270" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1285" field_type="4" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1285" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1285" tag="hblock_tag_65" canDelete="false" classfield_id="1285" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1285" tag="hblock_tag_66" canDelete="false" classfield_id="1285" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1285" tag="hblock_tag_67" canDelete="false" writeOutText="false" classfield_id="1285" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1285" tag="hblock_tag_68" canDelete="false" writeOutText="false" classfield_id="1285" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1285" tag="hblock_tag_69" canDelete="false" writeOutText="false" classfield_id="1285" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1453" tqparent_class="1453" fileExt=".cpp" fileName="kispaintdevice" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;kistilemgrsp.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;compositeop.h&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;enumimgtype.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1454" tag="hblock_tag_0" canDelete="false" classfield_id="1454" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1454" tag="hblock_tag_1" canDelete="false" classfield_id="1454" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1456" tag="hblock_tag_2" canDelete="false" classfield_id="1456" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1456" tag="hblock_tag_3" canDelete="false" classfield_id="1456" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1457" tag="hblock_tag_4" canDelete="false" classfield_id="1457" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1457" tag="hblock_tag_5" canDelete="false" classfield_id="1457" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1459" tag="hblock_tag_6" canDelete="false" classfield_id="1459" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1459" tag="hblock_tag_7" canDelete="false" classfield_id="1459" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1460" tag="hblock_tag_8" canDelete="false" classfield_id="1460" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1460" tag="hblock_tag_9" canDelete="false" classfield_id="1460" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1461" tag="hblock_tag_10" canDelete="false" classfield_id="1461" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1461" tag="hblock_tag_11" canDelete="false" classfield_id="1461" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1462" tag="hblock_tag_12" canDelete="false" classfield_id="1462" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1462" tag="hblock_tag_13" canDelete="false" classfield_id="1462" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1463" tag="hblock_tag_14" canDelete="false" classfield_id="1463" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1463" tag="hblock_tag_15" canDelete="false" classfield_id="1463" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1464" tag="hblock_tag_16" canDelete="false" classfield_id="1464" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1464" tag="hblock_tag_17" canDelete="false" classfield_id="1464" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1465" tag="hblock_tag_18" canDelete="false" classfield_id="1465" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1465" tag="hblock_tag_19" canDelete="false" classfield_id="1465" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1466" tag="hblock_tag_20" canDelete="false" classfield_id="1466" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1466" tag="hblock_tag_21" canDelete="false" classfield_id="1466" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1467" tag="hblock_tag_22" canDelete="false" classfield_id="1467" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1467" tag="hblock_tag_23" canDelete="false" classfield_id="1467" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1468" tag="hblock_tag_24" canDelete="false" classfield_id="1468" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1468" tag="hblock_tag_25" canDelete="false" classfield_id="1468" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1469" tag="hblock_tag_26" canDelete="false" classfield_id="1469" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1469" tag="hblock_tag_27" canDelete="false" classfield_id="1469" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1470" tag="hblock_tag_28" canDelete="false" classfield_id="1470" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1470" tag="hblock_tag_29" canDelete="false" classfield_id="1470" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1471" tag="hblock_tag_30" canDelete="false" classfield_id="1471" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1471" tag="hblock_tag_31" canDelete="false" classfield_id="1471" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1472" tag="hblock_tag_32" canDelete="false" classfield_id="1472" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1472" tag="hblock_tag_33" canDelete="false" classfield_id="1472" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1473" tag="hblock_tag_34" canDelete="false" classfield_id="1473" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1473" tag="hblock_tag_35" canDelete="false" classfield_id="1473" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1455" tag="hblock_tag_36" canDelete="false" classfield_id="1455" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1455" tag="hblock_tag_37" canDelete="false" classfield_id="1455" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1455" tag="hblock_tag_38" canDelete="false" writeOutText="false" classfield_id="1455" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1455" tag="hblock_tag_39" canDelete="false" writeOutText="false" classfield_id="1455" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1455" tag="hblock_tag_40" canDelete="false" writeOutText="false" classfield_id="1455" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1458" tag="hblock_tag_41" canDelete="false" classfield_id="1458" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1458" tag="hblock_tag_42" canDelete="false" classfield_id="1458" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1458" tag="hblock_tag_43" canDelete="false" writeOutText="false" classfield_id="1458" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1458" tag="hblock_tag_44" canDelete="false" writeOutText="false" classfield_id="1458" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1458" tag="hblock_tag_45" canDelete="false" writeOutText="false" classfield_id="1458" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1474" tag="operation_1474" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1476" tag="operation_1476" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1482" tag="operation_1482" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1486" tag="operation_1486" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1491" tag="operation_1491" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1493" tag="operation_1493" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1494" tag="operation_1494" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Reimplemented by KisSelection; here it does nothing useful, but it&amp;#010;cannot be abstract, because otherwise this class would be abstract." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1495" tag="operation_1495" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1496" tag="operation_1496" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1497" tag="operation_1497" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1502" tag="operation_1502" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1504" tag="operation_1504" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1505" tag="operation_1505" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1506" tag="operation_1506" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1513" tag="operation_1513" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1516" tag="operation_1516" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1518" tag="operation_1518" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1519" tag="operation_1519" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1521" tag="operation_1521" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1524" tag="operation_1524" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1526" tag="operation_1526" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1527" tag="operation_1527" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1529" tag="operation_1529" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1530" tag="operation_1530" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1531" tag="operation_1531" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1532" tag="operation_1532" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1534" tag="operation_1534" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1539" tag="operation_1539" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1541" tag="operation_1541" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1543" tag="operation_1543" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1548" tag="operation_1548" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1551" tag="operation_1551" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1553" tag="operation_1553" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1554" tag="operation_1554" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1557" tag="operation_1557" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1562" tag="operation_1562" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1563" tag="operation_1563" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1564" tag="operation_1564" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1566" tag="operation_1566" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1567" tag="operation_1567" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1570" tag="operation_1570" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1572" tag="operation_1572" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1577" tag="operation_1577" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1579" tag="operation_1579" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1581" tag="operation_1581" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1583" tag="operation_1583" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1588" tag="operation_1588" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1590" tag="operation_1590" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1592" tag="operation_1592" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1593" tag="operation_1593" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1594" tag="operation_1594" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1597" tag="operation_1597" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1598" tag="operation_1598" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1599" tag="operation_1599" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1600" tag="operation_1600" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1601" tag="operation_1601" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1602" tag="operation_1602" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1607" tag="operation_1607" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1609" tag="operation_1609" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1610" tag="operation_1610" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1612" tag="operation_1612" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1613" tag="operation_1613" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1615" tag="operation_1615" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1617" tag="operation_1617" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1618" tag="operation_1618" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1619" tag="operation_1619" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kispaintdevice.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1454" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1454" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1454" tag="hblock_tag_0" canDelete="false" classfield_id="1454" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1454" tag="hblock_tag_1" canDelete="false" classfield_id="1454" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1456" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1456" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1456" tag="hblock_tag_2" canDelete="false" classfield_id="1456" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1456" tag="hblock_tag_3" canDelete="false" classfield_id="1456" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1457" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1457" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1457" tag="hblock_tag_4" canDelete="false" classfield_id="1457" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1457" tag="hblock_tag_5" canDelete="false" classfield_id="1457" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1459" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1459" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1459" tag="hblock_tag_6" canDelete="false" classfield_id="1459" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1459" tag="hblock_tag_7" canDelete="false" classfield_id="1459" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1460" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1460" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1460" tag="hblock_tag_8" canDelete="false" classfield_id="1460" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1460" tag="hblock_tag_9" canDelete="false" classfield_id="1460" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1461" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1461" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1461" tag="hblock_tag_10" canDelete="false" classfield_id="1461" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1461" tag="hblock_tag_11" canDelete="false" classfield_id="1461" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1462" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1462" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1462" tag="hblock_tag_12" canDelete="false" classfield_id="1462" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1462" tag="hblock_tag_13" canDelete="false" classfield_id="1462" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1463" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1463" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1463" tag="hblock_tag_14" canDelete="false" classfield_id="1463" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1463" tag="hblock_tag_15" canDelete="false" classfield_id="1463" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1464" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1464" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1464" tag="hblock_tag_16" canDelete="false" classfield_id="1464" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1464" tag="hblock_tag_17" canDelete="false" classfield_id="1464" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1465" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1465" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1465" tag="hblock_tag_18" canDelete="false" classfield_id="1465" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1465" tag="hblock_tag_19" canDelete="false" classfield_id="1465" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1466" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1466" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1466" tag="hblock_tag_20" canDelete="false" classfield_id="1466" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1466" tag="hblock_tag_21" canDelete="false" classfield_id="1466" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1467" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1467" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1467" tag="hblock_tag_22" canDelete="false" classfield_id="1467" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1467" tag="hblock_tag_23" canDelete="false" classfield_id="1467" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1468" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1468" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1468" tag="hblock_tag_24" canDelete="false" classfield_id="1468" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1468" tag="hblock_tag_25" canDelete="false" classfield_id="1468" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1469" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1469" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1469" tag="hblock_tag_26" canDelete="false" classfield_id="1469" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1469" tag="hblock_tag_27" canDelete="false" classfield_id="1469" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1470" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1470" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1470" tag="hblock_tag_28" canDelete="false" classfield_id="1470" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1470" tag="hblock_tag_29" canDelete="false" classfield_id="1470" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1471" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1471" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1471" tag="hblock_tag_30" canDelete="false" classfield_id="1471" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1471" tag="hblock_tag_31" canDelete="false" classfield_id="1471" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1472" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1472" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1472" tag="hblock_tag_32" canDelete="false" classfield_id="1472" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1472" tag="hblock_tag_33" canDelete="false" classfield_id="1472" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1473" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1473" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1473" tag="hblock_tag_34" canDelete="false" classfield_id="1473" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1473" tag="hblock_tag_35" canDelete="false" classfield_id="1473" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1455" field_type="4" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1455" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1455" tag="hblock_tag_36" canDelete="false" classfield_id="1455" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1455" tag="hblock_tag_37" canDelete="false" classfield_id="1455" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1455" tag="hblock_tag_38" canDelete="false" writeOutText="false" classfield_id="1455" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1455" tag="hblock_tag_39" canDelete="false" writeOutText="false" classfield_id="1455" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1455" tag="hblock_tag_40" canDelete="false" writeOutText="false" classfield_id="1455" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1458" field_type="4" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1458" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1458" tag="hblock_tag_41" canDelete="false" classfield_id="1458" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1458" tag="hblock_tag_42" canDelete="false" classfield_id="1458" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1458" tag="hblock_tag_43" canDelete="false" writeOutText="false" classfield_id="1458" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1458" tag="hblock_tag_44" canDelete="false" writeOutText="false" classfield_id="1458" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1458" tag="hblock_tag_45" canDelete="false" writeOutText="false" classfield_id="1458" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1620" tqparent_class="1620" fileExt=".cpp" fileName="kislayer" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;kistilemgrsp.h&quot;&amp;#010;#include &quot;kistqmasksp.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1621" tag="hblock_tag_0" canDelete="false" classfield_id="1621" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1621" tag="hblock_tag_1" canDelete="false" classfield_id="1621" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1622" tag="hblock_tag_2" canDelete="false" classfield_id="1622" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1622" tag="hblock_tag_3" canDelete="false" classfield_id="1622" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1623" tag="hblock_tag_4" canDelete="false" classfield_id="1623" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1623" tag="hblock_tag_5" canDelete="false" classfield_id="1623" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1624" tag="hblock_tag_6" canDelete="false" classfield_id="1624" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1624" tag="hblock_tag_7" canDelete="false" classfield_id="1624" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1625" tag="hblock_tag_8" canDelete="false" classfield_id="1625" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1625" tag="hblock_tag_9" canDelete="false" classfield_id="1625" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1626" tag="hblock_tag_10" canDelete="false" classfield_id="1626" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1626" tag="hblock_tag_11" canDelete="false" classfield_id="1626" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1627" tag="hblock_tag_12" canDelete="false" classfield_id="1627" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1627" tag="hblock_tag_13" canDelete="false" classfield_id="1627" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1628" tag="operation_1628" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1634" tag="operation_1634" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1639" tag="operation_1639" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1644" tag="operation_1644" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1646" tag="operation_1646" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1647" tag="operation_1647" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1649" tag="operation_1649" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1651" tag="operation_1651" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1653" tag="operation_1653" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1654" tag="operation_1654" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1656" tag="operation_1656" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1657" tag="operation_1657" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1658" tag="operation_1658" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1660" tag="operation_1660" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1663" tag="operation_1663" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1664" tag="operation_1664" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1666" tag="operation_1666" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kislayer.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1621" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1621" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1621" tag="hblock_tag_0" canDelete="false" classfield_id="1621" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1621" tag="hblock_tag_1" canDelete="false" classfield_id="1621" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1622" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1622" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1622" tag="hblock_tag_2" canDelete="false" classfield_id="1622" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1622" tag="hblock_tag_3" canDelete="false" classfield_id="1622" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1623" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1623" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1623" tag="hblock_tag_4" canDelete="false" classfield_id="1623" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1623" tag="hblock_tag_5" canDelete="false" classfield_id="1623" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1624" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1624" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1624" tag="hblock_tag_6" canDelete="false" classfield_id="1624" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1624" tag="hblock_tag_7" canDelete="false" classfield_id="1624" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1625" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1625" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1625" tag="hblock_tag_8" canDelete="false" classfield_id="1625" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1625" tag="hblock_tag_9" canDelete="false" classfield_id="1625" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1626" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1626" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1626" tag="hblock_tag_10" canDelete="false" classfield_id="1626" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1626" tag="hblock_tag_11" canDelete="false" classfield_id="1626" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1627" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1627" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1627" tag="hblock_tag_12" canDelete="false" classfield_id="1627" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1627" tag="hblock_tag_13" canDelete="false" classfield_id="1627" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1667" tqparent_class="1667" fileExt=".cpp" fileName="kisnameserver" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1668" tag="hblock_tag_0" canDelete="false" classfield_id="1668" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1668" tag="hblock_tag_1" canDelete="false" classfield_id="1668" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1669" tag="hblock_tag_2" canDelete="false" classfield_id="1669" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1669" tag="hblock_tag_3" canDelete="false" classfield_id="1669" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1670" tag="operation_1670" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1673" tag="operation_1673" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1674" tag="operation_1674" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1675" tag="operation_1675" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1676" tag="operation_1676" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisnameserver.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1668" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1668" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1668" tag="hblock_tag_0" canDelete="false" classfield_id="1668" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1668" tag="hblock_tag_1" canDelete="false" classfield_id="1668" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1669" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1669" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1669" tag="hblock_tag_2" canDelete="false" classfield_id="1669" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1669" tag="hblock_tag_3" canDelete="false" classfield_id="1669" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1677" tqparent_class="1677" fileExt=".cpp" fileName="kismemento" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="1678" tag="operation_1678" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kismemento.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:50:11&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1679" tqparent_class="1679" fileExt=".cpp" fileName="kispaintdevicevisitor" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;#include &quot;kispaintdevicesp.h&quot;&amp;#010;#include &quot;kisselectionsp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="1680" tag="operation_1680" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1683" tag="operation_1683" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1686" tag="operation_1686" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1689" tag="operation_1689" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1692" tag="operation_1692" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1695" tag="operation_1695" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1696" tag="operation_1696" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1699" tag="operation_1699" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1702" tag="operation_1702" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1705" tag="operation_1705" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1708" tag="operation_1708" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1711" tag="operation_1711" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kispaintdevicevisitor.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1712" tqparent_class="1712" fileExt=".cpp" fileName="kismementooriginatorinterface" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kismementosp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="1713" tag="operation_1713" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1715" tag="operation_1715" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1716" tag="operation_1716" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1718" tag="operation_1718" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1720" tag="operation_1720" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1721" tag="operation_1721" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kismementooriginatorinterface.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:50:19&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1722" tqparent_class="1722" fileExt=".cpp" fileName="kistqmask" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="1723" tag="operation_1723" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1729" tag="operation_1729" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1731" tag="operation_1731" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1732" tag="operation_1732" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1734" tag="operation_1734" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1735" tag="operation_1735" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1737" tag="operation_1737" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1738" tag="operation_1738" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1740" tag="operation_1740" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistqmask.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1741" tqparent_class="1741" fileExt=".cpp" fileName="kisimagepipebrush" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1743" tag="hblock_tag_0" canDelete="false" classfield_id="1743" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1743" tag="hblock_tag_1" canDelete="false" classfield_id="1743" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1744" tag="hblock_tag_2" canDelete="false" classfield_id="1744" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1744" tag="hblock_tag_3" canDelete="false" classfield_id="1744" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1745" tag="hblock_tag_4" canDelete="false" classfield_id="1745" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1745" tag="hblock_tag_5" canDelete="false" classfield_id="1745" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1746" tag="hblock_tag_6" canDelete="false" classfield_id="1746" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1746" tag="hblock_tag_7" canDelete="false" classfield_id="1746" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1747" tag="hblock_tag_8" canDelete="false" classfield_id="1747" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1747" tag="hblock_tag_9" canDelete="false" classfield_id="1747" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1748" tag="hblock_tag_10" canDelete="false" classfield_id="1748" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1748" tag="hblock_tag_11" canDelete="false" classfield_id="1748" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1749" tag="hblock_tag_12" canDelete="false" classfield_id="1749" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1749" tag="hblock_tag_13" canDelete="false" classfield_id="1749" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1742" tag="hblock_tag_14" canDelete="false" classfield_id="1742" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1742" tag="hblock_tag_15" canDelete="false" classfield_id="1742" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1742" tag="hblock_tag_16" canDelete="false" writeOutText="false" classfield_id="1742" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1742" tag="hblock_tag_17" canDelete="false" writeOutText="false" classfield_id="1742" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1742" tag="hblock_tag_18" canDelete="false" writeOutText="false" classfield_id="1742" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1750" tag="operation_1750" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1752" tag="operation_1752" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1753" tag="operation_1753" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1754" tag="operation_1754" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="@return the next image in the pipe." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1755" tag="operation_1755" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1756" tag="operation_1756" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="@return the next tqmask in the pipe." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1758" tag="operation_1758" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1759" tag="operation_1759" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1761" tag="operation_1761" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1763" tag="operation_1763" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisimagepipebrush.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1743" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1743" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1743" tag="hblock_tag_0" canDelete="false" classfield_id="1743" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1743" tag="hblock_tag_1" canDelete="false" classfield_id="1743" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1744" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1744" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1744" tag="hblock_tag_2" canDelete="false" classfield_id="1744" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1744" tag="hblock_tag_3" canDelete="false" classfield_id="1744" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1745" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1745" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1745" tag="hblock_tag_4" canDelete="false" classfield_id="1745" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1745" tag="hblock_tag_5" canDelete="false" classfield_id="1745" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1746" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1746" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1746" tag="hblock_tag_6" canDelete="false" classfield_id="1746" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1746" tag="hblock_tag_7" canDelete="false" classfield_id="1746" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1747" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1747" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1747" tag="hblock_tag_8" canDelete="false" classfield_id="1747" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1747" tag="hblock_tag_9" canDelete="false" classfield_id="1747" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1748" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1748" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1748" tag="hblock_tag_10" canDelete="false" classfield_id="1748" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1748" tag="hblock_tag_11" canDelete="false" classfield_id="1748" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1749" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1749" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1749" tag="hblock_tag_12" canDelete="false" classfield_id="1749" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1749" tag="hblock_tag_13" canDelete="false" classfield_id="1749" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1742" field_type="4" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1742" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1742" tag="hblock_tag_14" canDelete="false" classfield_id="1742" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1742" tag="hblock_tag_15" canDelete="false" classfield_id="1742" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1742" tag="hblock_tag_16" canDelete="false" writeOutText="false" classfield_id="1742" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1742" tag="hblock_tag_17" canDelete="false" writeOutText="false" classfield_id="1742" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1742" tag="hblock_tag_18" canDelete="false" writeOutText="false" classfield_id="1742" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1767" tqparent_class="1767" fileExt=".cpp" fileName="kispainter" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kispaintdevicesp.h&quot;&amp;#010;#include &quot;compositeop.h&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;float.h&quot;&amp;#010;#include &quot;kistilesp.h&quot;&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1768" tag="hblock_tag_0" canDelete="false" classfield_id="1768" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1768" tag="hblock_tag_1" canDelete="false" classfield_id="1768" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1770" tag="hblock_tag_2" canDelete="false" classfield_id="1770" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1770" tag="hblock_tag_3" canDelete="false" classfield_id="1770" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1771" tag="hblock_tag_4" canDelete="false" classfield_id="1771" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1771" tag="hblock_tag_5" canDelete="false" classfield_id="1771" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1772" tag="hblock_tag_6" canDelete="false" classfield_id="1772" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1772" tag="hblock_tag_7" canDelete="false" classfield_id="1772" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1773" tag="hblock_tag_8" canDelete="false" classfield_id="1773" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1773" tag="hblock_tag_9" canDelete="false" classfield_id="1773" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1774" tag="hblock_tag_10" canDelete="false" classfield_id="1774" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1774" tag="hblock_tag_11" canDelete="false" classfield_id="1774" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1775" tag="hblock_tag_12" canDelete="false" classfield_id="1775" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1775" tag="hblock_tag_13" canDelete="false" classfield_id="1775" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1777" tag="hblock_tag_14" canDelete="false" classfield_id="1777" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1777" tag="hblock_tag_15" canDelete="false" classfield_id="1777" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1778" tag="hblock_tag_16" canDelete="false" classfield_id="1778" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1778" tag="hblock_tag_17" canDelete="false" classfield_id="1778" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1779" tag="hblock_tag_18" canDelete="false" classfield_id="1779" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1779" tag="hblock_tag_19" canDelete="false" classfield_id="1779" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1780" tag="hblock_tag_20" canDelete="false" classfield_id="1780" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1780" tag="hblock_tag_21" canDelete="false" classfield_id="1780" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1781" tag="hblock_tag_22" canDelete="false" classfield_id="1781" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1781" tag="hblock_tag_23" canDelete="false" classfield_id="1781" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1782" tag="hblock_tag_24" canDelete="false" classfield_id="1782" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1782" tag="hblock_tag_25" canDelete="false" classfield_id="1782" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1783" tag="hblock_tag_26" canDelete="false" classfield_id="1783" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1783" tag="hblock_tag_27" canDelete="false" classfield_id="1783" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1769" tag="hblock_tag_28" canDelete="false" classfield_id="1769" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1769" tag="hblock_tag_29" canDelete="false" classfield_id="1769" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1769" tag="hblock_tag_30" canDelete="false" writeOutText="false" classfield_id="1769" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1769" tag="hblock_tag_31" canDelete="false" writeOutText="false" classfield_id="1769" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1769" tag="hblock_tag_32" canDelete="false" writeOutText="false" classfield_id="1769" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1776" tag="hblock_tag_33" canDelete="false" classfield_id="1776" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1776" tag="hblock_tag_34" canDelete="false" classfield_id="1776" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="1776" tag="hblock_tag_35" canDelete="false" writeOutText="false" classfield_id="1776" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="1776" tag="hblock_tag_36" canDelete="false" writeOutText="false" classfield_id="1776" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="1776" tag="hblock_tag_37" canDelete="false" writeOutText="false" classfield_id="1776" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1784" tag="operation_1784" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1786" tag="operation_1786" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1787" tag="operation_1787" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1789" tag="operation_1789" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1791" tag="operation_1791" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1793" tag="operation_1793" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1795" tag="operation_1795" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1805" tag="operation_1805" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1814" tag="operation_1814" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1816" tag="operation_1816" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1817" tag="operation_1817" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1818" tag="operation_1818" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1819" tag="operation_1819" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1820" tag="operation_1820" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1825" tag="operation_1825" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1832" tag="operation_1832" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1837" tag="operation_1837" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1839" tag="operation_1839" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1845" tag="operation_1845" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1852" tag="operation_1852" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1855" tag="operation_1855" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1859" tag="operation_1859" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1864" tag="operation_1864" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1871" tag="operation_1871" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1873" tag="operation_1873" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1875" tag="operation_1875" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1877" tag="operation_1877" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1879" tag="operation_1879" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1881" tag="operation_1881" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1883" tag="operation_1883" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1885" tag="operation_1885" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1894" tag="operation_1894" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1902" tag="operation_1902" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kispainter.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1768" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1768" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1768" tag="hblock_tag_0" canDelete="false" classfield_id="1768" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1768" tag="hblock_tag_1" canDelete="false" classfield_id="1768" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1770" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1770" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1770" tag="hblock_tag_2" canDelete="false" classfield_id="1770" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1770" tag="hblock_tag_3" canDelete="false" classfield_id="1770" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1771" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1771" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1771" tag="hblock_tag_4" canDelete="false" classfield_id="1771" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1771" tag="hblock_tag_5" canDelete="false" classfield_id="1771" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1772" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1772" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1772" tag="hblock_tag_6" canDelete="false" classfield_id="1772" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1772" tag="hblock_tag_7" canDelete="false" classfield_id="1772" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1773" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1773" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1773" tag="hblock_tag_8" canDelete="false" classfield_id="1773" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1773" tag="hblock_tag_9" canDelete="false" classfield_id="1773" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1774" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1774" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1774" tag="hblock_tag_10" canDelete="false" classfield_id="1774" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1774" tag="hblock_tag_11" canDelete="false" classfield_id="1774" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1775" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1775" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1775" tag="hblock_tag_12" canDelete="false" classfield_id="1775" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1775" tag="hblock_tag_13" canDelete="false" classfield_id="1775" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1777" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1777" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1777" tag="hblock_tag_14" canDelete="false" classfield_id="1777" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1777" tag="hblock_tag_15" canDelete="false" classfield_id="1777" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1778" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1778" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1778" tag="hblock_tag_16" canDelete="false" classfield_id="1778" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1778" tag="hblock_tag_17" canDelete="false" classfield_id="1778" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1779" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1779" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1779" tag="hblock_tag_18" canDelete="false" classfield_id="1779" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1779" tag="hblock_tag_19" canDelete="false" classfield_id="1779" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1780" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1780" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1780" tag="hblock_tag_20" canDelete="false" classfield_id="1780" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1780" tag="hblock_tag_21" canDelete="false" classfield_id="1780" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1781" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1781" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1781" tag="hblock_tag_22" canDelete="false" classfield_id="1781" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1781" tag="hblock_tag_23" canDelete="false" classfield_id="1781" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1782" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1782" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1782" tag="hblock_tag_24" canDelete="false" classfield_id="1782" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1782" tag="hblock_tag_25" canDelete="false" classfield_id="1782" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1783" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1783" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1783" tag="hblock_tag_26" canDelete="false" classfield_id="1783" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1783" tag="hblock_tag_27" canDelete="false" classfield_id="1783" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1769" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1769" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1769" tag="hblock_tag_28" canDelete="false" classfield_id="1769" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1769" tag="hblock_tag_29" canDelete="false" classfield_id="1769" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1769" tag="hblock_tag_30" canDelete="false" writeOutText="false" classfield_id="1769" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1769" tag="hblock_tag_31" canDelete="false" writeOutText="false" classfield_id="1769" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1769" tag="hblock_tag_32" canDelete="false" writeOutText="false" classfield_id="1769" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1776" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1776" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1776" tag="hblock_tag_33" canDelete="false" classfield_id="1776" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1776" tag="hblock_tag_34" canDelete="false" classfield_id="1776" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1776" tag="hblock_tag_35" canDelete="false" writeOutText="false" classfield_id="1776" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1776" tag="hblock_tag_36" canDelete="false" writeOutText="false" classfield_id="1776" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1776" tag="hblock_tag_37" canDelete="false" writeOutText="false" classfield_id="1776" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1903" tqparent_class="1903" fileExt=".cpp" fileName="kisselection" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kispaintdevicesp.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1904" tag="hblock_tag_0" canDelete="false" classfield_id="1904" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1904" tag="hblock_tag_1" canDelete="false" classfield_id="1904" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1905" tag="hblock_tag_2" canDelete="false" classfield_id="1905" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1905" tag="hblock_tag_3" canDelete="false" classfield_id="1905" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1906" tag="hblock_tag_4" canDelete="false" classfield_id="1906" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1906" tag="hblock_tag_5" canDelete="false" classfield_id="1906" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1907" tag="hblock_tag_6" canDelete="false" classfield_id="1907" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1907" tag="hblock_tag_7" canDelete="false" classfield_id="1907" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1908" tag="hblock_tag_8" canDelete="false" classfield_id="1908" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1908" tag="hblock_tag_9" canDelete="false" classfield_id="1908" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1909" tag="hblock_tag_10" canDelete="false" classfield_id="1909" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1909" tag="hblock_tag_11" canDelete="false" classfield_id="1909" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1910" tag="hblock_tag_12" canDelete="false" classfield_id="1910" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1910" tag="hblock_tag_13" canDelete="false" classfield_id="1910" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1911" tag="operation_1911" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1916" tag="operation_1916" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1921" tag="operation_1921" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1922" tag="operation_1922" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1924" tag="operation_1924" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1925" tag="operation_1925" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1927" tag="operation_1927" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1930" tag="operation_1930" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1931" tag="operation_1931" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1936" tag="operation_1936" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1938" tag="operation_1938" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1940" tag="operation_1940" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1941" tag="operation_1941" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1942" tag="operation_1942" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisselection.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:50:04&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1904" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1904" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1904" tag="hblock_tag_0" canDelete="false" classfield_id="1904" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1904" tag="hblock_tag_1" canDelete="false" classfield_id="1904" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1905" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1905" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1905" tag="hblock_tag_2" canDelete="false" classfield_id="1905" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1905" tag="hblock_tag_3" canDelete="false" classfield_id="1905" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1906" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1906" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1906" tag="hblock_tag_4" canDelete="false" classfield_id="1906" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1906" tag="hblock_tag_5" canDelete="false" classfield_id="1906" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1907" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1907" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1907" tag="hblock_tag_6" canDelete="false" classfield_id="1907" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1907" tag="hblock_tag_7" canDelete="false" classfield_id="1907" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1908" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1908" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1908" tag="hblock_tag_8" canDelete="false" classfield_id="1908" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1908" tag="hblock_tag_9" canDelete="false" classfield_id="1908" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1909" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1909" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1909" tag="hblock_tag_10" canDelete="false" classfield_id="1909" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1909" tag="hblock_tag_11" canDelete="false" classfield_id="1909" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1910" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1910" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1910" tag="hblock_tag_12" canDelete="false" classfield_id="1910" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1910" tag="hblock_tag_13" canDelete="false" classfield_id="1910" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1943" tqparent_class="1943" fileExt=".cpp" fileName="kisresourcemediator" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1944" tag="hblock_tag_0" canDelete="false" classfield_id="1944" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1944" tag="hblock_tag_1" canDelete="false" classfield_id="1944" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1945" tag="hblock_tag_2" canDelete="false" classfield_id="1945" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1945" tag="hblock_tag_3" canDelete="false" classfield_id="1945" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1946" tag="hblock_tag_4" canDelete="false" classfield_id="1946" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1946" tag="hblock_tag_5" canDelete="false" classfield_id="1946" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2369" tag="hblock_tag_6" canDelete="false" writeOutText="false" classfield_id="2369" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2369" tag="hblock_tag_7" canDelete="false" writeOutText="false" classfield_id="2369" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2369" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="2369" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2369" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="2369" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2369" tag="hblock_tag_10" canDelete="false" writeOutText="false" classfield_id="2369" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2423" tag="hblock_tag_11" canDelete="false" writeOutText="false" classfield_id="2423" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2423" tag="hblock_tag_12" canDelete="false" writeOutText="false" classfield_id="2423" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2423" tag="hblock_tag_13" canDelete="false" writeOutText="false" classfield_id="2423" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2423" tag="hblock_tag_14" canDelete="false" writeOutText="false" classfield_id="2423" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2423" tag="hblock_tag_15" canDelete="false" writeOutText="false" classfield_id="2423" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1947" tag="operation_1947" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1955" tag="operation_1955" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1956" tag="operation_1956" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1957" tag="operation_1957" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1959" tag="operation_1959" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1961" tag="operation_1961" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1963" tag="operation_1963" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisresourcemediator.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1944" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1944" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1944" tag="hblock_tag_0" canDelete="false" classfield_id="1944" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1944" tag="hblock_tag_1" canDelete="false" classfield_id="1944" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1945" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1945" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1945" tag="hblock_tag_2" canDelete="false" classfield_id="1945" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1945" tag="hblock_tag_3" canDelete="false" classfield_id="1945" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1946" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1946" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1946" tag="hblock_tag_4" canDelete="false" classfield_id="1946" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1946" tag="hblock_tag_5" canDelete="false" classfield_id="1946" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2369" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2369" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2369" tag="hblock_tag_6" canDelete="false" writeOutText="false" classfield_id="2369" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2369" tag="hblock_tag_7" canDelete="false" writeOutText="false" classfield_id="2369" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2369" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="2369" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2369" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="2369" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2369" tag="hblock_tag_10" canDelete="false" writeOutText="false" classfield_id="2369" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2423" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2423" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2423" tag="hblock_tag_11" canDelete="false" writeOutText="false" classfield_id="2423" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2423" tag="hblock_tag_12" canDelete="false" writeOutText="false" classfield_id="2423" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2423" tag="hblock_tag_13" canDelete="false" writeOutText="false" classfield_id="2423" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2423" tag="hblock_tag_14" canDelete="false" writeOutText="false" classfield_id="2423" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2423" tag="hblock_tag_15" canDelete="false" writeOutText="false" classfield_id="2423" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1964" tqparent_class="1964" fileExt=".cpp" fileName="kisresourceserver" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1965" tag="hblock_tag_0" canDelete="false" classfield_id="1965" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1965" tag="hblock_tag_1" canDelete="false" classfield_id="1965" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1966" tag="hblock_tag_2" canDelete="false" classfield_id="1966" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1966" tag="hblock_tag_3" canDelete="false" classfield_id="1966" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1967" tag="hblock_tag_4" canDelete="false" classfield_id="1967" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1967" tag="hblock_tag_5" canDelete="false" classfield_id="1967" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1968" tag="hblock_tag_6" canDelete="false" classfield_id="1968" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1968" tag="hblock_tag_7" canDelete="false" classfield_id="1968" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1969" tag="hblock_tag_8" canDelete="false" classfield_id="1969" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1969" tag="hblock_tag_9" canDelete="false" classfield_id="1969" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1970" tag="hblock_tag_10" canDelete="false" classfield_id="1970" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1970" tag="hblock_tag_11" canDelete="false" classfield_id="1970" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1971" tag="operation_1971" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1972" tag="operation_1972" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1973" tag="operation_1973" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1974" tag="operation_1974" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1975" tag="operation_1975" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1976" tag="operation_1976" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1977" tag="operation_1977" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1978" tag="operation_1978" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1979" tag="operation_1979" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1980" tag="operation_1980" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1981" tag="operation_1981" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1982" tag="operation_1982" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1983" tag="operation_1983" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1984" tag="operation_1984" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisresourceserver.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1965" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1965" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1965" tag="hblock_tag_0" canDelete="false" classfield_id="1965" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1965" tag="hblock_tag_1" canDelete="false" classfield_id="1965" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1966" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1966" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1966" tag="hblock_tag_2" canDelete="false" classfield_id="1966" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1966" tag="hblock_tag_3" canDelete="false" classfield_id="1966" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1967" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1967" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1967" tag="hblock_tag_4" canDelete="false" classfield_id="1967" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1967" tag="hblock_tag_5" canDelete="false" classfield_id="1967" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1968" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1968" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1968" tag="hblock_tag_6" canDelete="false" classfield_id="1968" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1968" tag="hblock_tag_7" canDelete="false" classfield_id="1968" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1969" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1969" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1969" tag="hblock_tag_8" canDelete="false" classfield_id="1969" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1969" tag="hblock_tag_9" canDelete="false" classfield_id="1969" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1970" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1970" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1970" tag="hblock_tag_10" canDelete="false" classfield_id="1970" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1970" tag="hblock_tag_11" canDelete="false" classfield_id="1970" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1985" tqparent_class="1985" fileExt=".cpp" fileName="kispluginserver" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;int.h&quot;&amp;#010;#include &quot;plugininfolist.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1986" tag="hblock_tag_0" canDelete="false" classfield_id="1986" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1986" tag="hblock_tag_1" canDelete="false" classfield_id="1986" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1987" tag="hblock_tag_2" canDelete="false" classfield_id="1987" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1987" tag="hblock_tag_3" canDelete="false" classfield_id="1987" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="1988" tag="operation_1988" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1989" tag="operation_1989" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1991" tag="operation_1991" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1993" tag="operation_1993" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="1995" tag="operation_1995" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kispluginserver.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1986" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1986" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1986" tag="hblock_tag_0" canDelete="false" classfield_id="1986" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1986" tag="hblock_tag_1" canDelete="false" classfield_id="1986" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1987" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1987" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1987" tag="hblock_tag_2" canDelete="false" classfield_id="1987" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1987" tag="hblock_tag_3" canDelete="false" classfield_id="1987" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="1996" tqparent_class="1996" fileExt=".cpp" fileName="kistilecommand" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kispaintdevicesp.h&quot;&amp;#010;#include &quot;kistilesp.h&quot;&amp;#010;#include &quot;tilemap.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="1997" tag="hblock_tag_0" canDelete="false" classfield_id="1997" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1997" tag="hblock_tag_1" canDelete="false" classfield_id="1997" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1998" tag="hblock_tag_2" canDelete="false" classfield_id="1998" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1998" tag="hblock_tag_3" canDelete="false" classfield_id="1998" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="1999" tag="hblock_tag_4" canDelete="false" classfield_id="1999" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="1999" tag="hblock_tag_5" canDelete="false" classfield_id="1999" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2000" tag="hblock_tag_6" canDelete="false" classfield_id="2000" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2000" tag="hblock_tag_7" canDelete="false" classfield_id="2000" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2001" tag="hblock_tag_8" canDelete="false" classfield_id="2001" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2001" tag="hblock_tag_9" canDelete="false" classfield_id="2001" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="2002" tag="operation_2002" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2005" tag="operation_2005" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2012" tag="operation_2012" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2016" tag="operation_2016" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2019" tag="operation_2019" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2020" tag="operation_2020" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2021" tag="operation_2021" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2022" tag="operation_2022" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistilecommand.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:47:19&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1997" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1997" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1997" tag="hblock_tag_0" canDelete="false" classfield_id="1997" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1997" tag="hblock_tag_1" canDelete="false" classfield_id="1997" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1998" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1998" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1998" tag="hblock_tag_2" canDelete="false" classfield_id="1998" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1998" tag="hblock_tag_3" canDelete="false" classfield_id="1998" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1999" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1999" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1999" tag="hblock_tag_4" canDelete="false" classfield_id="1999" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1999" tag="hblock_tag_5" canDelete="false" classfield_id="1999" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2000" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2000" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2000" tag="hblock_tag_6" canDelete="false" classfield_id="2000" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2000" tag="hblock_tag_7" canDelete="false" classfield_id="2000" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2001" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2001" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2001" tag="hblock_tag_8" canDelete="false" classfield_id="2001" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2001" tag="hblock_tag_9" canDelete="false" classfield_id="2001" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2023" tqparent_class="2023" fileExt=".cpp" fileName="plugininfo" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;plugintype.h&quot;&amp;#010;#include &quot;int.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="2024" tag="hblock_tag_0" canDelete="false" classfield_id="2024" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2024" tag="hblock_tag_1" canDelete="false" classfield_id="2024" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2025" tag="hblock_tag_2" canDelete="false" classfield_id="2025" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2025" tag="hblock_tag_3" canDelete="false" classfield_id="2025" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2026" tag="hblock_tag_4" canDelete="false" classfield_id="2026" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2026" tag="hblock_tag_5" canDelete="false" classfield_id="2026" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2027" tag="hblock_tag_6" canDelete="false" classfield_id="2027" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2027" tag="hblock_tag_7" canDelete="false" classfield_id="2027" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2028" tag="hblock_tag_8" canDelete="false" classfield_id="2028" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2028" tag="hblock_tag_9" canDelete="false" classfield_id="2028" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2029" tag="hblock_tag_10" canDelete="false" classfield_id="2029" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2029" tag="hblock_tag_11" canDelete="false" classfield_id="2029" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2030" tag="hblock_tag_12" canDelete="false" classfield_id="2030" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2030" tag="hblock_tag_13" canDelete="false" classfield_id="2030" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="2031" tag="operation_2031" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2038" tag="operation_2038" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2039" tag="operation_2039" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2040" tag="operation_2040" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2041" tag="operation_2041" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2042" tag="operation_2042" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2043" tag="operation_2043" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2044" tag="operation_2044" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2046" tag="operation_2046" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			plugininfo.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="2024" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2024" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2024" tag="hblock_tag_0" canDelete="false" classfield_id="2024" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2024" tag="hblock_tag_1" canDelete="false" classfield_id="2024" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2025" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2025" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2025" tag="hblock_tag_2" canDelete="false" classfield_id="2025" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2025" tag="hblock_tag_3" canDelete="false" classfield_id="2025" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2026" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2026" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2026" tag="hblock_tag_4" canDelete="false" classfield_id="2026" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2026" tag="hblock_tag_5" canDelete="false" classfield_id="2026" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2027" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2027" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2027" tag="hblock_tag_6" canDelete="false" classfield_id="2027" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2027" tag="hblock_tag_7" canDelete="false" classfield_id="2027" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2028" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2028" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2028" tag="hblock_tag_8" canDelete="false" classfield_id="2028" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2028" tag="hblock_tag_9" canDelete="false" classfield_id="2028" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2029" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2029" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2029" tag="hblock_tag_10" canDelete="false" classfield_id="2029" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2029" tag="hblock_tag_11" canDelete="false" classfield_id="2029" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2030" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2030" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2030" tag="hblock_tag_12" canDelete="false" classfield_id="2030" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2030" tag="hblock_tag_13" canDelete="false" classfield_id="2030" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2047" tqparent_class="2047" fileExt=".cpp" fileName="kisresource" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="2048" tag="hblock_tag_0" canDelete="false" classfield_id="2048" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2048" tag="hblock_tag_1" canDelete="false" classfield_id="2048" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2049" tag="hblock_tag_2" canDelete="false" classfield_id="2049" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2049" tag="hblock_tag_3" canDelete="false" classfield_id="2049" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2050" tag="hblock_tag_4" canDelete="false" classfield_id="2050" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2050" tag="hblock_tag_5" canDelete="false" classfield_id="2050" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2051" tag="hblock_tag_6" canDelete="false" classfield_id="2051" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2051" tag="hblock_tag_7" canDelete="false" classfield_id="2051" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2052" tag="hblock_tag_8" canDelete="false" classfield_id="2052" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2052" tag="hblock_tag_9" canDelete="false" classfield_id="2052" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2053" tag="hblock_tag_10" canDelete="false" classfield_id="2053" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2053" tag="hblock_tag_11" canDelete="false" classfield_id="2053" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2054" tag="hblock_tag_12" canDelete="false" classfield_id="2054" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2054" tag="hblock_tag_13" canDelete="false" classfield_id="2054" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="2055" tag="operation_2055" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2057" tag="operation_2057" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2059" tag="operation_2059" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Creates a new KisResource object using @p filename.  No file is opened&amp;#010;in the constructor, you have to call loadAsync.&amp;#010;&amp;#010;@param filename the file name to save and load from." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2061" tag="operation_2061" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2062" tag="operation_2062" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2063" tag="operation_2063" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2064" tag="operation_2064" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Returns a QImage representing this resource.  This image could be null." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2065" tag="operation_2065" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Load this resource asynchronously.  The signal loadComplete is emitted when&amp;#010;the resource has been loaded and valid flag is set to true." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2066" tag="operation_2066" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2067" tag="operation_2067" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Save this resource asynchronously.  The signal saveComplete is emitted when&amp;#010;the resource has been saved." />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2068" tag="operation_2068" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2070" tag="operation_2070" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2072" tag="operation_2072" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2074" tag="operation_2074" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2076" tag="operation_2076" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2078" tag="operation_2078" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2080" tag="operation_2080" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2082" tag="operation_2082" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2083" tag="operation_2083" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2084" tag="operation_2084" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2085" tag="operation_2085" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" text="Creates a new KisResource object using @p filename.  No file is opened&amp;#010;in the constructor, you have to call loadAsync.&amp;#010;&amp;#010;@param filename the file name to save and load from." />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisresource.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="2048" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2048" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2048" tag="hblock_tag_0" canDelete="false" classfield_id="2048" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2048" tag="hblock_tag_1" canDelete="false" classfield_id="2048" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2049" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2049" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2049" tag="hblock_tag_2" canDelete="false" classfield_id="2049" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2049" tag="hblock_tag_3" canDelete="false" classfield_id="2049" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2050" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2050" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2050" tag="hblock_tag_4" canDelete="false" classfield_id="2050" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2050" tag="hblock_tag_5" canDelete="false" classfield_id="2050" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2051" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2051" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2051" tag="hblock_tag_6" canDelete="false" classfield_id="2051" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2051" tag="hblock_tag_7" canDelete="false" classfield_id="2051" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2052" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2052" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2052" tag="hblock_tag_8" canDelete="false" classfield_id="2052" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2052" tag="hblock_tag_9" canDelete="false" classfield_id="2052" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2053" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2053" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2053" tag="hblock_tag_10" canDelete="false" classfield_id="2053" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2053" tag="hblock_tag_11" canDelete="false" classfield_id="2053" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2054" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2054" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2054" tag="hblock_tag_12" canDelete="false" classfield_id="2054" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2054" tag="hblock_tag_13" canDelete="false" classfield_id="2054" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2086" tqparent_class="2086" fileExt=".cpp" fileName="kisrenderinterface" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="2087" tag="operation_2087" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2089" tag="operation_2089" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2090" tag="operation_2090" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2092" tag="operation_2092" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2093" tag="operation_2093" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2095" tag="operation_2095" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2100" tag="operation_2100" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2102" tag="operation_2102" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2105" tag="operation_2105" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2106" tag="operation_2106" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2108" tag="operation_2108" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisrenderinterface.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2109" tqparent_class="2109" fileExt=".cpp" fileName="kispattern" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;kisresource.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="2110" tag="hblock_tag_0" canDelete="false" classfield_id="2110" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2110" tag="hblock_tag_1" canDelete="false" classfield_id="2110" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2111" tag="hblock_tag_2" canDelete="false" classfield_id="2111" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2111" tag="hblock_tag_3" canDelete="false" classfield_id="2111" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2112" tag="hblock_tag_4" canDelete="false" classfield_id="2112" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2112" tag="hblock_tag_5" canDelete="false" classfield_id="2112" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2113" tag="hblock_tag_6" canDelete="false" classfield_id="2113" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2113" tag="hblock_tag_7" canDelete="false" classfield_id="2113" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2114" tag="hblock_tag_8" canDelete="false" classfield_id="2114" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2114" tag="hblock_tag_9" canDelete="false" classfield_id="2114" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2115" tag="hblock_tag_10" canDelete="false" classfield_id="2115" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2115" tag="hblock_tag_11" canDelete="false" classfield_id="2115" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2116" tag="hblock_tag_12" canDelete="false" classfield_id="2116" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2116" tag="hblock_tag_13" canDelete="false" classfield_id="2116" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2422" tag="hblock_tag_14" canDelete="false" writeOutText="false" classfield_id="2422" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2422" tag="hblock_tag_15" canDelete="false" writeOutText="false" classfield_id="2422" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2422" tag="hblock_tag_16" canDelete="false" writeOutText="false" classfield_id="2422" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2422" tag="hblock_tag_17" canDelete="false" writeOutText="false" classfield_id="2422" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2422" tag="hblock_tag_18" canDelete="false" writeOutText="false" classfield_id="2422" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="2117" tag="operation_2117" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2119" tag="operation_2119" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2120" tag="operation_2120" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2121" tag="operation_2121" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2122" tag="operation_2122" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2123" tag="operation_2123" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2124" tag="operation_2124" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2125" tag="operation_2125" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2126" tag="operation_2126" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kispattern.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="2110" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2110" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2110" tag="hblock_tag_0" canDelete="false" classfield_id="2110" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2110" tag="hblock_tag_1" canDelete="false" classfield_id="2110" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2111" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2111" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2111" tag="hblock_tag_2" canDelete="false" classfield_id="2111" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2111" tag="hblock_tag_3" canDelete="false" classfield_id="2111" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2112" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2112" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2112" tag="hblock_tag_4" canDelete="false" classfield_id="2112" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2112" tag="hblock_tag_5" canDelete="false" classfield_id="2112" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2113" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2113" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2113" tag="hblock_tag_6" canDelete="false" classfield_id="2113" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2113" tag="hblock_tag_7" canDelete="false" classfield_id="2113" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2114" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2114" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2114" tag="hblock_tag_8" canDelete="false" classfield_id="2114" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2114" tag="hblock_tag_9" canDelete="false" classfield_id="2114" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2115" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2115" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2115" tag="hblock_tag_10" canDelete="false" classfield_id="2115" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2115" tag="hblock_tag_11" canDelete="false" classfield_id="2115" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2116" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2116" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2116" tag="hblock_tag_12" canDelete="false" classfield_id="2116" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2116" tag="hblock_tag_13" canDelete="false" classfield_id="2116" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2422" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2422" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2422" tag="hblock_tag_14" canDelete="false" writeOutText="false" classfield_id="2422" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2422" tag="hblock_tag_15" canDelete="false" writeOutText="false" classfield_id="2422" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2422" tag="hblock_tag_16" canDelete="false" writeOutText="false" classfield_id="2422" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2422" tag="hblock_tag_17" canDelete="false" writeOutText="false" classfield_id="2422" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2422" tag="hblock_tag_18" canDelete="false" writeOutText="false" classfield_id="2422" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2129" tqparent_class="2129" fileExt=".cpp" fileName="plugintype" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			plugintype.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2135" tqparent_class="2135" fileExt=".cpp" fileName="kistool" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="2441" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="2441" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2441" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="2441" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2441" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="2441" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2441" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="2441" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2441" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="2441" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="2136" tag="operation_2136" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2138" tag="operation_2138" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2139" tag="operation_2139" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2141" tag="operation_2141" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2142" tag="operation_2142" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2144" tag="operation_2144" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2146" tag="operation_2146" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2148" tag="operation_2148" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2150" tag="operation_2150" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2152" tag="operation_2152" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2154" tag="operation_2154" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2156" tag="operation_2156" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2158" tag="operation_2158" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2160" tag="operation_2160" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2162" tag="operation_2162" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2164" tag="operation_2164" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2167" tag="operation_2167" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2169" tag="operation_2169" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2171" tag="operation_2171" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2173" tag="operation_2173" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistool.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="2441" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2441" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2441" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="2441" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2441" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="2441" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2441" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="2441" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2441" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="2441" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2441" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="2441" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2174" tqparent_class="2174" fileExt=".cpp" fileName="kisundoadapter" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="2366" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="2366" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2366" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="2366" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2366" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="2366" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2366" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="2366" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2366" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="2366" role_id="1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="2175" tag="operation_2175" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2177" tag="operation_2177" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2178" tag="operation_2178" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2180" tag="operation_2180" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2182" tag="operation_2182" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2184" tag="operation_2184" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2185" tag="operation_2185" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2186" tag="operation_2186" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2188" tag="operation_2188" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2189" tag="operation_2189" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisundoadapter.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="2366" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2366" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2366" tag="hblock_tag_0" canDelete="false" writeOutText="false" classfield_id="2366" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2366" tag="hblock_tag_1" canDelete="false" writeOutText="false" classfield_id="2366" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2366" tag="hblock_tag_2" canDelete="false" writeOutText="false" classfield_id="2366" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2366" tag="hblock_tag_3" canDelete="false" writeOutText="false" classfield_id="2366" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2366" tag="hblock_tag_4" canDelete="false" writeOutText="false" classfield_id="2366" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2190" tqparent_class="2190" fileExt=".cpp" fileName="kistoolfactory" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;vkistool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="2192" tag="hblock_tag_0" canDelete="false" classfield_id="2192" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2192" tag="hblock_tag_1" canDelete="false" classfield_id="2192" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2191" tag="hblock_tag_7" canDelete="false" classfield_id="2191" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2191" tag="hblock_tag_8" canDelete="false" classfield_id="2191" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2191" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="2191" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2191" tag="hblock_tag_10" canDelete="false" writeOutText="false" classfield_id="2191" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2191" tag="hblock_tag_11" canDelete="false" writeOutText="false" classfield_id="2191" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="2193" tag="operation_2193" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2195" tag="operation_2195" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2196" tag="operation_2196" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2198" tag="operation_2198" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2201" tag="operation_2201" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2202" tag="operation_2202" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistoolfactory.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="2192" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2192" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2192" tag="hblock_tag_0" canDelete="false" classfield_id="2192" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2192" tag="hblock_tag_1" canDelete="false" classfield_id="2192" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2191" field_type="1" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2191" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2191" tag="hblock_tag_7" canDelete="false" classfield_id="2191" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2191" tag="hblock_tag_8" canDelete="false" classfield_id="2191" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2191" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="2191" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2191" tag="hblock_tag_10" canDelete="false" writeOutText="false" classfield_id="2191" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2191" tag="hblock_tag_11" canDelete="false" writeOutText="false" classfield_id="2191" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2191" field_type="1" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2191" tag="" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2191" tag="hblock_tag_7" canDelete="false" writeOutText="false" classfield_id="2191" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2191" tag="hblock_tag_8" canDelete="false" writeOutText="false" classfield_id="2191" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2191" tag="hblock_tag_9" canDelete="false" writeOutText="false" classfield_id="2191" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2191" tag="hblock_tag_10" canDelete="false" writeOutText="false" classfield_id="2191" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2191" tag="hblock_tag_11" canDelete="false" writeOutText="false" classfield_id="2191" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2203" tqparent_class="2203" fileExt=".cpp" fileName="kistoolcontrollerinterface" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="2204" tag="operation_2204" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2206" tag="operation_2206" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2207" tag="operation_2207" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2209" tag="operation_2209" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2210" tag="operation_2210" canDelete="false" writeOutText="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2212" tag="operation_2212" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistoolcontrollerinterface.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2218" tqparent_class="2218" fileExt=".cpp" fileName="kisutil" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;int.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeoperation tqparent_id="2219" tag="operation_2219" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2222" tag="operation_2222" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2224" tag="operation_2224" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2226" tag="operation_2226" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2229" tag="operation_2229" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2232" tag="operation_2232" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisutil.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2236" tqparent_class="2236" fileExt=".cpp" fileName="kisvector" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;kisvector.h&quot;&amp;#010;#include &quot;double.h&quot;&amp;#010;#include &quot;int.h&quot;&amp;#010;#include &quot;long.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="2237" tag="hblock_tag_0" canDelete="false" classfield_id="2237" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2237" tag="hblock_tag_1" canDelete="false" classfield_id="2237" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2238" tag="hblock_tag_2" canDelete="false" classfield_id="2238" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2238" tag="hblock_tag_3" canDelete="false" classfield_id="2238" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2239" tag="hblock_tag_4" canDelete="false" classfield_id="2239" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2239" tag="hblock_tag_5" canDelete="false" classfield_id="2239" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="2240" tag="operation_2240" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2243" tag="operation_2243" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2246" tag="operation_2246" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2249" tag="operation_2249" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2252" tag="operation_2252" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2255" tag="operation_2255" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2258" tag="operation_2258" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2261" tag="operation_2261" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2263" tag="operation_2263" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2265" tag="operation_2265" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2267" tag="operation_2267" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2270" tag="operation_2270" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2272" tag="operation_2272" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2274" tag="operation_2274" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2277" tag="operation_2277" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2279" tag="operation_2279" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2282" tag="operation_2282" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2285" tag="operation_2285" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2288" tag="operation_2288" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2290" tag="operation_2290" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2292" tag="operation_2292" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2294" tag="operation_2294" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2297" tag="operation_2297" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2298" tag="operation_2298" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2302" tag="operation_2302" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2306" tag="operation_2306" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2310" tag="operation_2310" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2312" tag="operation_2312" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2314" tag="operation_2314" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2315" tag="operation_2315" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2316" tag="operation_2316" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2317" tag="operation_2317" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2319" tag="operation_2319" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2321" tag="operation_2321" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2323" tag="operation_2323" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2324" tag="operation_2324" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2325" tag="operation_2325" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisvector.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="2237" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2237" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2237" tag="hblock_tag_0" canDelete="false" classfield_id="2237" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2237" tag="hblock_tag_1" canDelete="false" classfield_id="2237" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2238" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2238" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2238" tag="hblock_tag_2" canDelete="false" classfield_id="2238" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2238" tag="hblock_tag_3" canDelete="false" classfield_id="2238" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2239" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2239" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2239" tag="hblock_tag_4" canDelete="false" classfield_id="2239" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2239" tag="hblock_tag_5" canDelete="false" classfield_id="2239" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="2365" tqparent_class="2365" fileExt=".cpp" fileName="kisview" >
+     <textblocks>
+      <codeblockwithcomments tag="includes" text="#include &quot;string&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;double.h&quot;&amp;#010;#include &quot;kisguidesp.h&quot;&amp;#010;#include &quot;vkiscanvasobserver.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="constructionMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Constructors/Destructors" />
+       </header>
+       <textblocks/>
+      </hierarchicalcodeblock>
+      <hierarchicalcodeblock tag="otherMethodsBlock" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" text="Methods" />
+       </header>
+       <textblocks>
+        <codeaccessormethod accessType="0" tqparent_id="2367" tag="hblock_tag_0" canDelete="false" classfield_id="2367" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2367" tag="hblock_tag_1" canDelete="false" classfield_id="2367" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2370" tag="hblock_tag_2" canDelete="false" classfield_id="2370" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2370" tag="hblock_tag_3" canDelete="false" classfield_id="2370" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2371" tag="hblock_tag_4" canDelete="false" classfield_id="2371" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2371" tag="hblock_tag_5" canDelete="false" classfield_id="2371" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2372" tag="hblock_tag_6" canDelete="false" classfield_id="2372" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2372" tag="hblock_tag_7" canDelete="false" classfield_id="2372" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2373" tag="hblock_tag_8" canDelete="false" classfield_id="2373" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2373" tag="hblock_tag_9" canDelete="false" classfield_id="2373" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2374" tag="hblock_tag_10" canDelete="false" classfield_id="2374" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2374" tag="hblock_tag_11" canDelete="false" classfield_id="2374" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2375" tag="hblock_tag_12" canDelete="false" classfield_id="2375" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2375" tag="hblock_tag_13" canDelete="false" classfield_id="2375" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2376" tag="hblock_tag_14" canDelete="false" classfield_id="2376" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2376" tag="hblock_tag_15" canDelete="false" classfield_id="2376" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2377" tag="hblock_tag_16" canDelete="false" classfield_id="2377" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2377" tag="hblock_tag_17" canDelete="false" classfield_id="2377" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2378" tag="hblock_tag_18" canDelete="false" classfield_id="2378" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2378" tag="hblock_tag_19" canDelete="false" classfield_id="2378" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2379" tag="hblock_tag_20" canDelete="false" classfield_id="2379" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2379" tag="hblock_tag_21" canDelete="false" classfield_id="2379" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2380" tag="hblock_tag_22" canDelete="false" classfield_id="2380" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2380" tag="hblock_tag_23" canDelete="false" classfield_id="2380" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2381" tag="hblock_tag_24" canDelete="false" classfield_id="2381" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2381" tag="hblock_tag_25" canDelete="false" classfield_id="2381" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2383" tag="hblock_tag_26" canDelete="false" classfield_id="2383" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2383" tag="hblock_tag_27" canDelete="false" classfield_id="2383" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2384" tag="hblock_tag_28" canDelete="false" classfield_id="2384" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2384" tag="hblock_tag_29" canDelete="false" classfield_id="2384" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2386" tag="hblock_tag_30" canDelete="false" classfield_id="2386" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2386" tag="hblock_tag_31" canDelete="false" classfield_id="2386" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2387" tag="hblock_tag_32" canDelete="false" classfield_id="2387" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2387" tag="hblock_tag_33" canDelete="false" classfield_id="2387" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2388" tag="hblock_tag_34" canDelete="false" classfield_id="2388" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2388" tag="hblock_tag_35" canDelete="false" classfield_id="2388" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2389" tag="hblock_tag_36" canDelete="false" classfield_id="2389" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2389" tag="hblock_tag_37" canDelete="false" classfield_id="2389" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2391" tag="hblock_tag_38" canDelete="false" classfield_id="2391" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2391" tag="hblock_tag_39" canDelete="false" classfield_id="2391" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2392" tag="hblock_tag_40" canDelete="false" classfield_id="2392" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2392" tag="hblock_tag_41" canDelete="false" classfield_id="2392" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2393" tag="hblock_tag_42" canDelete="false" classfield_id="2393" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2393" tag="hblock_tag_43" canDelete="false" classfield_id="2393" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2394" tag="hblock_tag_44" canDelete="false" classfield_id="2394" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2394" tag="hblock_tag_45" canDelete="false" classfield_id="2394" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2395" tag="hblock_tag_46" canDelete="false" classfield_id="2395" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2395" tag="hblock_tag_47" canDelete="false" classfield_id="2395" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2396" tag="hblock_tag_48" canDelete="false" classfield_id="2396" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2396" tag="hblock_tag_49" canDelete="false" classfield_id="2396" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2397" tag="hblock_tag_50" canDelete="false" classfield_id="2397" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2397" tag="hblock_tag_51" canDelete="false" classfield_id="2397" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2398" tag="hblock_tag_52" canDelete="false" classfield_id="2398" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2398" tag="hblock_tag_53" canDelete="false" classfield_id="2398" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2399" tag="hblock_tag_54" canDelete="false" classfield_id="2399" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2399" tag="hblock_tag_55" canDelete="false" classfield_id="2399" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2400" tag="hblock_tag_56" canDelete="false" classfield_id="2400" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2400" tag="hblock_tag_57" canDelete="false" classfield_id="2400" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2401" tag="hblock_tag_58" canDelete="false" classfield_id="2401" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2401" tag="hblock_tag_59" canDelete="false" classfield_id="2401" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2402" tag="hblock_tag_60" canDelete="false" classfield_id="2402" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2402" tag="hblock_tag_61" canDelete="false" classfield_id="2402" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2403" tag="hblock_tag_62" canDelete="false" classfield_id="2403" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2403" tag="hblock_tag_63" canDelete="false" classfield_id="2403" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2404" tag="hblock_tag_64" canDelete="false" classfield_id="2404" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2404" tag="hblock_tag_65" canDelete="false" classfield_id="2404" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2405" tag="hblock_tag_66" canDelete="false" classfield_id="2405" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2405" tag="hblock_tag_67" canDelete="false" classfield_id="2405" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2406" tag="hblock_tag_68" canDelete="false" classfield_id="2406" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2406" tag="hblock_tag_69" canDelete="false" classfield_id="2406" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2407" tag="hblock_tag_70" canDelete="false" classfield_id="2407" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2407" tag="hblock_tag_71" canDelete="false" classfield_id="2407" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2408" tag="hblock_tag_72" canDelete="false" classfield_id="2408" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2408" tag="hblock_tag_73" canDelete="false" classfield_id="2408" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2409" tag="hblock_tag_74" canDelete="false" classfield_id="2409" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2409" tag="hblock_tag_75" canDelete="false" classfield_id="2409" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2410" tag="hblock_tag_76" canDelete="false" classfield_id="2410" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2410" tag="hblock_tag_77" canDelete="false" classfield_id="2410" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2411" tag="hblock_tag_78" canDelete="false" classfield_id="2411" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2411" tag="hblock_tag_79" canDelete="false" classfield_id="2411" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2412" tag="hblock_tag_80" canDelete="false" classfield_id="2412" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2412" tag="hblock_tag_81" canDelete="false" classfield_id="2412" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2413" tag="hblock_tag_82" canDelete="false" classfield_id="2413" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2413" tag="hblock_tag_83" canDelete="false" classfield_id="2413" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2414" tag="hblock_tag_84" canDelete="false" classfield_id="2414" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2414" tag="hblock_tag_85" canDelete="false" classfield_id="2414" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2415" tag="hblock_tag_86" canDelete="false" classfield_id="2415" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2415" tag="hblock_tag_87" canDelete="false" classfield_id="2415" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2416" tag="hblock_tag_88" canDelete="false" classfield_id="2416" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2416" tag="hblock_tag_89" canDelete="false" classfield_id="2416" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2417" tag="hblock_tag_90" canDelete="false" classfield_id="2417" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2417" tag="hblock_tag_91" canDelete="false" classfield_id="2417" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2418" tag="hblock_tag_92" canDelete="false" classfield_id="2418" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2418" tag="hblock_tag_93" canDelete="false" classfield_id="2418" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2419" tag="hblock_tag_94" canDelete="false" classfield_id="2419" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2419" tag="hblock_tag_95" canDelete="false" classfield_id="2419" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2420" tag="hblock_tag_96" canDelete="false" classfield_id="2420" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2420" tag="hblock_tag_97" canDelete="false" classfield_id="2420" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2421" tag="hblock_tag_98" canDelete="false" classfield_id="2421" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2421" tag="hblock_tag_99" canDelete="false" classfield_id="2421" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2424" tag="hblock_tag_100" canDelete="false" classfield_id="2424" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2424" tag="hblock_tag_101" canDelete="false" classfield_id="2424" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2425" tag="hblock_tag_102" canDelete="false" classfield_id="2425" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2425" tag="hblock_tag_103" canDelete="false" classfield_id="2425" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2426" tag="hblock_tag_104" canDelete="false" classfield_id="2426" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2426" tag="hblock_tag_105" canDelete="false" classfield_id="2426" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2427" tag="hblock_tag_106" canDelete="false" classfield_id="2427" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2427" tag="hblock_tag_107" canDelete="false" classfield_id="2427" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2428" tag="hblock_tag_108" canDelete="false" classfield_id="2428" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2428" tag="hblock_tag_109" canDelete="false" classfield_id="2428" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2429" tag="hblock_tag_110" canDelete="false" classfield_id="2429" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2429" tag="hblock_tag_111" canDelete="false" classfield_id="2429" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2430" tag="hblock_tag_112" canDelete="false" classfield_id="2430" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2430" tag="hblock_tag_113" canDelete="false" classfield_id="2430" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2431" tag="hblock_tag_114" canDelete="false" classfield_id="2431" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2431" tag="hblock_tag_115" canDelete="false" classfield_id="2431" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2432" tag="hblock_tag_116" canDelete="false" classfield_id="2432" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2432" tag="hblock_tag_117" canDelete="false" classfield_id="2432" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2433" tag="hblock_tag_118" canDelete="false" classfield_id="2433" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2433" tag="hblock_tag_119" canDelete="false" classfield_id="2433" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2434" tag="hblock_tag_120" canDelete="false" classfield_id="2434" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2434" tag="hblock_tag_121" canDelete="false" classfield_id="2434" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2435" tag="hblock_tag_122" canDelete="false" classfield_id="2435" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2435" tag="hblock_tag_123" canDelete="false" classfield_id="2435" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2436" tag="hblock_tag_124" canDelete="false" classfield_id="2436" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2436" tag="hblock_tag_125" canDelete="false" classfield_id="2436" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2437" tag="hblock_tag_126" canDelete="false" classfield_id="2437" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2437" tag="hblock_tag_127" canDelete="false" classfield_id="2437" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2438" tag="hblock_tag_128" canDelete="false" classfield_id="2438" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2438" tag="hblock_tag_129" canDelete="false" classfield_id="2438" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2439" tag="hblock_tag_130" canDelete="false" classfield_id="2439" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2439" tag="hblock_tag_131" canDelete="false" classfield_id="2439" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2440" tag="hblock_tag_132" canDelete="false" classfield_id="2440" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2440" tag="hblock_tag_133" canDelete="false" classfield_id="2440" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2442" tag="hblock_tag_134" canDelete="false" classfield_id="2442" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2442" tag="hblock_tag_135" canDelete="false" classfield_id="2442" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2443" tag="hblock_tag_136" canDelete="false" classfield_id="2443" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2443" tag="hblock_tag_137" canDelete="false" classfield_id="2443" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2444" tag="hblock_tag_138" canDelete="false" classfield_id="2444" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2444" tag="hblock_tag_139" canDelete="false" classfield_id="2444" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2445" tag="hblock_tag_140" canDelete="false" classfield_id="2445" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2445" tag="hblock_tag_141" canDelete="false" classfield_id="2445" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2446" tag="hblock_tag_142" canDelete="false" classfield_id="2446" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2446" tag="hblock_tag_143" canDelete="false" classfield_id="2446" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2447" tag="hblock_tag_144" canDelete="false" classfield_id="2447" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2447" tag="hblock_tag_145" canDelete="false" classfield_id="2447" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2366" tag="hblock_tag_146" canDelete="false" classfield_id="2366" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2366" tag="hblock_tag_147" canDelete="false" classfield_id="2366" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2366" tag="hblock_tag_148" canDelete="false" writeOutText="false" classfield_id="2366" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2366" tag="hblock_tag_149" canDelete="false" writeOutText="false" classfield_id="2366" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2366" tag="hblock_tag_150" canDelete="false" writeOutText="false" classfield_id="2366" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2368" tag="hblock_tag_151" canDelete="false" classfield_id="2368" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2368" tag="hblock_tag_152" canDelete="false" classfield_id="2368" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2368" tag="hblock_tag_153" canDelete="false" writeOutText="false" classfield_id="2368" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2368" tag="hblock_tag_154" canDelete="false" writeOutText="false" classfield_id="2368" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2368" tag="hblock_tag_155" canDelete="false" writeOutText="false" classfield_id="2368" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2369" tag="hblock_tag_156" canDelete="false" classfield_id="2369" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2369" tag="hblock_tag_157" canDelete="false" classfield_id="2369" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2369" tag="hblock_tag_158" canDelete="false" writeOutText="false" classfield_id="2369" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2369" tag="hblock_tag_159" canDelete="false" writeOutText="false" classfield_id="2369" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2369" tag="hblock_tag_160" canDelete="false" writeOutText="false" classfield_id="2369" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2382" tag="hblock_tag_161" canDelete="false" classfield_id="2382" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2382" tag="hblock_tag_162" canDelete="false" classfield_id="2382" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2382" tag="hblock_tag_163" canDelete="false" writeOutText="false" classfield_id="2382" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2382" tag="hblock_tag_164" canDelete="false" writeOutText="false" classfield_id="2382" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2382" tag="hblock_tag_165" canDelete="false" writeOutText="false" classfield_id="2382" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2385" tag="hblock_tag_166" canDelete="false" classfield_id="2385" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2385" tag="hblock_tag_167" canDelete="false" classfield_id="2385" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2385" tag="hblock_tag_168" canDelete="false" writeOutText="false" classfield_id="2385" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2385" tag="hblock_tag_169" canDelete="false" writeOutText="false" classfield_id="2385" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2385" tag="hblock_tag_170" canDelete="false" writeOutText="false" classfield_id="2385" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2390" tag="hblock_tag_171" canDelete="false" classfield_id="2390" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2390" tag="hblock_tag_172" canDelete="false" classfield_id="2390" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2390" tag="hblock_tag_173" canDelete="false" writeOutText="false" classfield_id="2390" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2390" tag="hblock_tag_174" canDelete="false" writeOutText="false" classfield_id="2390" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2390" tag="hblock_tag_175" canDelete="false" writeOutText="false" classfield_id="2390" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2422" tag="hblock_tag_176" canDelete="false" classfield_id="2422" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2422" tag="hblock_tag_177" canDelete="false" classfield_id="2422" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2422" tag="hblock_tag_178" canDelete="false" writeOutText="false" classfield_id="2422" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2422" tag="hblock_tag_179" canDelete="false" writeOutText="false" classfield_id="2422" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2422" tag="hblock_tag_180" canDelete="false" writeOutText="false" classfield_id="2422" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2423" tag="hblock_tag_181" canDelete="false" classfield_id="2423" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2423" tag="hblock_tag_182" canDelete="false" classfield_id="2423" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2423" tag="hblock_tag_183" canDelete="false" writeOutText="false" classfield_id="2423" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2423" tag="hblock_tag_184" canDelete="false" writeOutText="false" classfield_id="2423" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2423" tag="hblock_tag_185" canDelete="false" writeOutText="false" classfield_id="2423" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="0" tqparent_id="2441" tag="hblock_tag_186" canDelete="false" classfield_id="2441" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="1" tqparent_id="2441" tag="hblock_tag_187" canDelete="false" classfield_id="2441" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="2" tqparent_id="2441" tag="hblock_tag_188" canDelete="false" writeOutText="false" classfield_id="2441" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="3" tqparent_id="2441" tag="hblock_tag_189" canDelete="false" writeOutText="false" classfield_id="2441" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeaccessormethod accessType="4" tqparent_id="2441" tag="hblock_tag_190" canDelete="false" writeOutText="false" classfield_id="2441" role_id="0" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeaccessormethod>
+        <codeoperation tqparent_id="2448" tag="operation_2448" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2453" tag="operation_2453" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2455" tag="operation_2455" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2456" tag="operation_2456" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2457" tag="operation_2457" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2458" tag="operation_2458" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2459" tag="operation_2459" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2460" tag="operation_2460" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2462" tag="operation_2462" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2463" tag="operation_2463" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2464" tag="operation_2464" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2465" tag="operation_2465" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2466" tag="operation_2466" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2467" tag="operation_2467" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2468" tag="operation_2468" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2469" tag="operation_2469" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2470" tag="operation_2470" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2472" tag="operation_2472" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2473" tag="operation_2473" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2474" tag="operation_2474" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2475" tag="operation_2475" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2476" tag="operation_2476" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2477" tag="operation_2477" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2480" tag="operation_2480" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2481" tag="operation_2481" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2484" tag="operation_2484" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2486" tag="operation_2486" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2487" tag="operation_2487" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2488" tag="operation_2488" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2492" tag="operation_2492" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2494" tag="operation_2494" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2495" tag="operation_2495" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2496" tag="operation_2496" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2498" tag="operation_2498" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2500" tag="operation_2500" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2502" tag="operation_2502" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2504" tag="operation_2504" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2506" tag="operation_2506" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2508" tag="operation_2508" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2510" tag="operation_2510" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2512" tag="operation_2512" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2514" tag="operation_2514" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2515" tag="operation_2515" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2516" tag="operation_2516" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2517" tag="operation_2517" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2519" tag="operation_2519" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2520" tag="operation_2520" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2521" tag="operation_2521" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2522" tag="operation_2522" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2523" tag="operation_2523" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2524" tag="operation_2524" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2525" tag="operation_2525" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2526" tag="operation_2526" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2527" tag="operation_2527" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2528" tag="operation_2528" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2533" tag="operation_2533" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2535" tag="operation_2535" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2536" tag="operation_2536" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2538" tag="operation_2538" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2539" tag="operation_2539" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2542" tag="operation_2542" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2544" tag="operation_2544" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2546" tag="operation_2546" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2549" tag="operation_2549" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2551" tag="operation_2551" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2553" tag="operation_2553" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2554" tag="operation_2554" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2555" tag="operation_2555" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2558" tag="operation_2558" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2559" tag="operation_2559" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2562" tag="operation_2562" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+        <codeoperation tqparent_id="2566" tag="operation_2566" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodedocumentation tag="" />
+         </header>
+        </codeoperation>
+       </textblocks>
+      </hierarchicalcodeblock>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisview.cpp - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="2367" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2367" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2367" tag="hblock_tag_0" canDelete="false" classfield_id="2367" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2367" tag="hblock_tag_1" canDelete="false" classfield_id="2367" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2370" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2370" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2370" tag="hblock_tag_2" canDelete="false" classfield_id="2370" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2370" tag="hblock_tag_3" canDelete="false" classfield_id="2370" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2371" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2371" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2371" tag="hblock_tag_4" canDelete="false" classfield_id="2371" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2371" tag="hblock_tag_5" canDelete="false" classfield_id="2371" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2372" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2372" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2372" tag="hblock_tag_6" canDelete="false" classfield_id="2372" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2372" tag="hblock_tag_7" canDelete="false" classfield_id="2372" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2373" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2373" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2373" tag="hblock_tag_8" canDelete="false" classfield_id="2373" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2373" tag="hblock_tag_9" canDelete="false" classfield_id="2373" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2374" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2374" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2374" tag="hblock_tag_10" canDelete="false" classfield_id="2374" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2374" tag="hblock_tag_11" canDelete="false" classfield_id="2374" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2375" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2375" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2375" tag="hblock_tag_12" canDelete="false" classfield_id="2375" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2375" tag="hblock_tag_13" canDelete="false" classfield_id="2375" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2376" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2376" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2376" tag="hblock_tag_14" canDelete="false" classfield_id="2376" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2376" tag="hblock_tag_15" canDelete="false" classfield_id="2376" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2377" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2377" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2377" tag="hblock_tag_16" canDelete="false" classfield_id="2377" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2377" tag="hblock_tag_17" canDelete="false" classfield_id="2377" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2378" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2378" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2378" tag="hblock_tag_18" canDelete="false" classfield_id="2378" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2378" tag="hblock_tag_19" canDelete="false" classfield_id="2378" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2379" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2379" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2379" tag="hblock_tag_20" canDelete="false" classfield_id="2379" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2379" tag="hblock_tag_21" canDelete="false" classfield_id="2379" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2380" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2380" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2380" tag="hblock_tag_22" canDelete="false" classfield_id="2380" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2380" tag="hblock_tag_23" canDelete="false" classfield_id="2380" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2381" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2381" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2381" tag="hblock_tag_24" canDelete="false" classfield_id="2381" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2381" tag="hblock_tag_25" canDelete="false" classfield_id="2381" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2383" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2383" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2383" tag="hblock_tag_26" canDelete="false" classfield_id="2383" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2383" tag="hblock_tag_27" canDelete="false" classfield_id="2383" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2384" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2384" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2384" tag="hblock_tag_28" canDelete="false" classfield_id="2384" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2384" tag="hblock_tag_29" canDelete="false" classfield_id="2384" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2386" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2386" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2386" tag="hblock_tag_30" canDelete="false" classfield_id="2386" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2386" tag="hblock_tag_31" canDelete="false" classfield_id="2386" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2387" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2387" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2387" tag="hblock_tag_32" canDelete="false" classfield_id="2387" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2387" tag="hblock_tag_33" canDelete="false" classfield_id="2387" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2388" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2388" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2388" tag="hblock_tag_34" canDelete="false" classfield_id="2388" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2388" tag="hblock_tag_35" canDelete="false" classfield_id="2388" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2389" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2389" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2389" tag="hblock_tag_36" canDelete="false" classfield_id="2389" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2389" tag="hblock_tag_37" canDelete="false" classfield_id="2389" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2391" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2391" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2391" tag="hblock_tag_38" canDelete="false" classfield_id="2391" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2391" tag="hblock_tag_39" canDelete="false" classfield_id="2391" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2392" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2392" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2392" tag="hblock_tag_40" canDelete="false" classfield_id="2392" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2392" tag="hblock_tag_41" canDelete="false" classfield_id="2392" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2393" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2393" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2393" tag="hblock_tag_42" canDelete="false" classfield_id="2393" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2393" tag="hblock_tag_43" canDelete="false" classfield_id="2393" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2394" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2394" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2394" tag="hblock_tag_44" canDelete="false" classfield_id="2394" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2394" tag="hblock_tag_45" canDelete="false" classfield_id="2394" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2395" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2395" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2395" tag="hblock_tag_46" canDelete="false" classfield_id="2395" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2395" tag="hblock_tag_47" canDelete="false" classfield_id="2395" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2396" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2396" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2396" tag="hblock_tag_48" canDelete="false" classfield_id="2396" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2396" tag="hblock_tag_49" canDelete="false" classfield_id="2396" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2397" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2397" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2397" tag="hblock_tag_50" canDelete="false" classfield_id="2397" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2397" tag="hblock_tag_51" canDelete="false" classfield_id="2397" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2398" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2398" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2398" tag="hblock_tag_52" canDelete="false" classfield_id="2398" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2398" tag="hblock_tag_53" canDelete="false" classfield_id="2398" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2399" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2399" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2399" tag="hblock_tag_54" canDelete="false" classfield_id="2399" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2399" tag="hblock_tag_55" canDelete="false" classfield_id="2399" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2400" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2400" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2400" tag="hblock_tag_56" canDelete="false" classfield_id="2400" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2400" tag="hblock_tag_57" canDelete="false" classfield_id="2400" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2401" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2401" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2401" tag="hblock_tag_58" canDelete="false" classfield_id="2401" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2401" tag="hblock_tag_59" canDelete="false" classfield_id="2401" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2402" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2402" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2402" tag="hblock_tag_60" canDelete="false" classfield_id="2402" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2402" tag="hblock_tag_61" canDelete="false" classfield_id="2402" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2403" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2403" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2403" tag="hblock_tag_62" canDelete="false" classfield_id="2403" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2403" tag="hblock_tag_63" canDelete="false" classfield_id="2403" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2404" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2404" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2404" tag="hblock_tag_64" canDelete="false" classfield_id="2404" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2404" tag="hblock_tag_65" canDelete="false" classfield_id="2404" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2405" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2405" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2405" tag="hblock_tag_66" canDelete="false" classfield_id="2405" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2405" tag="hblock_tag_67" canDelete="false" classfield_id="2405" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2406" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2406" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2406" tag="hblock_tag_68" canDelete="false" classfield_id="2406" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2406" tag="hblock_tag_69" canDelete="false" classfield_id="2406" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2407" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2407" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2407" tag="hblock_tag_70" canDelete="false" classfield_id="2407" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2407" tag="hblock_tag_71" canDelete="false" classfield_id="2407" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2408" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2408" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2408" tag="hblock_tag_72" canDelete="false" classfield_id="2408" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2408" tag="hblock_tag_73" canDelete="false" classfield_id="2408" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2409" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2409" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2409" tag="hblock_tag_74" canDelete="false" classfield_id="2409" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2409" tag="hblock_tag_75" canDelete="false" classfield_id="2409" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2410" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2410" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2410" tag="hblock_tag_76" canDelete="false" classfield_id="2410" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2410" tag="hblock_tag_77" canDelete="false" classfield_id="2410" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2411" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2411" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2411" tag="hblock_tag_78" canDelete="false" classfield_id="2411" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2411" tag="hblock_tag_79" canDelete="false" classfield_id="2411" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2412" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2412" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2412" tag="hblock_tag_80" canDelete="false" classfield_id="2412" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2412" tag="hblock_tag_81" canDelete="false" classfield_id="2412" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2413" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2413" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2413" tag="hblock_tag_82" canDelete="false" classfield_id="2413" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2413" tag="hblock_tag_83" canDelete="false" classfield_id="2413" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2414" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2414" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2414" tag="hblock_tag_84" canDelete="false" classfield_id="2414" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2414" tag="hblock_tag_85" canDelete="false" classfield_id="2414" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2415" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2415" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2415" tag="hblock_tag_86" canDelete="false" classfield_id="2415" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2415" tag="hblock_tag_87" canDelete="false" classfield_id="2415" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2416" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2416" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2416" tag="hblock_tag_88" canDelete="false" classfield_id="2416" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2416" tag="hblock_tag_89" canDelete="false" classfield_id="2416" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2417" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2417" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2417" tag="hblock_tag_90" canDelete="false" classfield_id="2417" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2417" tag="hblock_tag_91" canDelete="false" classfield_id="2417" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2418" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2418" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2418" tag="hblock_tag_92" canDelete="false" classfield_id="2418" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2418" tag="hblock_tag_93" canDelete="false" classfield_id="2418" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2419" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2419" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2419" tag="hblock_tag_94" canDelete="false" classfield_id="2419" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2419" tag="hblock_tag_95" canDelete="false" classfield_id="2419" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2420" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2420" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2420" tag="hblock_tag_96" canDelete="false" classfield_id="2420" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2420" tag="hblock_tag_97" canDelete="false" classfield_id="2420" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2421" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2421" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2421" tag="hblock_tag_98" canDelete="false" classfield_id="2421" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2421" tag="hblock_tag_99" canDelete="false" classfield_id="2421" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2424" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2424" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2424" tag="hblock_tag_100" canDelete="false" classfield_id="2424" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2424" tag="hblock_tag_101" canDelete="false" classfield_id="2424" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2425" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2425" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2425" tag="hblock_tag_102" canDelete="false" classfield_id="2425" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2425" tag="hblock_tag_103" canDelete="false" classfield_id="2425" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2426" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2426" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2426" tag="hblock_tag_104" canDelete="false" classfield_id="2426" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2426" tag="hblock_tag_105" canDelete="false" classfield_id="2426" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2427" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2427" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2427" tag="hblock_tag_106" canDelete="false" classfield_id="2427" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2427" tag="hblock_tag_107" canDelete="false" classfield_id="2427" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2428" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2428" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2428" tag="hblock_tag_108" canDelete="false" classfield_id="2428" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2428" tag="hblock_tag_109" canDelete="false" classfield_id="2428" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2429" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2429" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2429" tag="hblock_tag_110" canDelete="false" classfield_id="2429" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2429" tag="hblock_tag_111" canDelete="false" classfield_id="2429" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2430" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2430" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2430" tag="hblock_tag_112" canDelete="false" classfield_id="2430" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2430" tag="hblock_tag_113" canDelete="false" classfield_id="2430" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2431" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2431" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2431" tag="hblock_tag_114" canDelete="false" classfield_id="2431" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2431" tag="hblock_tag_115" canDelete="false" classfield_id="2431" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2432" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2432" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2432" tag="hblock_tag_116" canDelete="false" classfield_id="2432" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2432" tag="hblock_tag_117" canDelete="false" classfield_id="2432" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2433" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2433" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2433" tag="hblock_tag_118" canDelete="false" classfield_id="2433" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2433" tag="hblock_tag_119" canDelete="false" classfield_id="2433" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2434" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2434" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2434" tag="hblock_tag_120" canDelete="false" classfield_id="2434" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2434" tag="hblock_tag_121" canDelete="false" classfield_id="2434" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2435" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2435" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2435" tag="hblock_tag_122" canDelete="false" classfield_id="2435" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2435" tag="hblock_tag_123" canDelete="false" classfield_id="2435" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2436" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2436" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2436" tag="hblock_tag_124" canDelete="false" classfield_id="2436" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2436" tag="hblock_tag_125" canDelete="false" classfield_id="2436" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2437" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2437" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2437" tag="hblock_tag_126" canDelete="false" classfield_id="2437" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2437" tag="hblock_tag_127" canDelete="false" classfield_id="2437" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2438" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2438" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2438" tag="hblock_tag_128" canDelete="false" classfield_id="2438" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2438" tag="hblock_tag_129" canDelete="false" classfield_id="2438" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2439" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2439" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2439" tag="hblock_tag_130" canDelete="false" classfield_id="2439" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2439" tag="hblock_tag_131" canDelete="false" classfield_id="2439" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2440" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2440" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2440" tag="hblock_tag_132" canDelete="false" classfield_id="2440" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2440" tag="hblock_tag_133" canDelete="false" classfield_id="2440" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2442" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2442" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2442" tag="hblock_tag_134" canDelete="false" classfield_id="2442" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2442" tag="hblock_tag_135" canDelete="false" classfield_id="2442" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2443" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2443" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2443" tag="hblock_tag_136" canDelete="false" classfield_id="2443" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2443" tag="hblock_tag_137" canDelete="false" classfield_id="2443" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2444" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2444" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2444" tag="hblock_tag_138" canDelete="false" classfield_id="2444" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2444" tag="hblock_tag_139" canDelete="false" classfield_id="2444" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2445" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2445" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2445" tag="hblock_tag_140" canDelete="false" classfield_id="2445" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2445" tag="hblock_tag_141" canDelete="false" classfield_id="2445" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2446" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2446" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2446" tag="hblock_tag_142" canDelete="false" classfield_id="2446" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2446" tag="hblock_tag_143" canDelete="false" classfield_id="2446" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2447" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2447" tag="" canDelete="false" indentLevel="1" role_id="-1" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2447" tag="hblock_tag_144" canDelete="false" classfield_id="2447" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2447" tag="hblock_tag_145" canDelete="false" classfield_id="2447" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2366" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2366" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2366" tag="hblock_tag_146" canDelete="false" classfield_id="2366" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2366" tag="hblock_tag_147" canDelete="false" classfield_id="2366" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2366" tag="hblock_tag_148" canDelete="false" writeOutText="false" classfield_id="2366" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2366" tag="hblock_tag_149" canDelete="false" writeOutText="false" classfield_id="2366" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2366" tag="hblock_tag_150" canDelete="false" writeOutText="false" classfield_id="2366" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2368" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2368" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2368" tag="hblock_tag_151" canDelete="false" classfield_id="2368" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2368" tag="hblock_tag_152" canDelete="false" classfield_id="2368" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2368" tag="hblock_tag_153" canDelete="false" writeOutText="false" classfield_id="2368" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2368" tag="hblock_tag_154" canDelete="false" writeOutText="false" classfield_id="2368" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2368" tag="hblock_tag_155" canDelete="false" writeOutText="false" classfield_id="2368" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2369" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2369" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2369" tag="hblock_tag_156" canDelete="false" classfield_id="2369" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2369" tag="hblock_tag_157" canDelete="false" classfield_id="2369" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2369" tag="hblock_tag_158" canDelete="false" writeOutText="false" classfield_id="2369" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2369" tag="hblock_tag_159" canDelete="false" writeOutText="false" classfield_id="2369" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2369" tag="hblock_tag_160" canDelete="false" writeOutText="false" classfield_id="2369" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2382" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2382" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2382" tag="hblock_tag_161" canDelete="false" classfield_id="2382" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2382" tag="hblock_tag_162" canDelete="false" classfield_id="2382" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2382" tag="hblock_tag_163" canDelete="false" writeOutText="false" classfield_id="2382" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2382" tag="hblock_tag_164" canDelete="false" writeOutText="false" classfield_id="2382" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2382" tag="hblock_tag_165" canDelete="false" writeOutText="false" classfield_id="2382" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2385" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2385" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2385" tag="hblock_tag_166" canDelete="false" classfield_id="2385" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2385" tag="hblock_tag_167" canDelete="false" classfield_id="2385" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2385" tag="hblock_tag_168" canDelete="false" writeOutText="false" classfield_id="2385" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2385" tag="hblock_tag_169" canDelete="false" writeOutText="false" classfield_id="2385" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2385" tag="hblock_tag_170" canDelete="false" writeOutText="false" classfield_id="2385" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2390" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2390" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2390" tag="hblock_tag_171" canDelete="false" classfield_id="2390" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2390" tag="hblock_tag_172" canDelete="false" classfield_id="2390" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2390" tag="hblock_tag_173" canDelete="false" writeOutText="false" classfield_id="2390" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2390" tag="hblock_tag_174" canDelete="false" writeOutText="false" classfield_id="2390" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2390" tag="hblock_tag_175" canDelete="false" writeOutText="false" classfield_id="2390" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2422" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2422" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2422" tag="hblock_tag_176" canDelete="false" classfield_id="2422" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2422" tag="hblock_tag_177" canDelete="false" classfield_id="2422" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2422" tag="hblock_tag_178" canDelete="false" writeOutText="false" classfield_id="2422" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2422" tag="hblock_tag_179" canDelete="false" writeOutText="false" classfield_id="2422" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2422" tag="hblock_tag_180" canDelete="false" writeOutText="false" classfield_id="2422" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2423" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2423" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2423" tag="hblock_tag_181" canDelete="false" classfield_id="2423" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2423" tag="hblock_tag_182" canDelete="false" classfield_id="2423" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2423" tag="hblock_tag_183" canDelete="false" writeOutText="false" classfield_id="2423" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2423" tag="hblock_tag_184" canDelete="false" writeOutText="false" classfield_id="2423" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2423" tag="hblock_tag_185" canDelete="false" writeOutText="false" classfield_id="2423" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2441" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2441" tag="" canDelete="false" indentLevel="1" role_id="0" text="FIX ME;" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2441" tag="hblock_tag_186" canDelete="false" classfield_id="2441" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2441" tag="hblock_tag_187" canDelete="false" classfield_id="2441" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2441" tag="hblock_tag_188" canDelete="false" writeOutText="false" classfield_id="2441" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2441" tag="hblock_tag_189" canDelete="false" writeOutText="false" classfield_id="2441" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2441" tag="hblock_tag_190" canDelete="false" writeOutText="false" classfield_id="2441" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <codedocument writeOutCode="false" package="" id="Makefile_DOC" fileExt="" fileName="Makefile" >
+     <textblocks/>
+     <header>
+      <codecomment tag="" />
+     </header>
+    </codedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader9" tqparent_class="9" fileExt=".h" fileName="kisbuildersubject" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISBUILDERSUBJECT_H&amp;#010;#define KISBUILDERSUBJECT_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="9" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisBuilderSubject&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisBuilderSubject ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="10" tag="operation_10" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="11" tag="operation_11" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISBUILDERSUBJECT_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisbuildersubject.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader12" tqparent_class="12" fileExt=".h" fileName="kisimagemagickconverter" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISIMAGEMAGICKCONVERTER_H&amp;#010;#define KISIMAGEMAGICKCONVERTER_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;kisimagebuilder_result.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="12" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisImageMagickConverter&amp;#010;Build a KisImage representation of an image file." />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisImageMagickConverter ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="20" tag="operation_20" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param doc &amp;#010;@param adapter " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="25" tag="operation_25" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param uri &amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="28" tag="operation_28" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param uri &amp;#010;@param layer " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="31" tag="operation_31" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param uri " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="36" tag="operation_36" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="40" tag="operation_40" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="41" tag="operation_41" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="42" tag="operation_42" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="43" tag="operation_43" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="18" tag="operation_18" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="23" tag="operation_23" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="33" tag="operation_33" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param uri &amp;#010;@param isBlob " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="37" tag="operation_37" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param doc &amp;#010;@param adapter " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="13" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisUndoAdapter * m_adapter;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="14" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" QValueVector m_data;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="15" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" KisDoc * m_doc;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="16" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" KisImageSP m_img;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="17" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_stop;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="13" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="13" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="13" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="13" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="14" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="14" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="14" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="14" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="15" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="15" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="15" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="15" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="16" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="16" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="16" tag="hblock_tag_11" canDelete="false" indentLevel="1" classfield_id="16" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="17" tag="hblock_tag_12" canDelete="false" indentLevel="1" classfield_id="17" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="17" tag="hblock_tag_13" canDelete="false" indentLevel="1" classfield_id="17" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISIMAGEMAGICKCONVERTER_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisimagemagickconverter.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="13" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="13" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisUndoAdapter * m_adapter;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="13" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="13" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="13" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="13" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="14" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="14" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" QValueVector m_data;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="14" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="14" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="14" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="14" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="15" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="15" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" KisDoc * m_doc;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="15" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="15" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="15" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="15" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="16" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="16" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" KisImageSP m_img;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="16" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="16" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="16" tag="hblock_tag_11" canDelete="false" indentLevel="1" classfield_id="16" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="17" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="17" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_stop;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="17" tag="hblock_tag_12" canDelete="false" indentLevel="1" classfield_id="17" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="17" tag="hblock_tag_13" canDelete="false" indentLevel="1" classfield_id="17" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader44" tqparent_class="44" fileExt=".h" fileName="kisbuildermonitor" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISBUILDERMONITOR_H&amp;#010;#define KISBUILDERMONITOR_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;vkisbuildersubject.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="44" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisBuilderMonitor&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="2390" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisView ;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisBuilderMonitor ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="2390" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2390" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="2390" tag="hblock_tag_2" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2390" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="2390" tag="hblock_tag_3" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2390" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="2390" tag="hblock_tag_4" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2390" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="2390" tag="hblock_tag_5" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2390" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="46" tag="operation_46" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tqparent &amp;#010;@param name " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="49" tag="operation_49" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param subject " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="51" tag="operation_51" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param subject " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="53" tag="operation_53" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="45" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" vKisBuilderSubject m_subjects;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="45" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="45" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="45" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="45" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISBUILDERMONITOR_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisbuildermonitor.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="45" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="45" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" vKisBuilderSubject m_subjects;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="45" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="45" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="45" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="45" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2390" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2390" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisView ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2390" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2390" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2390" tag="hblock_tag_2" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2390" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2390" tag="hblock_tag_3" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2390" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2390" tag="hblock_tag_4" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2390" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2390" tag="hblock_tag_5" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2390" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader55" tqparent_class="55" fileExt=".h" fileName="kisimagebuilder_result" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISIMAGEBUILDER_RESULT_H&amp;#010;#define KISIMAGEBUILDER_RESULT_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="55" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisImageBuilder_Result&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisImageBuilder_Result ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISIMAGEBUILDER_RESULT_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisimagebuilder_result.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader69" tqparent_class="69" fileExt=".h" fileName="kisimagebuilder_step" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISIMAGEBUILDER_STEP_H&amp;#010;#define KISIMAGEBUILDER_STEP_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="69" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisImageBuilder_Step&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisImageBuilder_Step ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISIMAGEBUILDER_STEP_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisimagebuilder_step.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader81" tqparent_class="81" fileExt=".h" fileName="kisstrategycolorspacecmyk" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISSTRATEGYCOLORSPACECMYK_H&amp;#010;#define KISSTRATEGYCOLORSPACECMYK_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;compositeop.h&quot;&amp;#010;#include &quot;colorlut.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="81" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisStrategyColorSpaceCMYK&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisStrategyColorSpaceCMYK ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="86" tag="operation_86" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="87" tag="operation_87" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param rgb &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="90" tag="operation_90" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param rgb &amp;#010;@param opacity &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="94" tag="operation_94" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="97" tag="operation_97" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param opacity &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="101" tag="operation_101" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="104" tag="operation_104" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param opacity &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="108" tag="operation_108" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param projection &amp;#010;@param painter &amp;#010;@param x &amp;#010;@param y &amp;#010;@param width &amp;#010;@param height " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="115" tag="operation_115" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param stride &amp;#010;@param dst &amp;#010;@param dststride &amp;#010;@param src &amp;#010;@param srcstride &amp;#010;@param opacity &amp;#010;@param rows &amp;#010;@param cols &amp;#010;@param op " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="125" tag="operation_125" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param stride &amp;#010;@param dst &amp;#010;@param dststride &amp;#010;@param src &amp;#010;@param srcstride &amp;#010;@param rows &amp;#010;@param cols &amp;#010;@param op " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="134" tag="operation_134" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="82" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM * m_buf;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="83" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KPixmapIO m_pixio;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="84" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_pixmap;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="85" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" ColorLUT m_rgbLUT;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="82" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="82" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="82" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="82" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="83" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="83" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="83" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="83" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="84" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="84" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="84" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="84" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="85" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="85" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="85" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="85" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISSTRATEGYCOLORSPACECMYK_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisstrategycolorspacecmyk.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="82" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="82" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM * m_buf;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="82" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="82" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="82" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="82" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="83" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="83" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KPixmapIO m_pixio;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="83" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="83" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="83" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="83" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="84" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="84" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_pixmap;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="84" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="84" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="84" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="84" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="85" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="85" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" ColorLUT m_rgbLUT;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="85" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="85" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="85" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="85" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader135" tqparent_class="135" fileExt=".h" fileName="rgb" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef RGB_H&amp;#010;#define RGB_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;quantum.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="135" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class RGB&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="136" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM b;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="137" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM g;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="138" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM r;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="RGB ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="136" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="136" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="136" tag="hblock_tag_3" canDelete="false" indentLevel="1" classfield_id="136" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="137" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="137" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="137" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="137" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="138" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="138" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="138" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="138" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //RGB_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			rgb.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="136" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="136" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM b;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="136" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="136" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="136" tag="hblock_tag_3" canDelete="false" indentLevel="1" classfield_id="136" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="137" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="137" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM g;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="137" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="137" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="137" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="137" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="138" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="138" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM r;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="138" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="138" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="138" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="138" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader139" tqparent_class="139" fileExt=".h" fileName="kisstrategycolorspace" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISSTRATEGYCOLORSPACE_H&amp;#010;#define KISSTRATEGYCOLORSPACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;compositeop.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="139" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisStrategyColorSpace&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisStrategyColorSpace ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="142" tag="operation_142" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="145" tag="operation_145" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param rgb &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="148" tag="operation_148" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param rgb &amp;#010;@param opacity &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="152" tag="operation_152" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="155" tag="operation_155" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param opacity &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="159" tag="operation_159" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="162" tag="operation_162" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param opacity &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="166" tag="operation_166" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param projection &amp;#010;@param painter &amp;#010;@param x &amp;#010;@param y &amp;#010;@param width &amp;#010;@param height " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="173" tag="operation_173" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param stride &amp;#010;@param dst &amp;#010;@param dststride &amp;#010;@param src &amp;#010;@param srcstride &amp;#010;@param opacity &amp;#010;@param rows &amp;#010;@param cols &amp;#010;@param op " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="183" tag="operation_183" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param stride &amp;#010;@param dst &amp;#010;@param dststride &amp;#010;@param src &amp;#010;@param srcstride &amp;#010;@param rows &amp;#010;@param cols &amp;#010;@param op " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="192" tag="operation_192" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="140" tag="operation_140" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="143" tag="operation_143" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISSTRATEGYCOLORSPACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisstrategycolorspace.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader193" tqparent_class="193" fileExt=".h" fileName="kiscolorspacefactoryinterface" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISCOLORSPACEFACTORYINTERFACE_H&amp;#010;#define KISCOLORSPACEFACTORYINTERFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;enumimgtype.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="193" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisColorSpaceFactoryInterface&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="194" tag="tblock_1" canDelete="false" indentLevel="1" role_id="0" text=" KisColorSpaceFactoryInterface m_singleton;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisColorSpaceFactoryInterface ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="194" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="194" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="194" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="194" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="194" tag="hblock_tag_8" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="194" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="194" tag="hblock_tag_9" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="194" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="194" tag="hblock_tag_10" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="194" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="197" tag="operation_197" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="200" tag="operation_200" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param device " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="202" tag="operation_202" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param imgType " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="204" tag="operation_204" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="205" tag="operation_205" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="195" tag="operation_195" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="198" tag="operation_198" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISCOLORSPACEFACTORYINTERFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kiscolorspacefactoryinterface.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:49:16&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="194" field_type="1" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="194" tag="tblock_1" canDelete="false" indentLevel="1" role_id="0" text=" KisColorSpaceFactoryInterface m_singleton;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="194" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="194" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="194" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="194" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="194" tag="hblock_tag_8" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="194" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="194" tag="hblock_tag_9" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="194" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="194" tag="hblock_tag_10" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="194" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="194" field_type="1" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="194" tag="tblock_1" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisColorSpaceFactoryInterface ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="194" tag="hblock_tag_6" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="194" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="194" tag="hblock_tag_7" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="194" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="194" tag="hblock_tag_8" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="194" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="194" tag="hblock_tag_9" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="194" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="194" tag="hblock_tag_10" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="194" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader206" tqparent_class="206" fileExt=".h" fileName="kisstrategycolorspacergb" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISSTRATEGYCOLORSPACERGB_H&amp;#010;#define KISSTRATEGYCOLORSPACERGB_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;compositeop.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="206" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisStrategyColorSpaceRGB&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisStrategyColorSpaceRGB ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="210" tag="operation_210" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="211" tag="operation_211" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param rgb &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="214" tag="operation_214" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param rgb &amp;#010;@param opacity &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="218" tag="operation_218" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="221" tag="operation_221" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param opacity &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="225" tag="operation_225" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="228" tag="operation_228" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param c &amp;#010;@param opacity &amp;#010;@param dst " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="232" tag="operation_232" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param projection &amp;#010;@param painter &amp;#010;@param x &amp;#010;@param y &amp;#010;@param width &amp;#010;@param height " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="239" tag="operation_239" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param stride &amp;#010;@param dst &amp;#010;@param dststride &amp;#010;@param src &amp;#010;@param srcstride &amp;#010;@param opacity &amp;#010;@param rows &amp;#010;@param cols &amp;#010;@param op " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="249" tag="operation_249" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param stride &amp;#010;@param dst &amp;#010;@param dststride &amp;#010;@param src &amp;#010;@param srcstride &amp;#010;@param rows &amp;#010;@param cols &amp;#010;@param op " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="258" tag="operation_258" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="207" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM * m_buf;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="208" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KPixmapIO m_pixio;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="209" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_pixmap;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="207" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="207" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="207" tag="hblock_tag_3" canDelete="false" indentLevel="1" classfield_id="207" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="208" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="208" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="208" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="208" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="209" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="209" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="209" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="209" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISSTRATEGYCOLORSPACERGB_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisstrategycolorspacergb.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="207" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="207" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM * m_buf;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="207" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="207" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="207" tag="hblock_tag_3" canDelete="false" indentLevel="1" classfield_id="207" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="208" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="208" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KPixmapIO m_pixio;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="208" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="208" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="208" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="208" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="209" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="209" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_pixmap;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="209" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="209" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="209" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="209" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader259" tqparent_class="259" fileExt=".h" fileName="cmyk" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef CMYK_H&amp;#010;#define CMYK_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="259" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class CMYK&amp;#010;This class implements the conversion of the Chalk images that contain cmy + transparency&amp;#010;data to rbg for screen rendering." />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="260" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM c;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="261" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM k;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="262" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM m;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="263" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM y;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="CMYK ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="260" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="260" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="260" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="260" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="261" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="261" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="261" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="261" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="262" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="262" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="262" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="262" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="263" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="263" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="263" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="263" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="264" tag="operation_264" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //CMYK_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			cmyk.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="260" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="260" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM c;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="260" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="260" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="260" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="260" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="261" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="261" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM k;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="261" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="261" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="261" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="261" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="262" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="262" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM m;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="262" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="262" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="262" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="262" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="263" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="263" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM y;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="263" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="263" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="263" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="263" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader266" tqparent_class="266" fileExt=".h" fileName="kiscolorspacefactoryflyweight" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISCOLORSPACEFACTORYFLYWEIGHT_H&amp;#010;#define KISCOLORSPACEFACTORYFLYWEIGHT_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;enumimgtype.h&quot;&amp;#010;#include &quot;kisstrategycolorspacesp.h&quot;&amp;#010;#include &quot;acflyweights.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="266" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisColorSpaceFactoryFlyweight&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisColorSpaceFactoryFlyweight ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="268" tag="operation_268" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="269" tag="operation_269" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param device " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="271" tag="operation_271" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param imgType " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="275" tag="operation_275" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="273" tag="operation_273" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param imgType " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="267" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" acFlyweights m_flyweights;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="267" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="267" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="267" tag="hblock_tag_1" canDelete="false" indentLevel="1" classfield_id="267" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISCOLORSPACEFACTORYFLYWEIGHT_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kiscolorspacefactoryflyweight.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:17&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="267" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="267" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" acFlyweights m_flyweights;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="267" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="267" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="267" tag="hblock_tag_1" canDelete="false" indentLevel="1" classfield_id="267" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader283" tqparent_class="283" fileExt=".h" fileName="kisscopedlock" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISSCOPEDLOCK_H&amp;#010;#define KISSCOPEDLOCK_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;bool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="283" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisScopedLock&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisScopedLock ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="285" tag="operation_285" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param lock &amp;#010;@param initialLock " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="288" tag="operation_288" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="289" tag="operation_289" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="290" tag="operation_290" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="291" tag="operation_291" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="284" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QMutex * m_mutex;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="284" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="284" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="284" tag="hblock_tag_1" canDelete="false" indentLevel="1" classfield_id="284" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISSCOPEDLOCK_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisscopedlock.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:49:09&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="284" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="284" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QMutex * m_mutex;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="284" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="284" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="284" tag="hblock_tag_1" canDelete="false" indentLevel="1" classfield_id="284" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader292" tqparent_class="292" fileExt=".h" fileName="kisstrategymove" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISSTRATEGYMOVE_H&amp;#010;#define KISSTRATEGYMOVE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;bool.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="292" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisStrategyMove&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisStrategyMove ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="302" tag="operation_302" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="303" tag="operation_303" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param subject " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="307" tag="operation_307" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param pos " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="309" tag="operation_309" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param pos &amp;#010;@param undo " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="312" tag="operation_312" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param subject " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="314" tag="operation_314" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param x1 &amp;#010;@param y1 &amp;#010;@param x2 &amp;#010;@param y2 " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="319" tag="operation_319" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param pt1 &amp;#010;@param pt2 " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="322" tag="operation_322" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param pos " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="324" tag="operation_324" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="300" tag="operation_300" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="305" tag="operation_305" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="293" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisCanvasControllerInterface * m_controller;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="294" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KoDocument * m_doc;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="295" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QPoint m_dragStart;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="296" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_dragging;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="297" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" QPoint m_layerPosition;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="298" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" QPoint m_layerStart;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="299" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" KisCanvasSubject * m_subject;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="293" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="293" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="293" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="293" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="294" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="294" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="294" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="294" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="295" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="295" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="295" tag="hblock_tag_11" canDelete="false" indentLevel="1" classfield_id="295" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="296" tag="hblock_tag_12" canDelete="false" indentLevel="1" classfield_id="296" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="296" tag="hblock_tag_13" canDelete="false" indentLevel="1" classfield_id="296" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="297" tag="hblock_tag_14" canDelete="false" indentLevel="1" classfield_id="297" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="297" tag="hblock_tag_15" canDelete="false" indentLevel="1" classfield_id="297" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="298" tag="hblock_tag_16" canDelete="false" indentLevel="1" classfield_id="298" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="298" tag="hblock_tag_17" canDelete="false" indentLevel="1" classfield_id="298" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="299" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="299" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="299" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="299" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISSTRATEGYMOVE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisstrategymove.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:47:15&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="293" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="293" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisCanvasControllerInterface * m_controller;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="293" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="293" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="293" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="293" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="294" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="294" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KoDocument * m_doc;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="294" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="294" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="294" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="294" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="295" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="295" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QPoint m_dragStart;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="295" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="295" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="295" tag="hblock_tag_11" canDelete="false" indentLevel="1" classfield_id="295" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="296" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="296" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_dragging;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="296" tag="hblock_tag_12" canDelete="false" indentLevel="1" classfield_id="296" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="296" tag="hblock_tag_13" canDelete="false" indentLevel="1" classfield_id="296" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="297" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="297" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" QPoint m_layerPosition;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="297" tag="hblock_tag_14" canDelete="false" indentLevel="1" classfield_id="297" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="297" tag="hblock_tag_15" canDelete="false" indentLevel="1" classfield_id="297" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="298" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="298" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" QPoint m_layerStart;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="298" tag="hblock_tag_16" canDelete="false" indentLevel="1" classfield_id="298" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="298" tag="hblock_tag_17" canDelete="false" indentLevel="1" classfield_id="298" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="299" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="299" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" KisCanvasSubject * m_subject;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="299" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="299" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="299" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="299" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader325" tqparent_class="325" fileExt=".h" fileName="kistilemgr" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISTILEMGR_H&amp;#010;#define KISTILEMGR_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;kistilesp.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;kispixeldatasp.h&quot;&amp;#010;#include &quot;vkistilesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="325" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisTileMgr&amp;#010;KisTileMgr manages the imagedata that for implementations of KisRenderInterface.&amp;#010;Those are:&amp;#010;&amp;#010;KisPaintDevices&amp;#010;   KisLayer&amp;#010;      KisBackround&amp;#010;      KisSelection&amp;#010;   KisChannel&amp;#010;      KisMask&amp;#010;&amp;#010;and&amp;#010;&amp;#010;KisImage&amp;#010;&amp;#010;Imagedata is structured in the form of tiles, by default 64 by 64&amp;#010;pixels big. The KisTileMgr is smart enough to hide most of the&amp;#010;details of reading on and writing from tiles.&amp;#010;&amp;#010;@short KisTileMgr manages the pixels for every layer.&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="329" tag="tblock_0" canDelete="false" indentLevel="1" role_id="0" text=" KisTileMediator m_mediator;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisTileMgr ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="329" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="329" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="329" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="329" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="329" tag="hblock_tag_9" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="329" tag="hblock_tag_10" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="329" tag="hblock_tag_11" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="337" tag="operation_337" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Create a new KisTileMgr of width and height with the&amp;#010;specified colour depth. Deep copies the tiles of tm to the&amp;#010;new KisTileMgr.&amp;#010;&amp;#010;XXX: I am not sure what happens when tm is bigger or smaller&amp;#010;than width and height, nor what happens when tm has a&amp;#010;different depth.&amp;#010;@param tm &amp;#010;@param depth &amp;#010;@param width &amp;#010;@param height " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="342" tag="operation_342" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Create a KisTileMgr of width and height with the specified&amp;#010;colour depth.&amp;#010;@param depth &amp;#010;@param width &amp;#010;@param height " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="346" tag="operation_346" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Creates a new KisTileMgr based on rhs, shares a reference&amp;#010;to the tiles of rhs.&amp;#010;@param rhs " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="350" tag="operation_350" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="XXX?&amp;#010;@param tile &amp;#010;@param tilenum &amp;#010;@param keepold " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="354" tag="operation_354" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Color-depth of the KisRenderInterface implementation&amp;#010;managed by this KisTileMgr" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="355" tag="operation_355" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="XXX?&amp;#010;@param tile &amp;#010;@param tilenum &amp;#010;@param keepold " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="362" tag="operation_362" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Returns true if this KisTileMgr does not manage any&amp;#010;tiles." />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="363" tag="operation_363" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Height in pixels of the total area managed by this KisTileMgr" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="364" tag="operation_364" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="XXX&amp;#010;@param tile &amp;#010;@param xpix &amp;#010;@param ypix " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="368" tag="operation_368" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="XXX&amp;#010;@param tileno " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="370" tag="operation_370" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="XXX&amp;#010;@param xpix &amp;#010;@param ypix " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="376" tag="operation_376" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="XXX&amp;#010;@param tile " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="378" tag="operation_378" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Total size in memory the data managed by this KisTileMgr " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="379" tag="operation_379" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Number of columns of tiles managed by this KisTileMgr" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="380" tag="operation_380" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Number of rows of tiles managed by this KisTileMgr" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="381" tag="operation_381" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Returns the KisPixelData defined by the rectangle x1, y1,&amp;#010;x2, y2. Depending on mode, this data is readable, writable&amp;#010;or both.&amp;#010;@param x1 &amp;#010;@param y1 &amp;#010;@param x2 &amp;#010;@param y2 &amp;#010;@param mode " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="387" tag="operation_387" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param pd " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="389" tag="operation_389" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Read the area defined by x1, y2, x2, y2 into the buffer. Stride is number of bytes&amp;#010;that a pixel takes in the buffer.&amp;#010;@param x1 &amp;#010;@param y1 &amp;#010;@param x2 &amp;#010;@param y2 &amp;#010;@param buffer &amp;#010;@param stride " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="396" tag="operation_396" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Not sure what this does... Perhaps write changed data if&amp;#010;owner, else mark something invalid. XXX&amp;#010;@param pd " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="398" tag="operation_398" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Create or duplicate a tile with identity tilenum; tilenum&amp;#010;is computed from the x/y coordinates of the tile in the&amp;#010;image&amp;#010;&amp;#010;XXX: Not sure what 'mode' is. Presumbly related to the&amp;#010;TILEMODE constants.&amp;#010;@param tilenum &amp;#010;@param mode " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="401" tag="operation_401" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Create or duplicate a tile at location xpix/ypix.&amp;#010;&amp;#010;XXX: Not sure what 'mode' is. Presumbly related to the&amp;#010;TILEMODE constants.&amp;#010;@param xpix &amp;#010;@param ypix &amp;#010;@param mode " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="405" tag="operation_405" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Puts the x/y coordinates of the top left (?) corner&amp;#010;of tile in coord.&amp;#010;@param tile &amp;#010;@param coord " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="408" tag="operation_408" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Puts the x/y coordinates of the top left (?) corner&amp;#010;of tile in x and y.&amp;#010;@param tile &amp;#010;@param x &amp;#010;@param y " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="412" tag="operation_412" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="XXX&amp;#010;@param tilenum &amp;#010;@param src " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="415" tag="operation_415" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="XXX&amp;#010;@param xpix &amp;#010;@param ypix &amp;#010;@param src " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="419" tag="operation_419" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param xpix &amp;#010;@param ypix " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="422" tag="operation_422" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Width in pixels of the total area managed by this KisTileMgr" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="423" tag="operation_423" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param pd " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="425" tag="operation_425" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Commit the pixel data in buffer.&amp;#010;@param x1 &amp;#010;@param y1 &amp;#010;@param x2 &amp;#010;@param y2 &amp;#010;@param buffer &amp;#010;@param stride " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="432" tag="operation_432" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="335" tag="operation_335" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="348" tag="operation_348" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param ntiles " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="359" tag="operation_359" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param ntiles &amp;#010;@param tm " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="373" tag="operation_373" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile &amp;#010;@param tilenum " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="326" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_depth;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="327" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_height;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="330" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" QMutex m_mutex;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="331" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_ntileCols;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="332" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_ntileRows;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="333" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" vKisTileSP m_tiles;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="334" tag="tblock_7" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_width;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="326" tag="hblock_tag_12" canDelete="false" indentLevel="1" classfield_id="326" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="326" tag="hblock_tag_13" canDelete="false" indentLevel="1" classfield_id="326" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="327" tag="hblock_tag_14" canDelete="false" indentLevel="1" classfield_id="327" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="327" tag="hblock_tag_15" canDelete="false" indentLevel="1" classfield_id="327" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="330" tag="hblock_tag_16" canDelete="false" indentLevel="1" classfield_id="330" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="330" tag="hblock_tag_17" canDelete="false" indentLevel="1" classfield_id="330" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="331" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="331" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="331" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="331" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="332" tag="hblock_tag_20" canDelete="false" indentLevel="1" classfield_id="332" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="332" tag="hblock_tag_21" canDelete="false" indentLevel="1" classfield_id="332" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="333" tag="hblock_tag_22" canDelete="false" indentLevel="1" classfield_id="333" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="333" tag="hblock_tag_23" canDelete="false" indentLevel="1" classfield_id="333" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="334" tag="hblock_tag_24" canDelete="false" indentLevel="1" classfield_id="334" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="334" tag="hblock_tag_25" canDelete="false" indentLevel="1" classfield_id="334" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISTILEMGR_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistilemgr.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="326" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="326" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_depth;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="326" tag="hblock_tag_12" canDelete="false" indentLevel="1" classfield_id="326" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="326" tag="hblock_tag_13" canDelete="false" indentLevel="1" classfield_id="326" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="327" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="327" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_height;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="327" tag="hblock_tag_14" canDelete="false" indentLevel="1" classfield_id="327" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="327" tag="hblock_tag_15" canDelete="false" indentLevel="1" classfield_id="327" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="330" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="330" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" QMutex m_mutex;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="330" tag="hblock_tag_16" canDelete="false" indentLevel="1" classfield_id="330" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="330" tag="hblock_tag_17" canDelete="false" indentLevel="1" classfield_id="330" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="331" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="331" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_ntileCols;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="331" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="331" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="331" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="331" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="332" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="332" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_ntileRows;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="332" tag="hblock_tag_20" canDelete="false" indentLevel="1" classfield_id="332" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="332" tag="hblock_tag_21" canDelete="false" indentLevel="1" classfield_id="332" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="333" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="333" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" vKisTileSP m_tiles;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="333" tag="hblock_tag_22" canDelete="false" indentLevel="1" classfield_id="333" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="333" tag="hblock_tag_23" canDelete="false" indentLevel="1" classfield_id="333" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="334" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="334" tag="tblock_7" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_width;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="334" tag="hblock_tag_24" canDelete="false" indentLevel="1" classfield_id="334" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="334" tag="hblock_tag_25" canDelete="false" indentLevel="1" classfield_id="334" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="329" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="329" tag="tblock_0" canDelete="false" indentLevel="1" role_id="0" text=" KisTileMediator m_mediator;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="329" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="329" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="329" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="329" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="329" tag="hblock_tag_9" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="329" tag="hblock_tag_10" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="329" tag="hblock_tag_11" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader328" tqparent_class="328" fileExt=".h" fileName="kistilemediator" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISTILEMEDIATOR_H&amp;#010;#define KISTILEMEDIATOR_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;kistilesp.h&quot;&amp;#010;#include &quot;kistilemgrsp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="328" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisTileMediator&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="329" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisTileMgr ;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisTileMediator ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="329" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="329" tag="hblock_tag_4" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="329" tag="hblock_tag_5" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="329" tag="hblock_tag_6" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="329" tag="hblock_tag_7" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="438" tag="operation_438" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="441" tag="operation_441" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile &amp;#010;@param mgr &amp;#010;@param tilenum " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="445" tag="operation_445" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile &amp;#010;@param mgr &amp;#010;@param tilenum " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="449" tag="operation_449" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param mgr " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="451" tag="operation_451" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile &amp;#010;@param mgr " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="454" tag="operation_454" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="436" tag="operation_436" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="439" tag="operation_439" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="433" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KisTileMediatorSingleton * m_instance;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="434" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QMutex m_mutex;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="435" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_ref;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="433" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="433" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="433" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="433" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="434" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="434" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="434" tag="hblock_tag_11" canDelete="false" indentLevel="1" classfield_id="434" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="435" tag="hblock_tag_12" canDelete="false" indentLevel="1" classfield_id="435" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="435" tag="hblock_tag_13" canDelete="false" indentLevel="1" classfield_id="435" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISTILEMEDIATOR_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistilemediator.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="433" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="433" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KisTileMediatorSingleton * m_instance;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="433" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="433" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="433" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="433" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="434" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="434" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QMutex m_mutex;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="434" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="434" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="434" tag="hblock_tag_11" canDelete="false" indentLevel="1" classfield_id="434" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="435" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="435" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_ref;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="435" tag="hblock_tag_12" canDelete="false" indentLevel="1" classfield_id="435" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="435" tag="hblock_tag_13" canDelete="false" indentLevel="1" classfield_id="435" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="329" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="329" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisTileMgr ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="329" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="329" tag="hblock_tag_4" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="329" tag="hblock_tag_5" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="329" tag="hblock_tag_6" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="329" tag="hblock_tag_7" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="329" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader455" tqparent_class="455" fileExt=".h" fileName="kistileswapinterface" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISTILESWAPINTERFACE_H&amp;#010;#define KISTILESWAPINTERFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;kistilesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="455" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisTileSwapInterface&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="492" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisTile ;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisTileSwapInterface ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="492" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="492" tag="hblock_tag_1" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="492" tag="hblock_tag_2" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="492" tag="hblock_tag_3" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="492" tag="hblock_tag_4" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="456" tag="operation_456" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="457" tag="operation_457" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="459" tag="operation_459" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param swapNo " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="461" tag="operation_461" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="463" tag="operation_463" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="465" tag="operation_465" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="467" tag="operation_467" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="469" tag="operation_469" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="471" tag="operation_471" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISTILESWAPINTERFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistileswapinterface.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="492" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="492" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisTile ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="492" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="492" tag="hblock_tag_1" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="492" tag="hblock_tag_2" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="492" tag="hblock_tag_3" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="492" tag="hblock_tag_4" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader472" tqparent_class="472" fileExt=".h" fileName="kistilecacheinterface" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISTILECACHEINTERFACE_H&amp;#010;#define KISTILECACHEINTERFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;kistilesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="472" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisTileCacheInterface&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="482" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisTile ;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisTileCacheInterface ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="482" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="482" tag="hblock_tag_1" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="482" tag="hblock_tag_2" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="482" tag="hblock_tag_3" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="482" tag="hblock_tag_4" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="473" tag="operation_473" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="474" tag="operation_474" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="476" tag="operation_476" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="478" tag="operation_478" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param nelements " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="480" tag="operation_480" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISTILECACHEINTERFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistilecacheinterface.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:47:01&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="482" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="482" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisTile ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="482" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="482" tag="hblock_tag_1" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="482" tag="hblock_tag_2" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="482" tag="hblock_tag_3" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="482" tag="hblock_tag_4" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader481" tqparent_class="481" fileExt=".h" fileName="kistile" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISTILE_H&amp;#010;#define KISTILE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;drawinghints.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="481" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisTile&amp;#010;Provides abstraction to a tile.  A tile tqcontains&amp;#010;a part of a layer.  Layers form an image." />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="482" tag="tblock_0" canDelete="false" indentLevel="1" role_id="0" text=" KisTileCacheInterface m_cache;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="492" tag="tblock_1" canDelete="false" indentLevel="1" role_id="0" text=" KisTileSwapInterface m_swap;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisTile ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="482" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="482" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="482" tag="hblock_tag_14" canDelete="false" indentLevel="1" classfield_id="482" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="482" tag="hblock_tag_15" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="482" tag="hblock_tag_16" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="482" tag="hblock_tag_17" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="492" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="492" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="492" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="492" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="492" tag="hblock_tag_20" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="492" tag="hblock_tag_21" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="492" tag="hblock_tag_22" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="0" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="498" tag="operation_498" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param rhs " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="500" tag="operation_500" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param depth &amp;#010;@param cache &amp;#010;@param swap " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="504" tag="operation_504" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="505" tag="operation_505" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param xoff &amp;#010;@param yoff " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="508" tag="operation_508" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="509" tag="operation_509" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="510" tag="operation_510" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param val " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="512" tag="operation_512" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tile " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="514" tag="operation_514" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="515" tag="operation_515" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param h " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="522" tag="operation_522" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="523" tag="operation_523" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="524" tag="operation_524" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="525" tag="operation_525" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="526" tag="operation_526" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="527" tag="operation_527" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="528" tag="operation_528" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param row " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="530" tag="operation_530" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param row &amp;#010;@param hint " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="533" tag="operation_533" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="534" tag="operation_534" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="535" tag="operation_535" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="536" tag="operation_536" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="537" tag="operation_537" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="538" tag="operation_538" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param valid " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="540" tag="operation_540" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="541" tag="operation_541" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param w " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="543" tag="operation_543" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="544" tag="operation_544" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="545" tag="operation_545" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="496" tag="operation_496" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="517" tag="operation_517" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param depth &amp;#010;@param cache &amp;#010;@param swap " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="521" tag="operation_521" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="483" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM * m_data;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="484" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_depth;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="485" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_dirty;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="486" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_height;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="487" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" QValueVector m_hints;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="488" tag="tblock_7" canDelete="false" indentLevel="1" role_id="-1" text=" QMutex m_mutex;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="489" tag="tblock_8" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_nref;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="490" tag="tblock_9" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_nshare;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="491" tag="tblock_10" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_nwrite;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="493" tag="tblock_11" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_swapNo;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="494" tag="tblock_12" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_valid;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="495" tag="tblock_13" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_width;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="483" tag="hblock_tag_23" canDelete="false" indentLevel="1" classfield_id="483" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="483" tag="hblock_tag_24" canDelete="false" indentLevel="1" classfield_id="483" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="484" tag="hblock_tag_25" canDelete="false" indentLevel="1" classfield_id="484" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="484" tag="hblock_tag_26" canDelete="false" indentLevel="1" classfield_id="484" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="485" tag="hblock_tag_27" canDelete="false" indentLevel="1" classfield_id="485" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="485" tag="hblock_tag_28" canDelete="false" indentLevel="1" classfield_id="485" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="486" tag="hblock_tag_29" canDelete="false" indentLevel="1" classfield_id="486" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="486" tag="hblock_tag_30" canDelete="false" indentLevel="1" classfield_id="486" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="487" tag="hblock_tag_31" canDelete="false" indentLevel="1" classfield_id="487" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="487" tag="hblock_tag_32" canDelete="false" indentLevel="1" classfield_id="487" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="488" tag="hblock_tag_33" canDelete="false" indentLevel="1" classfield_id="488" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="488" tag="hblock_tag_34" canDelete="false" indentLevel="1" classfield_id="488" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="489" tag="hblock_tag_35" canDelete="false" indentLevel="1" classfield_id="489" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="489" tag="hblock_tag_36" canDelete="false" indentLevel="1" classfield_id="489" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="490" tag="hblock_tag_37" canDelete="false" indentLevel="1" classfield_id="490" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="490" tag="hblock_tag_38" canDelete="false" indentLevel="1" classfield_id="490" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="491" tag="hblock_tag_39" canDelete="false" indentLevel="1" classfield_id="491" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="491" tag="hblock_tag_40" canDelete="false" indentLevel="1" classfield_id="491" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="493" tag="hblock_tag_41" canDelete="false" indentLevel="1" classfield_id="493" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="493" tag="hblock_tag_42" canDelete="false" indentLevel="1" classfield_id="493" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="494" tag="hblock_tag_43" canDelete="false" indentLevel="1" classfield_id="494" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="494" tag="hblock_tag_44" canDelete="false" indentLevel="1" classfield_id="494" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="495" tag="hblock_tag_45" canDelete="false" indentLevel="1" classfield_id="495" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="495" tag="hblock_tag_46" canDelete="false" indentLevel="1" classfield_id="495" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISTILE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kistile.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:47:10&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="483" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="483" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QUANTUM * m_data;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="483" tag="hblock_tag_23" canDelete="false" indentLevel="1" classfield_id="483" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="483" tag="hblock_tag_24" canDelete="false" indentLevel="1" classfield_id="483" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="484" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="484" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_depth;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="484" tag="hblock_tag_25" canDelete="false" indentLevel="1" classfield_id="484" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="484" tag="hblock_tag_26" canDelete="false" indentLevel="1" classfield_id="484" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="485" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="485" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_dirty;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="485" tag="hblock_tag_27" canDelete="false" indentLevel="1" classfield_id="485" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="485" tag="hblock_tag_28" canDelete="false" indentLevel="1" classfield_id="485" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="486" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="486" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_height;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="486" tag="hblock_tag_29" canDelete="false" indentLevel="1" classfield_id="486" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="486" tag="hblock_tag_30" canDelete="false" indentLevel="1" classfield_id="486" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="487" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="487" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" QValueVector m_hints;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="487" tag="hblock_tag_31" canDelete="false" indentLevel="1" classfield_id="487" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="487" tag="hblock_tag_32" canDelete="false" indentLevel="1" classfield_id="487" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="488" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="488" tag="tblock_7" canDelete="false" indentLevel="1" role_id="-1" text=" QMutex m_mutex;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="488" tag="hblock_tag_33" canDelete="false" indentLevel="1" classfield_id="488" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="488" tag="hblock_tag_34" canDelete="false" indentLevel="1" classfield_id="488" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="489" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="489" tag="tblock_8" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_nref;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="489" tag="hblock_tag_35" canDelete="false" indentLevel="1" classfield_id="489" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="489" tag="hblock_tag_36" canDelete="false" indentLevel="1" classfield_id="489" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="490" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="490" tag="tblock_9" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_nshare;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="490" tag="hblock_tag_37" canDelete="false" indentLevel="1" classfield_id="490" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="490" tag="hblock_tag_38" canDelete="false" indentLevel="1" classfield_id="490" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="491" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="491" tag="tblock_10" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_nwrite;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="491" tag="hblock_tag_39" canDelete="false" indentLevel="1" classfield_id="491" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="491" tag="hblock_tag_40" canDelete="false" indentLevel="1" classfield_id="491" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="493" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="493" tag="tblock_11" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_swapNo;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="493" tag="hblock_tag_41" canDelete="false" indentLevel="1" classfield_id="493" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="493" tag="hblock_tag_42" canDelete="false" indentLevel="1" classfield_id="493" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="494" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="494" tag="tblock_12" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_valid;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="494" tag="hblock_tag_43" canDelete="false" indentLevel="1" classfield_id="494" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="494" tag="hblock_tag_44" canDelete="false" indentLevel="1" classfield_id="494" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="495" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="495" tag="tblock_13" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_width;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="495" tag="hblock_tag_45" canDelete="false" indentLevel="1" classfield_id="495" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="495" tag="hblock_tag_46" canDelete="false" indentLevel="1" classfield_id="495" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="482" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="482" tag="tblock_0" canDelete="false" indentLevel="1" role_id="0" text=" KisTileCacheInterface m_cache;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="482" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="482" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="482" tag="hblock_tag_14" canDelete="false" indentLevel="1" classfield_id="482" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="482" tag="hblock_tag_15" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="482" tag="hblock_tag_16" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="482" tag="hblock_tag_17" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="482" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="492" field_type="3" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="492" tag="tblock_1" canDelete="false" indentLevel="1" role_id="0" text=" KisTileSwapInterface m_swap;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="492" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="492" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="492" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="492" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="492" tag="hblock_tag_20" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="492" tag="hblock_tag_21" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="492" tag="hblock_tag_22" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="492" role_id="0" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader546" tqparent_class="546" fileExt=".h" fileName="drawinghints" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef DRAWINGHINTS_H&amp;#010;#define DRAWINGHINTS_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="546" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class drawingHints&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="drawingHints ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //DRAWINGHINTS_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			drawinghints.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader560" tqparent_class="560" fileExt=".h" fileName="kismerge" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISMERGE_H&amp;#010;#define KISMERGE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;kispaintdevicesp.h&quot;&amp;#010;#include &quot;kisselectionsp.h&quot;&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="560" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisMerge&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisMerge ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="565" tag="operation_565" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param keepOld " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="568" tag="operation_568" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  &amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="571" tag="operation_571" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  &amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="574" tag="operation_574" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  &amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="577" tag="operation_577" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gc &amp;#010;@param layer " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="580" tag="operation_580" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gc &amp;#010;@param layers " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="561" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisImageSP m_img;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="562" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_keepOld;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="563" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QRect m_rc;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="564" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" cond_t m_test;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="561" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="561" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="561" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="561" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="562" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="562" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="562" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="562" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="563" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="563" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="563" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="563" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="564" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="564" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="564" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="564" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISMERGE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kismerge.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="561" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="561" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisImageSP m_img;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="561" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="561" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="561" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="561" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="562" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="562" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_keepOld;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="562" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="562" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="562" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="562" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="563" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="563" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QRect m_rc;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="563" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="563" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="563" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="563" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="564" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="564" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" cond_t m_test;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="564" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="564" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="564" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="564" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader583" tqparent_class="583" fileExt=".h" fileName="kisflatten" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISFLATTEN_H&amp;#010;#define KISFLATTEN_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;#include &quot;kispaintdevicesp.h&quot;&amp;#010;#include &quot;kisselectionsp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="583" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisFlatten&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisFlatten ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="586" tag="operation_586" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param rc " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="588" tag="operation_588" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param x &amp;#010;@param y &amp;#010;@param width &amp;#010;@param height " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="593" tag="operation_593" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gc &amp;#010;@param layer " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="596" tag="operation_596" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gc &amp;#010;@param dev " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="603" tag="operation_603" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gc &amp;#010;@param selection " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="606" tag="operation_606" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gc &amp;#010;@param layers " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="609" tag="operation_609" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gc &amp;#010;@param devs " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="612" tag="operation_612" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="599" tag="operation_599" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gc &amp;#010;@param dev &amp;#010;@param opacity " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="584" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QRect m_rc;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="585" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" cond_t m_test;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="584" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="584" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="584" tag="hblock_tag_2" canDelete="false" indentLevel="1" classfield_id="584" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="585" tag="hblock_tag_3" canDelete="false" indentLevel="1" classfield_id="585" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="585" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="585" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISFLATTEN_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisflatten.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="584" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="584" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QRect m_rc;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="584" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="584" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="584" tag="hblock_tag_2" canDelete="false" indentLevel="1" classfield_id="584" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="585" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="585" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" cond_t m_test;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="585" tag="hblock_tag_3" canDelete="false" indentLevel="1" classfield_id="585" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="585" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="585" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader613" tqparent_class="613" fileExt=".h" fileName="kisdociface" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISDOCIFACE_H&amp;#010;#define KISDOCIFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;int.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="613" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KIsDocIface&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KIsDocIface ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="615" tag="operation_615" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="616" tag="operation_616" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param oldName &amp;#010;@param newName " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="619" tag="operation_619" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param limit " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="621" tag="operation_621" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param limit " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="623" tag="operation_623" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="614" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisDoc * m_doc;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="614" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="614" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="614" tag="hblock_tag_1" canDelete="false" indentLevel="1" classfield_id="614" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISDOCIFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisdociface.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:49:51&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="614" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="614" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisDoc * m_doc;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="614" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="614" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="614" tag="hblock_tag_1" canDelete="false" indentLevel="1" classfield_id="614" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader624" tqparent_class="624" fileExt=".h" fileName="kisalphatqmask" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISALPHAMASK_H&amp;#010;#define KISALPHAMASK_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;double.h&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="624" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisAlphaMask&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisAlphaMask ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="629" tag="operation_629" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Create an alpha tqmask based on the gray values of the&amp;#010;specified QImage. If the QImage is not grayscale, you're&amp;#010;buggered.&amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="631" tag="operation_631" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Create an alpha tqmask based on the gray values of the&amp;#010;specified QImage. If the QImage is not grayscale, you're&amp;#010;buggered. The QImage is scaled using QImage::smoothScale,&amp;#010;where the target w and h are computed by taking scale as a&amp;#010;percentage.&amp;#010;@param img &amp;#010;@param scale " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="634" tag="operation_634" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="@return the alpha value at the specified position.&amp;#010;Returns QUANTUM OPACITY_TRANSPARENT if the value is&amp;#010;outside the bounds of the tqmask.&amp;#010;XXX: this is, of course, not the best way of tqmasking.&amp;#010;Better would be to let KisAlphaMask fill a chunk of memory&amp;#010;with the alpha values at the right position, something like&amp;#010;void applyMask(QUANTUM *pixeldata, Q_INT32 pixelWidth,&amp;#010;Q_INT32 alphaPos). That would be fastest, or we could&amp;#010;provide an iterator over the tqmask, that would be nice, too.&amp;#010;@param x &amp;#010;@param y " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="641" tag="operation_641" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="@return the number of alpha values in a scanline." />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="642" tag="operation_642" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="@return the scale factor." />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="643" tag="operation_643" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="@return the number of lines in the tqmask." />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="644" tag="operation_644" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="637" tag="operation_637" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="639" tag="operation_639" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="625" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QValueVector m_data;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="626" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" double m_scale;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="627" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_scaledHeight;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="628" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_scaledWidth;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="625" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="625" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="625" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="625" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="626" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="626" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="626" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="626" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="627" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="627" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="627" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="627" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="628" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="628" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="628" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="628" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISALPHAMASK_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisalphatqmask.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:52:01&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="625" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="625" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QValueVector m_data;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="625" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="625" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="625" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="625" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="626" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="626" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" double m_scale;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="626" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="626" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="626" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="626" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="627" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="627" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_scaledHeight;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="627" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="627" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="627" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="627" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="628" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="628" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_scaledWidth;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="628" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="628" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="628" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="628" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader645" tqparent_class="645" fileExt=".h" fileName="krayonviewiface" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KRAYONVIEWIFACE_H&amp;#010;#define KRAYONVIEWIFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="645" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KRayonViewIface&amp;#010;This is the definition of the interface Chalk presents to&amp;#010;dcop." />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KRayonViewIface ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="647" tag="operation_647" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param view_ " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="649" tag="operation_649" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="650" tag="operation_650" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="651" tag="operation_651" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="652" tag="operation_652" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="653" tag="operation_653" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="654" tag="operation_654" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="655" tag="operation_655" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="656" tag="operation_656" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="657" tag="operation_657" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="658" tag="operation_658" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="659" tag="operation_659" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="660" tag="operation_660" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="661" tag="operation_661" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="662" tag="operation_662" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="663" tag="operation_663" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="664" tag="operation_664" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="665" tag="operation_665" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="666" tag="operation_666" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="667" tag="operation_667" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="668" tag="operation_668" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="669" tag="operation_669" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="646" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisView * m_view;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="646" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="646" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="646" tag="hblock_tag_1" canDelete="false" indentLevel="1" classfield_id="646" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KRAYONVIEWIFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			krayonviewiface.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="646" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="646" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisView * m_view;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="646" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="646" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="646" tag="hblock_tag_1" canDelete="false" indentLevel="1" classfield_id="646" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader670" tqparent_class="670" fileExt=".h" fileName="kisimageiface" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISIMAGEIFACE_H&amp;#010;#define KISIMAGEIFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;int.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="670" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KIsImageIface&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KIsImageIface ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="672" tag="operation_672" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img_ " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="674" tag="operation_674" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="675" tag="operation_675" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="676" tag="operation_676" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="677" tag="operation_677" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="678" tag="operation_678" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param name " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="680" tag="operation_680" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="671" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisImage * m_img;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="671" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="671" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="671" tag="hblock_tag_1" canDelete="false" indentLevel="1" classfield_id="671" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISIMAGEIFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisimageiface.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:49:42&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="671" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="671" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" KisImage * m_img;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="671" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="671" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="671" tag="hblock_tag_1" canDelete="false" indentLevel="1" classfield_id="671" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader681" tqparent_class="681" fileExt=".h" fileName="kisbrush" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISBRUSH_H&amp;#010;#define KISBRUSH_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;kisresource.h&quot;&amp;#010;#include &quot;enumbrushtype.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="681" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisBrush&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="1769" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisPainter ;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="2368" tag="tblock_1" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisView ;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisBrush ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="1769" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1769" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="1769" tag="hblock_tag_13" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1769" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="1769" tag="hblock_tag_14" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1769" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="1769" tag="hblock_tag_15" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1769" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="1769" tag="hblock_tag_16" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1769" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="2368" tag="hblock_tag_17" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2368" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="2368" tag="hblock_tag_18" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2368" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="2368" tag="hblock_tag_19" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2368" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="2368" tag="hblock_tag_20" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2368" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="2368" tag="hblock_tag_21" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2368" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="693" tag="operation_693" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param filename " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="695" tag="operation_695" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param filename &amp;#010;@param data &amp;#010;@param dataPos " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="699" tag="operation_699" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="702" tag="operation_702" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="703" tag="operation_703" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="704" tag="operation_704" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="705" tag="operation_705" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="@return a tqmask computed from the grey-level values of the&amp;#010;pixels in the brush.&amp;#010;@param scale " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="707" tag="operation_707" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="708" tag="operation_708" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="710" tag="operation_710" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="700" tag="operation_700" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="682" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" enumBrushType m_brushType;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="683" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_bytes;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="684" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" QValueVector m_data;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="685" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_header_size;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="686" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_height;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="687" tag="tblock_7" canDelete="false" indentLevel="1" role_id="-1" text=" QPoint m_hotSpot;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="688" tag="tblock_8" canDelete="false" indentLevel="1" role_id="-1" text=" QImage m_img;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="689" tag="tblock_9" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_magic_number;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="690" tag="tblock_10" canDelete="false" indentLevel="1" role_id="-1" text=" QPtrList m_tqmasks;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="691" tag="tblock_11" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_version;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="692" tag="tblock_12" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_width;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="682" tag="hblock_tag_22" canDelete="false" indentLevel="1" classfield_id="682" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="682" tag="hblock_tag_23" canDelete="false" indentLevel="1" classfield_id="682" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="683" tag="hblock_tag_24" canDelete="false" indentLevel="1" classfield_id="683" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="683" tag="hblock_tag_25" canDelete="false" indentLevel="1" classfield_id="683" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="684" tag="hblock_tag_26" canDelete="false" indentLevel="1" classfield_id="684" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="684" tag="hblock_tag_27" canDelete="false" indentLevel="1" classfield_id="684" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="685" tag="hblock_tag_28" canDelete="false" indentLevel="1" classfield_id="685" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="685" tag="hblock_tag_29" canDelete="false" indentLevel="1" classfield_id="685" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="686" tag="hblock_tag_30" canDelete="false" indentLevel="1" classfield_id="686" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="686" tag="hblock_tag_31" canDelete="false" indentLevel="1" classfield_id="686" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="687" tag="hblock_tag_32" canDelete="false" indentLevel="1" classfield_id="687" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="687" tag="hblock_tag_33" canDelete="false" indentLevel="1" classfield_id="687" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="688" tag="hblock_tag_34" canDelete="false" indentLevel="1" classfield_id="688" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="688" tag="hblock_tag_35" canDelete="false" indentLevel="1" classfield_id="688" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="689" tag="hblock_tag_36" canDelete="false" indentLevel="1" classfield_id="689" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="689" tag="hblock_tag_37" canDelete="false" indentLevel="1" classfield_id="689" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="690" tag="hblock_tag_38" canDelete="false" indentLevel="1" classfield_id="690" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="690" tag="hblock_tag_39" canDelete="false" indentLevel="1" classfield_id="690" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="691" tag="hblock_tag_40" canDelete="false" indentLevel="1" classfield_id="691" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="691" tag="hblock_tag_41" canDelete="false" indentLevel="1" classfield_id="691" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="692" tag="hblock_tag_42" canDelete="false" indentLevel="1" classfield_id="692" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="692" tag="hblock_tag_43" canDelete="false" indentLevel="1" classfield_id="692" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISBRUSH_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisbrush.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="682" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="682" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" enumBrushType m_brushType;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="682" tag="hblock_tag_22" canDelete="false" indentLevel="1" classfield_id="682" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="682" tag="hblock_tag_23" canDelete="false" indentLevel="1" classfield_id="682" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="683" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="683" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_bytes;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="683" tag="hblock_tag_24" canDelete="false" indentLevel="1" classfield_id="683" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="683" tag="hblock_tag_25" canDelete="false" indentLevel="1" classfield_id="683" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="684" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="684" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" QValueVector m_data;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="684" tag="hblock_tag_26" canDelete="false" indentLevel="1" classfield_id="684" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="684" tag="hblock_tag_27" canDelete="false" indentLevel="1" classfield_id="684" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="685" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="685" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_header_size;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="685" tag="hblock_tag_28" canDelete="false" indentLevel="1" classfield_id="685" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="685" tag="hblock_tag_29" canDelete="false" indentLevel="1" classfield_id="685" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="686" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="686" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_height;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="686" tag="hblock_tag_30" canDelete="false" indentLevel="1" classfield_id="686" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="686" tag="hblock_tag_31" canDelete="false" indentLevel="1" classfield_id="686" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="687" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="687" tag="tblock_7" canDelete="false" indentLevel="1" role_id="-1" text=" QPoint m_hotSpot;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="687" tag="hblock_tag_32" canDelete="false" indentLevel="1" classfield_id="687" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="687" tag="hblock_tag_33" canDelete="false" indentLevel="1" classfield_id="687" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="688" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="688" tag="tblock_8" canDelete="false" indentLevel="1" role_id="-1" text=" QImage m_img;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="688" tag="hblock_tag_34" canDelete="false" indentLevel="1" classfield_id="688" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="688" tag="hblock_tag_35" canDelete="false" indentLevel="1" classfield_id="688" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="689" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="689" tag="tblock_9" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_magic_number;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="689" tag="hblock_tag_36" canDelete="false" indentLevel="1" classfield_id="689" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="689" tag="hblock_tag_37" canDelete="false" indentLevel="1" classfield_id="689" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="690" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="690" tag="tblock_10" canDelete="false" indentLevel="1" role_id="-1" text=" QPtrList m_tqmasks;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="690" tag="hblock_tag_38" canDelete="false" indentLevel="1" classfield_id="690" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="690" tag="hblock_tag_39" canDelete="false" indentLevel="1" classfield_id="690" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="691" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="691" tag="tblock_11" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_version;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="691" tag="hblock_tag_40" canDelete="false" indentLevel="1" classfield_id="691" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="691" tag="hblock_tag_41" canDelete="false" indentLevel="1" classfield_id="691" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="692" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="692" tag="tblock_12" canDelete="false" indentLevel="1" role_id="-1" text=" Q_UINT32 m_width;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="692" tag="hblock_tag_42" canDelete="false" indentLevel="1" classfield_id="692" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="692" tag="hblock_tag_43" canDelete="false" indentLevel="1" classfield_id="692" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1769" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1769" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisPainter ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1769" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1769" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1769" tag="hblock_tag_13" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1769" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1769" tag="hblock_tag_14" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1769" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1769" tag="hblock_tag_15" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1769" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1769" tag="hblock_tag_16" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1769" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2368" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2368" tag="tblock_1" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisView ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2368" tag="hblock_tag_17" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2368" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2368" tag="hblock_tag_18" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2368" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2368" tag="hblock_tag_19" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2368" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2368" tag="hblock_tag_20" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2368" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2368" tag="hblock_tag_21" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2368" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader711" tqparent_class="711" fileExt=".h" fileName="kisbackground" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISBACKGROUND_H&amp;#010;#define KISBACKGROUND_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="711" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisBackground&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisBackground ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="712" tag="operation_712" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param width &amp;#010;@param height " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="716" tag="operation_716" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param xpix &amp;#010;@param ypix " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="719" tag="operation_719" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISBACKGROUND_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisbackground.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader720" tqparent_class="720" fileExt=".h" fileName="enumbrushtype" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef ENUMBRUSHTYPE_H&amp;#010;#define ENUMBRUSHTYPE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="720" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class enumBrushType&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="1742" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisImagePipeBrush ;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="enumBrushType ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="1742" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1742" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="1742" tag="hblock_tag_1" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1742" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="1742" tag="hblock_tag_2" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1742" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="1742" tag="hblock_tag_3" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1742" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="1742" tag="hblock_tag_4" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1742" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //ENUMBRUSHTYPE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			enumbrushtype.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="1742" field_type="4" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1742" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisImagePipeBrush ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1742" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1742" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1742" tag="hblock_tag_1" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1742" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1742" tag="hblock_tag_2" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1742" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1742" tag="hblock_tag_3" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1742" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1742" tag="hblock_tag_4" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1742" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader727" tqparent_class="727" fileExt=".h" fileName="kiscommand" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISCOMMAND_H&amp;#010;#define KISCOMMAND_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="727" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisCommand&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisCommand ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="730" tag="operation_730" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param undoAdapter " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="732" tag="operation_732" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param name &amp;#010;@param undoAdapter " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="736" tag="operation_736" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="737" tag="operation_737" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="738" tag="operation_738" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="739" tag="operation_739" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="735" tag="operation_735" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="728" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QString m_name;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="729" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KisUndoAdapter * m_undoAdapter;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="728" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="728" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="728" tag="hblock_tag_2" canDelete="false" indentLevel="1" classfield_id="728" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="729" tag="hblock_tag_3" canDelete="false" indentLevel="1" classfield_id="729" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="729" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="729" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISCOMMAND_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kiscommand.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="728" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="728" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QString m_name;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="728" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="728" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="728" tag="hblock_tag_2" canDelete="false" indentLevel="1" classfield_id="728" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="729" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="729" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KisUndoAdapter * m_undoAdapter;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="729" tag="hblock_tag_3" canDelete="false" indentLevel="1" classfield_id="729" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="729" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="729" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader740" tqparent_class="740" fileExt=".h" fileName="kisguide" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISGUIDE_H&amp;#010;#define KISGUIDE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;double.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="740" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisGuide&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="741" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap buffer;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="742" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" bool hasBuffer;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="743" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" double pos;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="744" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" bool selected;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisGuide ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="741" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="741" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="741" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="741" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="742" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="742" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="742" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="742" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="743" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="743" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="743" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="743" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="744" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="744" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="744" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="744" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="745" tag="operation_745" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param o " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="747" tag="operation_747" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="748" tag="operation_748" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="749" tag="operation_749" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISGUIDE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisguide.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="741" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="741" tag="tblock_0" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap buffer;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="741" tag="hblock_tag_0" canDelete="false" indentLevel="1" classfield_id="741" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="741" tag="hblock_tag_4" canDelete="false" indentLevel="1" classfield_id="741" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="742" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="742" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" bool hasBuffer;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="742" tag="hblock_tag_5" canDelete="false" indentLevel="1" classfield_id="742" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="742" tag="hblock_tag_6" canDelete="false" indentLevel="1" classfield_id="742" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="743" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="743" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" double pos;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="743" tag="hblock_tag_7" canDelete="false" indentLevel="1" classfield_id="743" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="743" tag="hblock_tag_8" canDelete="false" indentLevel="1" classfield_id="743" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="744" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="744" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" bool selected;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="744" tag="hblock_tag_9" canDelete="false" indentLevel="1" classfield_id="744" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="744" tag="hblock_tag_10" canDelete="false" indentLevel="1" classfield_id="744" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader750" tqparent_class="750" fileExt=".h" fileName="kiscanvascontrollerinterface" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISCANVASCONTROLLERINTERFACE_H&amp;#010;#define KISCANVASCONTROLLERINTERFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="750" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisCanvasControllerInterface&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisCanvasControllerInterface ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="753" tag="operation_753" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="756" tag="operation_756" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="757" tag="operation_757" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="758" tag="operation_758" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="759" tag="operation_759" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param x &amp;#010;@param y &amp;#010;@param w &amp;#010;@param h " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="764" tag="operation_764" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param rc " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="766" tag="operation_766" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="767" tag="operation_767" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param x &amp;#010;@param y " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="770" tag="operation_770" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param pt " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="772" tag="operation_772" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param rc " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="774" tag="operation_774" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param x &amp;#010;@param y " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="777" tag="operation_777" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param pt " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="779" tag="operation_779" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param rc " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="781" tag="operation_781" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="782" tag="operation_782" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param x &amp;#010;@param y " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="785" tag="operation_785" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="786" tag="operation_786" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param x &amp;#010;@param y " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="789" tag="operation_789" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="751" tag="operation_751" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="754" tag="operation_754" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISCANVASCONTROLLERINTERFACE_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kiscanvascontrollerinterface.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:49:33&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields/>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader790" tqparent_class="790" fileExt=".h" fileName="kisguidemgr" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISGUIDEMGR_H&amp;#010;#define KISGUIDEMGR_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;kisguidesp.h&quot;&amp;#010;#include &quot;double.h&quot;&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;vkisguidesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="790" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisGuideMgr&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="1270" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisImage ;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisGuideMgr ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="1270" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1270" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="1270" tag="hblock_tag_12" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1270" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="1270" tag="hblock_tag_13" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1270" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="1270" tag="hblock_tag_14" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1270" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="1270" tag="hblock_tag_15" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1270" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="802" tag="operation_802" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="803" tag="operation_803" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param pos &amp;#010;@param o " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="806" tag="operation_806" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param device &amp;#010;@param w &amp;#010;@param xOffset &amp;#010;@param yOffset &amp;#010;@param zoom " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="812" tag="operation_812" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param x &amp;#010;@param y &amp;#010;@param d " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="816" tag="operation_816" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param y &amp;#010;@param d " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="819" tag="operation_819" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param x &amp;#010;@param d " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="822" tag="operation_822" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="823" tag="operation_823" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param element " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="825" tag="operation_825" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param d " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="827" tag="operation_827" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param d " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="829" tag="operation_829" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param device &amp;#010;@param w &amp;#010;@param xOffset &amp;#010;@param yOffset &amp;#010;@param zoom " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="835" tag="operation_835" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gd " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="837" tag="operation_837" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="838" tag="operation_838" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="839" tag="operation_839" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param size " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="846" tag="operation_846" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param element " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="848" tag="operation_848" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gd " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="850" tag="operation_850" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="851" tag="operation_851" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="852" tag="operation_852" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gd " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="854" tag="operation_854" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="855" tag="operation_855" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="841" tag="operation_841" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param size &amp;#010;@param vLine &amp;#010;@param hLine &amp;#010;@param linePattern " />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="791" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_hGuideLines;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="792" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_hGuideLinesSelected;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="793" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" vKisGuideSP m_lines;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="794" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_pattern;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="795" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_patternSelected;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="796" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" QSize m_size;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="797" tag="tblock_7" canDelete="false" indentLevel="1" role_id="-1" text=" vKisGuideSP m_slines;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="798" tag="tblock_8" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_vGuideLines;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="799" tag="tblock_9" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_vGuideLinesSelected;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="800" tag="tblock_10" canDelete="false" indentLevel="1" role_id="-1" text=" const char * [] s_xbm;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="801" tag="tblock_11" canDelete="false" indentLevel="1" role_id="-1" text=" const char * [] s_xbm_selected;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="791" tag="hblock_tag_16" canDelete="false" indentLevel="1" classfield_id="791" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="791" tag="hblock_tag_17" canDelete="false" indentLevel="1" classfield_id="791" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="792" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="792" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="792" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="792" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="793" tag="hblock_tag_20" canDelete="false" indentLevel="1" classfield_id="793" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="793" tag="hblock_tag_21" canDelete="false" indentLevel="1" classfield_id="793" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="794" tag="hblock_tag_22" canDelete="false" indentLevel="1" classfield_id="794" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="794" tag="hblock_tag_23" canDelete="false" indentLevel="1" classfield_id="794" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="795" tag="hblock_tag_24" canDelete="false" indentLevel="1" classfield_id="795" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="795" tag="hblock_tag_25" canDelete="false" indentLevel="1" classfield_id="795" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="796" tag="hblock_tag_26" canDelete="false" indentLevel="1" classfield_id="796" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="796" tag="hblock_tag_27" canDelete="false" indentLevel="1" classfield_id="796" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="797" tag="hblock_tag_28" canDelete="false" indentLevel="1" classfield_id="797" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="797" tag="hblock_tag_29" canDelete="false" indentLevel="1" classfield_id="797" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="798" tag="hblock_tag_30" canDelete="false" indentLevel="1" classfield_id="798" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="798" tag="hblock_tag_31" canDelete="false" indentLevel="1" classfield_id="798" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="799" tag="hblock_tag_32" canDelete="false" indentLevel="1" classfield_id="799" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="799" tag="hblock_tag_33" canDelete="false" indentLevel="1" classfield_id="799" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="800" tag="hblock_tag_34" canDelete="false" indentLevel="1" classfield_id="800" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="800" tag="hblock_tag_35" canDelete="false" indentLevel="1" classfield_id="800" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="801" tag="hblock_tag_36" canDelete="false" indentLevel="1" classfield_id="801" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="801" tag="hblock_tag_37" canDelete="false" indentLevel="1" classfield_id="801" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISGUIDEMGR_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisguidemgr.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="791" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="791" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_hGuideLines;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="791" tag="hblock_tag_16" canDelete="false" indentLevel="1" classfield_id="791" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="791" tag="hblock_tag_17" canDelete="false" indentLevel="1" classfield_id="791" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="792" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="792" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_hGuideLinesSelected;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="792" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="792" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="792" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="792" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="793" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="793" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" vKisGuideSP m_lines;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="793" tag="hblock_tag_20" canDelete="false" indentLevel="1" classfield_id="793" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="793" tag="hblock_tag_21" canDelete="false" indentLevel="1" classfield_id="793" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="794" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="794" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_pattern;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="794" tag="hblock_tag_22" canDelete="false" indentLevel="1" classfield_id="794" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="794" tag="hblock_tag_23" canDelete="false" indentLevel="1" classfield_id="794" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="795" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="795" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_patternSelected;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="795" tag="hblock_tag_24" canDelete="false" indentLevel="1" classfield_id="795" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="795" tag="hblock_tag_25" canDelete="false" indentLevel="1" classfield_id="795" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="796" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="796" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" QSize m_size;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="796" tag="hblock_tag_26" canDelete="false" indentLevel="1" classfield_id="796" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="796" tag="hblock_tag_27" canDelete="false" indentLevel="1" classfield_id="796" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="797" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="797" tag="tblock_7" canDelete="false" indentLevel="1" role_id="-1" text=" vKisGuideSP m_slines;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="797" tag="hblock_tag_28" canDelete="false" indentLevel="1" classfield_id="797" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="797" tag="hblock_tag_29" canDelete="false" indentLevel="1" classfield_id="797" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="798" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="798" tag="tblock_8" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_vGuideLines;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="798" tag="hblock_tag_30" canDelete="false" indentLevel="1" classfield_id="798" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="798" tag="hblock_tag_31" canDelete="false" indentLevel="1" classfield_id="798" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="799" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="799" tag="tblock_9" canDelete="false" indentLevel="1" role_id="-1" text=" QPixmap m_vGuideLinesSelected;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="799" tag="hblock_tag_32" canDelete="false" indentLevel="1" classfield_id="799" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="799" tag="hblock_tag_33" canDelete="false" indentLevel="1" classfield_id="799" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="800" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="800" tag="tblock_10" canDelete="false" indentLevel="1" role_id="-1" text=" const char * [] s_xbm;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="800" tag="hblock_tag_34" canDelete="false" indentLevel="1" classfield_id="800" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="800" tag="hblock_tag_35" canDelete="false" indentLevel="1" classfield_id="800" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="801" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="801" tag="tblock_11" canDelete="false" indentLevel="1" role_id="-1" text=" const char * [] s_xbm_selected;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="801" tag="hblock_tag_36" canDelete="false" indentLevel="1" classfield_id="801" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="801" tag="hblock_tag_37" canDelete="false" indentLevel="1" classfield_id="801" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1270" field_type="4" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1270" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisImage ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1270" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1270" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1270" tag="hblock_tag_12" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1270" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1270" tag="hblock_tag_13" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1270" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1270" tag="hblock_tag_14" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1270" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1270" tag="hblock_tag_15" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1270" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader856" tqparent_class="856" fileExt=".h" fileName="kisgradient" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISGRADIENT_H&amp;#010;#define KISGRADIENT_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;int.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="856" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisGradient&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="1776" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisPainter ;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="2385" tag="tblock_1" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisView ;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisGradient ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="1776" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1776" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="1776" tag="hblock_tag_6" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1776" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="1776" tag="hblock_tag_7" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1776" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="1776" tag="hblock_tag_8" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1776" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="1776" tag="hblock_tag_9" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1776" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="2385" tag="hblock_tag_10" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2385" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="2385" tag="hblock_tag_11" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2385" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="2385" tag="hblock_tag_12" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2385" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="2385" tag="hblock_tag_13" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2385" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="2385" tag="hblock_tag_14" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2385" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="861" tag="operation_861" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="862" tag="operation_862" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param x &amp;#010;@param y " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="865" tag="operation_865" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param palette &amp;#010;@param size " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="869" tag="operation_869" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param size &amp;#010;@param ca &amp;#010;@param cb &amp;#010;@param eff &amp;#010;@param ncols " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="875" tag="operation_875" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="876" tag="operation_876" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param x &amp;#010;@param y " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="879" tag="operation_879" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gradR &amp;#010;@param startColor &amp;#010;@param endColor " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="883" tag="operation_883" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gradR &amp;#010;@param startColor &amp;#010;@param endColor " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="887" tag="operation_887" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param gradR &amp;#010;@param startColor &amp;#010;@param endColor " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="891" tag="operation_891" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param r &amp;#010;@param g &amp;#010;@param b &amp;#010;@param palette &amp;#010;@param size " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="897" tag="operation_897" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param _effect " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="899" tag="operation_899" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="900" tag="operation_900" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="901" tag="operation_901" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="857" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QMemArray gradArray;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="858" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" QImage gradImage;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="859" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" int mGradientHeight;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="860" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" int mGradientWidth;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="857" tag="hblock_tag_15" canDelete="false" indentLevel="1" classfield_id="857" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="857" tag="hblock_tag_16" canDelete="false" indentLevel="1" classfield_id="857" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="858" tag="hblock_tag_17" canDelete="false" indentLevel="1" classfield_id="858" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="858" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="858" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="859" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="859" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="859" tag="hblock_tag_20" canDelete="false" indentLevel="1" classfield_id="859" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="860" tag="hblock_tag_21" canDelete="false" indentLevel="1" classfield_id="860" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="860" tag="hblock_tag_22" canDelete="false" indentLevel="1" classfield_id="860" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISGRADIENT_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisgradient.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="857" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="857" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" QMemArray gradArray;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="857" tag="hblock_tag_15" canDelete="false" indentLevel="1" classfield_id="857" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="857" tag="hblock_tag_16" canDelete="false" indentLevel="1" classfield_id="857" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="858" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="858" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" QImage gradImage;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="858" tag="hblock_tag_17" canDelete="false" indentLevel="1" classfield_id="858" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="858" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="858" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="859" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="859" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" int mGradientHeight;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="859" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="859" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="859" tag="hblock_tag_20" canDelete="false" indentLevel="1" classfield_id="859" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="860" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="860" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" int mGradientWidth;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="860" tag="hblock_tag_21" canDelete="false" indentLevel="1" classfield_id="860" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="860" tag="hblock_tag_22" canDelete="false" indentLevel="1" classfield_id="860" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="1776" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="1776" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisPainter ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="1776" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1776" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="1776" tag="hblock_tag_6" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1776" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="1776" tag="hblock_tag_7" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1776" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="1776" tag="hblock_tag_8" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1776" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="1776" tag="hblock_tag_9" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="1776" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2385" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2385" tag="tblock_1" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisView ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2385" tag="hblock_tag_10" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2385" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2385" tag="hblock_tag_11" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2385" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2385" tag="hblock_tag_12" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2385" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2385" tag="hblock_tag_13" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2385" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2385" tag="hblock_tag_14" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2385" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader902" tqparent_class="902" fileExt=".h" fileName="kisdoc" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISDOC_H&amp;#010;#define KISDOC_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;#include &quot;bool.h&quot;&amp;#010;#include &quot;kisimagesp.h&quot;&amp;#010;#include &quot;kisselectionsp.h&quot;&amp;#010;#include &quot;kislayersp.h&quot;&amp;#010;#include &quot;compositeop.h&quot;&amp;#010;#include &quot;quantum.h&quot;&amp;#010;#include &quot;enumimgtype.h&quot;&amp;#010;#include &quot;kischannelsp.h&quot;&amp;#010;#include &quot;double.h&quot;&amp;#010;#include &quot;kisstrategycolorspacemap.h&quot;&amp;#010;#include &quot;vkisimagesp.h&quot;&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="902" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisDoc&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="2382" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisView ;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisDoc ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="2382" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2382" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="2382" tag="hblock_tag_12" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2382" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="2" tqparent_id="2382" tag="hblock_tag_13" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2382" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="3" tqparent_id="2382" tag="hblock_tag_14" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2382" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="4" tqparent_id="2382" tag="hblock_tag_15" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2382" role_id="1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="914" tag="operation_914" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tqparentWidget &amp;#010;@param widgetName &amp;#010;@param tqparent &amp;#010;@param name &amp;#010;@param singleViewMode " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="922" tag="operation_922" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="926" tag="operation_926" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="927" tag="operation_927" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param store " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="929" tag="operation_929" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="931" tag="operation_931" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="936" tag="operation_936" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="937" tag="operation_937" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="939" tag="operation_939" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param name " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="941" tag="operation_941" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="943" tag="operation_943" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param num " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="945" tag="operation_945" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="946" tag="operation_946" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param filename " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="950" tag="operation_950" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="951" tag="operation_951" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="952" tag="operation_952" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param layer &amp;#010;@param position " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="956" tag="operation_956" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param width &amp;#010;@param height &amp;#010;@param name &amp;#010;@param compositeOp &amp;#010;@param opacity &amp;#010;@param pos &amp;#010;@param type " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="965" tag="operation_965" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param width &amp;#010;@param height &amp;#010;@param name &amp;#010;@param devOpacity " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="971" tag="operation_971" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param name &amp;#010;@param selection " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="975" tag="operation_975" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param layer " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="978" tag="operation_978" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param layer " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="981" tag="operation_981" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param layer " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="984" tag="operation_984" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param layer " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="987" tag="operation_987" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param layer " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="998" tag="operation_998" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  &amp;#010;@param  " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1001" tag="operation_1001" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param  &amp;#010;@param doc " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1004" tag="operation_1004" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1005" tag="operation_1005" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param name " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1007" tag="operation_1007" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param name &amp;#010;@param width &amp;#010;@param height &amp;#010;@param type " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1012" tag="operation_1012" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1013" tag="operation_1013" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1014" tag="operation_1014" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param painter &amp;#010;@param rect &amp;#010;@param transparent &amp;#010;@param zoomX &amp;#010;@param zoomY " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1020" tag="operation_1020" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1021" tag="operation_1021" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1023" tag="operation_1023" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param name " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1025" tag="operation_1025" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param oldName &amp;#010;@param newName " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1037" tag="operation_1037" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1038" tag="operation_1038" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param selection " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1040" tag="operation_1040" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img &amp;#010;@param layer &amp;#010;@param opacity &amp;#010;@param compositeOp &amp;#010;@param name " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1046" tag="operation_1046" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1048" tag="operation_1048" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param limit " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1052" tag="operation_1052" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param limit " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1056" tag="operation_1056" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1057" tag="operation_1057" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="protectedBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Protected stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="protectedFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="protMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="protStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="protRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="920" tag="operation_920" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param cmd " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="924" tag="operation_924" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param macroName " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="933" tag="operation_933" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param tqparent &amp;#010;@param name " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="938" tag="operation_938" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="948" tag="operation_948" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="949" tag="operation_949" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="990" tag="operation_990" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param elem &amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="993" tag="operation_993" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param elem " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="995" tag="operation_995" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param elem &amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1028" tag="operation_1028" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param doc &amp;#010;@param channel " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1031" tag="operation_1031" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param doc &amp;#010;@param img " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1034" tag="operation_1034" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param doc &amp;#010;@param layer " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1050" tag="operation_1050" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="&amp;#010;@param undo " />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1054" tag="operation_1054" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1055" tag="operation_1055" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+               </textblocks>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+          <hierarchicalcodeblock tag="privateBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Private stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="privateFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks>
+              <ccfdeclarationcodeblock tqparent_id="903" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KisSelectionSP m_clipboard;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="904" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" KCommandHistory * m_cmdHistory;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="905" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" KisStrategyColorSpaceMap m_colorspaces;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="906" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_conversionDepth;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="907" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" KMacroCommand * m_currentMacro;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="908" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" DCOPObject * m_dcop;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="909" tag="tblock_7" canDelete="false" indentLevel="1" role_id="-1" text=" vKisImageSP m_images;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="910" tag="tblock_8" canDelete="false" indentLevel="1" role_id="-1" text=" KisNameServer * m_nserver;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="911" tag="tblock_9" canDelete="false" indentLevel="1" role_id="-1" text=" KisImageSP m_projection;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="912" tag="tblock_10" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_pushedClipboard;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+              <ccfdeclarationcodeblock tqparent_id="913" tag="tblock_11" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_undo;" >
+               <header>
+                <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+               </header>
+              </ccfdeclarationcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="privMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="privStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="privRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks>
+                  <codeaccessormethod accessType="0" tqparent_id="903" tag="hblock_tag_16" canDelete="false" indentLevel="1" classfield_id="903" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="903" tag="hblock_tag_17" canDelete="false" indentLevel="1" classfield_id="903" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="904" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="904" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="904" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="904" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="905" tag="hblock_tag_20" canDelete="false" indentLevel="1" classfield_id="905" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="905" tag="hblock_tag_21" canDelete="false" indentLevel="1" classfield_id="905" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="906" tag="hblock_tag_22" canDelete="false" indentLevel="1" classfield_id="906" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="906" tag="hblock_tag_23" canDelete="false" indentLevel="1" classfield_id="906" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="907" tag="hblock_tag_24" canDelete="false" indentLevel="1" classfield_id="907" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="907" tag="hblock_tag_25" canDelete="false" indentLevel="1" classfield_id="907" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="908" tag="hblock_tag_26" canDelete="false" indentLevel="1" classfield_id="908" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="908" tag="hblock_tag_27" canDelete="false" indentLevel="1" classfield_id="908" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="909" tag="hblock_tag_28" canDelete="false" indentLevel="1" classfield_id="909" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="909" tag="hblock_tag_29" canDelete="false" indentLevel="1" classfield_id="909" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="910" tag="hblock_tag_30" canDelete="false" indentLevel="1" classfield_id="910" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="910" tag="hblock_tag_31" canDelete="false" indentLevel="1" classfield_id="910" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="911" tag="hblock_tag_32" canDelete="false" indentLevel="1" classfield_id="911" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="911" tag="hblock_tag_33" canDelete="false" indentLevel="1" classfield_id="911" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="912" tag="hblock_tag_34" canDelete="false" indentLevel="1" classfield_id="912" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="912" tag="hblock_tag_35" canDelete="false" indentLevel="1" classfield_id="912" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="0" tqparent_id="913" tag="hblock_tag_36" canDelete="false" indentLevel="1" classfield_id="913" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                  <codeaccessormethod accessType="1" tqparent_id="913" tag="hblock_tag_37" canDelete="false" indentLevel="1" classfield_id="913" role_id="-1" >
+                   <header>
+                    <cppcodedocumentation tag="" indentLevel="1" />
+                   </header>
+                  </codeaccessormethod>
+                 </textblocks>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks/>
+              </hierarchicalcodeblock>
+             </textblocks>
+            </hierarchicalcodeblock>
+           </textblocks>
+          </hierarchicalcodeblock>
+         </textblocks>
+        </cppheaderclassdeclarationblock>
+       </textblocks>
+      </hierarchicalcodeblock>
+      <codeblockwithcomments tag="hashDefBlockEnd" text="#endif //KISDOC_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+     </textblocks>
+     <header>
+      <codecomment tag="" text="/************************************************************************&amp;#010;  			kisdoc.h - Copyright boud&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/opt/kde3/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010;   i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010;   files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010;   java code.&amp;#010;   If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010;   choose this file even if there are other files with the same extension in the&amp;#010;   directory. If you name the file something else, it must be the only one with that&amp;#010;   extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Sun Feb 8 2004 at 16:45:18&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
+     </header>
+     <classfields>
+      <codeclassfield tqparent_id="903" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="903" tag="tblock_1" canDelete="false" indentLevel="1" role_id="-1" text=" KisSelectionSP m_clipboard;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="903" tag="hblock_tag_16" canDelete="false" indentLevel="1" classfield_id="903" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="903" tag="hblock_tag_17" canDelete="false" indentLevel="1" classfield_id="903" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="904" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="904" tag="tblock_2" canDelete="false" indentLevel="1" role_id="-1" text=" KCommandHistory * m_cmdHistory;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="904" tag="hblock_tag_18" canDelete="false" indentLevel="1" classfield_id="904" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="904" tag="hblock_tag_19" canDelete="false" indentLevel="1" classfield_id="904" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="905" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="905" tag="tblock_3" canDelete="false" indentLevel="1" role_id="-1" text=" KisStrategyColorSpaceMap m_colorspaces;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="905" tag="hblock_tag_20" canDelete="false" indentLevel="1" classfield_id="905" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="905" tag="hblock_tag_21" canDelete="false" indentLevel="1" classfield_id="905" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="906" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="906" tag="tblock_4" canDelete="false" indentLevel="1" role_id="-1" text=" Q_INT32 m_conversionDepth;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="906" tag="hblock_tag_22" canDelete="false" indentLevel="1" classfield_id="906" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="906" tag="hblock_tag_23" canDelete="false" indentLevel="1" classfield_id="906" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="907" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="907" tag="tblock_5" canDelete="false" indentLevel="1" role_id="-1" text=" KMacroCommand * m_currentMacro;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="907" tag="hblock_tag_24" canDelete="false" indentLevel="1" classfield_id="907" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="907" tag="hblock_tag_25" canDelete="false" indentLevel="1" classfield_id="907" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="908" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="908" tag="tblock_6" canDelete="false" indentLevel="1" role_id="-1" text=" DCOPObject * m_dcop;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="908" tag="hblock_tag_26" canDelete="false" indentLevel="1" classfield_id="908" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="908" tag="hblock_tag_27" canDelete="false" indentLevel="1" classfield_id="908" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="909" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="909" tag="tblock_7" canDelete="false" indentLevel="1" role_id="-1" text=" vKisImageSP m_images;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="909" tag="hblock_tag_28" canDelete="false" indentLevel="1" classfield_id="909" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="909" tag="hblock_tag_29" canDelete="false" indentLevel="1" classfield_id="909" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="910" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="910" tag="tblock_8" canDelete="false" indentLevel="1" role_id="-1" text=" KisNameServer * m_nserver;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="910" tag="hblock_tag_30" canDelete="false" indentLevel="1" classfield_id="910" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="910" tag="hblock_tag_31" canDelete="false" indentLevel="1" classfield_id="910" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="911" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="911" tag="tblock_9" canDelete="false" indentLevel="1" role_id="-1" text=" KisImageSP m_projection;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="911" tag="hblock_tag_32" canDelete="false" indentLevel="1" classfield_id="911" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="911" tag="hblock_tag_33" canDelete="false" indentLevel="1" classfield_id="911" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="912" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="912" tag="tblock_10" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_pushedClipboard;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="912" tag="hblock_tag_34" canDelete="false" indentLevel="1" classfield_id="912" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="912" tag="hblock_tag_35" canDelete="false" indentLevel="1" classfield_id="912" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="913" field_type="0" initialValue="" role_id="-1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="913" tag="tblock_11" canDelete="false" indentLevel="1" role_id="-1" text=" bool m_undo;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="913" tag="hblock_tag_36" canDelete="false" indentLevel="1" classfield_id="913" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="913" tag="hblock_tag_37" canDelete="false" indentLevel="1" classfield_id="913" role_id="-1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+      <codeclassfield tqparent_id="2382" field_type="3" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
+       <header>
+        <cppcodedocumentation tag="" />
+       </header>
+       <ccfdeclarationcodeblock tqparent_id="2382" tag="tblock_0" canDelete="false" writeOutText="false" indentLevel="1" role_id="1" text=" KisView ;" >
+        <header>
+         <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+        </header>
+       </ccfdeclarationcodeblock>
+       <codeaccessormethod accessType="0" tqparent_id="2382" tag="hblock_tag_0" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2382" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="1" tqparent_id="2382" tag="hblock_tag_12" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2382" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="2" tqparent_id="2382" tag="hblock_tag_13" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2382" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="3" tqparent_id="2382" tag="hblock_tag_14" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2382" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+       <codeaccessormethod accessType="4" tqparent_id="2382" tag="hblock_tag_15" canDelete="false" writeOutText="false" indentLevel="1" classfield_id="2382" role_id="1" >
+        <header>
+         <cppcodedocumentation tag="" indentLevel="1" />
+        </header>
+       </codeaccessormethod>
+      </codeclassfield>
+     </classfields>
+    </classifiercodedocument>
+    <classifiercodedocument writeOutCode="true" package="" id="cppheader1058" tqparent_class="1058" fileExt=".h" fileName="kiscursor" >
+     <textblocks>
+      <codeblockwithcomments tag="hashDefBlock" text="#ifndef KISCURSOR_H&amp;#010;#define KISCURSOR_H" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="includes" text="#include &lt;string>&amp;#010;" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <codeblockwithcomments tag="using" writeOutText="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" />
+       </header>
+      </codeblockwithcomments>
+      <hierarchicalcodeblock tag="namespace" canDelete="false" >
+       <header>
+        <cppcodedocumentation tag="" writeOutText="false" text="Namespace" />
+       </header>
+       <textblocks>
+        <codeblockwithcomments tag="enums" writeOutText="false" >
+         <header>
+          <cppcodedocumentation tag="" writeOutText="false" />
+         </header>
+        </codeblockwithcomments>
+        <cppheaderclassdeclarationblock tqparent_id="1058" tag="classDeclarationBlock" canDelete="false" role_id="-1" >
+         <header>
+          <cppcodecomment tag="" text="Class KisCursor&amp;#010;" />
+         </header>
+         <textblocks>
+          <hierarchicalcodeblock tag="publicBlock" canDelete="false" >
+           <header>
+            <cppcodedocumentation tag="" text="Public stuff" />
+           </header>
+           <textblocks>
+            <hierarchicalcodeblock tag="publicFieldsDecl" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" text="Fields" />
+             </header>
+             <textblocks/>
+            </hierarchicalcodeblock>
+            <hierarchicalcodeblock tag="pubMethodsBlock" canDelete="false" indentLevel="1" >
+             <header>
+              <cppcodedocumentation tag="" indentLevel="1" />
+             </header>
+             <textblocks>
+              <hierarchicalcodeblock tag="constructionMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Constructors" />
+               </header>
+               <textblocks>
+                <codeblockwithcomments tag="emptyconstructor" writeOutText="false" indentLevel="1" text="KisCursor ( ) { }" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" text="Empty Constructor" />
+                 </header>
+                </codeblockwithcomments>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="accessorMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Accessor Methods" />
+               </header>
+               <textblocks>
+                <hierarchicalcodeblock tag="pubStaticAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+                <hierarchicalcodeblock tag="pubRegularAccessorMethods" canDelete="false" indentLevel="1" >
+                 <header>
+                  <cppcodedocumentation tag="" writeOutText="false" indentLevel="1" />
+                 </header>
+                 <textblocks/>
+                </hierarchicalcodeblock>
+               </textblocks>
+              </hierarchicalcodeblock>
+              <hierarchicalcodeblock tag="operationMethods" canDelete="false" indentLevel="1" >
+               <header>
+                <cppcodedocumentation tag="" indentLevel="1" text="Operations" />
+               </header>
+               <textblocks>
+                <codeoperation tqparent_id="1059" tag="operation_1059" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1060" tag="operation_1060" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1061" tag="operation_1061" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1062" tag="operation_1062" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1063" tag="operation_1063" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1064" tag="operation_1064" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1065" tag="operation_1065" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1066" tag="operation_1066" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1067" tag="operation_1067" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1068" tag="operation_1068" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1069" tag="operation_1069" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1070" tag="operation_1070" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1071" tag="operation_1071" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1072" tag="operation_1072" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1073" tag="operation_1073" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1074" tag="operation_1074" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1075" tag="operation_1075" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1076" tag="operation_1076" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1077" tag="operation_1077" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocumentation tag="" indentLevel="1" />
+                 </header>
+                </codeoperation>
+                <codeoperation tqparent_id="1078" tag="operation_1078" canDelete="false" indentLevel="1" role_id="-1" >
+                 <header>
+                  <cppcodedocume