All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.bloodshura.x.assets.image.gif.GifFrame Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
/*
 * Copyright (c) 2013-2018, João Vitor Verona Biazibetti - All Rights Reserved
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see .
 *
 * https://www.github.com/BloodShura
 */

package com.github.bloodshura.x.assets.image.gif;

import com.github.bloodshura.x.assets.image.Image;
import com.github.bloodshura.x.object.Base;
import com.github.bloodshura.x.object.Mutable;

import javax.annotation.Nonnull;

@Mutable
public class GifFrame extends Base {
	private long delay;
	private DisposalMethod disposalMethod;
	private final Image image;
	private int loopCount;

	public GifFrame(@Nonnull Image image) {
		this.delay = 20L;
		this.disposalMethod = DisposalMethod.NONE;
		this.image = image;
	}

	public long getDelay() {
		return delay;
	}

	@Nonnull
	public DisposalMethod getDisposalMethod() {
		return disposalMethod;
	}

	@Nonnull
	public Image getImage() {
		return image;
	}

	public int getLoopCount() {
		return loopCount;
	}

	public boolean hasLoop() {
		return getLoopCount() > 0;
	}

	public void setDelay(long delay) {
		this.delay = delay;
	}

	public void setDisposalMethod(@Nonnull DisposalMethod disposalMethod) {
		this.disposalMethod = disposalMethod;
	}

	public void setLoopCount(int loopCount) {
		this.loopCount = loopCount;
	}

	@Nonnull
	@Override
	protected Object[] stringValues() {
		return new Object[] { getImage(), getDisposalMethod(), getDelay(), getLoopCount() };
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy