-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
-#include "except.h"
+#include <msp/strings/format.h>
#include "pixelformat.h"
using namespace std;
case Graphics::RGBA: return RGBA;
case Graphics::BGR: return BGR;
case Graphics::BGRA: return BGRA;
- default: throw InvalidParameterValue("Unknown Graphics::PixelFormat");
+ default: throw invalid_argument("pixelformat_from_graphics");
+ }
+}
+
+PixelFormat get_base_pixelformat(PixelFormat pf)
+{
+ switch(pf)
+ {
+ case RGB8:
+ case RGB16F:
+ case RGB32F: return RGB;
+ case RGBA8:
+ case RGBA16F:
+ case RGBA32F: return RGBA;
+ case LUMINANCE8:
+ case LUMINANCE16F:
+ case LUMINANCE32F: return LUMINANCE;
+ case LUMINANCE_ALPHA8:
+ case LUMINANCE_ALPHA16F:
+ case LUMINANCE_ALPHA32F: return LUMINANCE_ALPHA;
+ default: return pf;
}
}