void GraphicsContext::fillRect(const IntRect& rectWK, const Color& color, bool solidFill)
{
    if (paintingDisabled())
        return;

    const IntSize&   o = origin();
    EA::Raster::Rect rect(rectWK.x() + o.width(), rectWK.y() + o.height(), rectWK.width(), rectWK.height());

    EA::Raster::ISurface* const pSurface = m_data->surface;
    EA::Raster::IEARaster* pRaster = EA::WebKit::GetEARasterInstance();

    EA::Raster::Color c(color.red(), color.green(), color.blue(), color.alpha());
    if( (!solidFill) &&  (color.alpha()) )
    {
        // To do: What really want to do is modify the alpha of 'color' in place instead of create temporary.
        // 12/8/10 CSidhall - Replaced the alpha stroke by the color alpha to fix background color fills with alpha and text highlight bug.       
        // Note: Still remains an issue with overlapping child nodes with a same alpha which should not be darker.
        // const int            alpha = m_data->layers.isEmpty() ? strokeColor().alpha() : static_cast<int>(strokeColor().alpha() * m_data->layers.last());
        const int            alpha = m_data->layers.isEmpty() ? color.alpha() : static_cast<int>(color.alpha() * m_data->layers.last());    
        c.setAlpha(alpha);
    }

    // 12/18/10 CSidhall - Added transform support for fill.
    if(hasTransform())
    {
        AffineTransform t = getCTM();
        double x[4];
        double y[4];
        double x1 = double (rect.x - origin().width());       
        double y1 = double (rect.y - origin().height());       
        
        t.map( x1, y1, &x[0],&y[0]);
        t.map((x1 + (double) rect.w), (y1 + (double) rect.h), &x[1],&y[1]);
        t.map((x1 + (double) rect.w), y1, &x[2],&y[2]);
        t.map( x1,  (y1 + (double) rect.h), &x[3],&y[3]);

        int orgW = origin().width();
        int orgH = origin().height();
        int vx[3] ={ (int) x[0] + orgW ,(int) x[2] + orgW,(int) x[3] + orgW}; 
        int vy[3] ={ (int) y[0] + orgH,(int) y[2] + orgH,(int) y[3] + orgH}; 
            
        pRaster->FilledPolygonColor( pSurface, &vx[0], &vy[0], 3 ,c);

        vx[0] = (int) x[1] + orgW;
        vy[0] = (int) y[1] + orgH;
        pRaster->FilledPolygonColor( pSurface, &vx[0], &vy[0], 3 ,c);
    }
    else if(solidFill)
    {
        pRaster->FillRectSolidColor(pSurface, &rect, c);
    }
    else
    {    
        pRaster->FillRectColor(pSurface, &rect, c);
    }
}
FloatRect SVGSVGElement::viewport() const
{
    double _x = 0.0;
    double _y = 0.0;
    if (!isOutermostSVG()) {
        _x = x().value(this);
        _y = y().value(this);
    }
    float w = width().value(this);
    float h = height().value(this);
    AffineTransform viewBox = viewBoxToViewTransform(w, h);
    double wDouble = w;
    double hDouble = h;
    viewBox.map(_x, _y, _x, _y);
    viewBox.map(w, h, wDouble, hDouble);
    return FloatRect::narrowPrecision(_x, _y, wDouble, hDouble);
}
Example #3
0
FloatRect SVGSVGElement::viewport() const
{
    double _x = 0.0;
    double _y = 0.0;
    if (renderer() && renderer()->parent() &&
            !renderer()->parent()->isSVGContainer()) {
        _x = x().value();
        _y = y().value();
    }
    float w = width().value();
    float h = height().value();
    AffineTransform viewBox = viewBoxToViewTransform(w, h);
    double wDouble = w;
    double hDouble = h;
    viewBox.map(_x, _y, &_x, &_y);
    viewBox.map(w, h, &wDouble, &hDouble);
    return FloatRect::narrowPrecision(_x, _y, wDouble, hDouble);
}
Example #4
0
FloatPoint FloatPoint::matrixTransform(const AffineTransform& transform) const
{
    double newX, newY;
    transform.map(static_cast<double>(m_x), static_cast<double>(m_y), newX, newY);
    return narrowPrecision(newX, newY);
}
Example #5
0
FloatPoint SVGPoint::matrixTransform(const AffineTransform& transform) const
{
    double newX, newY;
    transform.map(static_cast<double>(x()), static_cast<double>(y()), newX, newY);
    return FloatPoint::narrowPrecision(newX, newY);
}