IppImageAnchorSolid.java 4.12 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.scene7.is.ipp.messages;

import com.scene7.is.ipp.messages.Ipp;
import com.scene7.is.ipp.messages.IppByte;
import com.scene7.is.ipp.messages.IppImageAnchor;
import com.scene7.is.ipp.messages.IppImageAnchorType;
import com.scene7.is.ipp.messages.IppInt;
import com.scene7.is.ipp.messages.IppPixel;
import com.scene7.is.ipp.messages.Offset;
import java.io.IOException;
import java.io.Writer;

public class IppImageAnchorSolid
extends IppImageAnchor {
    private int width_;
    private int height_;
    private IppPixel pixelValue_;

    public IppImageAnchorSolid(int width, int height, IppPixel pixelValue) {
        this.width_ = width;
        this.height_ = height;
        this.pixelValue_ = pixelValue;
    }

    public String toString() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("[");
        buffer.append("width: ").append(String.valueOf(this.width_)).append(" ");
        buffer.append("height: ").append(String.valueOf(this.height_)).append(" ");
        buffer.append("pixelValue: ").append(String.valueOf(this.pixelValue_)).append(" ");
        buffer.append("]");
        return buffer.toString();
    }

    public boolean equals(Object o) {
        if (!(o instanceof IppImageAnchorSolid)) {
            return false;
        }
        IppImageAnchorSolid e = (IppImageAnchorSolid)o;
        if (this.width_ != e.width_) {
            return false;
        }
        if (this.height_ != e.height_) {
            return false;
        }
        if (!this.pixelValue_.equals(e.pixelValue_)) {
            return false;
        }
        return true;
    }

    public static IppImageAnchorSolid UnstuffDerived(byte[] arr, Offset arrayPos) {
        Ipp.Assert((arrayPos.val & 3) == 0, "IppImageAnchorSolid align");
        int type = IppInt.Unstuff(arr, arrayPos);
        int width = IppInt.Unstuff(arr, arrayPos);
        int height = IppInt.Unstuff(arr, arrayPos);
        IppPixel pixelValue = IppPixel.Unstuff(arr, arrayPos);
        IppByte.UnstuffFixedArray(arr, arrayPos, 24);
        Ipp.Assert(type == 65540, "IppImageAnchorSolid enum id");
        return new IppImageAnchorSolid(width, height, pixelValue);
    }

    public static void StuffDerived(byte[] arr, Offset arrayPos, Offset varPos, IppImageAnchorSolid val) {
        Ipp.Assert((arrayPos.val & 3) == 0, "IppImageAnchorSolid align");
        if (val != null) {
            IppInt.Stuff(arr, arrayPos, varPos, val.type());
            IppInt.Stuff(arr, arrayPos, varPos, val.width());
            IppInt.Stuff(arr, arrayPos, varPos, val.height());
            IppPixel.Stuff(arr, arrayPos, varPos, val.pixelValue());
            Ipp.StuffNullBytes(arr, arrayPos, 24);
        } else {
            Ipp.StuffNullBytes(arr, arrayPos, 48);
        }
    }

    public static void Print(Writer tf, String label, IppImageAnchorSolid it) throws IOException {
        String ll = label + "IppImageAnchorSolid: ";
        if (it == null) {
            tf.write(ll + "NULL!!\n");
            return;
        }
        tf.write(ll + "\n");
        IppImageAnchorType.Print(tf, ll + "type: ", it.type());
        IppInt.Print(tf, ll + "width: ", it.width());
        IppInt.Print(tf, ll + "height: ", it.height());
        IppPixel.Print(tf, ll + "pixelValue: ", it.pixelValue());
    }

    public static void PrintArray(Writer tf, String label, IppImageAnchorSolid[] it) throws IOException {
        String ll = label + "IppImageAnchorSolid Array, length: ";
        tf.write(ll);
        if (it == null) {
            tf.write("NULL!!!\n");
            return;
        }
        tf.write("" + it.length + "\n");
        for (int i = 0; i < it.length; ++i) {
            ll = label + "IppImageAnchorSolid[" + String.valueOf(i) + "]: ";
            IppImageAnchorSolid.Print(tf, ll, it[i]);
        }
    }

    public void adjustVarPos(Offset varPos) {
        this.pixelValue_.adjustVarPos(varPos);
    }

    public int type() {
        return 65540;
    }

    public int width() {
        return this.width_;
    }

    public int height() {
        return this.height_;
    }

    public IppPixel pixelValue() {
        return this.pixelValue_;
    }
}