Package rosequartz.gfx
Class Texture
java.lang.Object
rosequartz.gfx.Texture
Represents a texture.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a function used for texture minification / magnification. -
Constructor Summary
ConstructorsConstructorDescriptionTexture(int width, int height)Creates an empty texture from its width and height.Creates a texture from an image file.Texture(NativesFX.Texture nativeTexture) -
Method Summary
Modifier and TypeMethodDescriptionblit(float srcX1, float srcY1, float srcX2, float srcY2, float destX1, float destY1, float destX2, float destY2)Blits this texture onto the current render target.Blits this texture onto the current render target.intGets the height of the texture.intgetWidth()Gets the width of the texture.setMagnificationFunction(Texture.ResizeFunction function)Sets the function used for magnification of the texture.setMinificationFunction(Texture.ResizeFunction function)Sets the function used for minification of the texture.setResizeFunctions(Texture.ResizeFunction function)Sets the functions used for minification and magnification of the texture.toString()
-
Constructor Details
-
Texture
Creates a texture from an image file.- Parameters:
r- the image resource to load from- Throws:
NotOnGraphicsThreadException
-
Texture
Creates an empty texture from its width and height.- Parameters:
width- width of the textureheight- height of the texture- Throws:
NotOnGraphicsThreadException
-
Texture
-
-
Method Details
-
setMinificationFunction
public Texture setMinificationFunction(Texture.ResizeFunction function) throws NotOnGraphicsThreadExceptionSets the function used for minification of the texture. The default is ResizeFilter.NEAREST.- Parameters:
function- function used for minification- Returns:
- this
- Throws:
NotOnGraphicsThreadException
-
setMagnificationFunction
public Texture setMagnificationFunction(Texture.ResizeFunction function) throws NotOnGraphicsThreadExceptionSets the function used for magnification of the texture. The default is ResizeFilter.NEAREST.- Parameters:
function- function used for magnification- Returns:
- this
- Throws:
NotOnGraphicsThreadException
-
setResizeFunctions
public Texture setResizeFunctions(Texture.ResizeFunction function) throws NotOnGraphicsThreadExceptionSets the functions used for minification and magnification of the texture.- Parameters:
function- function used for minification and magnification- Returns:
- this
- Throws:
NotOnGraphicsThreadException
-
blit
public Texture blit(float srcX1, float srcY1, float srcX2, float srcY2, float destX1, float destY1, float destX2, float destY2) throws NotOnGraphicsThreadExceptionBlits this texture onto the current render target.- Parameters:
srcX1- position of the bottom left corner of the area to blit from on the x-axissrcY1- position of the bottom left corner of the area to blit from on the y-axissrcX2- position of the top right corner of the area to blit from on the x-axissrcY2- position of the top right corner of the area to blit from on the y-axisdestX1- position of the bottom left corner of the area to blit to on the x-axisdestY1- position of the bottom left corner of the area to blit to on the y-axisdestX2- position of the top right corner of the area to blit to on the x-axisdestY2- position of the top right corner of the area to blit to on the y-axis- Returns:
- this
- Throws:
NotOnGraphicsThreadException
-
blit
public Texture blit(Vec2 src1, Vec2 src2, Vec2 dest1, Vec2 dest2) throws NotOnGraphicsThreadExceptionBlits this texture onto the current render target.- Parameters:
src1- position of the bottom left corner of the area to blit fromsrc2- position of the top right corner of the area to blit fromdest1- position of the bottom left corner of the area to blit todest2- position of the top right corner of the area to blit to- Returns:
- this
- Throws:
NotOnGraphicsThreadException
-
getWidth
public int getWidth()Gets the width of the texture.- Returns:
- texture width
-
getHeight
public int getHeight()Gets the height of the texture.- Returns:
- texture height
-
_getNativeTexture
-
toString
-