-
Notifications
You must be signed in to change notification settings - Fork 0
/
lgpng.h
60 lines (41 loc) · 979 Bytes
/
lgpng.h
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* lgpng.h
* Lucas Garron
*
* Started June 2010
*
* This generates simple (read: large, essentially bitmap) images
* without using any non-standard includes or libraries.
*
* Intended to be a used with lgwav2png/lgsound2png tool to generate
* pretty waveform images from sound files.
*
*/
#ifndef LGPNG_H
#define LGPNG_H
#define LGPNG_VERSION "1.1"
/********************************************
*
* Image
*
*/
typedef struct pixel
{
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char a;
} pixel;
typedef struct image
{
int width;
int height;
struct pixel** data;
} image;
struct image* image_alloc(int width, int height);
void image_free(struct image* img);
struct pixel* pixel_at(struct image* img, int row, int col);
int set_pixel_at(struct image* img, int row, int col, int r, int g, int b, int a);
int image_sanity_test(struct image* img);
int write_PNG_image_to_file(FILE* file, struct image* img);
#endif //LGPNG_H