X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=include%2Fcolor.h;h=ca07f1b6552c1575ccc0f27ab6afd7d8cf7c646a;hb=06e2807a52623261ac31d83f3de6c75bc0e3f3e5;hp=443aa0921b3990a67fc4540f570d59d7154601ce;hpb=1c78f8bbdfe52be741185762123fba2c169d738a;p=meshio%2Fmeshio.git diff --git a/include/color.h b/include/color.h index 443aa09..ca07f1b 100644 --- a/include/color.h +++ b/include/color.h @@ -7,10 +7,10 @@ namespace color { //! Byte•ÛŽ‚ÌGBA struct bRGBA { - char r; - char g; - char b; - char a; + int r; + int g; + int b; + int a; bRGBA() {} @@ -29,11 +29,14 @@ struct bRGBA ); } }; +#ifndef SWIG inline std::ostream &operator<<(std::ostream &os, const bRGBA &rhs) { return os << '[' << rhs.r << ',' << rhs.g << ',' << rhs.b << ',' << rhs.a << ']'; } +#endif + //! Float•ÛŽ‚ÌRGBA struct fRGBA @@ -42,12 +45,31 @@ struct fRGBA float g; float b; float a; + + fRGBA() + {} + + fRGBA(float _r, float _g, float _b, float _a) + : r(_r), g(_g), b(_b), a(_a) + {} + + static fRGBA createFromUInt(unsigned int uint) + { + return fRGBA( + (uint & 0x000000FF) / 255.0f, + (uint & 0x0000FF00 >> 8) / 255.0f, + (uint & 0x00FF0000 >> 16) / 255.0f, + (uint & 0xFF000000 >> 24) / 255.0f + ); + } }; +#ifndef SWIG inline std::ostream &operator<<(std::ostream &os, const fRGBA &rhs) { return os << '[' << rhs.r << ',' << rhs.g << ',' << rhs.b << ',' << rhs.a << ']'; } +#endif //! Float•ÛŽ‚ÌRGB @@ -57,11 +79,13 @@ struct fRGB float g; float b; }; +#ifndef SWIG inline std::ostream &operator<<(std::ostream &os, const fRGB &rhs) { return os << '[' << rhs.r << ',' << rhs.g << ',' << rhs.b << ',' << ']'; } +#endif } // namespace color