Panda3D
Loading...
Searching...
No Matches
pnmWriter.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file pnmWriter.h
10 * @author drose
11 * @date 2000-06-14
12 */
13
14#ifndef PNMWRITER_H
15#define PNMWRITER_H
16
17#include "pandabase.h"
18
19#include "pnmImageHeader.h"
20class PfmFile;
21
22/**
23 * This is an abstract base class that defines the interface for writing image
24 * files of various types. Any particular image file type that can be written
25 * must define a class that inherits from PNMWriter to write it.
26 */
27class EXPCL_PANDA_PNMIMAGE PNMWriter : public PNMImageHeader {
28protected:
29 INLINE PNMWriter(PNMFileType *type, std::ostream *file, bool owns_file);
30
31public:
32
33 // It is important to delete the PNMWriter class after successfully writing
34 // the data. Failing to do this may result in some data not getting
35 // flushed!
36 virtual ~PNMWriter();
37
38 INLINE PNMFileType *get_type() const;
39
40 INLINE void set_color_type(ColorType type);
41 INLINE void set_num_channels(int num_channels);
42 INLINE void set_maxval(xelval maxval);
43 INLINE void set_x_size(int x_size);
44 INLINE void set_y_size(int y_size);
45
46 INLINE void copy_header_from(const PNMImageHeader &header);
47
48 virtual bool supports_floating_point();
49 virtual bool supports_integer();
50 virtual bool write_pfm(const PfmFile &pfm);
51
52 virtual int write_data(xel *array, xelval *alpha);
53 virtual bool supports_write_row() const;
54 virtual bool supports_grayscale() const;
55 virtual bool write_header();
56 virtual bool write_row(xel *array, xelval *alpha);
57
58 virtual bool supports_stream_write() const;
59
60 INLINE bool is_valid() const;
61
62protected:
63 PNMFileType *_type;
64 bool _owns_file;
65 std::ostream *_file;
66 bool _is_valid;
67};
68
69#include "pnmWriter.I"
70
71#endif
This is the base class of a family of classes that represent particular image file types that PNMImag...
Definition pnmFileType.h:32
This is the base class of PNMImage, PNMReader, and PNMWriter.
get_type
If the file type is known (e.g.
This is an abstract base class that defines the interface for writing image files of various types.
Definition pnmWriter.h:27
Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component,...
Definition pfmFile.h:31
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.