1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 20:10:05 +00:00

strongly typed flags

Chuck Walbourn 2020-05-29 18:03:44 -07:00
parent 56f1acc1be
commit b691d63d9d
13 changed files with 41 additions and 41 deletions

@ -3,25 +3,25 @@ Compresses an image or set of images to a block-compressed (BC) format.
## CPU Codec
```cpp
HRESULT Compress( const Image& srcImage, DXGI_FORMAT format,
DWORD compress, float threshold,
TEX_COMPRESS_FLAGS compress, float threshold,
ScratchImage& cImage );
HRESULT Compress( const Image* srcImages, size_t nimages,
const TexMetadata& metadata,
DXGI_FORMAT format, DWORD compress, float threshold,
DXGI_FORMAT format, TEX_COMPRESS_FLAGS compress, float threshold,
ScratchImage& cImages );
```
## GPU Codec (BC6H/BC7)
```cpp
HRESULT Compress( ID3D11Device* pDevice, const Image& srcImage,
DXGI_FORMAT format, DWORD compress, float alphaWeight,
DXGI_FORMAT format, TEX_COMPRESS_FLAGS compress, float alphaWeight,
ScratchImage& image );
HRESULT Compress( ID3D11Device* pDevice,
const Image* srcImages, size_t nimages,
const TexMetadata& metadata,
DXGI_FORMAT format, DWORD compress, float alphaWeight,
DXGI_FORMAT format, TEX_COMPRESS_FLAGS compress, float alphaWeight,
ScratchImage& cImages );
```

@ -4,7 +4,7 @@ Computes the mean-squared error for each component based on two input images.
HRESULT ComputeMSE(
const Image& image1, const Image& image2,
float& mse, float* mseV,
DWORD flags = 0 );
CMSE_FLAGS flags = CMSE_DEFAULT );
```
# Parameters

@ -2,14 +2,14 @@ Converts a height-map to a normal-map.
```cpp
HRESULT ComputeNormalMap(
const Image& srcImage, DWORD flags,
const Image& srcImage, CNMAP_FLAGS flags,
float amplitude, DXGI_FORMAT format,
ScratchImage& normalMap );
HRESULT ComputeNormalMap(
const Image* srcImages, size_t nimages,
const TexMetadata& metadata,
DWORD flags, float amplitude, DXGI_FORMAT format,
CNMAP_FLAGS flags, float amplitude, DXGI_FORMAT format,
ScratchImage& normalMaps );
```

@ -3,7 +3,7 @@ Returns both the row and slice pitch for a given width, height, and DXGI format.
```cpp
HRESULT ComputePitch(
DXGI_FORMAT fmt, size_t width, size_t height,
size_t& rowPitch, size_t& slicePitch, DWORD flags = CP_FLAGS_NONE );
size_t& rowPitch, size_t& slicePitch, CP_FLAGS flags = CP_FLAGS_NONE );
```
# Parameters

@ -3,13 +3,13 @@ Convert an image or set of images from one pixel format to another.
```cpp
HRESULT Convert(
const Image& srcImage,
DXGI_FORMAT format, DWORD filter,
DXGI_FORMAT format, TEX_FILTER_FLAGS filter,
float threshold, ScratchImage& image );
HRESULT Convert(
const Image* srcImages, size_t nimages,
const TexMetadata& metadata,
DXGI_FORMAT format, DWORD filter,
DXGI_FORMAT format, TEX_FILTER_FLAGS filter,
float threshold, ScratchImage& result );
```

@ -4,7 +4,7 @@ Copies a rectangle of pixels from one image to another.
HRESULT CopyRectangle(
const Image& srcImage, const Rect& srcRect,
const Image& dstImage,
DWORD filter, size_t xOffset, size_t yOffset );
TEX_FILTER_FLAGS filter, size_t xOffset, size_t yOffset );
```
# Parameters

