docs.unity.cn
    Show / Hide Table of Contents

    Class XRCpuImageFormatExtensions

    Extensions to convert between UnityEngine.TextureFormat and XRCpuImage.Format.

    Inheritance
    Object
    XRCpuImageFormatExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    public static class XRCpuImageFormatExtensions

    Methods

    AsTextureFormat(XRCpuImage.Format)

    Attempts to convert an XRCpuImage.Format to a UnityEngine.TextureFormat.

    Declaration
    public static TextureFormat AsTextureFormat(this XRCpuImage.Format this)
    Parameters
    Type Name Description
    XRCpuImage.Format this

    Defines an extension of XRCpuImage.Format.

    Returns
    Type Description
    UnityEngine.TextureFormat

    Returns a texture format that matches this if possible. Returns 0 if there is no matching texture format.

    ToXRCpuImageFormat(TextureFormat)

    Attempts to convert a UnityEngine.TextureFormat to an XRCpuImage.Format.

    Declaration
    public static XRCpuImage.Format ToXRCpuImageFormat(this TextureFormat this)
    Parameters
    Type Name Description
    UnityEngine.TextureFormat this

    Defines an extension of UnityEngine.TextureFormat.

    Returns
    Type Description
    XRCpuImage.Format

    Returns a XRCpuImage.Format that matches this if possible. Returns Unknown if there is no matching XRCpuImage.Format.

    Remarks

    For some formats, there may be multiple XRCpuImage.Formats that match the format. In this case this method will return a generalized format. For example, UnityEngine.TextureFormat.RFloat will return OneComponent32 instead of DepthFloat32 as it's possible that the single channel is not depth. In these cases, you should also check the image type.

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Friday, July 14, 2023