summaryrefslogtreecommitdiff
path: root/apps/plugins/imageviewer/ppm/ppm_decoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/imageviewer/ppm/ppm_decoder.h')
-rw-r--r--apps/plugins/imageviewer/ppm/ppm_decoder.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/apps/plugins/imageviewer/ppm/ppm_decoder.h b/apps/plugins/imageviewer/ppm/ppm_decoder.h
new file mode 100644
index 0000000..edd1bcb
--- /dev/null
+++ b/apps/plugins/imageviewer/ppm/ppm_decoder.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2010 Marcin Bukat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* Magic constants. */
+#define PPM_MAGIC1 'P'
+#define PPM_MAGIC2 '3'
+#define RPPM_MAGIC2 '6'
+#define PPM_FORMAT (PPM_MAGIC1 * 256 + PPM_MAGIC2)
+#define RPPM_FORMAT (PPM_MAGIC1 * 256 + RPPM_MAGIC2)
+
+#define PPM_OVERALLMAXVAL 65535
+
+#define ppm_error(...) rb->splashf(HZ*2, __VA_ARGS__ )
+
+struct ppm_info {
+ int x;
+ int y;
+ int maxval;
+ int format;
+ unsigned char *buf;
+ size_t buf_size;
+ unsigned int native_img_size;
+};
+
+/* public prototype */
+int read_ppm(int fd, struct ppm_info *ppm);