UnsharpMaskSpecSerializer.java 1.36 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.scene7.is.util.serializers.Serializer
 *  org.jetbrains.annotations.NotNull
 */
package com.scene7.is.ps.provider;

import com.scene7.is.ps.provider.UnsharpMaskSpec;
import com.scene7.is.util.serializers.Serializer;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.jetbrains.annotations.NotNull;

public class UnsharpMaskSpecSerializer
implements Serializer<UnsharpMaskSpec> {
    private static final Serializer<UnsharpMaskSpec> INSTANCE = new UnsharpMaskSpecSerializer();

    @NotNull
    public static Serializer<UnsharpMaskSpec> create() {
        return INSTANCE;
    }

    @NotNull
    public UnsharpMaskSpec load(@NotNull DataInput in) throws IOException {
        return UnsharpMaskSpec.builder().setAmount(in.readDouble()).setRadius(in.readDouble()).setThreshold(in.readDouble()).setLightnessOnly(in.readBoolean()).getProduct();
    }

    public void store(@NotNull UnsharpMaskSpec value, @NotNull DataOutput out) throws IOException {
        out.writeDouble(value.amount);
        out.writeDouble(value.radius);
        out.writeDouble(value.threshold);
        out.writeBoolean(value.lightnessOnly);
    }

    public int dataLength() throws UnsupportedOperationException {
        return 25;
    }

    private UnsharpMaskSpecSerializer() {
    }
}