SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
ImageFormats.h File Reference
#include <tuple>
#include <sourcepp/Math.h>
Include dependency graph for ImageFormats.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  vtfpp
namespace  vtfpp::ImageFormatDetails
namespace  vtfpp::ImageDimensions

Enumerations

enum class  vtfpp::ImageFormat : int32_t {
  vtfpp::RGBA8888 = 0 , vtfpp::ABGR8888 , vtfpp::RGB888 , vtfpp::BGR888 ,
  vtfpp::RGB565 , vtfpp::I8 , vtfpp::IA88 , vtfpp::P8 ,
  vtfpp::A8 , vtfpp::RGB888_BLUESCREEN , vtfpp::BGR888_BLUESCREEN , vtfpp::ARGB8888 ,
  vtfpp::BGRA8888 , vtfpp::DXT1 , vtfpp::DXT3 , vtfpp::DXT5 ,
  vtfpp::BGRX8888 , vtfpp::BGR565 , vtfpp::BGRX5551 , vtfpp::BGRA4444 ,
  vtfpp::DXT1_ONE_BIT_ALPHA , vtfpp::BGRA5551 , vtfpp::UV88 , vtfpp::UVWQ8888 ,
  vtfpp::RGBA16161616F , vtfpp::RGBA16161616 , vtfpp::UVLX8888 , vtfpp::R32F ,
  vtfpp::RGB323232F , vtfpp::RGBA32323232F , vtfpp::RG1616F , vtfpp::RG3232F ,
  vtfpp::RGBX8888 , vtfpp::EMPTY , vtfpp::ATI2N , vtfpp::ATI1N ,
  vtfpp::RGBA1010102 , vtfpp::BGRA1010102 , vtfpp::R16F , vtfpp::CONSOLE_BGRX8888_LINEAR = 42 ,
  vtfpp::CONSOLE_RGBA8888_LINEAR , vtfpp::CONSOLE_ABGR8888_LINEAR , vtfpp::CONSOLE_ARGB8888_LINEAR , vtfpp::CONSOLE_BGRA8888_LINEAR ,
  vtfpp::CONSOLE_RGB888_LINEAR , vtfpp::CONSOLE_BGR888_LINEAR , vtfpp::CONSOLE_BGRX5551_LINEAR , vtfpp::CONSOLE_I8_LINEAR ,
  vtfpp::CONSOLE_RGBA16161616_LINEAR , vtfpp::CONSOLE_BGRX8888_LE , vtfpp::CONSOLE_BGRA8888_LE , vtfpp::R8 = 69 ,
  vtfpp::BC7 , vtfpp::BC6H
}

Functions

constexpr int8_t vtfpp::ImageFormatDetails::red (ImageFormat format)
 Get the number of bits of precision of the red channel in the given format.
constexpr int8_t vtfpp::ImageFormatDetails::decompressedRed (ImageFormat format)
 Get the number of bits of precision of the red channel in the given format regardless of compression.
constexpr int8_t vtfpp::ImageFormatDetails::green (ImageFormat format)
 Get the number of bits of precision of the green channel in the given format.
constexpr int8_t vtfpp::ImageFormatDetails::decompressedGreen (ImageFormat format)
 Get the number of bits of precision of the green channel in the given format regardless of compression.
constexpr int8_t vtfpp::ImageFormatDetails::blue (ImageFormat format)
 Get the number of bits of precision of the blue channel in the given format.
constexpr int8_t vtfpp::ImageFormatDetails::decompressedBlue (ImageFormat format)
 Get the number of bits of precision of the blue channel in the given format regardless of compression.
constexpr int8_t vtfpp::ImageFormatDetails::alpha (ImageFormat format)
 Get the number of bits of precision of the alpha channel in the given format.
constexpr int8_t vtfpp::ImageFormatDetails::decompressedAlpha (ImageFormat format)
 Get the number of bits of precision of the alpha channel in the given format regardless of compression.
