📄 imfloat.h
字号:
#ifndef IMFLOAT_H
#define IMFLOAT_H
#include "imagbase.h"
#include "imagfile.h"
class mgcImageFloat : public mgcImage
{
// object information
public:
// image creation
mgcImageFloat ();
mgcImageFloat (int _dimensions, const int* initial);
mgcImageFloat (int _dimensions, int initial_all);
mgcImageFloat (int _dimensions, int initial0, int initial1, ...);
mgcImageFloat (const mgcImage& image);
mgcImageFloat (const mgcLattice& lattice);
// image file access
mgcImageFloat (char* fname);
mgcImage& Load (char* fname, int trgt = -1);
mgcImage& Save (char* fname, int trgt = -1);
mgcImage& SaveAs (char* fname, int ff, int trgt = -1);
// element access
float* operator() () { return (float*)data; }
float& operator[] (int i) const
{ return *(float*)(data+size*i); }
float& operator() (int x) const
{ return *(float*)(data+size*x); }
float& operator() (int x, int y) const
{ return *(float*)(data+size*Index(x,y)); }
float& operator() (int x, int y, int z) const
{ return *(float*)(data+size*Index(x,y,z)); }
float& operator() (int x, int y, int z, int w) const
{ return *(float*)(data+size*Index(x,y,z,w)); }
float& operator() (const mgcCoordinate& coordinate) const
{ return *(float*)(data+size*Index(coordinate)); }
// assignments and comparisons
mgcImageFloat& operator= (const mgcImageFloat& image);
mgcImageFloat& operator= (const mgcImage& image);
mgcImageFloat& operator= (float value);
int operator== (const mgcImage& image);
int operator== (float value);
int operator!= (const mgcImage& image) { return !( *this == image ); }
int operator!= (float value) { return !( *this == value ); }
// arithmetic updates
static float zero_divide_result;
mgcImageFloat& operator+= (const mgcImageFloat &image);
mgcImageFloat& operator-= (const mgcImageFloat &image);
mgcImageFloat& operator*= (const mgcImageFloat &image);
mgcImageFloat& operator/= (const mgcImageFloat &image);
mgcImageFloat& operator+= (float value);
mgcImageFloat& operator-= (float value);
mgcImageFloat& operator*= (float value);
mgcImageFloat& operator/= (float value);
// arithmetic operations
mgcImageFloat operator- ();
mgcImageFloat operator+ (const mgcImageFloat &image);
mgcImageFloat operator- (const mgcImageFloat &image);
mgcImageFloat operator* (const mgcImageFloat &image);
mgcImageFloat operator/ (const mgcImageFloat &image);
mgcImageFloat operator+ (float value);
mgcImageFloat operator- (float value);
mgcImageFloat operator* (float value);
mgcImageFloat operator/ (float value);
friend mgcImageFloat operator+ (float value, mgcImageFloat &image);
friend mgcImageFloat operator- (float value, mgcImageFloat &image);
friend mgcImageFloat operator* (float value, mgcImageFloat &image);
friend mgcImageFloat operator/ (float value, mgcImageFloat &image);
// pixel statistics
float Min () const { return minimum; }
float Max () const { return maximum; }
void Min (float value) { minimum = value; }
void Max (float value) { maximum = value; }
void ComputeMaxMin ();
protected:
float minimum, maximum;
// error handling
public:
static int verbose;
static unsigned error;
static void Report (ostream& ostr);
private:
static const unsigned zero_dimension;
static const unsigned invalid_dimension;
static const unsigned null_pixel_pointer;
static const unsigned incompatible_images;
static const unsigned get_data_failed;
static const unsigned put_data_failed;
static const unsigned load_failed;
static const unsigned save_failed;
static const char* message[8];
static int Number (unsigned single_error);
static void Report (unsigned single_error);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -