#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2021 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_PIXELS_PIXELFORMATS_PIXELFORMATDESCRIPTION_H #error This file is intended to be included through PixelFormatDescription.h #endif namespace Nuclex { namespace Pixels { namespace PixelFormats { // ------------------------------------------------------------------------------------------- // /// Describes the B5 G6 R5 unsigned pixel format template<> struct PixelFormatDescription { /// Data format of the individual color channels public: static constexpr enum PixelFormatDataType DataType = ( PixelFormatDataType::UnsignedInteger ); /// What kind of endian flip this format needs public: static constexpr EndianFlipOperation EndianFlip = ( EndianFlipOperation::None // this is a "native endian" format! ); /// Integral type that can hold a whole pixel public: typedef std::uint16_t PixelType; /// Bits occupied by the red color channel public: typedef ColorChannelDescription<0, 11, 5> Channel1; /// Bits occupied by the green color channel public: typedef ColorChannelDescription<1, 5, 6> Channel2; /// Bits occupied by the blue color channel public: typedef ColorChannelDescription<2, 0, 5> Channel3; /// Unused alpha channel public: typedef std::nullptr_t Channel4; }; // ------------------------------------------------------------------------------------------- // /// Describes the B8 G8 R8 unsigned pixel format template<> struct PixelFormatDescription { /// Data format of the individual color channels public: static constexpr enum PixelFormatDataType DataType = ( PixelFormatDataType::UnsignedInteger ); /// Whether this format requires endian flipping on the current platform public: static constexpr bool IsOppositeEndian = false; /// Integral type that can hold a whole pixel public: typedef std::uint32_t PixelType; #if defined(NUCLEX_PIXELS_LITTLE_ENDIAN) /// Bits occupied by the red color channel public: typedef ColorChannelDescription<0, 16, 8> Channel1; /// Bits occupied by the green color channel public: typedef ColorChannelDescription<1, 8, 8> Channel2; /// Bits occupied by the blue color channel public: typedef ColorChannelDescription<2, 0, 8> Channel3; #else /// Bits occupied by the red color channel public: typedef ColorChannelDescription<0, 0, 8> Channel1; /// Bits occupied by the green color channel public: typedef ColorChannelDescription<1, 8, 8> Channel2; /// Bits occupied by the blue color channel public: typedef ColorChannelDescription<2, 16, 8> Channel3; #endif /// Unused alpha channel public: typedef std::nullptr_t Channel4; }; // ------------------------------------------------------------------------------------------- // /// Describes the B8 G8 R8 signed pixel format template<> struct PixelFormatDescription { /// Data format of the individual color channels public: static constexpr enum PixelFormatDataType DataType = ( PixelFormatDataType::SignedInteger ); /// Whether this format requires endian flipping on the current platform public: static constexpr bool IsOppositeEndian = true; /// Integral type that can hold a whole pixel public: typedef std::uint32_t PixelType; #if defined(NUCLEX_PIXELS_LITTLE_ENDIAN) /// Bits occupied by the red color channel public: typedef ColorChannelDescription<0, 16, 8> Channel1; /// Bits occupied by the green color channel public: typedef ColorChannelDescription<1, 8, 8> Channel2; /// Bits occupied by the blue color channel public: typedef ColorChannelDescription<2, 0, 8> Channel3; #else /// Bits occupied by the red color channel public: typedef ColorChannelDescription<0, 0, 8> Channel1; /// Bits occupied by the green color channel public: typedef ColorChannelDescription<1, 8, 8> Channel2; /// Bits occupied by the blue color channel public: typedef ColorChannelDescription<2, 16, 8> Channel3; #endif /// Unused alpha channel public: typedef std::nullptr_t Channel4; }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Pixels::PixelFormats