-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpixbuf.h
35 lines (27 loc) · 1021 Bytes
/
pixbuf.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
/* -------------------------------------------------------------------
Management of a basic pixel buffer with export to BMP file format.
by Zerkman / Sector One
------------------------------------------------------------------- */
/* Copyright (c) 2012-2025 Francois Galea <fgalea at free.fr>
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* the COPYING file or http://www.wtfpl.net/ for more details. */
#ifndef _PIXBUF_H_
#define _PIXBUF_H_
#include <stdint.h>
typedef union pixel {
uint32_t rgb;
struct { uint8_t a, r, g, b; } cp;
} Pixel;
typedef struct _pixbuf {
int width;
int height;
Pixel *array;
void *_ptr;
} PixBuf;
PixBuf *pixbuf_new(int width, int height);
void pixbuf_delete(PixBuf *pb);
void pixbuf_export_bmp(const PixBuf *pb, const char *filename);
#endif