-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisp.h
50 lines (42 loc) · 1.37 KB
/
disp.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
/*
disp.h -- cs580 HW1 include file for Display
*/
#include "gz.h"
/* define general display pixel-type */
#ifndef GZ_PIXEL
typedef struct {
GzIntensity red;
GzIntensity green;
GzIntensity blue;
GzIntensity alpha;
GzDepth z;
} GzPixel;
#define GZ_PIXEL
#endif;
/* define a display type */
#ifndef GZ_DISPLAY
typedef struct {
unsigned short xres;
unsigned short yres;
GzPixel *fbuf; /* frame buffer array */
} GzDisplay;
#define GZ_DISPLAY
#endif;
/* define bounds on display size in case of error */
#define MAXXRES 1024
#define MAXYRES 1024
// simplify display fbuf indexing
// (optional - use this or define your own indexing method)
#define ARRAY(x,y) (x+(y*display->xres))
// Function declarations
int GzNewFrameBuffer(char** framebuffer, int width, int height);
int GzNewDisplay(GzDisplay **display, int xRes, int yRes);
int GzFreeDisplay(GzDisplay *display);
int GzGetDisplayParams(GzDisplay *display, int *xRes, int *yRes);
int GzInitDisplay(GzDisplay *display);
int GzPutDisplay(GzDisplay *display, int i, int j,
GzIntensity r, GzIntensity g, GzIntensity b, GzIntensity a, GzDepth z);
int GzGetDisplay(GzDisplay *display, int i, int j,
GzIntensity *r, GzIntensity *g, GzIntensity *b, GzIntensity *a, GzDepth *z);
int GzFlushDisplay2File(FILE* outfile, GzDisplay *display);
int GzFlushDisplay2FrameBuffer(char* framebuffer, GzDisplay* display);