-
Notifications
You must be signed in to change notification settings - Fork 0
/
ppm.h
39 lines (35 loc) · 873 Bytes
/
ppm.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
/*
* ppm.h
* IJC-DU1
* Author : Pomsar Jakub
* Organization : VUT FIT
* Date : March 15, 2022
* Compiled : gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04)
*/
#include <stdio.h>
#include <stdlib.h>
#include "bitset.h"
#include "error.h"
#include <limits.h>
#ifndef PPM_H
#define PPM_H
#define RGB 3
#define MAX_SIZE (8000*8000*RGB)
#define SIZE_OF_IMAGE (image->xsize * image->ysize * RGB)
struct ppm
{
unsigned xsize;
unsigned ysize;
char data[]; // RGB bajty, celkem 3*xsize*ysize
};
struct ppm * ppm_read(const char * filename);
/*
* načte obsah PPM souboru do touto funkcí dynamicky
* alokované struktury. Při chybě formátu použije funkci warning_msg
* a vrátí NULL. Pozor na "memory leaks".
*/
void ppm_free(struct ppm *p);
/*
* uvolní paměť dynamicky alokovanou v ppm_read
*/
#endif