FlexBook / Mbed 2 deprecated FlexBook171204a

Dependencies:   SDFileSystem app epson mbed msp430 pl tests

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pnm-utils.h Source File

pnm-utils.h

00001 /*
00002   Plastic Logic EPD project on MSP430
00003 
00004   Copyright (C) 2013, 2014 Plastic Logic Limited
00005 
00006   This program is free software: you can redistribute it and/or modify
00007   it under the terms of the GNU General Public License as published by
00008   the Free Software Foundation, either version 3 of the License, or
00009   (at your option) any later version.
00010 
00011   This program is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014   GNU General Public License for more details.
00015 
00016   You should have received a copy of the GNU General Public License
00017   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 /*
00020  * pnm-utils.h -- Utilities for dealing with PNM format graphics files
00021  *
00022  * Authors:
00023  *   Nick Terry <nick.terry@plasticlogic.com>
00024  *   Guillaume Tucker <guillaume.tucker@plasticlogic.com>
00025  *
00026  */
00027 
00028 #ifndef PNM_UTILS_H
00029 #define PNM_UTILS_H 1
00030 
00031 #include <ChaN/ff.h>
00032 #include <stdint.h>
00033 
00034 enum {
00035     PNM_BITMAP,
00036     PNM_GREYSCALE,
00037     PNM_UNKNOWN
00038 };
00039 
00040 struct pnm_header {
00041     uint8_t type;
00042     int width;
00043     int height;
00044     int max_gray;
00045 };
00046 
00047 #define pnm_read_int(_f) ({         \
00048         int32_t _value;         \
00049         pnm_read_int32(_f, &_value);    \
00050         (int)_value; })
00051 
00052 extern int pnm_read_header(FIL *pnm_file, struct pnm_header *hdr);
00053 extern int pnm_read_int32(FIL *pnm_file, int32_t *value);
00054 
00055 #endif /* PNM_UTILS_H */