Ejemplo n.º 1
0
void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore,
        ColourDesired back)
{
    Q_ASSERT(painter);

    painter->setPen(convertQColor(fore));
    painter->setBrush(convertQColor(back));
    drawRect(rc);
}
Ejemplo n.º 2
0
void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore,
        ColourAllocated back)
{
    Q_ASSERT(painter);

    painter->setPen(convertQColor(fore));
    painter->setBrush(convertQColor(back));
    painter->drawRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
}
Ejemplo n.º 3
0
void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore,
        ColourDesired back)
{
    Q_ASSERT(painter);

    painter->setPen(convertQColor(fore));
    painter->setBrush(convertQColor(back));
    painter->drawEllipse(
            QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top));
}
Ejemplo n.º 4
0
void SurfaceImpl::Polygon(Point *pts, int npts, ColourDesired fore,
        ColourDesired back)
{
    Q_ASSERT(painter);

    QPolygonF qpts(npts);

    for (int i = 0; i < npts; ++i)
        qpts[i] = QPointF(pts[i].x, pts[i].y);

    painter->setPen(convertQColor(fore));
    painter->setBrush(convertQColor(back));
    painter->drawPolygon(qpts);
}
Ejemplo n.º 5
0
void SurfaceImpl::Polygon(Point *pts, int npts, ColourAllocated fore,
        ColourAllocated back)
{
    Q_ASSERT(painter);

    QPointArray qpts(npts);

    for (int i = 0; i < npts; ++i)
        qpts.setPoint(i, pts[i].x, pts[i].y);

    painter->setPen(convertQColor(fore));
    painter->setBrush(convertQColor(back));
    painter->drawPolygon(qpts);
}
Ejemplo n.º 6
0
void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back)
{
    Q_ASSERT(painter);

    painter->setPen(Qt::NoPen);
    painter->setBrush(convertQColor(back));
    drawRect(rc);
}
Ejemplo n.º 7
0
void SurfaceImpl::FillRectangle(PRectangle rc, ColourAllocated back)
{
    Q_ASSERT(painter);

    painter->setPen(Qt::NoPen);
    painter->setBrush(convertQColor(back));
    painter->drawRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
}
Ejemplo n.º 8
0
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
        ColourAllocated fill, int alphaFill, ColourAllocated outline,
        int alphaOutline, int)
{
    Q_ASSERT(painter);

    int w = rc.right - rc.left;
    int h = rc.bottom - rc.top;

    // Assume that "cornerSize" means outline width.
    if (cornerSize > 0)
        painter->setPen(QPen(convertQColor(outline, alphaOutline), cornerSize));
    else
        painter->setPen(Qt::NoPen);

    painter->setBrush(convertQColor(fill, alphaFill));
    painter->drawRect(rc.left, rc.top, w, h);
}
Ejemplo n.º 9
0
void SurfaceImpl::drawText(const PRectangle &rc, Font &font_, XYPOSITION ybase,
        const char *s, int len, ColourDesired fore)
{
    QString qs = convertText(s, len);

    QFont *f = PFont(font_.GetID());

    if (f)
        painter->setFont(*f);

    painter->setPen(convertQColor(fore));
    painter->drawText(QPointF(rc.left, ybase), qs);
}
Ejemplo n.º 10
0
void SurfaceImpl::drawText(PRectangle rc, Font &font_, int ybase,
        const char *s, int len, ColourAllocated fore)
{
    QString qs = convertText(s, len);

    QFont *f = PFont(font_.GetID());

    if (f)
        painter->setFont(*f);

    painter->setPen(convertQColor(fore));
    painter->drawText(rc.left, ybase, qs);
}
Ejemplo n.º 11
0
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
        ColourDesired fill, int alphaFill, ColourDesired outline,
        int alphaOutline, int)
{
    Q_ASSERT(painter);

    QColor outline_colour = convertQColor(outline, alphaOutline);
    QColor fill_colour = convertQColor(fill, alphaFill);

    // There was a report of Qt seeming to ignore the alpha value of the pen so
    // so we disable the pen if the outline and fill colours are the same.
    if (outline_colour == fill_colour)
        painter->setPen(Qt::NoPen);
    else
        painter->setPen(outline_colour);

    painter->setBrush(fill_colour);

    const int radius = (cornerSize ? 25 : 0);

    painter->drawRoundRect(
            QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top),
            radius, radius);
}
Ejemplo n.º 12
0
void SurfaceImpl::PenColour(ColourDesired fore)
{
    Q_ASSERT(painter);

    painter->setPen(convertQColor(fore));
}