@ -5,10 +5,10 @@ Returns the _TexMetadata_ structure from a ``.DDS`` file.
```cpp
HRESULT GetMetadataFromDDSMemory( const void* pSource, size_t size,
DWORD flags, TexMetadata& metadata );
DDS_FLAGS flags, TexMetadata& metadata );
HRESULT GetMetadataFromDDSFile( const wchar_t* szFile,
DWORD flags, TexMetadata& metadata );
DDS_FLAGS flags, TexMetadata& metadata );
```
# LoadFromDDSMemory, LoadFromDDSFile
@ -16,27 +16,27 @@ Loads a ``.DDS`` file (including performing any necessary legacy conversions).
```cpp
HRESULT LoadFromDDSMemory( const void* pSource, size_t size,
DWORD flags, TexMetadata* metadata, ScratchImage& image );
DDS_FLAGS flags, TexMetadata* metadata, ScratchImage& image );
HRESULT LoadFromDDSFile( _In_z_ const wchar_t* szFile,
DWORD flags, TexMetadata* metadata, ScratchImage& image );
DDS_FLAGS flags, TexMetadata* metadata, ScratchImage& image );
```
# SaveToDDSMemory, SaveToDDSFile
Saves a single image or a set of images to a ``.DDS`` file.
```cpp
HRESULT SaveToDDSMemory( const Image& image, DWORD flags,
HRESULT SaveToDDSMemory( const Image& image, DDS_FLAGS flags,
Blob& blob );
HRESULT SaveToDDSMemory( const Image* images, size_t nimages,
const TexMetadata& metadata, DWORD flags, Blob& blob );
const TexMetadata& metadata, DDS_FLAGS flags, Blob& blob );
HRESULT SaveToDDSFile( const Image& image, DWORD flags,
HRESULT SaveToDDSFile( const Image& image, DDS_FLAGS flags,
const wchar_t* szFile );
HRESULT SaveToDDSFile( const Image* images, size_t nimages,
const TexMetadata& metadata, DWORD flags, const wchar_t* szFile );
const TexMetadata& metadata, DDS_FLAGS flags, const wchar_t* szFile );
```
# Parameters

@ -1,11 +1,11 @@
Flip and/or rotate an image.
```cpp
HRESULT FlipRotate( const Image& srcImage, DWORD flags, ScratchImage& image );
HRESULT FlipRotate( const Image& srcImage, TEX_FR_FLAGS flags, ScratchImage& image );
HRESULT FlipRotate( const Image* srcImages, size_t nimages,
const TexMetadata& metadata
DWORD flags, ScratchImage& result );
TEX_FR_FLAGS flags, ScratchImage& result );
```
# Parameters

@ -3,13 +3,13 @@ Generates mipmaps for an image or a set of images.
> This generates mipmaps for 1D and 2D dimension textures. For 3D dimension textures (a.k.a. volume maps), see [[GenerateMipMaps3D]].
```cpp
HRESULT GenerateMipMaps( const Image& baseImage, DWORD filter,
HRESULT GenerateMipMaps( const Image& baseImage, TEX_FILTER_FLAGS filter,
size_t levels,
ScratchImage& mipChain, bool allow1D = false );
HRESULT GenerateMipMaps( const Image* srcImages, size_t nimages,
const TexMetadata& metadata,
DWORD filter, size_t levels,
TEX_FILTER_FLAGS filter, size_t levels,
ScratchImage& mipChain );
```

@ -4,12 +4,12 @@ Generates mipmaps for a 3D volume texture from a set of images representing the
```cpp
HRESULT GenerateMipMaps3D( const Image* baseImages, size_t depth,
DWORD filter, size_t levels,
TEX_FILTER_FLAGS filter, size_t levels,
ScratchImage& mipChain );
HRESULT GenerateMipMaps3D( const Image* srcImages, size_t nimages,
const TexMetadata& metadata,
DWORD filter, size_t levels,
TEX_FILTER_FLAGS filter, size_t levels,
ScratchImage& mipChain );
```

@ -3,11 +3,11 @@ This converts an image to using premultiplied alpha. The format and size are not
Note that the conversion to premultipled alpha is not fully reversible. For example if alpha is 0, then all the color information becomes 0.
```cpp
HRESULT PremultiplyAlpha( const Image& srcImage, DWORD flags,
HRESULT PremultiplyAlpha( const Image& srcImage, TEX_PMALPHA_FLAGS flags,
ScratchImage& image );
HRESULT PremultiplyAlpha( const Image* srcImages, size_t nimages,
const TexMetadata& metadata, DWORD flags,
const TexMetadata& metadata, TEX_PMALPHA_FLAGS flags,
ScratchImage& result );
```

