X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fpixelformat.h;h=213328a5578f393acd616eb092a5a55322dc0d07;hp=17a90d365781095f650109457ec6673506522ac1;hb=bec07999d95b76f4b47cffcc564d0cd0afc0435e;hpb=b1c758a602262afad23e28ab68d62021a5b1257e diff --git a/source/pixelformat.h b/source/pixelformat.h index 17a90d36..213328a5 100644 --- a/source/pixelformat.h +++ b/source/pixelformat.h @@ -1,31 +1,40 @@ #ifndef MSP_GL_PIXELFORMAT_H_ #define MSP_GL_PIXELFORMAT_H_ -#include +#include +#include #include #include "gl.h" +#include #include #include #include #include #include -#include -#include +#include +#include +#include +#include "datatype.h" namespace Msp { namespace GL { -enum PixelFormat +enum PixelComponents { - STENCIL_INDEX = GL_STENCIL_INDEX, - DEPTH_COMPONENT = GL_DEPTH_COMPONENT, - DEPTH_COMPONENT16 = GL_DEPTH_COMPONENT16, - DEPTH_COMPONENT24 = GL_DEPTH_COMPONENT24, - DEPTH_COMPONENT32 = GL_DEPTH_COMPONENT32, RED = GL_RED, RG = GL_RG, RGB = GL_RGB, RGBA = GL_RGBA, + BGR = GL_BGR, + BGRA = GL_BGRA, + LUMINANCE = GL_LUMINANCE, + LUMINANCE_ALPHA = GL_LUMINANCE_ALPHA, + DEPTH_COMPONENT = GL_DEPTH_COMPONENT, + STENCIL_INDEX = GL_STENCIL_INDEX +}; + +enum PixelFormat +{ R8 = GL_R8, R16F = GL_R16F, R32F = GL_R32F, @@ -38,39 +47,52 @@ enum PixelFormat RGBA8 = GL_RGBA8, RGBA16F = GL_RGBA16F, RGBA32F = GL_RGBA32F, - SRGB = GL_SRGB, - SRGB_ALPHA = GL_SRGB_ALPHA, SRGB8 = GL_SRGB8, SRGB8_ALPHA8 = GL_SRGB8_ALPHA8, - BGR = GL_BGR, - BGRA = GL_BGRA, - LUMINANCE = GL_LUMINANCE, + BGR8 = 200000, + BGRA8 = 200001, + SBGR8 = 200002, + SBGR8_ALPHA8 = 200003, LUMINANCE8 = GL_LUMINANCE8, - LUMINANCE_ALPHA = GL_LUMINANCE_ALPHA, - LUMINANCE8_ALPHA8 = GL_LUMINANCE8_ALPHA8, - SLUMINANCE = GL_SLUMINANCE, - SLUMINANCE8 = GL_SLUMINANCE8, - SLUMINANCE_ALPHA = GL_SLUMINANCE_ALPHA, - SLUMINANCE8_ALPHA8 = GL_SLUMINANCE8_ALPHA8, - - // Typo, deprecated - LUMINANCE_ALPHA8 = GL_LUMINANCE8_ALPHA8 + LUMINANCE8_ALPHA8 = GL_LUMINANCE8_ALPHA8, + DEPTH_COMPONENT16 = GL_DEPTH_COMPONENT16, + DEPTH_COMPONENT24 = GL_DEPTH_COMPONENT24, + DEPTH_COMPONENT32 = GL_DEPTH_COMPONENT32, + DEPTH_COMPONENT32F = GL_DEPTH_COMPONENT32F, + STENCIL_INDEX8 = GL_STENCIL_INDEX8 }; +void operator>>(const LexicalConverter &, PixelComponents &); void operator>>(const LexicalConverter &, PixelFormat &); -PixelFormat pixelformat_from_graphics(Graphics::PixelFormat); -PixelFormat storage_pixelformat_from_graphics(Graphics::PixelFormat, bool = false); +DEPRECATED PixelComponents pixelformat_from_graphics(Graphics::PixelFormat); +DEPRECATED PixelComponents storage_pixelformat_from_graphics(Graphics::PixelFormat, bool); +PixelFormat pixelformat_from_image(const Graphics::Image &); + +PixelFormat make_pixelformat(PixelComponents, DataType, bool = false); +DEPRECATED PixelFormat get_base_pixelformat(PixelFormat); +PixelComponents get_components(PixelFormat); +DEPRECATED PixelFormat get_default_sized_pixelformat(PixelComponents); +DEPRECATED PixelFormat get_srgb_pixelformat(PixelFormat); + +unsigned get_component_count(PixelComponents); +inline unsigned get_component_count(PixelFormat f) +{ return get_component_count(get_components(f)); } + +DataType get_component_type(PixelFormat); +inline unsigned get_component_size(PixelFormat f) +{ return get_type_size(get_component_type(f)); } -PixelFormat get_base_pixelformat(PixelFormat); -PixelFormat get_sized_pixelformat(PixelFormat); -PixelFormat get_srgb_pixelformat(PixelFormat); -unsigned get_component_count(PixelFormat); -unsigned get_component_size(PixelFormat); unsigned get_pixel_size(PixelFormat); void require_pixelformat(PixelFormat); +DEPRECATED inline PixelFormat get_sized_pixelformat(PixelComponents c, unsigned s = 1) +{ return make_pixelformat(c, (s==2 ? HALF_FLOAT : s==4 ? FLOAT : UNSIGNED_BYTE)); } + +DEPRECATED inline PixelComponents get_unsized_pixelformat(PixelFormat f) +{ return get_components(f); } + } // namespace GL } // namespace Msp