示例#1
0
void SVGPaintServer::renderPath(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const
{
    RenderStyle* style = path ? path->style() : 0;
    CGContextRef contextRef = context->platformContext();

    if ((type & ApplyToFillTargetType) && (!style || style->svgStyle()->hasFill()))
        fillPath(contextRef, path);

    if ((type & ApplyToStrokeTargetType) && (!style || style->svgStyle()->hasStroke()))
        strokePath(contextRef, path);
}
示例#2
0
void Graphics::drawRect (const float x, const float y, const float width, const float height, const float lineThickness) const
{
    // passing in a silly number can cause maths problems in rendering!
    jassert (areCoordsSensibleNumbers (x, y, width, height));

    Path p;
    p.addRectangle (x, y, width, lineThickness);
    p.addRectangle (x, y + lineThickness, lineThickness, height - lineThickness * 2.0f);
    p.addRectangle (x + width - lineThickness, y + lineThickness, lineThickness, height - lineThickness * 2.0f);
    p.addRectangle (x, y + height - lineThickness, width, lineThickness);
    fillPath (p);
}
void Graphics::drawEllipse (Rectangle<float> area, float lineThickness) const
{
    Path p;

    if (area.getWidth() == area.getHeight())
    {
        // For a circle, we can avoid having to generate a stroke
        p.addEllipse (area.expanded (lineThickness * 0.5f));
        p.addEllipse (area.reduced  (lineThickness * 0.5f));
        p.setUsingNonZeroWinding (false);
        fillPath (p);
    }
    else
    {
        p.addEllipse (area);
        strokePath (p, PathStrokeType (lineThickness));
    }
}
void LowLevelGraphicsPostScriptRenderer::fillRect (const Rectangle<float>& r)
{
    if (stateStack.getLast()->fillType.isColour())
    {
        writeClip();
        writeColour (stateStack.getLast()->fillType.colour);

        Rectangle<float> r2 (r.translated ((float) stateStack.getLast()->xOffset,
                                           (float) stateStack.getLast()->yOffset));

        out << r2.getX() << ' ' << -r2.getBottom() << ' ' << r2.getWidth() << ' ' << r2.getHeight() << " rectfill\n";
    }
    else
    {
        Path p;
        p.addRectangle (r);
        fillPath (p, AffineTransform::identity);
    }
}
void GepardGLES2::strokePath()
{
    PathData* pathData = _context.path.pathData();
    GepardState& state = _context.currentState();

    GD_LOG3("Path: " << pathData->firstElement());
    if (!pathData || pathData->isEmpty())
        return;

    Float miterLimit = state.miterLimit ? state.miterLimit : 10;

    StrokePathBuilder sPath(state.lineWitdh, miterLimit, state.lineJoinMode, state.lineCapMode);
    sPath.convertStrokeToFill(pathData);

    Color tempColor = state.fillColor;
    state.fillColor = state.strokeColor;
    fillPath(sPath.pathData(), state);
    state.fillColor = tempColor;
}
示例#6
0
void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color, ColorSpace colorSpace)
{
    if (paintingDisabled())
        return;

    CGContextRef context = platformContext();
    Color oldFillColor = fillColor();
    ColorSpace oldColorSpace = fillColorSpace();

    if (oldFillColor != color || oldColorSpace != colorSpace)
        setCGFillColor(context, color, colorSpace);

    Path path;
    path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight);
    fillPath(path);

    if (oldFillColor != color || oldColorSpace != colorSpace)
        setCGFillColor(context, oldFillColor, oldColorSpace);
}
int GraphicProducer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: strikePath((*reinterpret_cast< const VectorPath(*)>(_a[1])),(*reinterpret_cast< const GraphicContext(*)>(_a[2]))); break;
        case 1: fillPath((*reinterpret_cast< const VectorPath(*)>(_a[1])),(*reinterpret_cast< const GraphicContext(*)>(_a[2])),(*reinterpret_cast< Qt::FillRule(*)>(_a[3]))); break;
        case 2: parsingDone((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: { bool _r = parseStream((*reinterpret_cast< const char*(*)>(_a[1])),(*reinterpret_cast< ulong(*)>(_a[2])));
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 4: { bool _r = parsePDF((*reinterpret_cast< const QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
示例#8
0
void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color)
{
    if (paintingDisabled())
        return;

    Path path;
    path.addRect(rect);

    if (!roundedHoleRect.radii().isZero())
        path.addRoundedRect(roundedHoleRect);
    else
        path.addRect(roundedHoleRect.rect());

    WindRule oldFillRule = fillRule();
    Color oldFillColor = fillColor();
    
    setFillRule(RULE_EVENODD);
    setFillColor(color);

    fillPath(path);
    
    setFillRule(oldFillRule);
    setFillColor(oldFillColor);
}
示例#9
0
void GraphicsContext::fillEllipseAsPath(const FloatRect& ellipse)
{
    Path path;
    path.addEllipse(ellipse);
    fillPath(path);
}
示例#10
0
void Graphics::fillRoundedRectangle (const Rectangle<float>& r, const float cornerSize) const
{
    Path p;
    p.addRoundedRectangle (r, cornerSize);
    fillPath (p);
}
示例#11
0
void Graphics::fillEllipse (float x, float y, float width, float height) const
{
    Path p;
    p.addEllipse (x, y, width, height);
    fillPath (p);
}
void GraphicsContext::drawPath()
{
    fillPath();
    strokePath();
}
void Graphics::drawArrow (const Line<float>& line, const float lineThickness, const float arrowheadWidth, const float arrowheadLength) const
{
    Path p;
    p.addArrow (line, lineThickness, arrowheadWidth, arrowheadLength);
    fillPath (p);
}
//==============================================================================
void Graphics::fillEllipse (const Rectangle<float>& area) const
{
    Path p;
    p.addEllipse (area);
    fillPath (p);
}
void medWorkspaceShifterPainter::fillRoundRect(const QRectF& rect, qreal radius, const QBrush& brush)
{
    fillPath(roundRectangle(rect, radius, radius, radius, radius), brush);
}
void medWorkspaceShifterPainter::fillRoundRect(const QRectF& rect, qreal leftTopRadius, qreal leftBottomRadius, qreal rightTopRadius, qreal rightBottomRadius, const QBrush& brush)
{
    fillPath(roundRectangle(rect, leftTopRadius, leftBottomRadius, rightTopRadius, rightBottomRadius), brush);
}
void Graphics::fillRect (const Rectangle<float>& rectangle) const
{
    Path p;
    p.addRectangle (rectangle);
    fillPath (p);
}
void LowLevelGraphicsPostScriptRenderer::fillRectList (const RectangleList<float>& list)
{
    fillPath (list.toPath(), AffineTransform::identity);
}
void Graphics::drawLine (const Line<float>& line, const float lineThickness) const
{
    Path p;
    p.addLineSegment (line, lineThickness);
    fillPath (p);
}
//==============================================================================
void LowLevelGraphicsPostScriptRenderer::drawLine (const Line <float>& line)
{
    Path p;
    p.addLineSegment (line, 1.0f);
    fillPath (p, AffineTransform::identity);
}