git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

gbdk-support/png2hicolorgb/src/image_info.h

      1 //
      2 // image_info.h
      3 //
      4 
      5 #ifndef IMAGE_INFO_HEADER
      6 #define IMAGE_INFO_HEADER
      7 
      8 #include <stdint.h>
      9 
     10     #define RGBA_32SZ   4  // 4 bytes
     11     #define RGBA_RED   0
     12     #define RGBA_GREEN 1
     13     #define RGBA_BLUE  2
     14     #define RGBA_ALPHA 3
     15 
     16     #define RGB_24SZ   3  // 3 bytes
     17     #define RGB_RED   0
     18     #define RGB_GREEN 1
     19     #define RGB_BLUE  2
     20 
     21     #define BGRX_BLUE  0
     22     #define BGRX_GREEN 1
     23     #define BGRX_RED   2
     24 
     25     #define MODE_8_BIT_INDEXED        ( 8 / 8)
     26     #define MODE_8_BIT_INDEXED_ALPHA  (16 / 8)
     27     #define MODE_24_BIT_RGB           (24 / 8)
     28     #define MODE_32_BIT_RGBA          (32 / 8)
     29 
     30     #define COLOR_DATA_PAL_MAX_COUNT   256 // 255 Colors max for indexed
     31     #define COLOR_DATA_BYTES_PER_COLOR 3   // RGB 1 byte per color
     32     #define COLOR_DATA_PAL_SIZE COLOR_DATA_PAL_MAX_COUNT * COLOR_DATA_BYTES_PER_COLOR
     33 
     34     #define USER_PAL_MAX_COLORS  32
     35 
     36 
     37     typedef struct {
     38         uint8_t    bytes_per_pixel;
     39         // uint16_t   width;
     40         // uint16_t   height;
     41         unsigned int   width;
     42         unsigned int   height;
     43         uint32_t   size;        // size in bytes
     44         uint8_t  * p_img_data;
     45         uint16_t   tile_width;  // should be even multiple of width 
     46         uint16_t   tile_height; // should be even multiple of height
     47 
     48         uint16_t   palette_tile_width;  // should be even multiple of width 
     49         uint16_t   palette_tile_height; // should be even multiple of height
     50     } image_data;
     51 
     52 
     53 #endif

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.