High-level pixel access methods

Boudewijn Rempt boud at calcifer.valdyas.org
Sun Feb 15 13:55:16 CET 2004


On Sunday 15 February 2004 13:25, Boudewijn Rempt wrote:

> In KisPainter::computeDab, I take the alpha mask from a brush (but it would
> be the same with the QImage of a brush) and create a temporary layer that I
> can composite with any of the implemented composite ops onto the target
> layer. This is what I do:
>
>         m_dab = new KisLayer(mask -> width(),
>                              mask -> height(),
>                              m_device -> typeWithAlpha(),
>                              "dab");
>         m_dab -> setOpacity(OPACITY_TRANSPARENT);
>         for (int y = 0; y < mask -> height(); y++) {
>                 for (int x = 0; x < mask -> width(); x++) {
>                         m_dab -> setPixel(x, y, m_paintColor, mask ->
> alphaAt(x, y));
>                 }
>         }
>

Hm. A temporary solution for this would perhaps be to add constructors to 
KisPaintDevice with QImage, KisAlphaBuffer and other buffers with image data, 
and hidden inside KisPaintdevice fill KisPixelData -- that would prevent 
multiple calls to setPixel at the expense of adding a new constructor for 
every type of image data I would like to convert to a paint device.

-- 
Boudewijn Rempt | http://www.valdyas.org/fading/index.cgi


More information about the kimageshop mailing list