[cairo] Serious concerns about cairo

Bill Spitzak spitzak at d2.com
Tue Sep 26 17:04:54 PDT 2006



Behdad Esfahbod wrote:

> Can you elaborate?  What is the area-preserving box?  What we currently
> return is the bounding box of the rotated glyph bounding box.

The returned box has the same area as the transformed bounding box, and 
should circumscribe the ellipse that results from transforming an 
ellipse inscribed in the input bounding box.

This is some math I am using, but I don't think it is correct, as it is 
not a continuous function. It does produce the correct area:

* Transform the vectors w,0 and 0,h to the output space as vectors A and B.

float dot = A.x*B.y-A.y*B.x;
float W = A.x*A.x+B.x*B.x;
float H = A.y*A.y+B.y*B.y;
if (W > H) {
   W = sqrt(W);
   H = absf(dot/W);
} else if (H > 0) {
   H = sqrt(H);
   W = absf(dot/H);
} else {
   W = H = 0;
}

* Transform the center point x,y of the bounding box to output space as X,Y.

* output bounding box corners are (X-W/2,Y-H/2),(X+W/2,Y+H/2)


More information about the cairo mailing list