Class TextureIcon
java.lang.Object
io.github.cottonmc.cotton.gui.widget.icon.TextureIcon
- All Implemented Interfaces:
Icon
An icon that draws a texture.
- Since:
- 2.2.0
-
Constructor Summary
ConstructorDescriptionTextureIcon
(Texture texture) Constructs a new texture icon.TextureIcon
(Identifier texture) Constructs a new texture icon. -
Method Summary
Modifier and TypeMethodDescriptionint
getColor()
Gets the color tint of the texture.float
Gets the opacity of the texture.void
paint
(DrawContext context, int x, int y, int size) Paints this icon.setColor
(int color) Sets the color tint of the texture.setOpacity
(float opacity) Sets the opacity of the texture.
-
Constructor Details
-
TextureIcon
Constructs a new texture icon.- Parameters:
texture
- the identifier of the icon texture
-
TextureIcon
Constructs a new texture icon.- Parameters:
texture
- the identifier of the icon texture- Since:
- 3.0.0
-
-
Method Details
-
getOpacity
public float getOpacity()Gets the opacity of the texture.- Returns:
- the opacity
-
setOpacity
Sets the opacity of the texture.- Parameters:
opacity
- the new opacity between 0 (fully transparent) and 1 (fully opaque)- Returns:
- this icon
-
getColor
public int getColor()Gets the color tint of the texture.- Returns:
- the color tint
-
setColor
Sets the color tint of the texture.- Parameters:
color
- the new color tint- Returns:
- this icon
-
paint
Description copied from interface:Icon
Paints this icon.
-