X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpixelformat.cpp;h=d968917b25956440bf0f8f096baffec4dcba7737;hb=a5797c9babd17673285b3b15c7572c2d8fe1595c;hp=738b796c5981fa307c2f9e3f15bc4f94fed1b789;hpb=d1800d7ea80290f4913d0203241cef1409656522;p=libs%2Fgl.git diff --git a/source/pixelformat.cpp b/source/pixelformat.cpp index 738b796c..d968917b 100644 --- a/source/pixelformat.cpp +++ b/source/pixelformat.cpp @@ -5,6 +5,7 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ +#include "except.h" #include "pixelformat.h" using namespace std; @@ -49,5 +50,20 @@ istream &operator>>(istream &in, PixelFormat &fmt) return in; } +PixelFormat pixelformat_from_graphics(Graphics::PixelFormat pf) +{ + switch(pf) + { + case Graphics::COLOR_INDEX: return COLOR_INDEX; + case Graphics::LUMINANCE: return LUMINANCE; + case Graphics::LUMINANCE_ALPHA: return LUMINANCE_ALPHA; + case Graphics::RGB: return RGB; + case Graphics::RGBA: return RGBA; + case Graphics::BGR: return BGR; + case Graphics::BGRA: return BGRA; + default: throw InvalidParameterValue("Unknown Graphics::PixelFormat"); + } +} + } // namespace GL } // namespace Msp