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
|
#include <stdio.h>
#include "X11/Xlib.h"
struct image;
struct imageformat{
struct image *(*open)(FILE *);
int (*read)(struct image *);
void (*close)(struct image *);
};
typedef enum{
NONE,
IMG,
ALLOC,
LINEAR,
LINEARDRAWN,
BILINEAR,
BILINEARDRAWN,
} drawstate;
struct image{
unsigned char *buf;
unsigned int bufwidth, bufheight;
struct imageformat *fmt;
int redraw;
drawstate state;
XImage *ximg;
};
XImage *ximage(struct image *img, unsigned int width, unsigned int height);
void setaspect(unsigned int w, unsigned int h);
void xinit();
void drawimage(XImage *ximg, unsigned int width, unsigned int height);
XImage *getimage(struct image *img, unsigned int width, unsigned int height);
|