aboutsummaryrefslogtreecommitdiff
path: root/src/png.h
blob: 404102661e5b1aeaf6f4c751846de99b27ef2c2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef PW_PNG_H
#define PW_PNG_H

#include <SDL3/SDL_stdinc.h>

/**
 * A pixel from a loaded PNG image.
 */
union pw_png_pixel {
  uint32_t raw;
  struct {
    uint8_t r;
    uint8_t g;
    uint8_t b;
    uint8_t a;
  } ch;
};
SDL_COMPILE_TIME_ASSERT(pw_png_pixel_size, sizeof(union pw_png_pixel) == 4);

/**
 * Loads a PNG with exact dimensions.
 */
union pw_png_pixel *pw_png_load(uint8_t const *data, size_t sz, int w, int h);

#endif