public class Texture extends SFMLNativeObject implements ConstTexture
| Modifier and Type | Class and Description |
|---|---|
static class |
Texture.CoordinateType
Enumeation of texture coordinate types that can be used for rendering.
|
| Constructor and Description |
|---|
Texture()
Constructs a new texture.
|
Texture(ConstTexture other)
Constructs a new texture by copying another texture.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
bind(ConstTexture texture)
Activates a texture for rendering, using the
Texture.CoordinateType.NORMALIZED coordinate type. |
static void |
bind(ConstTexture texture,
Texture.CoordinateType coordinateType)
Activates a texture for rendering with the specified coordinate type.
|
Image |
copyToImage()
Copies this texture to an editable
Image. |
void |
create(int width,
int height)
Generates an empty texture with the specified dimensions.
|
static int |
getMaximumSize()
Gets the maximum texture size supported by the current hardware.
|
Vector2i |
getSize()
Gets the dimensions of the texture.
|
boolean |
isRepeated()
Checks whether texture repeating is enabled.
|
boolean |
isSmooth()
Checks whether the smooth filter is enabled.
|
void |
loadFromFile(Path path)
Attempts to load the texture from a file.
|
void |
loadFromFile(Path path,
IntRect area)
Attempts to load the texture from a file.
|
void |
loadFromImage(Image image)
Attempts to load the texture from a source image.
|
void |
loadFromImage(Image image,
IntRect area)
Attempts to load the texture from a source image portion.
|
void |
loadFromStream(InputStream in)
Fully loads all available bytes from an
InputStream
and attempts to load the texture from it. |
void |
loadFromStream(InputStream in,
IntRect area)
Fully loads all available bytes from an
InputStream
and attempts to load the texture portion from it. |
protected long |
nativeCreate()
Deprecated.
|
protected void |
nativeDelete()
Deprecated.
|
protected void |
nativeSetExPtr()
Deprecated.
|
void |
setRepeated(boolean repeated)
Enables or disables texture repeating.
|
void |
setSmooth(boolean smooth)
Enables or disables the smooth filter.
|
void |
update(Image image,
int x,
int y)
Updates a part of the texture from an image.
|
void |
update(Window window)
Updates the texture from the contents of a window.
|
void |
update(Window window,
int x,
int y)
Updates a part of the texture from the contents of a window.
|
finalizepublic Texture()
public Texture(ConstTexture other)
other - The texture to copy.public static int getMaximumSize()
public static void bind(ConstTexture texture, Texture.CoordinateType coordinateType)
texture - the texture to bind, or null to indicate that
no texture is to be used..coordinateType - the coordinate type to use.public static void bind(ConstTexture texture)
Texture.CoordinateType.NORMALIZED coordinate type.@Deprecated protected long nativeCreate()
SFMLNativeObjectnativeCreate in class SFMLNativeObject@Deprecated protected void nativeSetExPtr()
SFMLNativeObjectnativeSetExPtr in class SFMLNativeObject@Deprecated protected void nativeDelete()
SFMLNativeObjectnativeDelete in class SFMLNativeObjectpublic void create(int width,
int height)
throws TextureCreationException
width - the texture's width.height - the texture's height.TextureCreationException - if the texture could not be created.public void loadFromStream(InputStream in, IntRect area) throws IOException
InputStream
and attempts to load the texture portion from it.in - the input stream to read from.area - the area of the image to load into the texture.IOException - in case an I/O error occurs.public final void loadFromStream(InputStream in) throws IOException
InputStream
and attempts to load the texture from it.in - the input stream to read from.IOException - in case an I/O error occurs.public void loadFromFile(Path path, IntRect area) throws IOException
path - the path to the file to load the texture from.area - the area of the image to load into the texture.IOException - in case an I/O error occurs.public final void loadFromFile(Path path) throws IOException
path - the path to the file to load the texture from.IOException - in case an I/O error occurs.public void loadFromImage(Image image, IntRect area) throws TextureCreationException
image - the source image.area - the area of the image to load into the texture.TextureCreationException - if the texture could not be loaded from the image.public final void loadFromImage(Image image) throws TextureCreationException
image - the source image.TextureCreationException - if the texture could not be loaded from the image.public Vector2i getSize()
getSize in interface ConstTexturepublic Image copyToImage()
ConstTextureImage.copyToImage in interface ConstTexturepublic void update(Image image, int x, int y)
image - the image to update from.x - the X offset inside the texture.y - the Y offset inside the texture.public void update(Window window, int x, int y)
window - the window to update from.x - the X offset inside the texture.y - the Y offset inside the texture.public final void update(Window window)
window - the window to update from.public void setSmooth(boolean smooth)
smooth - true to enable, false to disable.public boolean isSmooth()
ConstTextureisSmooth in interface ConstTexturetrue if enabled, false if disabled.public void setRepeated(boolean repeated)
repeated - true to enable, false to disable.public boolean isRepeated()
ConstTextureisRepeated in interface ConstTexturetrue if enabled, false if disabled.