@ -4,12 +4,12 @@ Resize an image or set of images.
```cpp
HRESULT Resize( const Image& srcImage,
size_t width, size_t height, DWORD filter,
size_t width, size_t height, TEX_FILTER_FLAGS filter,
ScratchImage& image );
HRESULT Resize( const Image* srcImages, size_t nimages,
const TexMetadata& metadata,
size_t width, size_t height, DWORD filter,
size_t width, size_t height, TEX_FILTER_FLAGS filter,
ScratchImage& result );
```
@ -28,8 +28,8 @@ Image image;
image.width = 640;
image.height = 480;
image.format = DXGI_FORMAT_B8G8R8A8_UNORM;
image.rowPitch = sizeof(DWORD) * 640;
image.slicePitch = sizeof(DWORD) * 640 * 480;
image.rowPitch = sizeof(uint32_t) * 640;
image.slicePitch = sizeof(uint32_t) * 640 * 480;
image.pixels = reinterpret_cast<const uint8_t*>( pixelData );
ScratchImage destImage;
@ -39,7 +39,7 @@ if ( FAILED(hr) )
// result is auto img = destImage.GetImage(0,0,0); where
// img->width = 320, img->height = 200, img->format = DXGI_FORMAT_B8G8R8A8_UNORM;
// img->rowPitch = sizeof(DWORD) * 320, img->slicePitch = sizeof(DWORD) * 320 * 200
// img->rowPitch = sizeof(uint32_t) * 320, img->slicePitch = sizeof(uint32_t) * 320 * 200
// img->pixels is the image data
```

@ -5,11 +5,11 @@ Returns the _TexMetadata_ metadata from a WIC-supported bitmap file.
```cpp
HRESULT GetMetadataFromWICMemory( const void* pSource, size_t size,
DWORD flags, TexMetadata& metadata,
WIC_FLAGS flags, TexMetadata& metadata,
std::function<void(IWICMetadataQueryReader*)> getMQR = nullptr );
HRESULT GetMetadataFromWICFile( const wchar_t* szFile,
DWORD flags, TexMetadata& metadata,
WIC_FLAGS flags, TexMetadata& metadata,
std::function<void(IWICMetadataQueryReader*)> getMQR = nullptr );
```
@ -18,11 +18,11 @@ Loads a WIC-supported bitmap file.
```cpp
HRESULT LoadFromWICMemory( const void* pSource, size_t size,
DWORD flags, TexMetadata* metadata, ScratchImage& image,
WIC_FLAGS flags, TexMetadata* metadata, ScratchImage& image,
std::function<void(IWICMetadataQueryReader*)> getMQR = nullptr );
HRESULT LoadFromWICFile( const wchar_t* szFile,
DWORD flags, TexMetadata* metadata, ScratchImage& image,
WIC_FLAGS flags, TexMetadata* metadata, ScratchImage& image,
std::function<void(IWICMetadataQueryReader*)> getMQR = nullptr );
```
@ -31,22 +31,22 @@ Saves a single image or a set of images to a WIC-supported bitmap file. The call
```cpp
HRESULT SaveToWICMemory( const Image& image,
DWORD flags, REFGUID guidContainerFormat,
WIC_FLAGS flags, REFGUID guidContainerFormat,
Blob& blob, const GUID* targetFormat = nullptr,
std::function<void(IPropertyBag2*)> setCustomProps = nullptr );
HRESULT SaveToWICMemory( const Image* images, size_t nimages,
DWORD flags, REFGUID guidContainerFormat,
WIC_FLAGS flags, REFGUID guidContainerFormat,
Blob& blob, const GUID* targetFormat = nullptr,
std::function<void(IPropertyBag2*)> setCustomProps = nullptr );
HRESULT SaveToWICFile( const Image& image,
DWORD flags, REFGUID guidContainerFormat,
WIC_FLAGS flags, REFGUID guidContainerFormat,
const wchar_t* szFile, const GUID* targetFormat = nullptr,
std::function<void(IPropertyBag2*)> setCustomProps = nullptr );
HRESULT SaveToWICFile( const Image* images, size_t nimages,
DWORD flags, REFGUID guidContainerFormat,
WIC_FLAGS flags, REFGUID guidContainerFormat,
const wchar_t* szFile, const GUID* targetFormat = nullptr,
std::function<void(IPropertyBag2*)> setCustomProps = nullptr );
```
@ -171,7 +171,7 @@ if ( FAILED(hr) )
* ``WIC_FLAGS_ALL_FRAMES`` By default, only the first frame of a multi-frame file is loaded. If this flag is provided, all frames are loaded and resized to match the size of the first image to fit the DirectXTex requirements for a 2D array.
## Color space
* `` WIC_FLAGS_IGNORE_SRGB`` While there is no explicit 'sRGB' pixel format defined for WIC, the load function will check for known metadata tags and may return ``DXGI_FORMAT_*_SRGB`` formats if there are equivalents of the same size and
* ``WIC_FLAGS_IGNORE_SRGB`` While there is no explicit 'sRGB' pixel format defined for WIC, the load function will check for known metadata tags and may return ``DXGI_FORMAT_*_SRGB`` formats if there are equivalents of the same size and
channel configuration available. If this flag is specified, any 'sRGB' metadata is ignored instead.
* ``WIC_FLAGS_DEFAULT_SRGB`` When there is no explicit colorspace information, the loader assumes it's a 'standard' type unless this flag is set to indicate it should use ``DXGI_FORMAT_*_SRGB`` formats if there are equivalents.