Module png

Returns the bytes per pixel for the given image

Types

ColorType = enum
  gray = 0, rgb = 2, palette = 3, graya = 4, rgba = 6
PngImageObj = object of ImageObj
  depth*: uint8
  colorType*: ColorType
  interlaced*: uint8
  palette*: array[0 .. 255, NColor]
PngImage = ref PngImageObj

Consts

PNG_HEADER = [0x00000089, 0x00000050, 0x0000004E, 0x00000047, 0x0000000D, 0x0000000A,
            0x0000001A, 0x0000000A]

Procs

proc `$`(x: PngImage): string {.raises: [], tags: [].}
proc bpp(img: PngImage): int {.raises: [], tags: [].}
proc bpp(img: ref PngImage): int {.raises: [], tags: [].}
proc bpp(img: ptr PngImage): int {.raises: [], tags: [].}
proc itostr(val: uint32; n = 4): string {.inline, raises: [], tags: [].}
Converts an integer to a string, as if the bytes had been copied directly out of the integer and into the bytestring. Copies the most-significant N bytes.

Templates

template ifromstr(s: string): uint32
Gets the integer representation of a 4-character string. This does the safe-ish equivalent of "((int)(c_str))" in C. This does not check the bounds on its inputs!