void DivineProportionShape::paint(QPainter &painter, const KoViewConverter &converter)
{
    if (m_printable) {
        applyConversion(painter, converter);
        draw(painter);
    }
}
Пример #2
0
void ArtisticTextShape::paint(QPainter &painter, const KViewConverter &converter)
{
    applyConversion( painter, converter );
    painter.setFont( m_font );
    if ( background() )
        background()->paint( painter, outline() );
}
Пример #3
0
void KoFormulaShape::paint( QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &)
{
    painter.save();
    applyConversion( painter, converter );   // apply zooming and coordinate translation
    m_formulaRenderer->layoutElement(  m_formulaData->formulaElement() );
    m_formulaRenderer->paintElement( painter,  m_formulaData->formulaElement() );  // paint the formula
    painter.restore();
}
void DivineProportionShape::paintDecorations(QPainter &painter, const KoViewConverter &converter, const KoCanvasBase *canvas)
{
    Q_UNUSED(canvas);
    if (!m_printable) {
        applyConversion(painter, converter);
        painter.setRenderHint(QPainter::Antialiasing);
        draw(painter);
    }
}
Пример #5
0
void KWPageBackground::paint(QPainter &painter, const KoViewConverter &converter)
{
    if (background()) {
        applyConversion(painter, converter);
        QPainterPath p;
        p.addRect(QRectF(QPointF(), size()));
        background()->paint(painter, p);
    }
}
Пример #6
0
void KWOutlineShape::paintDecorations(QPainter &painter, const KViewConverter &converter, const KCanvasBase *canvas)
{
    if (! canvas->shapeManager()->selection()->isSelected(this))
        return;

    applyConversion(painter, converter);

    QPen pen = QPen(canvas->resourceManager()->colorResource(KWord::FrameOutlineColor));
    QPointF onePixel = converter.viewToDocument(QPointF(1, 1));
    pen.setWidthF(onePixel.x());
    painter.strokePath(outline(), pen);
}
Пример #7
0
void KoParameterShape::paintHandle(QPainter & painter, const KoViewConverter & converter, int handleId, int handleRadius)
{
    applyConversion(painter, converter);

    QMatrix worldMatrix = painter.worldMatrix();
    painter.setMatrix(QMatrix());

    QMatrix matrix;
    matrix.rotate(45.0);
    QPolygonF poly(handleRect(QPointF(0, 0), handleRadius));
    poly = matrix.map(poly);
    poly.translate(worldMatrix.map(m_handles[handleId]));
    painter.drawPolygon(poly);
}
void KPrPlaceholderShape::paint( QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext)
{
    QRectF rect( QPointF( 0, 0 ), size() );
    if ( m_strategy ) {
        m_strategy->paint( painter, converter, rect, paintcontext);
    }
    else {
        applyConversion( painter, converter );
        QPen pen( Qt::gray );
        pen.setStyle( Qt::DashLine );
        painter.setPen( pen );
        painter.drawRect( rect );
    }
}
Пример #9
0
void KParameterShape::paintHandle(QPainter & painter, const KViewConverter & converter, int handleId, int handleRadius)
{
    Q_D(KParameterShape);
    applyConversion(painter, converter);

    QTransform worldMatrix = painter.worldTransform();
    painter.setTransform(QTransform());

    QTransform matrix;
    matrix.rotate(45.0);
    QPolygonF poly(d->handleRect(QPointF(0, 0), handleRadius));
    poly = matrix.map(poly);
    poly.translate(worldMatrix.map(d->handles[handleId]));
    painter.drawPolygon(poly);
}
Пример #10
0
/* GfxConvDialog::btnConvertAllClicked
 * Called when the 'Convert All' button is clicked
 *******************************************************************/
