GNOME Bugzilla – Bug 321278
Lack of control for gradients (diagonal and radial)
Last modified: 2006-03-23 00:40:48 UTC
1. It is impossible to create a gradient from top-right to bottom-left. All diagonal gradients move from top-left to bottom-right. It would be nice if gradients could be controlled by specifying an origin(x, y) and destination(x2, y2). This would also alleviate the need to specify horizontal, vertical or diagonal as all these gradients would simply be linear. 2. Radial gradients would be a nice addition (particuarly when using rounded corners). Radial graidents could use the same origin and destination values as linear gradients with the origin being the centre of a circle and the destination being any point on the circumference. As an added feature, an origin offset(angle, distance) could be added to allow the focus of the gradient to be shifted. Finally, adding an attribute for the number of degrees to draw from the destination could allow for non-round shapes (think pacman).
Created attachment 54691 [details] [review] top-right -> bottom-left diagonal gradient Shouldn't be included with the metacity source - it is only intended to demonstrate how these types of gradients can be created.
At the moment, the function that creates diagonal gradients [meta_gradient_create_diagonal()] works by creating a 1 pixel high horizontal gradient [with meta_gradient_create_horizontal()] which is then copied to the following rows with an increasing offset. The attatched patch to gradient.c instead decrements the offset to give a top-right -> bottom-left gradient. To create the more generic gradients that the bug reporter seeks meta_gradient_create_diagonal() and meta_gradient_create_multi_diagonal() will have to be made much more generic so that they don't just memcpy() sections of a linear horizontal gradient. Will this result in an unacceptable performance loss? Are title bar regions recreated for every Expose event or is the same GdkPixbuf reused each time?
Created attachment 54704 [details] [review] meta_gradient_create_radial This patch adds a function called meta_gradient_create_radial to gradient.c
Bug 107012 lets us use any gradient that SVG supports, which is pretty much anything there is. In particular, use of diagonal and radial gradients is demonstrated in attachment 61813 [details]. -> FIXED