Struct XRCpuImage.ConversionParams
Describes a set of conversion parameters for use with XRCpuImage's conversion methods.
Implements
Inherited Members
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 |
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 |
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 |
Returns
Type | Description |
---|---|
bool |
|
Overrides
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 |
|
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
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
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 |
XRCpuImage.ConversionParams | rhs | The XRCpuImage.ConversionParams to compare with |
Returns
Type | Description |
---|---|
bool |
|
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 |
XRCpuImage.ConversionParams | rhs | The XRCpuImage.ConversionParams to compare with |
Returns
Type | Description |
---|---|
bool |
|