All pastes #262883 Raw Edit

gradients in css

public cpp v1 · immutable
#262883 ·published 2006-11-30 23:27 UTC
rendered paste body
    // Paint the color first underneath all images.    if (!bgLayer->next()) {        IntRect rect(_tx, clipy, w, cliph);        // If we have an alpha and we are painting the root element, go ahead and blend with the base background color.        if (isRoot() && (!bgColor.isValid() || bgColor.alpha() < 0xFF) && !isTransparent) {            Color baseColor = view()->frameView()->baseBackgroundColor();            if (baseColor.alpha() > 0) {                p->save();                p->setCompositeOperation(CompositeCopy);                p->fillRect(rect, baseColor);                p->restore();            } else                p->clearRect(rect);        }        if (bgColor.isValid() && bgColor.alpha() > 0)            p->fillRect(rect, bgColor);    }    // Paint the gradient/pattern underneath all images    if (1) {        IntRect rect(_tx, clipy, w, cliph);        CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB();//      FloatRect topGradient(r.x(), r.y(), r.width(), r.height() / 2.0);        struct CGFunctionCallbacks topCallbacks = { 0, TopGradientInterpolate, NULL };        CGFunctionRef topFunction = CGFunctionCreate(NULL, 1, NULL, 4, NULL, &topCallbacks);        CGShadingRef shading = CGShadingCreateAxial(cspace, CGPointMake(0, 0),                                                   CGPointMake(0, 250), topFunction, false, false);//        CGContextDrawShading(p->platformContext(), shading);        CGContextDrawShading(rect, shading);     //   if (isRoot() && ()) {     //   }     //   if () {     //   }    }