ExPng.Pixel (ExPng v0.2.0)
Represents a single pixel in an image, storing red, green, blue and alpha values, or an index when part of a paletted image.
Link to this section Summary
Functions
Shortcut for returning an opaque black pixel.
Returns a grayscale pixel with the given value for the red, green, and blue values.
Returns a pixel with the arguments as the red, green, and blue values
Returns a pixel with the arguments as the red, green, blue, and alpha values
Shortcut for returning an opaque white pixel.
Link to this section Types
rgba_value()
Specs
rgba_value() :: 0..255
Specs
t() :: %ExPng.Pixel{ a: rgba_value(), b: rgba_value(), g: rgba_value(), index: ExPng.maybe(integer()), r: rgba_value() }
Link to this section Functions
black()
Specs
black() :: t()
Shortcut for returning an opaque black pixel.
black_or_white?(arg1)
Specs
grayscale(gray, alpha \\ 255)
Specs
grayscale(rgba_value(), ExPng.maybe(rgba_value())) :: t()
Returns a grayscale pixel with the given value for the red, green, and blue values.
iex> Pixel.grayscale(100)
%Pixel{r: 100, g: 100, b: 100, a: 255}
If a second argument is passed, it sets the alpha value for the pixel.
iex> Pixel.grayscale(100, 200)
%Pixel{r: 100, g: 100, b: 100, a: 200}
grayscale?(arg1)
Specs
line_bytesize(raw_data)
line_bytesize(color_mode, bit_depth, width)
opaque?(arg1)
Specs
pixel_bytesize(raw_data)
pixel_bytesize(color_mode, bit_depth \\ 8)
rgb(r, g, b)
Specs
rgb(rgba_value(), rgba_value(), rgba_value()) :: t()
Returns a pixel with the arguments as the red, green, and blue values
iex> Pixel.rgb(50, 100, 200)
%Pixel{r: 50, g: 100, b: 200, a: 255}
rgba(r, g, b, a)
Specs
rgba(rgba_value(), rgba_value(), rgba_value(), rgba_value()) :: t()
Returns a pixel with the arguments as the red, green, blue, and alpha values
iex> Pixel.rgba(20, 100, 100, 75)
%Pixel{r: 20, g: 100, b: 100, a: 75}
white()
Specs
white() :: t()
Shortcut for returning an opaque white pixel.