예제 #1
0
void Gradient::paint(GraphicsContext* context)
{
#ifdef BUILDING_ON_TIGER
    CGContextDrawShading(context->platformContext(), platformGradient());
#else
    CGGradientDrawingOptions extendOptions = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation;
    if (m_radial)
        CGContextDrawRadialGradient(context->platformContext(), platformGradient(), m_p0, m_r0, m_p1, m_r1, extendOptions);
    else
        CGContextDrawLinearGradient(context->platformContext(), platformGradient(), m_p0, m_p1, extendOptions);
#endif
}
void Gradient::fill(GraphicsContext* context, const FloatRect& rect)
{
    platformGradient();
    context->save();
    context->setFillGradient(this);
    context->fillRect(rect);
    context->restore();
}
예제 #3
0
void Gradient::fill(GraphicsContext* context, const FloatRect& rect)
{
    cairo_t* cr = context->platformContext()->cr();

    context->save();
    cairo_set_source(cr, platformGradient());
    cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
    cairo_fill(cr);
    context->restore();
}
예제 #4
0
void Gradient::paint(CGContextRef context)
{
    CGGradientDrawingOptions extendOptions = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation;
    if (!m_radial) {
        CGContextDrawLinearGradient(context, platformGradient(), m_p0, m_p1, extendOptions);
        return;
    }

    bool needScaling = aspectRatio() != 1;
    if (needScaling) {
        CGContextSaveGState(context);
        // Scale from the center of the gradient. We only ever scale non-deprecated gradients,
        // for which m_p0 == m_p1.
        ASSERT(m_p0 == m_p1);
        CGContextTranslateCTM(context, m_p0.x(), m_p0.y());
        CGContextScaleCTM(context, 1, 1 / aspectRatio());
        CGContextTranslateCTM(context, -m_p0.x(), -m_p0.y());
    }

    CGContextDrawRadialGradient(context, platformGradient(), m_p0, m_r0, m_p1, m_r1, extendOptions);

    if (needScaling)
        CGContextRestoreGState(context);
}
예제 #5
0
cairo_pattern_t* Gradient::platformGradient()
{
    return platformGradient(1);
}
예제 #6
0
void Gradient::setPlatformGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation)
{
    platformGradient()->setLocalMatrix(reinterpret_cast<const double*>(&gradientSpaceTransformation));
}
예제 #7
0
void Gradient::fill(GraphicsContext* context, const FloatRect& rect)
{
    platformGradient()->fill(context->platformContext(), rect);
}
예제 #8
0
void Gradient::fill(GraphicsContext* context, const FloatRect& rect)
{
    context->platformContext()->fillRect(rect, *platformGradient());
}