18 #include "pandabase.h"
19 #include "pnmImageHeader.h"
21 #include "boundingHexahedron.h"
22 #include "vector_float.h"
38 void operator = (
const PfmFile ©);
41 void clear(
int x_size,
int y_size,
int num_channels);
43 BLOCKING
bool read(
const Filename &fullpath);
46 BLOCKING
bool write(
const Filename &fullpath);
50 BLOCKING
bool load(
const PNMImage &pnmimage);
51 BLOCKING
bool store(
PNMImage &pnmimage)
const;
52 BLOCKING
bool store_mask(
PNMImage &pnmimage)
const;
54 INLINE
bool is_valid()
const;
56 INLINE PN_float32 get_scale()
const;
57 INLINE
void set_scale(PN_float32 scale);
59 INLINE
bool has_point(
int x,
int y)
const;
60 INLINE PN_float32 get_channel(
int x,
int y,
int c)
const;
61 INLINE
void set_channel(
int x,
int y,
int c, PN_float32 value);
62 INLINE PN_float32 get_point1(
int x,
int y)
const;
63 INLINE
void set_point1(
int x,
int y, PN_float32 point);
64 INLINE
const LPoint2f &get_point2(
int x,
int y)
const;
65 INLINE
void set_point2(
int x,
int y,
const LVecBase2f &point);
66 INLINE
void set_point2(
int x,
int y,
const LVecBase2d &point);
67 INLINE
LPoint2f &modify_point2(
int x,
int y);
68 INLINE
const LPoint3f &get_point(
int x,
int y)
const;
69 INLINE
void set_point(
int x,
int y,
const LVecBase3f &point);
70 INLINE
void set_point(
int x,
int y,
const LVecBase3d &point);
71 INLINE
LPoint3f &modify_point(
int x,
int y);
72 INLINE
const LPoint3f &get_point3(
int x,
int y)
const;
73 INLINE
void set_point3(
int x,
int y,
const LVecBase3f &point);
74 INLINE
void set_point3(
int x,
int y,
const LVecBase3d &point);
75 INLINE
LPoint3f &modify_point3(
int x,
int y);
76 INLINE
const LPoint4f &get_point4(
int x,
int y)
const;
77 INLINE
void set_point4(
int x,
int y,
const LVecBase4f &point);
78 INLINE
void set_point4(
int x,
int y,
const LVecBase4d &point);
79 INLINE
LPoint4f &modify_point4(
int x,
int y);
81 INLINE
void fill(PN_float32 value);
82 INLINE
void fill(
const LPoint2f &value);
83 INLINE
void fill(
const LPoint3f &value);
86 void fill_no_data_value();
87 void fill_channel(
int channel, PN_float32 value);
88 void fill_channel_nan(
int channel);
89 void fill_channel_masked(
int channel, PN_float32 value);
90 void fill_channel_masked_nan(
int channel);
92 BLOCKING
bool calc_average_point(
LPoint3f &result, PN_float32 x, PN_float32 y, PN_float32 radius)
const;
93 BLOCKING
bool calc_bilinear_point(
LPoint3f &result, PN_float32 x, PN_float32 y)
const;
95 BLOCKING
bool calc_autocrop(
int &x_begin,
int &x_end,
int &y_begin,
int &y_end)
const;
96 BLOCKING INLINE
bool calc_autocrop(
LVecBase4f &range)
const;
97 BLOCKING INLINE
bool calc_autocrop(
LVecBase4d &range)
const;
99 bool is_row_empty(
int y,
int x_begin,
int x_end)
const;
100 bool is_column_empty(
int x,
int y_begin,
int y_end)
const;
102 INLINE
void set_zero_special(
bool zero_special);
103 INLINE
void set_no_data_chan4(
bool chan4);
104 void set_no_data_nan(
int num_channels);
105 void set_no_data_value(
const LPoint4f &no_data_value);
106 INLINE
void set_no_data_value(
const LPoint4d &no_data_value);
107 void set_no_data_threshold(
const LPoint4f &no_data_value);
108 INLINE
void set_no_data_threshold(
const LPoint4d &no_data_value);
109 INLINE
void clear_no_data_value();
110 INLINE
bool has_no_data_value()
const;
111 INLINE
bool has_no_data_threshold()
const;
112 INLINE
const LPoint4f &get_no_data_value()
const;
114 BLOCKING
void resize(
int new_x_size,
int new_y_size);
115 BLOCKING
void box_filter_from(
float radius,
const PfmFile ©);
116 BLOCKING
void gaussian_filter_from(
float radius,
const PfmFile ©);
117 BLOCKING
void quick_filter_from(
const PfmFile ©);
119 BLOCKING
void reverse_rows();
120 BLOCKING
void flip(
bool flip_x,
bool flip_y,
bool transpose);
121 BLOCKING
void xform(
const LMatrix4f &transform);
122 INLINE BLOCKING
void xform(
const LMatrix4d &transform);
123 BLOCKING
void forward_distort(
const PfmFile &dist, PN_float32 scale_factor = 1.0);
124 BLOCKING
void reverse_distort(
const PfmFile &dist, PN_float32 scale_factor = 1.0);
125 BLOCKING
void merge(
const PfmFile &other);
126 BLOCKING
void copy_channel(
int to_channel,
const PfmFile &other,
int from_channel);
127 BLOCKING
void copy_channel_masked(
int to_channel,
const PfmFile &other,
int from_channel);
128 BLOCKING
void apply_crop(
int x_begin,
int x_end,
int y_begin,
int y_end);
129 BLOCKING
void clear_to_texcoords(
int x_size,
int y_size);
131 BLOCKING
int pull_spot(
const LPoint4f &delta,
float xc,
float yc,
132 float xr,
float yr,
float exponent);
135 BLOCKING PT(
BoundingHexahedron) compute_planar_bounds(
const LPoint2f ¢er, PN_float32 point_dist, PN_float32 sample_radius,
bool points_only)
const;
136 INLINE BLOCKING PT(
BoundingHexahedron) compute_planar_bounds(
const LPoint2d ¢er, PN_float32 point_dist, PN_float32 sample_radius,
bool points_only)
const;
137 void compute_sample_point(
LPoint3f &result,
138 PN_float32 x, PN_float32 y, PN_float32 sample_radius)
const;
140 void copy_sub_image(
const PfmFile ©,
int xto,
int yto,
141 int xfrom = 0,
int yfrom = 0,
142 int x_size = -1,
int y_size = -1);
143 void add_sub_image(
const PfmFile ©,
int xto,
int yto,
144 int xfrom = 0,
int yfrom = 0,
145 int x_size = -1,
int y_size = -1,
146 float pixel_scale = 1.0);
147 void mult_sub_image(
const PfmFile ©,
int xto,
int yto,
148 int xfrom = 0,
int yfrom = 0,
149 int x_size = -1,
int y_size = -1,
150 float pixel_scale = 1.0);
151 void divide_sub_image(
const PfmFile ©,
int xto,
int yto,
152 int xfrom = 0,
int yfrom = 0,
153 int x_size = -1,
int y_size = -1,
154 float pixel_scale = 1.0);
156 void operator *= (
float multiplier);
158 void output(ostream &out)
const;
160 EXTENSION(PyObject *get_points()
const);
162 #if PY_VERSION_HEX >= 0x02060000
163 EXTENSION(
int __getbuffer__(PyObject *
self, Py_buffer *view,
int flags)
const);
167 INLINE
const vector_float &get_table()
const;
168 INLINE
void swap_table(vector_float &table);
171 INLINE
void setup_sub_image(
const PfmFile ©,
int &xto,
int &yto,
172 int &xfrom,
int &yfrom,
int &x_size,
int &y_size,
173 int &xmin,
int &ymin,
int &xmax,
int &ymax);
175 void box_filter_region(PN_float32 &result,
176 PN_float32 x0, PN_float32 y0, PN_float32 x1, PN_float32 y1)
const;
177 void box_filter_region(
LPoint2f &result,
178 PN_float32 x0, PN_float32 y0, PN_float32 x1, PN_float32 y1)
const;
179 void box_filter_region(
LPoint3f &result,
180 PN_float32 x0, PN_float32 y0, PN_float32 x1, PN_float32 y1)
const;
181 void box_filter_region(
LPoint4f &result,
182 PN_float32 x0, PN_float32 y0, PN_float32 x1, PN_float32 y1)
const;
183 void box_filter_line(PN_float32 &result, PN_float32 &coverage,
184 PN_float32 x0,
int y, PN_float32 x1, PN_float32 y_contrib)
const;
185 void box_filter_line(
LPoint2f &result, PN_float32 &coverage,
186 PN_float32 x0,
int y, PN_float32 x1, PN_float32 y_contrib)
const;
187 void box_filter_line(
LPoint3f &result, PN_float32 &coverage,
188 PN_float32 x0,
int y, PN_float32 x1, PN_float32 y_contrib)
const;
189 void box_filter_line(
LPoint4f &result, PN_float32 &coverage,
190 PN_float32 x0,
int y, PN_float32 x1, PN_float32 y_contrib)
const;
191 void box_filter_point(PN_float32 &result, PN_float32 &coverage,
192 int x,
int y, PN_float32 x_contrib, PN_float32 y_contrib)
const;
193 void box_filter_point(
LPoint2f &result, PN_float32 &coverage,
194 int x,
int y, PN_float32 x_contrib, PN_float32 y_contrib)
const;
195 void box_filter_point(
LPoint3f &result, PN_float32 &coverage,
196 int x,
int y, PN_float32 x_contrib, PN_float32 y_contrib)
const;
197 void box_filter_point(
LPoint4f &result, PN_float32 &coverage,
198 int x,
int y, PN_float32 x_contrib, PN_float32 y_contrib)
const;
202 MiniGridCell() : _sxi(-1), _syi(-1), _dist(-1) { }
207 void fill_mini_grid(MiniGridCell *mini_grid,
int x_size,
int y_size,
208 int xi,
int yi,
int dist,
int sxi,
int syi)
const;
210 static bool has_point_noop(
const PfmFile *file,
int x,
int y);
211 static bool has_point_1(
const PfmFile *file,
int x,
int y);
212 static bool has_point_2(
const PfmFile *file,
int x,
int y);
213 static bool has_point_3(
const PfmFile *file,
int x,
int y);
214 static bool has_point_4(
const PfmFile *file,
int x,
int y);
215 static bool has_point_threshold_1(
const PfmFile *file,
int x,
int y);
216 static bool has_point_threshold_2(
const PfmFile *file,
int x,
int y);
217 static bool has_point_threshold_3(
const PfmFile *file,
int x,
int y);
218 static bool has_point_threshold_4(
const PfmFile *file,
int x,
int y);
219 static bool has_point_chan4(
const PfmFile *file,
int x,
int y);
220 static bool has_point_nan_1(
const PfmFile *file,
int x,
int y);
221 static bool has_point_nan_2(
const PfmFile *file,
int x,
int y);
222 static bool has_point_nan_3(
const PfmFile *file,
int x,
int y);
223 static bool has_point_nan_4(
const PfmFile *file,
int x,
int y);
226 typedef vector_float Table;
231 bool _has_no_data_value;
232 bool _has_no_data_threshold;
235 typedef bool HasPointFunc(
const PfmFile *file,
int x,
int y);
236 HasPointFunc *_has_point;
This is the base class for all three-component vectors and points.
This is a 4-by-4 transform matrix.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
This is the base class for all two-component vectors and points.
This is a four-component point in space.
This is the base class for all three-component vectors and points.
This is a two-component point in space.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
The name of a file, such as a texture file or an Egg file.
Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component, or with a special extension, 2- or 4-component.
This is a 4-by-4 transform matrix.
This is the base class for all two-component vectors and points.
This is the base class for all three-component vectors and points.
This is an abstract base class that defines the interface for reading image files of various types...
This is an abstract base class that defines the interface for writing image files of various types...
This is the base class for all three-component vectors and points.
This is a four-component point in space.
This is a two-component point in space.
This defines a bounding convex hexahedron.
This class aids in the visualization and manipulation of PfmFile objects.