3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
9 #include "pixelformat.h"
16 istream &operator>>(istream &in, PixelFormat &fmt)
21 if(word=="COLOR_INDEX")
23 else if(word=="STENCIL_INDEX")
25 else if(word=="DEPTH_COMPONENT")
26 fmt = DEPTH_COMPONENT;
29 else if(word=="GREEN")
33 else if(word=="ALPHA")
43 else if(word=="LUMINANCE")
45 else if(word=="LUMINANCE_ALPHA")
46 fmt = LUMINANCE_ALPHA;
48 in.setstate(ios_base::failbit);
53 PixelFormat pixelformat_from_graphics(Graphics::PixelFormat pf)
57 case Graphics::COLOR_INDEX: return COLOR_INDEX;
58 case Graphics::LUMINANCE: return LUMINANCE;
59 case Graphics::LUMINANCE_ALPHA: return LUMINANCE_ALPHA;
60 case Graphics::RGB: return RGB;
61 case Graphics::RGBA: return RGBA;
62 case Graphics::BGR: return BGR;
63 case Graphics::BGRA: return BGRA;
64 default: throw InvalidParameterValue("Unknown Graphics::PixelFormat");
68 PixelFormat get_base_pixelformat(PixelFormat pf)
74 case RGB32F: return RGB;
77 case RGBA32F: return RGBA;
80 case LUMINANCE32F: return LUMINANCE;
81 case LUMINANCE_ALPHA8:
82 case LUMINANCE_ALPHA16F:
83 case LUMINANCE_ALPHA32F: return LUMINANCE_ALPHA;