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

    Class RleWriter

    Inheritance
    System.Object
    RleWriter
    Namespace: PhotoshopFile
    Syntax
    public class RleWriter

    Constructors

    RleWriter(Stream)

    Declaration
    public RleWriter(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    Methods

    Write(Byte[], Int32, Int32)

    Encodes byte data using PackBits RLE compression.

    Declaration
    public int Write(byte[] data, int offset, int count)
    Parameters
    Type Name Description
    System.Byte[] data

    Raw data to be encoded.

    System.Int32 offset

    Offset at which to begin transferring data.

    System.Int32 count

    Number of bytes of data to transfer.

    Returns
    Type Description
    System.Int32

    Number of compressed bytes written to the stream.

    Remarks

    There are multiple ways to encode two-byte runs:

    1. Apple PackBits only encodes three-byte runs as repeats.
    2. Adobe Photoshop encodes two-byte runs as repeats, unless preceded by literals.
    3. TIFF PackBits recommends that two-byte runs be encoded as repeats, unless preceded and followed by literals.

    This class adopts the Photoshop behavior, as it has slightly better compression efficiency than Apple PackBits, and is easier to implement than TIFF PackBits.

    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