forked from TeachingUndergradsCHC/modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathppmFile.h
More file actions
37 lines (27 loc) · 845 Bytes
/
ppmFile.h
File metadata and controls
37 lines (27 loc) · 845 Bytes
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
/****************************************************************
*
* ppm.h
*
* Read and write PPM files. Only works for "raw" format.
*
* AF970205
*
****************************************************************/
#ifndef PPM_H
#define PPM_H
#include <sys/types.h>
typedef struct Image
{
int width;
int height;
unsigned char *data;
} Image;
Image *ImageCreate(int width, int height);
Image *ImageRead(const char *filename);
void ImageWrite(Image *image, const char *filename);
int ImageWidth(Image *image);
int ImageHeight(Image *image);
void ImageClear(Image *image, unsigned char red, unsigned char green, unsigned char blue);
void ImageSetPixel(Image *image, int x, int y, int chan, unsigned char val);
unsigned char ImageGetPixel(Image *image, int x, int y, int chan);
#endif /* PPM_H */