Ah, your article brings back memories of the olden days when I used to work at a graphics bureau, one of the continual problems was fixing other designers' gradients in Adobe Illustrator 88 and Aldus Freehand. Gradients were defined by dragging out a rubber-band line, you defined the start and end points, but really what you were doing was creating a vector (a math vector as in a direction and magnitude, not as in vector graphics). We used to have a little Mac desk accessory app to help calculate gradients between two CMYK colors, and to tell us how many inches we could span a gradient on the imagesetter film at a certain linescreen without causing visible banding. It was very tricky to get it right, and mistakes meant you blew 4 sheets of film which could easily be over a hundred bucks. But getting to the point.. I haven't run your code, but from your description of bounding boxes, it appears that you have solved one instance of applying a gradient to a shape, but you haven't solved the general case. The vector that defines a gradient does not necessarily coincide with the bounding box. A gradient fill may not span the entire object, i.e. you might have an object with a large region of 20% gray on the left, a small 20 -> 50% gradient across the middle, and a large region of 50% gray on the right. It seems to me that that this would be easily defined with a vector but difficult to define with a bounding box.