]> 4ch.mooo.com Git - 16.git/blob - src/lib/planar.h
6aa8e2608f3b3c520901320ade22f64ea0d20e9f
[16.git] / src / lib / planar.h
1 /*
2  * Functions and types for a planar image buffer.  
3  * This is meant to be able to load into video memory faster.
4  */
5 #include "bitmap.h"
6
7 #ifndef PLANAR_H
8 #define PLANAR_H
9 typedef struct {
10   byte *plane[4];     /* 4 planes of image data */
11   word width;         /* width of the image (spread across 4 planes) */
12   word height;        /* height of the image (spread across 4 planes) */
13   word pwidth;        /* the number of bytes in each plane */
14 } planar_buf_t;
15
16
17 /* creates a planar buffer from the bitmap data.
18    The planar buffer is dynamically allocated, and should
19    be destroyed with the planar_buf_free function when no longer
20    needed.
21  */
22 planar_buf_t *planar_buf_from_bitmap(bitmap_t *b);
23
24
25 /* allocates a planar buffer with specified dimensions */
26 planar_buf_t *planar_buf_alloc(word width, word height);
27
28
29 /* deallocates a planar buffer */
30 void planar_buf_free(planar_buf_t *p);
31 #endif