constexpr uint8_t vtfpp::ImageFormatDetails::bpp (ImageFormat format)
 Find the bits per pixel of the given format.
constexpr ImageFormat vtfpp::ImageFormatDetails::containerFormat (ImageFormat format)
 Find a container format for the given format, a format that is more commonly understood within this library and can represent the input texture without losing data.
constexpr bool vtfpp::ImageFormatDetails::large (ImageFormat format)
 Check if the given format is representable by RGBA8888 without losing data.
constexpr bool vtfpp::ImageFormatDetails::decimal (ImageFormat format)
 Checks if the given format stores floating points in its channels.
constexpr bool vtfpp::ImageFormatDetails::compressed (ImageFormat format)
 Check if the given format is a compressed format (DXT1, DXT3, DXT5, ATI1N, ATI2N, BC7, BC6H).
constexpr bool vtfpp::ImageFormatDetails::transparent (ImageFormat format)
 Check if the given format can store transparency.
constexpr bool vtfpp::ImageFormatDetails::opaque (ImageFormat format)
 Check if the given format cannot store transparency.
constexpr bool vtfpp::ImageFormatDetails::console (ImageFormat format)
 Check if the given format is exclusively used on console platforms.
constexpr uint16_t vtfpp::ImageDimensions::getMipDim (uint8_t mip, uint16_t dim, bool addCompressedFormatPadding=false)
 Get the dimension at a given mip level.
constexpr std::pair< uint16_t, uint16_t > vtfpp::ImageDimensions::getMipDims (uint8_t mip, uint16_t width, uint16_t height, bool addCompressedFormatPadding=false)
 Get the width and height at a given mip level.
constexpr std::tuple< uint16_t, uint16_t, uint16_t > vtfpp::ImageDimensions::getMipDims (uint8_t mip, uint16_t width, uint16_t height, uint16_t depth, bool addCompressedFormatPadding=false)
 Get the width, height, and depth at a given mip level.
constexpr uint8_t vtfpp::ImageDimensions::getMaximumMipCount (uint16_t width, uint16_t height, uint16_t depth=1)
 Calculate the largest mip count a texture with the given width, height, and depth can contain.
constexpr uint32_t vtfpp::ImageFormatDetails::getDataLength (ImageFormat format, uint16_t width, uint16_t height, uint16_t depth=1)
 Calculate the amount of data required to store a texture with the given format and dimensions.
constexpr uint32_t vtfpp::ImageFormatDetails::getDataLength (ImageFormat format, uint8_t mipCount, uint16_t frameCount, uint8_t faceCount, uint16_t width, uint16_t height, uint16_t depth=1)
 Calculate the amount of data required to store a texture with the given format, mip/frame/face count, and dimensions.
constexpr uint32_t vtfpp::ImageFormatDetails::getDataLengthXBOX (bool padded, ImageFormat format, uint8_t mipCount, uint16_t frameCount, uint8_t faceCount, uint16_t width, uint16_t height, uint16_t depth=1)
 Calculate the amount of data required to store an XBOX platform texture with the given format, mip/frame/face count, and dimensions.
constexpr bool vtfpp::ImageFormatDetails::getDataPosition (uint32_t &offset, uint32_t &length, ImageFormat format, uint8_t mip, uint8_t mipCount, uint16_t frame, uint16_t frameCount, uint8_t face, uint8_t faceCount, uint16_t width, uint16_t height, uint16_t slice=0, uint16_t depth=1)
 Find the position of a specific mip, frame, face, and slice within a texture.
constexpr bool vtfpp::ImageFormatDetails::getDataPositionXbox (uint32_t &offset, uint32_t &length, bool padded, ImageFormat format, uint8_t mip, uint8_t mipCount, uint16_t frame, uint16_t frameCount, uint8_t face, uint8_t faceCount, uint16_t width, uint16_t height, uint16_t slice=0, uint16_t depth=1)
 Find the position of a specific mip, frame, face, and slice within an XBOX platform texture.