Example #1
0
bool KisPixelSelection::isTotallyUnselected(const QRect & r) const
{
    if (*(m_datamanager->defaultPixel()) != MIN_SELECTED)
        return false;
    QRect sr = selectedExactRect();
    return ! r.intersects(sr);
}
Example #2
0
void KisPixelSelection::renderToProjection(KisSelection* projection)
{
    QRect updateRect = selectedExactRect();
    KisPainter painter(projection);
    painter.setCompositeOp(colorSpace()->compositeOp(COMPOSITE_COPY));

    painter.bitBlt(updateRect.topLeft(), KisPaintDeviceSP(this), updateRect);
    painter.end();
}
Example #3
0
void KisPixelSelection::renderToProjection(KisSelection* projection, const QRect& r)
{
    QRect updateRect = r.intersected(selectedExactRect());
    if (updateRect.isValid()) {
        KisPainter painter(projection);
        painter.setCompositeOp(COMPOSITE_COPY);
        painter.bitBlt(updateRect.x(), updateRect.y(), KisPaintDeviceSP(this),
                       updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height());
        painter.end();
    }
}
QVector<QPolygon> KisPixelSelection::outline()
{
    QRect selectionExtent = selectedExactRect();
    qint32 xOffset = selectionExtent.x();
    qint32 yOffset = selectionExtent.y();
    qint32 width = selectionExtent.width();
    qint32 height = selectionExtent.height();

    quint8* buffer = new quint8[width*height];

    readBytes(buffer, xOffset, yOffset, width, height);

    KisOutlineGenerator generator(colorSpace(), *defaultPixel());
    QVector<QPolygon> paths = generator.outline(buffer, xOffset, yOffset, width, height);
    
    delete[] buffer;

    return paths;
}