docs.unity3d.com
    Show / Hide Table of Contents

    Struct XRCpuImage.ConversionParams

    Describes a set of conversion parameters for use with XRCpuImage's conversion methods.

    Inherited Members
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    public struct ConversionParams : IEquatable<XRCpuImage.ConversionParams>

    Constructors

    ConversionParams(XRCpuImage, TextureFormat, XRCpuImage.Transformation)

    Constructs a XRCpuImage.ConversionParams using the image's full resolution. That is, it sets inputRect to (0, 0, image.width, image.height) and outputDimensions to (image.width, image.height).

    Declaration
    public ConversionParams(XRCpuImage image, TextureFormat format, XRCpuImage.Transformation transformation = XRCpuImage.Transformation.None)
    Parameters
    Type Name Description
    XRCpuImage image

    The source XRCpuImage.

    UnityEngine.TextureFormat format

    The TextureFormat to convert to.

    XRCpuImage.Transformation transformation

    An optional XRCpuImage.Transformation to apply.

    Properties

    inputRect

    The portion of the original image that will be used as input to the conversion. The input rectangle must be completely contained inside the XRCpuImage dimensions.

    Declaration
    public RectInt inputRect { get; set; }
    Property Value
    Type Description
    UnityEngine.RectInt

    The portion of the original image that will be converted.

    Remarks

    It can be significantly faster to convert a sub-rectangle of the original image if you know which part of the image you need.

    outputDimensions

    The dimensions of the converted image. The output dimensions must be less than or equal to the inputRect's dimensions. If the output dimensions are less than the inputRect's dimensions, downsampling is performed using nearest neighbor.

    Declaration
    public Vector2Int outputDimensions { get; set; }
    Property Value
    Type Description
    UnityEngine.Vector2Int

    The dimensions of the converted image.

    Examples

    For example, you could supply (inputRect.width / 2, inputRect.height / 2) to get a half resolution image. This can decrease the time it takes to perform a color conversion.

    outputFormat

    The TextureFormat to which to convert. See FormatSupported(TextureFormat) for a list of supported formats.

    Declaration
    public TextureFormat outputFormat { get; set; }
    Property Value
    Type Description
    UnityEngine.TextureFormat

    The TextureFormat to which to convert.

    transformation

    The transformation to apply to the image during conversion.

    Declaration
    public XRCpuImage.Transformation transformation { get; set; }
    Property Value
    Type Description
    XRCpuImage.Transformation

    The transformation to apply to the image during conversion.

    Remarks

    Transformations typically do not increase the processing time.

    Methods

    Equals(Object)

    Tests for equality.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The object to compare against.

    Returns
    Type Description
    Boolean

    True if obj is of type XRCpuImage.ConversionParams and Equals(XRCpuImage.ConversionParams) also returns true; otherwise false.

    Overrides
    ValueType.Equals(Object)

    Equals(XRCpuImage.ConversionParams)

    Tests for equality.

    Declaration
    public bool Equals(XRCpuImage.ConversionParams other)
    Parameters
    Type Name Description
    XRCpuImage.ConversionParams other

    The other XRCpuImage.ConversionParams to compare against.

    Returns
    Type Description
    Boolean

    True if every field in other is equal to this XRCpuImage.ConversionParams, otherwise false.

    Implements
    IEquatable<T>.Equals(T)

    GetHashCode()

    Generates a hash suitable for use with containers like HashSet and Dictionary.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A hash code generated from this object's fields.

    Overrides
    ValueType.GetHashCode()

    ToString()

    Generates a string representation of this XRCpuImage.ConversionParams.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    A string representation of this XRCpuImage.ConversionParams.

    Overrides
    ValueType.ToString()

    Operators

    Equality(XRCpuImage.ConversionParams, XRCpuImage.ConversionParams)

    Tests for equality. Same as Equals(XRCpuImage.ConversionParams).

    Declaration
    public static bool operator ==(XRCpuImage.ConversionParams lhs, XRCpuImage.ConversionParams rhs)
    Parameters
    Type Name Description
    XRCpuImage.ConversionParams lhs

    The XRCpuImage.ConversionParams to compare with rhs.

    XRCpuImage.ConversionParams rhs

    The XRCpuImage.ConversionParams to compare with lhs.

    Returns
    Type Description
    Boolean

    True if lhs is equal to rhs, otherwise false.

    Inequality(XRCpuImage.ConversionParams, XRCpuImage.ConversionParams)

    Tests for inequality. Same as !Equals(XRCpuImage.ConversionParams).

    Declaration
    public static bool operator !=(XRCpuImage.ConversionParams lhs, XRCpuImage.ConversionParams rhs)
    Parameters
    Type Name Description
    XRCpuImage.ConversionParams lhs

    The XRCpuImage.ConversionParams to compare with rhs.

    XRCpuImage.ConversionParams rhs

    The XRCpuImage.ConversionParams to compare with lhs.

    Returns
    Type Description
    Boolean

    True if lhs is not equal to rhs, otherwise false.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023