Fawkes API Fawkes Development Version
pnm.h
1
2/***************************************************************************
3 * pnm.h - Header for tool to write PNM,
4 * for more information on the different available image formats see the
5 * NetPBM documentation.
6 *
7 * Generated: Mon Feb 06 19:18:03 2006
8 * Copyright 2005-2007 Tim Niemueller [www.niemueller.de]
9 *
10 ****************************************************************************/
11
12/* This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version. A runtime exception applies to
16 * this software (see LICENSE.GPL_WRE file mentioned below for details).
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Library General Public License for more details.
22 *
23 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
24 */
25
26#ifndef _FIREVISION_FVUTILS_WRITERS_PNM_H_
27#define _FIREVISION_FVUTILS_WRITERS_PNM_H_
28
29#include <fvutils/color/colorspaces.h>
30#include <fvutils/writers/writer.h>
31
32namespace firevision {
33
34/** PNM subtype. */
35typedef enum {
36 PNM_PBM, /**< PBM, B/W */
37 PNM_PBM_ASCII, /**< PBM, B/W, ASCII */
38 PNM_PGM, /**< PGM, grey */
39 PNM_PGM_ASCII, /**< PGM, grey, ASCII */
40 PNM_PPM, /**< PPM, color */
41 PNM_PPM_ASCII /**< PPM, color, ASCII */
42} PNMFormat;
43
44class PNMWriter : public Writer
45{
46public:
47 PNMWriter(PNMFormat format);
48 PNMWriter(PNMFormat format, const char *filename, unsigned int width, unsigned int height);
49
50 virtual void set_buffer(colorspace_t cspace, unsigned char *buffer);
51 virtual void write();
52
53private:
54 unsigned int calc_buffer_size();
55
56 unsigned int write_header(bool simulate = false);
57 const char * format2string(PNMFormat format);
58
59 PNMFormat format;
60 unsigned int buffer_size;
61 unsigned char *buffer;
62 unsigned char *buffer_start;
63 unsigned int width;
64 unsigned int height;
65};
66
67} // end namespace firevision
68
69#endif
PNM file writer.
Definition: pnm.h:45
PNMWriter(PNMFormat format)
Constructor.
Definition: pnm.cpp:46
virtual void set_buffer(colorspace_t cspace, unsigned char *buffer)
Set image buffer.
Definition: pnm.cpp:79
virtual void write()
Write to file.
Definition: pnm.cpp:216
Interface to write images.
Definition: writer.h:32
colorspace_t cspace
The colorspace of the image.
Definition: writer.h:52
char * filename
The complete filename.
Definition: writer.h:45