Fill path on rotated components not working


#1

Hey,

If I try to fill a path with a gradient if the component that draws it is rotated, then the fill seems to spill into the other nearby components. 

Here is an image showing the setup. Each of the 7 outer shapes are components. Each one is rotated with an affine transformation. In the paint methods, they are filling a path with a gradient. The gradient moves with the mouse. Here I'm clicking in the center of one pad.

 

This next image shows the problem. If I move the mouse to the edge of the component, the fill leaks into the next component! How do I fix this?

 

Thanks


#2

It looks like this is happening because Components, even if affine transformed, need to be enclosed in rectangular bounds (with sides parallel to the screen).

I notice that the gradient in the "wrong" image is somehow clipped as if it were sitting in the top left corner of a clipping rectangle. My guess is that that rectangle is the one representing the Component's bounds for the rotated component.

I guess this could be fixed if, in that Component's "paint()" method, you use the Graphic's reduceClipRegion() passing the Path of the "rounded" shape as the shape to clip to

 


#3

Hmm.. Could you give us a lump of code that we could use to reproduce and debug this?