ftsf / nico

a Game Framework in Nim inspired by Pico-8.
MIT License
624 stars 35 forks source link

loadSurfaceFromPNG not support all png modes #111

Closed TakWolf closed 1 year ago

TakWolf commented 1 year ago

In nimPNG,there are 5 png modes:

  PNGColorType* = enum
    LCT_GREY = 0,       # greyscale: 1,2,4,8,16 bit
    LCT_RGB = 2,        # RGB: 8,16 bit
    LCT_PALETTE = 3,    # palette: 1,2,4,8 bit
    LCT_GREY_ALPHA = 4, # greyscale with alpha: 8,16 bit
    LCT_RGBA = 6        # RGB with alpha: 8,16 bit

In loadSurfaceFromPNG only support 3 modes:

  if pngInfo.mode.colorType == LCT_RGBA:

  elif pngInfo.mode.colorType == LCT_RGB:

  elif pngInfo.mode.colorType == LCT_PALETTE:

In loadSurfaceFromPNGNoConvert only support 2 modes:

  if pngInfo.mode.colorType == LCT_RGBA:

  elif pngInfo.mode.colorType == LCT_PALETTE:

Why there not support all png modes? Is it just an oversight, or a specific reason for it?

At least grayscale mode is commonly used, that should be supported.

TakWolf commented 1 year ago

Is it related to this?

Paletted Bitmap Graphics (you can load a custom palette up to 256 colors)