2004-08-26 01:41:34 +08:00
|
|
|
The .ggr file format.
|
|
|
|
|
|
|
|
GGR files are used to store GIMP gradients. A gradient consists of a
|
2006-09-01 08:20:01 +08:00
|
|
|
series of consecutive *segments* spanning the range from 0.0 to 1.0. Each
|
2004-08-26 01:41:34 +08:00
|
|
|
segment has the following attributes:
|
|
|
|
|
|
|
|
Left Endpoint coordinate: (double)
|
|
|
|
Left Endpoint color (RGBA color)
|
|
|
|
Right Endpoint coordinate (double)
|
|
|
|
Right Endpoint color (RGBA color)
|
|
|
|
Midpoint coordinate (double)
|
2006-09-01 08:20:01 +08:00
|
|
|
Blending function (enum; values are:
|
|
|
|
0 = "linear"
|
|
|
|
1 = "curved"
|
|
|
|
2 = "sinusoidal"
|
|
|
|
3 = "spherical (increasing)"
|
|
|
|
4 = "spherical (decreasing)")
|
|
|
|
Coloring type (enum; values are:
|
|
|
|
0 = "RGB"
|
|
|
|
1 = "HSV CCW"
|
|
|
|
2 = "HSV CW")
|
|
|
|
Left and right Endpoint Color type (enum; values are:
|
|
|
|
0 = "fixed"
|
|
|
|
1 = "foreground",
|
|
|
|
2 = "foreground transparent"
|
|
|
|
3 = "background",
|
|
|
|
4 = "background transparent")
|
2004-08-26 01:41:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
A GGR file is an ASCII file structured as follows:
|
|
|
|
|
|
|
|
Line 1: "GIMP Gradient"
|
|
|
|
Line 2: "Name: " followed by the name of the gradient
|
|
|
|
Line 3: the number of segments
|
|
|
|
|
|
|
|
The remaining lines consist of segment specifications. There must be
|
2006-09-01 08:20:01 +08:00
|
|
|
one line for each segment. Each line contains 15 numbers -- the first
|
|
|
|
11 are floats, the remaining 4 are ints. Here is what each field
|
2004-08-26 01:41:34 +08:00
|
|
|
encodes:
|
|
|
|
|
|
|
|
Field Meaning
|
|
|
|
0 Left endpoint coordinate
|
|
|
|
1 Midpoint coordinate
|
|
|
|
2 Right endpoint coordinate
|
|
|
|
3 Left endpoint R
|
|
|
|
4 Left endpoint G
|
|
|
|
5 Left endpoint B
|
|
|
|
6 Left endpoint A
|
|
|
|
7 Right endpoint R
|
|
|
|
8 Right endpoint G
|
|
|
|
9 Right endpoint B
|
|
|
|
10 Right endpoint A
|
2006-09-01 08:20:01 +08:00
|
|
|
11 Blending function type
|
|
|
|
12 Coloring type
|
|
|
|
13 Left endpoint color type
|
|
|
|
14 Right endpoint color type
|
2004-08-26 01:41:34 +08:00
|
|
|
|
|
|
|
The left endpoint coordinate of each segment must equal the right
|
|
|
|
endpoint coordinate of the preceding segment.
|
|
|
|
|
2004-08-26 02:26:06 +08:00
|
|
|
Note 1: This is a description of the *new* gradient file format. In
|
2004-08-26 01:41:34 +08:00
|
|
|
earlier versions of GIMP a different format was used.
|
|
|
|
|
2006-09-01 08:20:01 +08:00
|
|
|
Note 2: In GIMP versions prior to 2.3.11 the file format didn't contain
|
|
|
|
the color types of the endpoints, thus it was impossible to get the
|
|
|
|
behavior of the special "FG to BG" etc. gradients in custom gradients.
|
2004-08-26 02:26:06 +08:00
|
|
|
|
2006-09-01 08:20:01 +08:00
|
|
|
Note 3: Starting with version 2.1, GIMP now has the ability to load
|
2004-08-26 02:26:06 +08:00
|
|
|
gradients in SVG gradient format, if the file is placed in the user's
|
|
|
|
personal "gradients" directory, or some other location in the
|
|
|
|
gradients search path.
|
|
|
|
|