X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fpixelformat.h;h=13bc03a8c059325d7272120f5a486b58e7e5d01e;hb=e1be82a4dfce8d90358c506f65be09da4dc9d5ec;hp=c180451403dc2af7e9f8c640a7c8384b04eb85e7;hpb=190a7e11237351f6b730c28f7b16f183e8adc69c;p=libs%2Fgl.git diff --git a/source/core/pixelformat.h b/source/core/pixelformat.h index c1804514..13bc03a8 100644 --- a/source/core/pixelformat.h +++ b/source/core/pixelformat.h @@ -37,6 +37,18 @@ 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, + RGBA_TO_RGB +}; + /** Identifies a pixel format, with components and type. @@ -89,6 +101,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; }