Skip to content
Chuck Walbourn edited this page Jul 13, 2020 · 5 revisions

The Image class is a structure that defines the system memory image most DirectXTex functions operate on.

struct Image
{
    size_t      width;
    size_t      height;
    DXGI_FORMAT format;
    size_t      rowPitch;
    size_t      slicePitch;
    uint8_t*    pixels;
}

Note that for 1D and 2D images, slicePitch should be set to the full size of the image.

For DirectXTex functions that create new images, the results are returned in an instance of ScracthImage which is a 'container' for Image instances:

Methods

  • Initialize: Creates a new scratch image given a TexMetadata description. The images are zero'd.

  • Initialize1D: Creates a 1D or 1D array scratch image with optional mipmap levels. The images are zero'd.

  • Initialize2D: Creates a 2D or 2D array scratch image with optional mipmap levels. The images are zero'd.

  • Initialize3D: Create a volume scratch image with optional mipmap levels. The images are zero'd.

  • InitializeCube: Creates a cubemap or cubemap array wiht optional mipmap levels. The images are zero'd.

  • InitializeFromImage: Creates a new scratch 1D or 2D image initialized from a source Image. The result has no mipmaps.

  • InitializeArrayFromImages: Creates a new scratch 1D or 2D array image initialized from an array of source Image instances. The result has no mipmaps.

  • InitializeCubeFromImages: Creates a cubemap from an array of Image instances. The result has no mipmaps.

  • Initialize3DFromImages: Creates a volume from an array of Image instances. The result has no mipmaps.

  • Release: Releases all memory associated with the ScratchImage.

  • OverrideFormat: Changes the format for all Image instances in the instance.

Note, the developer user must ensure the new format bits-per-pixel size matches the original or the result will be invalid.

  • GetMetadata: Returns the TexMetadata structure which describes the instance.

  • GetImage(size_t mip, size_t item, size_t slice): Returns the Image for a given index set.

  • GetImages, GetImageCount: Returns the array of Image instances and the count.

  • GetPixels, GetPixelsSize: Returns the system memory that holds all image pixels for the scratch image instance and the size in bytes. This includes all alignment padding as well.

  • IsAlphaAllOpaque: Returns true if all alpha-channel data in the image is set to fully opaque.

For Use

  • Universal Windows Platform apps
  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Windows 8.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

DirectXTex Rust bindings

DirectX Tool Kit for DirectX 11

DirectX Tool Kit for DirectX 12

DirectXMesh

DirectXMath

Tools

Test Suite

Content Exporter

DxCapsViewer

See also

DirectX Landing Page

Clone this wiki locally