TextureData

Inheritance: java.lang.Object

public class TextureData

This class contains the raw data and format definition of a texture.

Constructors

ConstructorDescription
TextureData(int width, int height, int stride, int bytesPerPixel, PixelFormat pixelFormat, byte[] data)Constructor of TextureData
TextureData(int width, int height, PixelFormat pixelFormat)Constructs a new TextureData and allocate pixel data.
TextureData()Constructor of TextureData

Methods

MethodDescription
equals(Object arg0)
fromFile(String fileName)Load a texture from file
fromStream(Stream stream)Load a texture from stream
getBytesPerPixel()Number of bytes of a pixel
getClass()
getData()Raw bytes of pixel data
getHeight()Number of vertical pixels
getPixelFormat()The pixel’s format
getStride()Number of bytes of a scanline.
getWidth()Number of horizontal pixels
hashCode()
mapPixels(PixelMapMode mapMode)Map all pixels for read/write
mapPixels(PixelMapMode mapMode, PixelFormat format)Map all pixels for read/write in given pixel format
mapPixels(Rect rect, PixelMapMode mapMode, PixelFormat format)Map pixels addressed by rect for reading/writing in given pixel format
notify()
notifyAll()
save(Stream stream, String format)Save texture data into specified image format
save(String fileName)Save texture data into image file
save(String fileName, String format)Save texture data into image file
toString()
transformPixelFormat(PixelFormat pixelFormat)Transform pixel’s layout to new pixel format.
wait()
wait(long arg0)
wait(long arg0, int arg1)

TextureData(int width, int height, int stride, int bytesPerPixel, PixelFormat pixelFormat, byte[] data)

public TextureData(int width, int height, int stride, int bytesPerPixel, PixelFormat pixelFormat, byte[] data)

Constructor of TextureData

Parameters:

ParameterTypeDescription
widthint
heightint
strideint
bytesPerPixelint
pixelFormatPixelFormat
databyte[]

TextureData(int width, int height, PixelFormat pixelFormat)

public TextureData(int width, int height, PixelFormat pixelFormat)

Constructs a new TextureData and allocate pixel data.

Parameters:

ParameterTypeDescription
widthint
heightint
pixelFormatPixelFormat

TextureData()

public TextureData()

Constructor of TextureData

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

fromFile(String fileName)

public static TextureData fromFile(String fileName)

Load a texture from file

Parameters:

ParameterTypeDescription
fileNamejava.lang.String

Returns: TextureData

fromStream(Stream stream)

public static TextureData fromStream(Stream stream)

Load a texture from stream

Parameters:

ParameterTypeDescription
streamcom.aspose.csporter.helpers.Stream

Returns: TextureData

getBytesPerPixel()

public int getBytesPerPixel()

Number of bytes of a pixel

Returns: int

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getData()

public byte[] getData()

Raw bytes of pixel data

Returns: byte[]

getHeight()

public int getHeight()

Number of vertical pixels

Returns: int

getPixelFormat()

public PixelFormat getPixelFormat()

The pixel’s format

Returns: PixelFormat

getStride()

public int getStride()

Number of bytes of a scanline.

Returns: int

getWidth()

public int getWidth()

Number of horizontal pixels

Returns: int

hashCode()

public native int hashCode()

Returns: int

mapPixels(PixelMapMode mapMode)

public PixelMapping mapPixels(PixelMapMode mapMode)

Map all pixels for read/write

Parameters:

ParameterTypeDescription
mapModePixelMapModeMap mode

Returns: PixelMapping

mapPixels(PixelMapMode mapMode, PixelFormat format)

public PixelMapping mapPixels(PixelMapMode mapMode, PixelFormat format)

Map all pixels for read/write in given pixel format

Parameters:

ParameterTypeDescription
mapModePixelMapModeMap mode
formatPixelFormatPixel format

Returns: PixelMapping

mapPixels(Rect rect, PixelMapMode mapMode, PixelFormat format)

public PixelMapping mapPixels(Rect rect, PixelMapMode mapMode, PixelFormat format)

Map pixels addressed by rect for reading/writing in given pixel format

Parameters:

ParameterTypeDescription
rectRectThe area of pixels to be accessed
mapModePixelMapModeMap mode
formatPixelFormatPixel format

Returns: PixelMapping - Returns a mapping object, it should be disposed when no longer needed.

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

save(Stream stream, String format)

public void save(Stream stream, String format)

Save texture data into specified image format

Parameters:

ParameterTypeDescription
streamcom.aspose.csporter.helpers.StreamThe stream that holds the saved image
formatjava.lang.StringImage format, usually file extension

save(String fileName)

public void save(String fileName)

Save texture data into image file

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringThe file name of where the image will be saved.

save(String fileName, String format)

public void save(String fileName, String format)

Save texture data into image file

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringThe file name of where the image will be saved.
formatjava.lang.StringImage format of the output file.

toString()

public String toString()

Returns: java.lang.String

transformPixelFormat(PixelFormat pixelFormat)

public void transformPixelFormat(PixelFormat pixelFormat)

Transform pixel’s layout to new pixel format.

Parameters:

ParameterTypeDescription
pixelFormatPixelFormatDestination pixel format

wait()

public final void wait()

wait(long arg0)

public final void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int