Class ImagePacker | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class ImagePacker

    Inheritance
    System.Object
    ImagePacker
    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

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023