image/color

Color types mirroring references/image/src/color.rs ColorType (12 variants), ExtendedColorType, Rgb/Rgba/Luma/LumaA pixels.

Types

ColorType = enum
  ctL8, ctLa8, ctRgb8, ctRgba8, ctL16, ctLa16, ctRgb16, ctRgba16, ctL32F,
  ctLa32F, ctRgb32F, ctRgba32F
ExtendedColorType = object
  case kind*: ExtKind
  of ekUnknown:
    bpp*: uint8
  else:
    nil
ExtKind = enum
  ekA8, ekL1, ekLa1, ekRgb1, ekRgba1, ekL2, ekLa2, ekRgb2, ekRgba2, ekL4, ekLa4,
  ekRgb4, ekRgba4, ekRgb5x1, ekL8, ekLa8, ekRgb8, ekRgba8, ekL16, ekLa16,
  ekRgb16, ekRgba16, ekBgr8, ekBgra8, ekL32F, ekLa32F, ekRgb32F, ekRgba32F,
  ekCmyk8, ekCmyk16, ekYCbCr8, ekUnknown
Luma[T] = object
  data*: array[1, T]
LumaA[T] = object
  data*: array[2, T]
Rgb[T] = object
  data*: array[3, T]
Rgba[T] = object
  data*: array[4, T]

Procs

func bitsPerPixel(c: ColorType): uint16 {....raises: [], tags: [], forbids: [].}
func bitsPerPixel(c: ExtendedColorType): uint16 {....raises: [], tags: [],
    forbids: [].}
func bufferSize(c: ExtendedColorType; width, height: uint32): uint64 {.
    ...raises: [], tags: [], forbids: [].}
func bytesPerPixel(c: ColorType): uint8 {....raises: [], tags: [], forbids: [].}
func channelCount(c: ColorType): uint8 {....raises: [], tags: [], forbids: [].}
func channelCount(c: ExtendedColorType): uint8 {....raises: [], tags: [],
    forbids: [].}
func colorType(c: ExtendedColorType): tuple[found: bool, ct: ColorType] {.
    ...raises: [], tags: [], forbids: [].}
func convF32toU8(v: float32): uint8 {....raises: [], tags: [], forbids: [].}
func convF32toU16(v: float32): uint16 {....raises: [], tags: [], forbids: [].}
func convU8toF32(v: uint8): float32 {....raises: [], tags: [], forbids: [].}
func convU8toU16(v: uint8): uint16 {....raises: [], tags: [], forbids: [].}
func convU16toF32(v: uint16): float32 {....raises: [], tags: [], forbids: [].}
func convU16toU8(v: uint16): uint8 {....raises: [], tags: [], forbids: [].}
func hasAlpha(c: ColorType): bool {....raises: [], tags: [], forbids: [].}
func hasColor(c: ColorType): bool {....raises: [], tags: [], forbids: [].}
func rgbToLumaF32(r, g, b: float32): float32 {....raises: [], tags: [], forbids: [].}
func rgbToLumaU8(r, g, b: uint8): uint8 {....raises: [], tags: [], forbids: [].}
func rgbToLumaU16(r, g, b: uint16): uint16 {....raises: [], tags: [], forbids: [].}
func toExtended(c: ColorType): ExtendedColorType {....raises: [], tags: [],
    forbids: [].}