Table of Contents
DirectXTex |
---|
Evaluates a user-supplied function across an image.
HRESULT EvaluateImage(const Image& image,
std::function<
void(const XMVECTOR* pixels, size_t width, size_t y)
> pixelFunc );
HRESULT EvaluateImage(const Image* images, size_t nimages, const TexMetadata& metadata,
std::function<
void(const XMVECTOR* pixels, size_t width, size_t y)
> pixelFunc );
Breaking change notice: In the September 2016 release this function was
Evaluate
but this generic name can cause conflicts in some client code so it was renamedEvaluateImage
.
Parameters
pixelFunc: A callback function to invoke for each scanline of the image.
Example
This function computes the maximum luminance of an input.
XMVECTOR maxLum = XMVectorZero();
HRESULT hr = EvaluateImage(*image.GetImage(0, 0, 0),
[&](const XMVECTOR* pixels, size_t width, size_t y)
{
UNREFERENCED_PARAMETER(y);
for (size_t j = 0; j < width; ++j)
{
static const XMVECTORF32 s_luminance = { 0.3f, 0.59f, 0.11f, 0.f };
XMVECTOR v = *pixels++;
v = XMVector3Dot(v, s_luminance);
maxLum = XMVectorMax(v, maxLum);
}
});
if (FAILED(hr))
...
Remarks
Image data is converted to DXGI_FORMAT_R32G32B32A32_FLOAT
for this operation. BC data is automatically decompressed.
This function cannot operate directly on a planar format image. See ConvertToSinglePlane for a method for converting planar data to a format that is supported by this routine.
For Use
- Universal Windows Platform apps
- Windows desktop apps
- Windows 11
- Windows 10
- Windows 8.1
- Windows 7 Service Pack 1
- Xbox One
- Xbox Series X|S
- Windows Subsystem for Linux
Architecture
- x86
- x64
- ARM64
For Development
- Visual Studio 2022
- Visual Studio 2019 (16.11)
- clang/LLVM v12 - v18
- GCC 10.5, 11.4, 12.3
- MinGW 12.2, 13.2
- CMake 3.20
Related Projects
DirectX Tool Kit for DirectX 11
DirectX Tool Kit for DirectX 12
Tools
See also
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.