X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fpixelformat.cpp;h=0b13f3ccefa7fe53cf2e5868b157a7d0c0e5588b;hb=HEAD;hp=91f102261cf63006d933b017427656adc8cb867d;hpb=cd446554e998204eaba22504b7b28227feb8edbb;p=libs%2Fgl.git diff --git a/source/pixelformat.cpp b/source/pixelformat.cpp deleted file mode 100644 index 91f10226..00000000 --- a/source/pixelformat.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#include "except.h" -#include "pixelformat.h" - -using namespace std; - -namespace Msp { -namespace GL { - -istream &operator>>(istream &in, PixelFormat &fmt) -{ - string word; - - in>>word; - if(word=="COLOR_INDEX") - fmt = COLOR_INDEX; - else if(word=="STENCIL_INDEX") - fmt = STENCIL_INDEX; - else if(word=="DEPTH_COMPONENT") - fmt = DEPTH_COMPONENT; - else if(word=="RED") - fmt = RED; - else if(word=="GREEN") - fmt = GREEN; - else if(word=="BLUE") - fmt = BLUE; - else if(word=="ALPHA") - fmt = ALPHA; - else if(word=="RGB") - fmt = RGB; - else if(word=="RGBA") - fmt = RGBA; - else if(word=="BGR") - fmt = BGR; - else if(word=="BGRA") - fmt = BGRA; - else if(word=="LUMINANCE") - fmt = LUMINANCE; - else if(word=="LUMINANCE_ALPHA") - fmt = LUMINANCE_ALPHA; - else - in.setstate(ios_base::failbit); - - 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"); - } -} - -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; - } -} - -} // namespace GL -} // namespace Msp