X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fpixelformat.h;h=b2d1b9cd7948d069233e71cb4722043df6120f83;hp=c180451403dc2af7e9f8c640a7c8384b04eb85e7;hb=8e58fc4da8443cb67fe4cd70d6f68de2be73011d;hpb=66cf095b3eeb3f5a37cc16231680a18d67b292fb diff --git a/source/core/pixelformat.h b/source/core/pixelformat.h index c1804514..b2d1b9cd 100644 --- a/source/core/pixelformat.h +++ b/source/core/pixelformat.h @@ -37,6 +37,17 @@ enum PixelComponents LUMINANCE_ALPHA = 0x42 }; +/** +Describes a mapping from one set of components to another. +*/ +enum ComponentSwizzle +{ + NO_SWIZZLE, + R_TO_LUMINANCE, + RG_TO_LUMINANCE_ALPHA, + RGB_TO_BGR +}; + /** Identifies a pixel format, with components and type. @@ -89,6 +100,10 @@ void operator>>(const LexicalConverter &, PixelFormat &); PixelComponents components_from_graphics(Graphics::PixelFormat); PixelFormat pixelformat_from_image(const Graphics::Image &, bool = false); +ComponentSwizzle get_required_swizzle(PixelComponents); +PixelComponents swizzle_components(PixelComponents, ComponentSwizzle); +PixelComponents unswizzle_components(PixelComponents, ComponentSwizzle); + PixelFormat make_pixelformat(PixelComponents, DataType, bool = false); inline PixelComponents get_components(PixelFormat f) { return static_cast(f&0xFF); } inline unsigned get_component_count(PixelComponents c) { return c&7; }