426 lines
13 KiB
C#
426 lines
13 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.CompilerServices;
|
|
using UnityEngine.Internal;
|
|
using UnityEngine.Scripting;
|
|
|
|
namespace UnityEngine
|
|
{
|
|
// Token: 0x020000CD RID: 205
|
|
public sealed class Texture2D : Texture
|
|
{
|
|
// Token: 0x06000EEB RID: 3819 RVA: 0x00014850 File Offset: 0x00012A50
|
|
public Texture2D(int width, int height)
|
|
{
|
|
Texture2D.Internal_Create(this, width, height, TextureFormat.RGBA32, true, false, IntPtr.Zero);
|
|
}
|
|
|
|
// Token: 0x06000EEC RID: 3820 RVA: 0x0001486C File Offset: 0x00012A6C
|
|
public Texture2D(int width, int height, TextureFormat format, bool mipmap)
|
|
{
|
|
Texture2D.Internal_Create(this, width, height, format, mipmap, false, IntPtr.Zero);
|
|
}
|
|
|
|
// Token: 0x06000EED RID: 3821 RVA: 0x00014888 File Offset: 0x00012A88
|
|
public Texture2D(int width, int height, TextureFormat format, bool mipmap, bool linear)
|
|
{
|
|
Texture2D.Internal_Create(this, width, height, format, mipmap, linear, IntPtr.Zero);
|
|
}
|
|
|
|
// Token: 0x06000EEE RID: 3822 RVA: 0x000148A4 File Offset: 0x00012AA4
|
|
internal Texture2D(int width, int height, TextureFormat format, bool mipmap, bool linear, IntPtr nativeTex)
|
|
{
|
|
Texture2D.Internal_Create(this, width, height, format, mipmap, linear, nativeTex);
|
|
}
|
|
|
|
// Token: 0x17000326 RID: 806
|
|
// (get) Token: 0x06000EEF RID: 3823
|
|
public extern int mipmapCount
|
|
{
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
get;
|
|
}
|
|
|
|
// Token: 0x06000EF0 RID: 3824
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void Internal_Create([Writable] Texture2D mono, int width, int height, TextureFormat format, bool mipmap, bool linear, IntPtr nativeTex);
|
|
|
|
// Token: 0x06000EF1 RID: 3825 RVA: 0x000148BC File Offset: 0x00012ABC
|
|
public static Texture2D CreateExternalTexture(int width, int height, TextureFormat format, bool mipmap, bool linear, IntPtr nativeTex)
|
|
{
|
|
if (nativeTex == IntPtr.Zero)
|
|
{
|
|
throw new ArgumentException("nativeTex can not be null");
|
|
}
|
|
return new Texture2D(width, height, format, mipmap, linear, nativeTex);
|
|
}
|
|
|
|
// Token: 0x06000EF2 RID: 3826
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
public extern void UpdateExternalTexture(IntPtr nativeTex);
|
|
|
|
// Token: 0x17000327 RID: 807
|
|
// (get) Token: 0x06000EF3 RID: 3827
|
|
public extern TextureFormat format
|
|
{
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
get;
|
|
}
|
|
|
|
// Token: 0x17000328 RID: 808
|
|
// (get) Token: 0x06000EF4 RID: 3828
|
|
public static extern Texture2D whiteTexture
|
|
{
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
get;
|
|
}
|
|
|
|
// Token: 0x17000329 RID: 809
|
|
// (get) Token: 0x06000EF5 RID: 3829
|
|
public static extern Texture2D blackTexture
|
|
{
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
get;
|
|
}
|
|
|
|
// Token: 0x06000EF6 RID: 3830 RVA: 0x000148FC File Offset: 0x00012AFC
|
|
public void SetPixel(int x, int y, Color color)
|
|
{
|
|
Texture2D.INTERNAL_CALL_SetPixel(this, x, y, ref color);
|
|
}
|
|
|
|
// Token: 0x06000EF7 RID: 3831
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_SetPixel(Texture2D self, int x, int y, ref Color color);
|
|
|
|
// Token: 0x06000EF8 RID: 3832 RVA: 0x0001490C File Offset: 0x00012B0C
|
|
public Color GetPixel(int x, int y)
|
|
{
|
|
Color color;
|
|
Texture2D.INTERNAL_CALL_GetPixel(this, x, y, out color);
|
|
return color;
|
|
}
|
|
|
|
// Token: 0x06000EF9 RID: 3833
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_GetPixel(Texture2D self, int x, int y, out Color value);
|
|
|
|
// Token: 0x06000EFA RID: 3834 RVA: 0x0001492C File Offset: 0x00012B2C
|
|
public Color GetPixelBilinear(float u, float v)
|
|
{
|
|
Color color;
|
|
Texture2D.INTERNAL_CALL_GetPixelBilinear(this, u, v, out color);
|
|
return color;
|
|
}
|
|
|
|
// Token: 0x06000EFB RID: 3835
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_GetPixelBilinear(Texture2D self, float u, float v, out Color value);
|
|
|
|
// Token: 0x06000EFC RID: 3836 RVA: 0x0001494C File Offset: 0x00012B4C
|
|
[ExcludeFromDocs]
|
|
public void SetPixels(Color[] colors)
|
|
{
|
|
int num = 0;
|
|
this.SetPixels(colors, num);
|
|
}
|
|
|
|
// Token: 0x06000EFD RID: 3837 RVA: 0x00014964 File Offset: 0x00012B64
|
|
public void SetPixels(Color[] colors, [DefaultValue("0")] int miplevel)
|
|
{
|
|
int num = this.width >> miplevel;
|
|
if (num < 1)
|
|
{
|
|
num = 1;
|
|
}
|
|
int num2 = this.height >> miplevel;
|
|
if (num2 < 1)
|
|
{
|
|
num2 = 1;
|
|
}
|
|
this.SetPixels(0, 0, num, num2, colors, miplevel);
|
|
}
|
|
|
|
// Token: 0x06000EFE RID: 3838
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
public extern void SetPixels(int x, int y, int blockWidth, int blockHeight, Color[] colors, [DefaultValue("0")] int miplevel);
|
|
|
|
// Token: 0x06000EFF RID: 3839 RVA: 0x000149A8 File Offset: 0x00012BA8
|
|
[ExcludeFromDocs]
|
|
public void SetPixels(int x, int y, int blockWidth, int blockHeight, Color[] colors)
|
|
{
|
|
int num = 0;
|
|
this.SetPixels(x, y, blockWidth, blockHeight, colors, num);
|
|
}
|
|
|
|
// Token: 0x06000F00 RID: 3840
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private extern void SetAllPixels32(Color32[] colors, int miplevel);
|
|
|
|
// Token: 0x06000F01 RID: 3841
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private extern void SetBlockOfPixels32(int x, int y, int blockWidth, int blockHeight, Color32[] colors, int miplevel);
|
|
|
|
// Token: 0x06000F02 RID: 3842 RVA: 0x000149C8 File Offset: 0x00012BC8
|
|
[ExcludeFromDocs]
|
|
public void SetPixels32(Color32[] colors)
|
|
{
|
|
int num = 0;
|
|
this.SetPixels32(colors, num);
|
|
}
|
|
|
|
// Token: 0x06000F03 RID: 3843 RVA: 0x000149E0 File Offset: 0x00012BE0
|
|
public void SetPixels32(Color32[] colors, [DefaultValue("0")] int miplevel)
|
|
{
|
|
this.SetAllPixels32(colors, miplevel);
|
|
}
|
|
|
|
// Token: 0x06000F04 RID: 3844 RVA: 0x000149EC File Offset: 0x00012BEC
|
|
[ExcludeFromDocs]
|
|
public void SetPixels32(int x, int y, int blockWidth, int blockHeight, Color32[] colors)
|
|
{
|
|
int num = 0;
|
|
this.SetPixels32(x, y, blockWidth, blockHeight, colors, num);
|
|
}
|
|
|
|
// Token: 0x06000F05 RID: 3845 RVA: 0x00014A0C File Offset: 0x00012C0C
|
|
public void SetPixels32(int x, int y, int blockWidth, int blockHeight, Color32[] colors, [DefaultValue("0")] int miplevel)
|
|
{
|
|
this.SetBlockOfPixels32(x, y, blockWidth, blockHeight, colors, miplevel);
|
|
}
|
|
|
|
// Token: 0x06000F06 RID: 3846
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private extern void LoadRawTextureData_ImplArray(byte[] data);
|
|
|
|
// Token: 0x06000F07 RID: 3847
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private extern void LoadRawTextureData_ImplPointer(IntPtr data, int size);
|
|
|
|
// Token: 0x06000F08 RID: 3848 RVA: 0x00014A20 File Offset: 0x00012C20
|
|
public void LoadRawTextureData(byte[] data)
|
|
{
|
|
this.LoadRawTextureData_ImplArray(data);
|
|
}
|
|
|
|
// Token: 0x06000F09 RID: 3849 RVA: 0x00014A2C File Offset: 0x00012C2C
|
|
public void LoadRawTextureData(IntPtr data, int size)
|
|
{
|
|
this.LoadRawTextureData_ImplPointer(data, size);
|
|
}
|
|
|
|
// Token: 0x06000F0A RID: 3850
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
public extern byte[] GetRawTextureData();
|
|
|
|
// Token: 0x06000F0B RID: 3851 RVA: 0x00014A38 File Offset: 0x00012C38
|
|
[ExcludeFromDocs]
|
|
public Color[] GetPixels()
|
|
{
|
|
int num = 0;
|
|
return this.GetPixels(num);
|
|
}
|
|
|
|
// Token: 0x06000F0C RID: 3852 RVA: 0x00014A58 File Offset: 0x00012C58
|
|
public Color[] GetPixels([DefaultValue("0")] int miplevel)
|
|
{
|
|
int num = this.width >> miplevel;
|
|
if (num < 1)
|
|
{
|
|
num = 1;
|
|
}
|
|
int num2 = this.height >> miplevel;
|
|
if (num2 < 1)
|
|
{
|
|
num2 = 1;
|
|
}
|
|
return this.GetPixels(0, 0, num, num2, miplevel);
|
|
}
|
|
|
|
// Token: 0x06000F0D RID: 3853
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
public extern Color[] GetPixels(int x, int y, int blockWidth, int blockHeight, [DefaultValue("0")] int miplevel);
|
|
|
|
// Token: 0x06000F0E RID: 3854 RVA: 0x00014AA4 File Offset: 0x00012CA4
|
|
[ExcludeFromDocs]
|
|
public Color[] GetPixels(int x, int y, int blockWidth, int blockHeight)
|
|
{
|
|
int num = 0;
|
|
return this.GetPixels(x, y, blockWidth, blockHeight, num);
|
|
}
|
|
|
|
// Token: 0x06000F0F RID: 3855
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
public extern Color32[] GetPixels32([DefaultValue("0")] int miplevel);
|
|
|
|
// Token: 0x06000F10 RID: 3856 RVA: 0x00014AC8 File Offset: 0x00012CC8
|
|
[ExcludeFromDocs]
|
|
public Color32[] GetPixels32()
|
|
{
|
|
int num = 0;
|
|
return this.GetPixels32(num);
|
|
}
|
|
|
|
// Token: 0x06000F11 RID: 3857
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
public extern void Apply([DefaultValue("true")] bool updateMipmaps, [DefaultValue("false")] bool makeNoLongerReadable);
|
|
|
|
// Token: 0x06000F12 RID: 3858 RVA: 0x00014AE8 File Offset: 0x00012CE8
|
|
[ExcludeFromDocs]
|
|
public void Apply(bool updateMipmaps)
|
|
{
|
|
bool flag = false;
|
|
this.Apply(updateMipmaps, flag);
|
|
}
|
|
|
|
// Token: 0x06000F13 RID: 3859 RVA: 0x00014B00 File Offset: 0x00012D00
|
|
[ExcludeFromDocs]
|
|
public void Apply()
|
|
{
|
|
bool flag = false;
|
|
bool flag2 = true;
|
|
this.Apply(flag2, flag);
|
|
}
|
|
|
|
// Token: 0x06000F14 RID: 3860
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
public extern bool Resize(int width, int height, TextureFormat format, bool hasMipMap);
|
|
|
|
// Token: 0x06000F15 RID: 3861 RVA: 0x00014B1C File Offset: 0x00012D1C
|
|
public bool Resize(int width, int height)
|
|
{
|
|
return this.Internal_ResizeWH(width, height);
|
|
}
|
|
|
|
// Token: 0x06000F16 RID: 3862
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private extern bool Internal_ResizeWH(int width, int height);
|
|
|
|
// Token: 0x06000F17 RID: 3863 RVA: 0x00014B3C File Offset: 0x00012D3C
|
|
public void Compress(bool highQuality)
|
|
{
|
|
Texture2D.INTERNAL_CALL_Compress(this, highQuality);
|
|
}
|
|
|
|
// Token: 0x06000F18 RID: 3864
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_Compress(Texture2D self, bool highQuality);
|
|
|
|
// Token: 0x06000F19 RID: 3865
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
public extern Rect[] PackTextures(Texture2D[] textures, int padding, [DefaultValue("2048")] int maximumAtlasSize, [DefaultValue("false")] bool makeNoLongerReadable);
|
|
|
|
// Token: 0x06000F1A RID: 3866 RVA: 0x00014B48 File Offset: 0x00012D48
|
|
[ExcludeFromDocs]
|
|
public Rect[] PackTextures(Texture2D[] textures, int padding, int maximumAtlasSize)
|
|
{
|
|
bool flag = false;
|
|
return this.PackTextures(textures, padding, maximumAtlasSize, flag);
|
|
}
|
|
|
|
// Token: 0x06000F1B RID: 3867 RVA: 0x00014B6C File Offset: 0x00012D6C
|
|
[ExcludeFromDocs]
|
|
public Rect[] PackTextures(Texture2D[] textures, int padding)
|
|
{
|
|
bool flag = false;
|
|
int num = 2048;
|
|
return this.PackTextures(textures, padding, num, flag);
|
|
}
|
|
|
|
// Token: 0x06000F1C RID: 3868 RVA: 0x00014B94 File Offset: 0x00012D94
|
|
public static bool GenerateAtlas(Vector2[] sizes, int padding, int atlasSize, List<Rect> results)
|
|
{
|
|
if (sizes == null)
|
|
{
|
|
throw new ArgumentException("sizes array can not be null");
|
|
}
|
|
if (results == null)
|
|
{
|
|
throw new ArgumentException("results list cannot be null");
|
|
}
|
|
if (padding < 0)
|
|
{
|
|
throw new ArgumentException("padding can not be negative");
|
|
}
|
|
if (atlasSize <= 0)
|
|
{
|
|
throw new ArgumentException("atlas size must be positive");
|
|
}
|
|
results.Clear();
|
|
bool flag;
|
|
if (sizes.Length == 0)
|
|
{
|
|
flag = true;
|
|
}
|
|
else
|
|
{
|
|
Texture2D.GenerateAtlasInternal(sizes, padding, atlasSize, results);
|
|
flag = results.Count != 0;
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x06000F1D RID: 3869
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void GenerateAtlasInternal(Vector2[] sizes, int padding, int atlasSize, object resultList);
|
|
|
|
// Token: 0x06000F1E RID: 3870 RVA: 0x00014C1C File Offset: 0x00012E1C
|
|
public void ReadPixels(Rect source, int destX, int destY, [DefaultValue("true")] bool recalculateMipMaps)
|
|
{
|
|
Texture2D.INTERNAL_CALL_ReadPixels(this, ref source, destX, destY, recalculateMipMaps);
|
|
}
|
|
|
|
// Token: 0x06000F1F RID: 3871 RVA: 0x00014C2C File Offset: 0x00012E2C
|
|
[ExcludeFromDocs]
|
|
public void ReadPixels(Rect source, int destX, int destY)
|
|
{
|
|
bool flag = true;
|
|
Texture2D.INTERNAL_CALL_ReadPixels(this, ref source, destX, destY, flag);
|
|
}
|
|
|
|
// Token: 0x06000F20 RID: 3872
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_ReadPixels(Texture2D self, ref Rect source, int destX, int destY, bool recalculateMipMaps);
|
|
|
|
// Token: 0x020000CE RID: 206
|
|
[Flags]
|
|
public enum EXRFlags
|
|
{
|
|
// Token: 0x040001DF RID: 479
|
|
None = 0,
|
|
// Token: 0x040001E0 RID: 480
|
|
OutputAsFloat = 1,
|
|
// Token: 0x040001E1 RID: 481
|
|
CompressZIP = 2,
|
|
// Token: 0x040001E2 RID: 482
|
|
CompressRLE = 4,
|
|
// Token: 0x040001E3 RID: 483
|
|
CompressPIZ = 8
|
|
}
|
|
}
|
|
}
|