]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/pixelformat.h
Move swizzling modes to pixelformat.h
[libs/gl.git] / source / core / pixelformat.h
index c180451403dc2af7e9f8c640a7c8384b04eb85e7..b2d1b9cd7948d069233e71cb4722043df6120f83 100644 (file)
@@ -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<PixelComponents>(f&0xFF); }
 inline unsigned get_component_count(PixelComponents c) { return c&7; }