1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-24 13:20:13 +00:00

Updated ScaleMipMapsAlphaForCoverage (markdown)

Chuck Walbourn 2019-01-28 16:48:17 -08:00
parent cb22bd1062
commit 5f0f10c0c8

@ -10,7 +10,7 @@ HRESULT ScaleMipMapsAlphaForCoverage(
# Parameters
_srcImages_: The image array of miplevels to use as a source which has _nimages_ images. The first level of the resulting _mipChain_ is set to a copy of the first image.
_srcImages_: The image array of miplevels to use as the image source which has _nimages_ images. The first level of the resulting _mipChain_ is set to a copy of the first image.
_metadata_: Metadata describing the texture. The ``info.mipLevels`` value should match the ``nimages`` value passed to this function.
@ -20,6 +20,36 @@ _alphaReference_: Is the alpha test reference value which ranges from 0 to 1.
_mipChain_: Is where the results are written. Generally it should be created to match the ``mipChain`` returned by [[GenerateMipMaps]] and then this function is called once for each array item to set all the values.
# Example
```cpp
ScratchImage baseImage;
...
ScratchImage mipChain;
hr = GenerateMipMaps( baseImage.GetImages(), baseImage.GetImageCount(),
baseImage.GetMetadata(), TEX_FILTER_DEFAULT, 0, mipChain );
if ( FAILED(hr) )
ScratchImage coverageMipChain;
hr = coverageMipChain.Initialize(mipChain.GetMetadata());
if (FAILED(hr))
const size_t items = mipChain.GetMetadata().arraySize;
for (size_t item = 0; item < items; ++item)
{
auto img = mipChain.GetImage(0, item, 0);
assert(img);
hr = ScaleMipMapsAlphaForCoverage(img, mipChain.GetMetadata().mipLevels, info, item, 0.5f, coverageMipChain);
if (FAILED(hr))
}
```
# Remarks
This function does not operate directly on block compressed images. See [[Decompress]] and [[Compress]].