void GfxConvDialog::onBtnConvertAll(wxCommandEvent& e)
{
	// Show splash window
	theSplashWindow->show("Converting Gfx...", true);

	// Convert all images
	for (size_t a = current_item; a < items.size(); a++)
	{
		applyConversion();
		if (!nextItem())
			break;
	}

	// Hide splash window
	theSplashWindow->hide();
}
Пример #11
0
void KritaShape::paint(QPainter& painter, const KoViewConverter& converter)
{
    if (m_d && m_d->doc && m_d->doc->image()) {
        // XXX: Only convert the bit the painter needs for painting?
        //      Or should we keep a converted qimage in readiness,
        //      just as with KisCanvas2?
        KisImageSP kimage = m_d->doc->image();

        QImage qimg = kimage->convertToQImage(0, 0, kimage->width(), kimage->height(),
                                              m_d->displayProfile); // XXX: How about exposure?

        const QRectF paintRect = QRectF(QPointF(0.0, 0.0), size());
        applyConversion(painter, converter);
        painter.drawImage(paintRect.toRect(), qimg);

    } else if (m_d->doc == 0)
        tryLoadFromImageData(dynamic_cast<KoImageData*>(KoShape::userData()));
}
Пример #12
0
void KoPAPageBase::paintBackground( QPainter & painter, const KoViewConverter & converter, KoShapePaintingContext &paintContext )
{
    painter.save();
    applyConversion( painter, converter );
    KoPageLayout layout = pageLayout();
    painter.setPen( Qt::black );

    if (background()) {
        QPainterPath p;
        p.addRect( QRectF( 0.0, 0.0, layout.width, layout.height ) );
        background()->paint( painter, converter, paintContext, p );
    }
    else {
        painter.setBrush(Qt::white);
        painter.drawRect(QRectF(0.0, 0.0, layout.width, layout.height));
    }

    painter.restore();
}
Пример #13
0
    virtual void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext)
    {
        applyConversion(painter, converter);

        // paint background
        if (background()) {
            QPainterPath p;
            p.addRect(QRectF(QPointF(), size()));
            background()->paint(painter, converter, paintContext, p);
        }

        // paint separators
        if (! m_separatorPositions.isEmpty()) {
            QPen separatorPen(QBrush(m_separatorColor), m_separatorWidth,
                              Qt::PenStyle(m_separatorStyle), Qt::FlatCap);
            painter.setPen(separatorPen);
            foreach(qreal separatorPos, m_separatorPositions) {
                QLineF line(separatorPos, m_separatorY, separatorPos, m_separatorY+m_separatorHeight);
                painter.drawLine(line);
            }
Пример #14
0
void KoParameterShape::paintHandles(QPainter & painter, const KoViewConverter & converter, int handleRadius)
{
    applyConversion(painter, converter);

    QMatrix worldMatrix = painter.worldMatrix();
    painter.setMatrix(QMatrix());

    QMatrix matrix;
    matrix.rotate(45.0);
    QPolygonF poly(handleRect(QPointF(0, 0), handleRadius));
    poly = matrix.map(poly);

    QList<QPointF>::const_iterator it(m_handles.constBegin());
    for (; it != m_handles.constEnd(); ++it) {
        QPointF moveVector = worldMatrix.map(*it);
        poly.translate(moveVector.x(), moveVector.y());
        painter.drawPolygon(poly);
        poly.translate(-moveVector.x(), -moveVector.y());
    }
}
Пример #15
0
void InitialsCommentShape::paint(QPainter& painter, const KoViewConverter& converter, KoShapePaintingContext &)
{
    applyConversion(painter, converter);

    QLinearGradient gradient(initialsBoxPoint, QPointF(0, initialsBoxSize.height()));
    qreal lighterPos = 0.0;
    qreal darkerPos = 0.0;
    if(!m_active){
        darkerPos = 1.0;
    }
    else {
        lighterPos = 1.0;
    }
    gradient.setColorAt(lighterPos, QColor(Qt::yellow));
    gradient.setColorAt(darkerPos, QColor(254, 201, 7));
    const QBrush brush(gradient);
    painter.setBrush(brush);

    painter.setPen(Qt::black);

    painter.drawRect(QRectF(initialsBoxPoint, initialsBoxSize));

    painter.drawText(QRectF(initialsBoxPoint, initialsBoxSize), Qt::AlignCenter, m_initials);
}
Пример #16
0
void PictureShape::paint(QPainter &painter, const KoViewConverter &converter,
                         KoShapePaintingContext &paintContext)
{
    Q_UNUSED(paintContext);

    QRectF viewRect = converter.documentToView(QRectF(QPointF(0,0), size()));
    if (imageData() == 0) {
        painter.fillRect(viewRect, QColor(Qt::gray));
        return;
    }

    painter.save();
    applyConversion(painter, converter);
    paintBorder(painter, converter);
    painter.restore();

    QSize pixmapSize = calcOptimalPixmapSize(viewRect.size(), imageData()->image().size());

    // Normalize the clipping rect if it isn't already done.
    m_clippingRect.normalize(imageData()->imageSize());

    // Handle style:mirror, i.e. mirroring horizontally and/or vertically.
    // 
    // NOTE: At this time we don't handle HorizontalOnEven
    //       and HorizontalOnOdd, which have to know which
    //       page they are on.  In those cases we treat it as
    //       no horizontal mirroring at all.
    bool   doFlip = false;
    QSizeF shapeSize = size();
    QSizeF viewSize = converter.documentToView(shapeSize);
    qreal  midpointX = 0.0;
    qreal  midpointY = 0.0;
    qreal  scaleX = 1.0;
    qreal  scaleY = 1.0;
    if (m_mirrorMode & MirrorHorizontal) {
        midpointX = viewSize.width() / qreal(2.0);
        scaleX = -1.0;
        doFlip = true;
    }
    if (m_mirrorMode & MirrorVertical) {
        midpointY = viewSize.height() / qreal(2.0);
        scaleY = -1.0;
        doFlip = true;
    }
    if (doFlip) {
        QTransform outputTransform = painter.transform();
        QTransform worldTransform  = QTransform();

        //kDebug(31000) << "Flipping" << midpointX << midpointY << scaleX << scaleY;
        worldTransform.translate(midpointX, midpointY);
        worldTransform.scale(scaleX, scaleY);
        worldTransform.translate(-midpointX, -midpointY);
        //kDebug(31000) << "After flipping for window" << worldTransform;

        QTransform newTransform = worldTransform * outputTransform;
        painter.setWorldTransform(newTransform);
    }

    // Paint the image as prepared in waitUntilReady()
    if (!m_printQualityImage.isNull() && pixmapSize != m_printQualityRequestedSize) {
        QSizeF imageSize = m_printQualityImage.size();
        QRectF cropRect(
            imageSize.width()  * m_clippingRect.left,
            imageSize.height() * m_clippingRect.top,
            imageSize.width()  * m_clippingRect.width(),
            imageSize.height() * m_clippingRect.height()
        );

        painter.drawImage(viewRect, m_printQualityImage, cropRect);
        m_printQualityImage = QImage(); // free memory
    }
    else {
        QPixmap pixmap;
        QString key(generate_key(imageData()->key(), pixmapSize));

        // If the required pixmap is not in the cache
        // launch a task in a background thread that scales
        // the source image to the required size
        if (!QPixmapCache::find(key, &pixmap)) {
            QThreadPool::globalInstance()->start(new _Private::PixmapScaler(this, pixmapSize));
            painter.fillRect(viewRect, QColor(Qt::gray)); // just paint a gray rect as long as we don't have the required pixmap
        }
        else {
            QRectF cropRect(
                pixmapSize.width()  * m_clippingRect.left,
                pixmapSize.height() * m_clippingRect.top,
                pixmapSize.width()  * m_clippingRect.width(),
                pixmapSize.height() * m_clippingRect.height()
            );

            painter.drawPixmap(viewRect, pixmap, cropRect);
        }
    }
}
Пример #17
0
/* GfxConvDialog::btnConvertClicked
 * Called when the 'Convert' button is clicked
 *******************************************************************/
void GfxConvDialog::onBtnConvert(wxCommandEvent& e)
{
	applyConversion();
	nextItem();
}
Пример #18
0
void ArtisticTextShape::paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext)
{
    applyConversion( painter, converter );
    if( background() )
        background()->paint( painter, converter, paintContext, outline() );
}