org.jeometry.geom3D.textured.TextureImage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jeometry-api Show documentation
Show all versions of jeometry-api Show documentation
Jeometry, a Mathematic and Geometry library for Java
package org.jeometry.geom3D.textured;
import java.awt.Image;
import org.jeometry.Jeometry;
/**
* A {@link Texture texture} is an identified resource that can provide display information attached to a coordinate.
* This texture use an {@link Image image} as resource.
* If the explicit use of {@link java.awt.image.BufferedImage buffered image} is required as texture resource, a
* {@link TextureBufferedImage TextureBufferedImage} can be used.
* @author Julien Seinturier - COMEX S.A. - [email protected] - https://github.com/jorigin/jeometry
* @version {@value Jeometry#version} build {@value Jeometry#BUILD}
* @since 1.0.0
*/
public class TextureImage implements Texture{
Image ressourceImage = null;
@Override
public Object getResource() {
return ressourceImage;
}
@Override
public void setResource(Object resource) {
if (resource instanceof Image){
ressourceImage = (Image) resource;
}
}
/**
* Get the {@link Image image} that is used as resource.
* @return the {@link Image image} that is used as resource.
*/
public Image getResourceImage(){
return ressourceImage;
}
/**
* Default constructor should not be used as texture identifier and resources are needed by various processes.
*/
public TextureImage(){
super();
}
/**
* Construct a new texture identified by the name
and the numerical identifier idn
given in parameters
* and linked to the {@link Image image} given as resource
.
* @param name the name of the texture.
* @param idn the numerical identifier of the resource.
* @param resource the {@link Image image} attached as resource to the texture.
*/
public TextureImage(String name, int idn, Image resource){
super();
setResource(resource);
}
}