+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");
+ }
+}
+