#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 B8 G8 R8 A8 unsigned pixel format
template<>
struct PixelFormatDescription {
/// Data format of the individual color channels
public: static constexpr enum PixelFormatDataType DataType = (
PixelFormatDataType::UnsignedInteger
);
/// 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;
/// Bits occupied by the alpha channel
public: typedef ColorChannelDescription<3, 24, 8> Channel4;
#else
/// Bits occupied by the red color channel
public: typedef ColorChannelDescription<0, 8, 8> Channel1;
/// Bits occupied by the green color channel
public: typedef ColorChannelDescription<1, 16, 8> Channel2;
/// Bits occupied by the blue color channel
public: typedef ColorChannelDescription<2, 24, 8> Channel3;
/// Bits occupied by the alpha channel
public: typedef ColorChannelDescription<3, 0, 8> Channel4;
#endif
};
// ------------------------------------------------------------------------------------------- //
/// Describes the B8 G8 R8 A8 signed pixel format
template<>
struct PixelFormatDescription {
/// Data format of the individual color channels
public: static constexpr enum PixelFormatDataType DataType = (
PixelFormatDataType::SignedInteger
);
/// 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;
/// Bits occupied by the alpha channel
public: typedef ColorChannelDescription<3, 24, 8> Channel4;
#else
/// Bits occupied by the red color channel
public: typedef ColorChannelDescription<0, 8, 8> Channel1;
/// Bits occupied by the green color channel
public: typedef ColorChannelDescription<1, 16, 8> Channel2;
/// Bits occupied by the blue color channel
public: typedef ColorChannelDescription<2, 24, 8> Channel3;
/// Bits occupied by the alpha channel
public: typedef ColorChannelDescription<3, 0, 8> Channel4;
#endif
};
// ------------------------------------------------------------------------------------------- //
}}} // namespace Nuclex::Pixels::PixelFormats