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

com.blitline.image.functions.Tile Maven / Gradle / Ivy

There is a newer version: 0.17.1
Show newest version
package com.blitline.image.functions;

import java.net.URI;

import org.apache.commons.lang3.Validate;

public class Tile extends AbstractFunction {

	private static final long serialVersionUID = 1L;

	@Override
	public String getName() {
		return "tile";
	}

	public Tile(String src) {
		params.put("src", src);
	}

	public Tile(URI src) {
		this(src.toString());
	}

	public Tile scaledAt(double scaleFactor) {
		Validate.validState(!params.containsKey("width"), "only one of scale factor or explicit size may be specified");
		params.put("scale", scaleFactor);
		return this;
	}

	public Tile resizedTo(int width, int height) {
		Validate.validState(!params.containsKey("scale"), "only one of scale factor or explicit size may be specified");
		Validate.isTrue(width > 0, "width must be positive");
		Validate.isTrue(height > 0, "height must be positive");
		params.put("width", width);
		params.put("height", height);
		return this;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy