devel-docs: update the XCF docs.

Various texts were still assuming 8-bit per component.
This commit is contained in:
Jehan
2019-10-31 16:49:53 +01:00
parent cffb86cc6f
commit 672b77dedb

View File

@ -248,32 +248,44 @@ Color
RGB: RGB:
Three intensity values for red, green, and blue additive color Three intensity values for red, green, and blue additive color
components, each on a scale from 0 to 255. The exact color space components. The exact format depends on the field 'precision' of the
is not specified. GIMP displays image data directly on PC image header. If this field is absent (i.e. for XCF version 3 or
display hardware without any software correction, so in most before), "8-bit gamma integer" is assumed, which means each component is
cases the intensity values should be considered nonlinear samples on a scale from 0 to 255, with the intensity values considered nonlinear
that map to physical light intensities using a power function samples that map to physical light intensities using a power function
with an exponent ("gamma") of about 2.5. (This is how PC hardware with an exponent ("gamma") of about 2.5 (this is how PC hardware
commonly treat bit values in the video buffer, which incidentally commonly treat bit values in the video buffer, which incidentally
also has the property of making each 1/255th step about equally also has the property of making each 1/255th step about equally
perceptible to the human eye when the monitor is correctly perceptible to the human eye when the monitor is correctly
adjusted). adjusted).
Beware, however, that GIMP's compositing algorithms (as described When the precision field is present though, it defines the storage
in the document compositing.txt) implicitly treat the intensities format and the exact color space depends on the color profile attached
as _linear_ samples. The XCF file format currently has no support to the image. The color profile is saved as a parasite named
for storing the intended gamma of the samples. "icc-profile" on the image. If no profile is set, sRGB is assumed.
TODO: Are the statements about color space, gamma and layer modes still valid? Beware, however, that **before GIMP 2.10**, GIMP's compositing
algorithms (as described in the document compositing.txt) implicitly
treated the intensities as _linear_ samples. The XCF file format had no
support for storing the intended gamma of the samples.
Since GIMP 2.10.0 and over, you must rely on PROP_COMPOSITE_MODE,
PROP_COMPOSITE_SPACE and PROP_BLEND_SPACE for compositing and blending.
Grayscale: Grayscale:
One intensity value on a scale from 0 (black) to 255 (white). One intensity value. Grayscale has the same precision considerations as
Gamma considerations as for RGB. for RGB and it can also have a profile since GIMP 2.10.0, as well as
compositing and blending rules.
On older XCF without precision field, the value was simply on a scale
from 0 (black) to 255 (white).
Indexed: Indexed:
An 8-bit index into a color map that is shared between all An 8-bit index into a color map that is shared between all
layers. The color map maps each index to an RGB triple which is layers. The color map maps each index to an RGB triple which is
interpreted as in the RGB model. interpreted as in the RGB model.
It is to be noted that Indexed image in GIMP is limited to 8-bit integer
RGB, even in GIMP 2.10.
Pixel data: Tiles Pixel data: Tiles
----------------- -----------------
@ -1444,13 +1456,19 @@ It appears in a context: each layer and channel has a pointer to its hierarchy.
uint32 width Width of the pixel array uint32 width Width of the pixel array
uint32 height Height of the pixel array uint32 height Height of the pixel array
uint32 bpp Number of bytes per pixel given uint32 bpp Number of bytes per pixel; this depends on the
3: RGB color without alpha color mode and image precision (fields 'base_type'
4: RGB color with alpha and 'precision' of the image header). For
1: Grayscale without alpha instance, some combination values:
2: Grayscale with alpha 3: RGB color without alpha in 8-bit precision
1: Indexed without alpha 4: RGB color with alpha in 8-bit precision
2: Indexed with alpha 6: RGB color without alpha in 16-bit precision
16: RGB color with alpha in 32-bit precision
1: Grayscale without alpha in 8-bit precision
4: Grayscale with alpha in 16-bit precision
1: Indexed without alpha (always 8-bit)
2: Indexed with alpha (always 8-bit)
And so on.
pointer lptr Pointer to the "level" structure pointer lptr Pointer to the "level" structure
,-------- ------ Repeat zero or more times ,-------- ------ Repeat zero or more times
@ -1501,10 +1519,13 @@ of width*height pixels, extracted from the tile in row-major,
top-to-bottom, left-to-right order (the same as the reading direction top-to-bottom, left-to-right order (the same as the reading direction
of multi-line English text). of multi-line English text).
In color modes with alpha information, the alpha value is the last of In color modes with alpha information, the alpha value is the last bytes
the 2 or 4 bytes for each pixel. In RGB color modes, the 3 (first) for each pixels, after the color information.
bytes for each pixel is the red intensity, the green intensity, and In RGB color modes, the color information (first bytes for each pixel)
the blue intensity, in that order. is the red intensity, the green intensity, and the blue intensity, in
that order.
The exact size of each component depends on the 'precision' field, for
instance 1 byte in 8-bit modes, 2 bytes in 16-bit, and so on.
Tile data, as other data in XCF format, is big-endian. In particular it Tile data, as other data in XCF format, is big-endian. In particular it
means that pixel values are stored as big-endian when the precision is means that pixel values are stored as big-endian when the precision is