Package net.risingworld.api.objects
Klasse CustomImage
java.lang.Object
net.risingworld.api.objects.CustomImage
Represents a custom image (i.e a "poster").
Example: Find out who uploaded a particular custom image
- Siehe auch:
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungGets an SHA1 hash of the raw image texture data.long
Gets the creation/upload date of the image as a timestamp in millisecondsGets the extension of the original image file (e.g ".png" or ".jpg" etc).int
Gets the height of the texture.long
getID()
Gets the global, unique ID of the custom image.long
Gets a timestamp in milliseconds representing the time when the last access to this image occurred.getName()
Gets the original file name of the image.int
Gets the database ID of the player who uploaded this image.byte[]
Gets the raw texture data, depending on the texture format (seegetTextureFormat()
).Gets the internal texture format.int[]
Gets the image pixel data.int
getWidth()
Gets the width of the texture.boolean
isValid()
Checks if this instance is still valid.void
setRawTextureData
(int width, int height, String format, byte[] data) Sets the raw texture data.
-
Methodendetails
-
getID
public long getID()Gets the global, unique ID of the custom image.- Gibt zurück:
- the unique image ID.
-
isValid
public boolean isValid()Checks if this instance is still valid.- Gibt zurück:
- true if the instance is valid, false if not.
-
getPlayerDbID
public int getPlayerDbID()Gets the database ID of the player who uploaded this image.- Gibt zurück:
- the player database ID who uploaded the image, or -1 if this image was not uploaded by a player.
-
getName
Gets the original file name of the image.- Gibt zurück:
- the original image file name.
-
getExtension
Gets the extension of the original image file (e.g ".png" or ".jpg" etc).- Gibt zurück:
- the original image extension.
-
getChecksum
Gets an SHA1 hash of the raw image texture data.- Gibt zurück:
- the checksum of the texture data.
-
getWidth
public int getWidth()Gets the width of the texture.- Gibt zurück:
- the texture width in pixels.
-
getHeight
public int getHeight()Gets the height of the texture.- Gibt zurück:
- the texture height in pixels.
-
getTextureFormat
Gets the internal texture format. Typically images are compressed, so the format is usually DXT1 (for images without alpha channel) or DXT5.- Gibt zurück:
- the internal texture format.
-
getCreationDate
public long getCreationDate()Gets the creation/upload date of the image as a timestamp in milliseconds- Gibt zurück:
- a timestamp (milliseconds) representing the original upload date of the image.
-
getLastAccess
public long getLastAccess()Gets a timestamp in milliseconds representing the time when the last access to this image occurred. Access via API is not taken into account.- Gibt zurück:
- a timestamp (milliseconds) representing the last access date of the image (e.g when a player requested the image etc).
-
getRawTextureData
public byte[] getRawTextureData()Gets the raw texture data, depending on the texture format (seegetTextureFormat()
). It typically also contains mipmaps.- Gibt zurück:
- the raw texture data.
-
setRawTextureData
Sets the raw texture data. It's highly recommendable to use a compressed texture format like DXT1 or DXT5.- Parameter:
width
- the new width of the texture.height
- the new height of the texture.format
- the texture data format.data
- the raw texture data.- Example: Copy texture data from one image to another
-
getTexturePixelData
public int[] getTexturePixelData()Gets the image pixel data. Note: This is a rather expensive call (because it internally parses and converts the texture data first), so it's recommendable to call this once and cache the result!- Gibt zurück:
- an int array containing the RGBA pixel data.
-