1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-23 04:50:06 +00:00
7 FlipRotate
Chuck Walbourn edited this page 2023-05-13 14:49:53 -07:00
DirectXTex

Flip and/or rotate an image.

HRESULT FlipRotate( const Image& srcImage, TEX_FR_FLAGS flags, ScratchImage& image );

HRESULT FlipRotate( const Image* srcImages, size_t nimages,
    const TexMetadata& metadata
    TEX_FR_FLAGS flags, ScratchImage& result );

WIC is not supported on Linux or Windows Subsystem for Linux, so these functions are not supported for non-Win32 platforms. WIC2 is supported on Xbox One and Xbox Series X|S.

Parameters

flags: Combination of options to apply

Optionally a rotation

  • TEX_FR_ROTATE0 Rotate by 0 degrees (no-op)
  • TEX_FR_ROTATE90 Rotate by 90 degrees
  • TEX_FR_ROTATE180 Rotate by 180 degrees
  • TEX_FR_ROTATE270 Rotate by 270 degrees

Optionally a flip

  • TEX_FR_FLIP_HORIZONTAL Horizonal flip
  • TEX_FR_FLIP_VERTICAL Vertical flip

Example

ScratchImage srcImage;

...

ScratchImage destImage;
hr = FlipRotate( srcImage.GetImages(), srcImage.GetImageCount(),
        srcImage.GetMetadata(),
        TEX_FR_FLIP_HORIZONTAL, destImage );
if ( FAILED(hr) )
    ...

Remarks

This function does not operate directly on block compressed images. See Decompress and Compress.

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.