Class ImagePacker
Inheritance
Inherited Members
Namespace: UnityEditor.Experimental.U2D.Common
Syntax
public static class ImagePacker
Methods
Blit(NativeArray<Color32>, RectInt[], Int32, NativeArray<Color32>[], RectInt[], Int32, Int32)
Declaration
public static void Blit(NativeArray<Color32> buffer, RectInt[] blitToArea, int bufferbytesPerRow, NativeArray<Color32>[] originalBuffer, RectInt[] blitFromArea, int bytesPerRow, int padding)
Parameters
Type | Name | Description |
---|---|---|
NativeArray<Color32> | buffer | |
RectInt[] | blitToArea | |
System.Int32 | bufferbytesPerRow | |
NativeArray<Color32>[] | originalBuffer | |
RectInt[] | blitFromArea | |
System.Int32 | bytesPerRow | |
System.Int32 | padding |
Pack(NativeArray<Color32>[], Int32, Int32, Int32, out NativeArray<Color32>, out Int32, out Int32, out RectInt[], out Vector2Int[])
Packs image buffer into a single buffer. Image buffers are assumed to be 4 bytes per pixel in RGBA format
Declaration
public static void Pack(NativeArray<Color32>[] buffers, int width, int height, int padding, out NativeArray<Color32> outPackedBuffer, out int outPackedBufferWidth, out int outPackedBufferHeight, out RectInt[] outPackedRect, out Vector2Int[] outUVTransform)
Parameters
Type | Name | Description |
---|---|---|
NativeArray<Color32>[] | buffers | Image buffers to pack |
System.Int32 | width | Image buffers width |
System.Int32 | height | Image buffers height |
System.Int32 | padding | Padding between each packed image |
NativeArray<Color32> | outPackedBuffer | Packed image buffer |
System.Int32 | outPackedBufferWidth | Packed image buffer's width |
System.Int32 | outPackedBufferHeight | Packed iamge buffer's height |
RectInt[] | outPackedRect | Location of each image buffers in the packed buffer |
Vector2Int[] | outUVTransform | Translation data from image original buffer to packed buffer |
Pack(RectInt[], Int32, out RectInt[], out Int32, out Int32)
Given an array of rects, the method returns an array of rects arranged within outPackedWidth and outPackedHeight
Declaration
public static void Pack(RectInt[] rects, int padding, out RectInt[] outPackedRects, out int outPackedWidth, out int outPackedHeight)
Parameters
Type | Name | Description |
---|---|---|
RectInt[] | rects | Rects to pack |
System.Int32 | padding | Padding between each rect |
RectInt[] | outPackedRects | Rects arranged within outPackedWidth and outPackedHeight |
System.Int32 | outPackedWidth | Width of the packed rects |
System.Int32 | outPackedHeight | Height of the packed rects |