[cairo] cairo-1.13 finally opens

Bill Spitzak spitzak at gmail.com
Thu Sep 5 15:59:53 PDT 2013

Henry (Yu) Song - SISA wrote:

> 5. as an optimization, the image to be blurred is scaled down first and scale up using bilinear sampling - similar to skia

Yes this can be a big win. Limit the downscale to powers of 2 however.

> The shadow parameters (blur, offset) are not affected by CTM (recall somewhere in html/css spec that shadow blur/offset should not be affected by ctm).

This is probably not a good idea for matching the rest of cairo. However 
it can do "locking" of the blur and offset. If the caller wants them in 
output pixels, they push the state, reset the transform to the identity, 
set the blur/offset, then pop the state. The values are transformed to 
the final result at the moment they are set by the CTM and thus "lock". 
I think everybody decided cairo would have been better if this was true 
for line widths, and there are proposals to add an option to make this 
the default.

A w/h can be transformed to an "approximate" w/h in another space by 
something that produces the correct area of the w*h rectangle, and 
matches for 90 degree rotations. I posted some code to do this before

> CSS3 only defines blur, offset, and spread.  The current implementation of shadow is much more flexible than that, it allows arbitrary shadow path to be drawn similar to osx's CALayer.shadowPath

My problem here is the CSS3 description uses filtering of a mask image, 
rather than altering the path. Correctly altering the path is really 
complex and won't work if the alpha is from an image (as the html 
examples I saw seemed to want).

> Regarding to different operators with shadow.  The drop shadow implementation follows what HTML/css spec, it draws drop shadow with current compositing operator, then draw drawing itself with again the current operator.  The problem is the inset shadow.  I am not clear about that with operators other than OVER.

So you don't think there would be a problem if drawing the shadow and 
the object were two different cairo calls? That seems the easiest way to 
reduce the amount of cairo api.

It looks to me like inset shadows draw the inverse of the outset shadows 
clipped to the path. I guess this would have to be a different call, and 
it would be done after the object is drawn.

More information about the cairo mailing list