Over the weekend I tackled the similar but simpler problem of radial shading. It's simpler because the shading is rotationally symmetric so the angle does not come into it. But it's not described in the official documentation so I had to use trial and error to get to the right matrix.
The correct way to call createGradientBox for circles is as follows, where fX, fY and fR are the coordinates and radius of the circle. The zero is the angle which is not needed.
mat.createGradientBox(2 * fR, 2 * fR, 0, fX - fR, fY - fR);
To demonstrate it I've written a simple app, only 26 lines only ten of which do anything, available here on Wonderfl and embedded below.
No comments:
Post a Comment