High-level pixel access methods
Patrick Julien
freak at codepimps.org
Sun Feb 15 17:02:13 CET 2004
On February 15, 2004 07:55 am, Boudewijn Rempt wrote:
> 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.
Well, the problem with that is that it will almost certainly fail with
medium/large images has you need one large buffer to hold all the pixels.
More information about the kimageshop
mailing list