⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imrgb8.h

📁 3D Game Engine Design Source Code非常棒
💻 H
字号:
#ifndef IMRGB8_H
#define IMRGB8_H

#include "imagbase.h"
#include "imagfile.h"

class mgcImageRGB8 : public mgcImage
{
// object information
public:
    // image creation
    mgcImageRGB8 ();
    mgcImageRGB8 (int _dimensions, const int* initial);
    mgcImageRGB8 (int _dimensions, int initial_all);
    mgcImageRGB8 (int _dimensions, int initial0, int initial1, ...);
    mgcImageRGB8 (const mgcImage& image);
    mgcImageRGB8 (const mgcLattice& lattice);

    // image file access
    mgcImageRGB8 (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
    unsigned int* operator() () { return (unsigned int*)data; }
    unsigned int& operator[] (int i) const
        { return *(unsigned int*)(data+size*i); }
    unsigned int& operator() (int x) const
        { return *(unsigned int*)(data+size*x); }
    unsigned int& operator() (int x, int y) const
        { return *(unsigned int*)(data+size*Index(x,y)); }
    unsigned int& operator() (int x, int y, int z) const
        { return *(unsigned int*)(data+size*Index(x,y,z)); }
    unsigned int& operator() (int x, int y, int z, int w) const
        { return *(unsigned int*)(data+size*Index(x,y,z,w)); }
    unsigned int& operator() (const mgcCoordinate& coordinate) const
        { return *(unsigned int*)(data+size*Index(coordinate)); }

    // assignments and comparisons
    mgcImageRGB8& operator= (const mgcImageRGB8& image);
    mgcImageRGB8& operator= (const mgcImage& image);
    mgcImageRGB8& operator= (unsigned int value);
    int operator== (const mgcImage& image);
    int operator== (unsigned int value);
    int operator!= (const mgcImage& image)  { return !( *this == image ); }
    int operator!= (unsigned int value)  { return !( *this == value ); }

// 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 get_data_failed;
    static const unsigned put_data_failed;
    static const unsigned load_failed;
    static const unsigned save_failed;
    static const char* message[7];
    static int Number (unsigned single_error);
    static void Report (unsigned single_error);
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -