This repository has been archived on 2025-04-28. You can view files and clone it, but cannot push or open issues or pull requests.
ARPlusSystem/ARPlusSystem-250418/Library/PackageCache/com.unity.xr.arsubsystems@4.../Editor/InternalBridge/TextureImporterBridge.cs

33 lines
1.3 KiB
C#

using System;
using UnityEngine;
namespace UnityEditor.XR.ARSubsystems.InternalBridge
{
/// <summary>
/// Extension methods for the <c>UnityEditor.TextureImporter</c>.
/// </summary>
public static class TextureImporterInternals
{
/// <summary>
/// Gets the original image dimensions. The texture import settings can affect the resulting
/// texture size, for instance: rounding to a power of 2.
/// </summary>
/// <param name="textureImporter">The <c>TextureImporter</c> on which to operate.</param>
/// <returns>The original dimensions of the imported image.</returns>
/// <exception cref="System.ArgumentNullException">Thrown if <paramref name="textureImporter"/> is <c>null</c>.</exception>
#if UNITY_2021_2_OR_NEWER
[Obsolete("Use TextureImporter.GetSourceTextureWidthAndHeight instead.")]
#endif
public static Vector2Int GetSourceTextureDimensions(TextureImporter textureImporter)
{
if (textureImporter == null)
throw new ArgumentNullException(nameof(textureImporter));
int width = 0;
int height = 0;
textureImporter.GetWidthAndHeight(ref width, ref height);
return new Vector2Int(width, height);
}
}
}