[PATCH 2/2] Document gradients

Andrea Canciani ranma42 at gmail.com
Thu Jul 28 10:27:55 PDT 2011


0.10 introduced gradient picture sources, but did not provide the
documentation which describes their behavior.
---
 renderproto.txt |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/renderproto.txt b/renderproto.txt
index be8e208..d15bab2 100644
--- a/renderproto.txt
+++ b/renderproto.txt
@@ -604,7 +604,66 @@ client-specified 32-bit numbers.
 Glyphs can be stored in any PictFormat supported by the server.  All glyphs
 in a GlyphSet are stored in the same format.
 
-14. Extension Initialization
+14. Gradients
+
+Gradients are source pictures whose color is defined in a simple
+mathematical way.
+
+All gradients are composed by a color function which maps an
+interpolation value to a color. This function interpolates between the
+color stops of the gradient and is extrapolated according to the
+repeat mode:
+
+	None	outside the range covered by the color stops, the color
+		function is transparent
+	Regular	the color function is the piecewise-linear function obtained
+		by repeating the color stops with period 1
+	Pad	outside the range covered by the color stops, the color function
+		has the same value as the nearest point within this range
+	Reflect	the color function is the piecewise-linear function obtained
+		by duplicating all the color stops with an opposite offset
+		(i.e. reflecting the color stops with respect to 0) and
+		repeating the resulting stops (both positive and negative)
+		with period 2
+
+A linear gradient is the picture obtained by drawing each line of a
+family of parallel lines with the color obtained applying the color
+function to the corresponding interpolation parameter.
+
+The family of parallel lines is defined by two points on a line
+perpendicular to the family, which also provide the base for the
+interpolation parameter: the line which passes through the first point
+has interpolation parameter 0, the one which passes through the second
+point has interpolation parameter 1.
+
+A conical gradient is the picture obtained by drawing each half-line
+of a family of half-lines with the color obtained applying the color
+function to the corresponding interpolation parameter.
+
+The family of half-lines is defined by the point at which they start
+and an angle, which indicates the base line. The interpolation
+parameters increases linearly with the counterclockwise angle. It goes
+from 0 at the base line, to 1 at the base line again, after a full
+rotation. The half-lines drawn belong to the [0,1) interpolation
+parameter range, hence no overlap can occur.
+
+A radial gradient is the picture obtained by drawing the
+circumferences of a family of circles with the color obtained applying
+the color function to the corresponding interpolation parameter. The
+resulting picture is the same as if the circumferences were drawn in
+order of increasing interpolation parameter. The order in which the
+circumferences are drawn is important, because they can overlap.
+
+The family of circles is defined by two extreme circles, whose
+interpolation parameter is 0 and 1 respectively; the other circles of
+the family are generated through linear interpolation of the centers
+and radiuses of the extreme circles. Only circles with a positive
+radius belong to the family and, if the repeat mode is Pad, only the
+interpolation is performed, i.e. only the circles with an
+interpolation parameter within [0,1] will belong to the family.
+
+
+15. Extension Initialization
 
 The client must negotiate the version of the extension before executing
 extension requests.  Behavior of the server is undefined otherwise.
@@ -679,7 +738,7 @@ QueryFilters
 	aliases:	LISTofCARD16
 
 	
-15. Extension Requests
+16. Extension Requests
 
 CreatePicture
 
-- 
1.7.1



More information about the xorg-devel mailing list