docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct XRCpuImage.ConversionParams

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

    Implements
    IEquatable<XRCpuImage.ConversionParams>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.ARSubsystems
    Assembly: Unity.XR.ARSubsystems.dll
    Syntax
    public struct XRCpuImage.ConversionParams : IEquatable<XRCpuImage.ConversionParams>

    Constructors

    ConversionParams(XRCpuImage, TextureFormat, 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 = Transformation.None)
    Parameters
    Type Name Description
    XRCpuImage image

    The source XRCpuImage.

    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
    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
    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
    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
    bool

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

    Overrides
    ValueType.Equals(object)

    Equals(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
    bool

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

    GetHashCode()

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

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    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

    operator ==(ConversionParams, ConversionParams)

    Tests for equality. Same as Equals(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
    bool

    True if lhs is equal to rhs, otherwise false.

    operator !=(ConversionParams, ConversionParams)

    Tests for inequality. Same as !Equals(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
    bool

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

    Implements

    IEquatable<T>
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)