Skip to content

Commit

Permalink
Try to clarify docs for ImageFormat
Browse files Browse the repository at this point in the history
The image format is based on individual bytes and thus independent of
the system's endianness. This commit tries to make that more explicit.

This was originally suggested in issue linebender#224.

Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information
psychon committed Jun 13, 2021
1 parent 2da0e35 commit 19e6eca
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion piet/src/render_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,24 @@ pub enum InterpolationMode {
#[derive(Clone, Copy, Debug, PartialEq)]
#[non_exhaustive]
pub enum ImageFormat {
/// 1 byte per pixel
/// 1 byte per pixel.
///
/// For example, a white pixel has value 0xff.
Grayscale,
/// 3 bytes per pixel, in RGB order.
///
/// For example, a red pixel consists of three bytes `[0xff, 0, 0]` independent of the system's
/// endianness.
Rgb,
/// 4 bytes per pixel, in RGBA order, with separate alpha.
///
/// For example, a full-intensity red pixel with 50% transparency consists of four bytes
/// `[0xff, 0, 0, 0x80]` independent of the system's endianness.
RgbaSeparate,
/// 4 bytes per pixel, in RGBA order, with premultiplied alpha.
///
/// For example, a full-intensity red pixel with 50% transparency consists of four bytes
/// `[0x80, 0, 0, 0x80]` independent of the system's endianness.
RgbaPremul,
}

Expand Down

0 comments on commit 19e6eca

Please sign in to comment.