APIdia Launch Partner
Top Inners Methods
com.sun.prism

public Interface Texture

extends GraphicsResource
Known Direct Subinterfaces
com.sun.prism.RTTexture
Known Direct Implementers
com.sun.prism.impl.BaseTexture, com.sun.prism.sw.SWTexture, com.sun.prism.MultiTexture
Imports
java.nio.Buffer

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
Texture.Usage

A hint indicating whether the contents of the texture will be changing frequently (DYNAMIC) or mostly stable for the lifetime of the texture (STATIC).

public static enum
Texture.WrapMode

Specifies the behavior when texels are accessed outside the physical bounds of the texture.

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
public int

Returns:

the content height of this texture, in pixels
getContentHeight
()

Returns the content height of this texture, in pixels.

public int

Returns:

the content width of this texture, in pixels
getContentWidth
()

Returns the content width of this texture, in pixels.

public int

Returns:

the content x-origin of this texture
getContentX
()

Returns the content x-origin of this texture relative to the upper-left corner, in pixels.

public int

Returns:

the content y-origin of this texture
getContentY
()

Returns the content y-origin of this texture relative to the upper-left corner, in pixels.

public int
public boolean

Returns:

whether linear filtering will be used for this texture
getLinearFiltering
()

Returns whether linear (smooth) filtering will be used when rendering this texture.

public int
public int

Returns:

the max content height of this texture, in pixels
getMaxContentHeight
()

Returns the max content height of this texture, in pixels.

public int

Returns:

the max content width of this texture, in pixels
getMaxContentWidth
()

Returns the max content width of this texture, in pixels.

public int

Returns:

the physical height of this texture, in pixels
getPhysicalHeight
()

Returns the physical height of this texture, in pixels.

public int

Returns:

the physical width of this texture, in pixels
getPhysicalWidth
()

Returns the physical width of this texture, in pixels.

public PixelFormat

Returns:

the PixelFormat of this texture
getPixelFormat
()

Returns the PixelFormat of this texture.

public Texture
getSharedTexture(Texture.WrapMode altMode)

Constructs an alternate version of this Texture with an alternate WrapMode if the two modes allow the underlying texture to be shared, otherwise a null value is returned.

public boolean

Returns:

the useMipmap flag for this texture
getUseMipmap
()

Returns the true if mipmapping is used for this texture.

public Texture.WrapMode

Returns:

the WrapMode for this texture
getWrapMode
()

Returns the WrapMode for this texture.

public boolean
public boolean

Returns:

True if the backing surface of this RTTexture is gone and the image is therefore no longer usable. False if it is still OK.
isSurfaceLost
()

Called by code wanting to know if the RTTexture's surface is lost.

public void
lock()

public void
public void
setContentHeight(int
The actual new height of user pixels.
contentHeight
)

Allows the content height, which is the current height of the actual content in pixels, to be adjusted.

public void
setContentWidth(int
The actual new width of user pixels.
contentWidth
)

Allows the content width, which is the current width of the actual content in pixels, to be adjusted.

public void
setLastImageSerial(int serial)

public void
setLinearFiltering(boolean
if true, enables linear filtering; if false, enables nearest neighbor filtering
linear
)

Sets whether linear filtering will be used when rendering this texture.

public void
public void
update(Image
the image data to be uploaded to this texture
img
)

Updates this texture using the contents of the given Image.

public void
update(Image
the image data to be uploaded to this texture
img
,
int
the x-offset of the image data, in pixels, relative to the contentX of this texture
dstx
,
int
the y-offset of the image data, in pixels, relative to the contentY of this texture
dsty
)

Updates this texture using the contents of the given Image.

public void
update(Image
the image data to be uploaded to this texture
img
,
int
the x-offset of the image data, in pixels, relative to the contentX of this texture
dstx
,
int
the y-offset of the image data, in pixels, relative to the contentY of this texture
dsty
,
int
the width of the pixel region from the source image
srcw
,
int
the height of the pixel region from the source image
srch
)

Updates this texture using the contents of the given Image.

public void
update(Image
the image data to be uploaded to this texture
img
,
int
the x-offset of the image data, in pixels, relative to the contentX of this texture
dstx
,
int
the y-offset of the image data, in pixels, relative to the contentY of this texture
dsty
,
int
the width of the pixel region from the source image
srcw
,
int
the height of the pixel region from the source image
srch
,
boolean
if true, the vertex buffer will not be flushed
skipFlush
)

Updates this texture using the contents of the given Image.

public void
update(Buffer buffer, PixelFormat
the format of the data contained in the pixel buffer
format
,
int
the x-offset of the image data, in pixels, relative to the contentX of this texture
dstx
,
int
the y-offset of the image data, in pixels, relative to the contentY of this texture
dsty
,
int
the x-offset into the source buffer, in pixels
srcx
,
int
the y-offset into the source buffer, in pixels
srcy
,
int
the width of the pixel region from the source buffer
srcw
,
int
the height of the pixel region from the source buffer
srch
,
int
the scanline stride of the source buffer, in bytes
srcscan
,
boolean
if true, the vertex buffer will not be flushed
skipFlush
)

Updates this texture using the contents of the given Buffer.

public void
update(MediaFrame
the source video buffer to update the texture data from
frame
,
boolean
if true, the vertex buffer will not be flushed
skipFlush
)

Updates this texture using the contents of the provided MediaFrame.

Inherited from com.sun.prism.GraphicsResource:
dispose

Method Detail

assertLockedback to summary
public void assertLocked()
contentsNotUsefulback to summary
public void contentsNotUseful()
contentsUsefulback to summary
public void contentsUseful()
getContentHeightback to summary
public int getContentHeight()

Returns the content height of this texture, in pixels. Note that the content size of a texture may be smaller than the requested size due to hardware restrictions (e.g. lack of non-power-of-two texture support). The content height will be less than or equal to the content height.

For example, if the hardware does not support non-power-of-two textures, and you call ResourceFactory.createTexture(400, 200), the returned Texture will have physical dimensions of 512x256, but the content dimensions will be 400x200.

Returns:int

the content height of this texture, in pixels

getContentWidthback to summary
public int getContentWidth()

Returns the content width of this texture, in pixels. Note that the content size of a texture may be smaller than the requested size due to hardware restrictions (e.g. lack of non-power-of-two texture support). The content width will be less than or equal to the content width.

For example, if the hardware does not support non-power-of-two textures, and you call ResourceFactory.createTexture(400, 200), the returned Texture will have physical dimensions of 512x256, but the content dimensions will be 400x200.

Returns:int

the content width of this texture, in pixels

getContentXback to summary
public int getContentX()

Returns the content x-origin of this texture relative to the upper-left corner, in pixels. This value will be greater than equal to zero.

Returns:int

the content x-origin of this texture

getContentYback to summary
public int getContentY()

Returns the content y-origin of this texture relative to the upper-left corner, in pixels. This value will be greater than equal to zero.

Returns:int

the content y-origin of this texture

getLastImageSerialback to summary
public int getLastImageSerial()
getLinearFilteringback to summary
public boolean getLinearFiltering()

Returns whether linear (smooth) filtering will be used when rendering this texture. If false, a simple nearest neighbor algorithm will be used.

Returns:boolean

whether linear filtering will be used for this texture

getLockCountback to summary
public int getLockCount()
getMaxContentHeightback to summary
public int getMaxContentHeight()

Returns the max content height of this texture, in pixels. Note that the content size of a texture may be smaller than the requested size due to hardware restrictions (e.g. lack of non-power-of-two texture support). The content height will be less than or equal to the max content height.

For example, if the hardware does not support non-power-of-two textures, and you call ResourceFactory.createTexture(400, 200), the returned Texture will have physical dimensions of 512x256 and the max content dimensions will be 512x256 minus any padding needed by the implementation to simulate edge conditions., but the content dimensions will be 400x200.

Returns:int

the max content height of this texture, in pixels

getMaxContentWidthback to summary
public int getMaxContentWidth()

Returns the max content width of this texture, in pixels. Note that the content size of a texture may be smaller than the requested size due to hardware restrictions (e.g. lack of non-power-of-two texture support). The content width will be less than or equal to the max content width.

For example, if the hardware does not support non-power-of-two textures, and you call ResourceFactory.createTexture(400, 200), the returned Texture will have physical dimensions of 512x256 and the max content dimensions will be 512x256 minus any padding needed by the implementation to simulate edge conditions., but the content dimensions will be 400x200.

Returns:int

the max content width of this texture, in pixels

getPhysicalHeightback to summary
public int getPhysicalHeight()

Returns the physical height of this texture, in pixels. Note that the physical size of a texture may be larger than the requested size due to hardware restrictions (e.g. lack of non-power-of-two texture support). The physical height will be greater than or equal to the content height.

Returns:int

the physical height of this texture, in pixels

getPhysicalWidthback to summary
public int getPhysicalWidth()

Returns the physical width of this texture, in pixels. Note that the physical size of a texture may be larger than the requested size due to hardware restrictions (e.g. lack of non-power-of-two texture support). The physical width will be greater than or equal to the content width.

Returns:int

the physical width of this texture, in pixels

getPixelFormatback to summary
public PixelFormat getPixelFormat()

Returns the PixelFormat of this texture.

Returns:PixelFormat

the PixelFormat of this texture

getSharedTextureback to summary
public Texture getSharedTexture(Texture.WrapMode altMode)

Constructs an alternate version of this Texture with an alternate WrapMode if the two modes allow the underlying texture to be shared, otherwise a null value is returned. This method can only be used to create a shared texture for REPEAT or CLAMP_TO_EDGE textures, which must necessarily have content that spans their entire physical dimensions (if their content was smaller then they would have a _SIMULATED type of wrap mode). This method expects the texture to be already locked (and checked for a valid surface) and if it returns a non-null value then that return value will have an outstanding lock in addition to retaining the lock on the original texture. Note that if the requested WrapMode is the same as the wrap mode of this texture, then this same object will be returned after having its lock count increased by 1. Thus, in all cases, the caller is responsible for locking this texture before the call, and eventually unlocking this texture after the call, and also for eventually unlocking the return value if it is non-null.

getUseMipmapback to summary
public boolean getUseMipmap()

Returns the true if mipmapping is used for this texture.

Returns:boolean

the useMipmap flag for this texture

getWrapModeback to summary
public Texture.WrapMode getWrapMode()

Returns the WrapMode for this texture.

Returns:Texture.WrapMode

the WrapMode for this texture

isLockedback to summary
public boolean isLocked()
isSurfaceLostback to summary
public boolean isSurfaceLost()

Called by code wanting to know if the RTTexture's surface is lost. This happens in some cases (mostly on Windows) when, for example, the user presses Ctrl+Alt+Delete, or the system goes to sleep.

Returns:boolean

True if the backing surface of this RTTexture is gone and the image is therefore no longer usable. False if it is still OK.

lockback to summary
public void lock()
makePermanentback to summary
public void makePermanent()
setContentHeightback to summary
public void setContentHeight(int contentHeight)

Allows the content height, which is the current height of the actual content in pixels, to be adjusted. The height must be between 0 and maxContentHeight . *

Parameters
contentHeight:int

The actual new height of user pixels.

setContentWidthback to summary
public void setContentWidth(int contentWidth)

Allows the content width, which is the current width of the actual content in pixels, to be adjusted. The height must be between 0 and maxContentHeight

Parameters
contentWidth:int

The actual new width of user pixels.

setLastImageSerialback to summary
public void setLastImageSerial(int serial)
setLinearFilteringback to summary
public void setLinearFiltering(boolean linear)

Sets whether linear filtering will be used when rendering this texture.

Parameters
linear:boolean

if true, enables linear filtering; if false, enables nearest neighbor filtering

unlockback to summary
public void unlock()
updateback to summary
public void update(Image img)

Updates this texture using the contents of the given Image. The upper-left corner of the image data will be positioned at (contentX, contentY) of the texture, and the full width and height of the image will be uploaded. This method will cause the vertex buffer to be flushed prior to uploading the pixels.

This is equivalent to calling:

    update(img, 0, 0);
Parameters
img:Image

the image data to be uploaded to this texture

updateback to summary
public void update(Image img, int dstx, int dsty)

Updates this texture using the contents of the given Image. The upper-left corner of the image data will be positioned at (contentX+dstx, contentY+dsty) of the texture, and the full width and height of the image will be uploaded. This method will cause the vertex buffer to be flushed prior to uploading the pixels.

This is equivalent to calling:

    update(img, dstx, dsty, img.getWidth(), img.getHeight());
Parameters
img:Image

the image data to be uploaded to this texture

dstx:int

the x-offset of the image data, in pixels, relative to the contentX of this texture

dsty:int

the y-offset of the image data, in pixels, relative to the contentY of this texture

updateback to summary
public void update(Image img, int dstx, int dsty, int srcw, int srch)

Updates this texture using the contents of the given Image. The upper-left corner of the image data will be positioned at (contentX+dstx, contentY+dsty) of the texture, and the source region to be uploaded will be srcw by srch pixels. This method will cause the vertex buffer to be flushed prior to uploading the pixels.

This is equivalent to calling:

    update(img, dstx, dsty, srcw, srch, false);
Parameters
img:Image

the image data to be uploaded to this texture

dstx:int

the x-offset of the image data, in pixels, relative to the contentX of this texture

dsty:int

the y-offset of the image data, in pixels, relative to the contentY of this texture

srcw:int

the width of the pixel region from the source image

srch:int

the height of the pixel region from the source image

updateback to summary
public void update(Image img, int dstx, int dsty, int srcw, int srch, boolean skipFlush)

Updates this texture using the contents of the given Image. The upper-left corner of the image data will be positioned at (contentX+dstx, contentY+dsty) of the texture, and the source region to be uploaded will be srcw by srch pixels. This method will cause the vertex buffer to be flushed unless skipFlush is true.

This is equivalent to calling:

    update(img.getPixelBuffer(), img.getPixelFormat(),
           dstx, dsty, img.getMinX(), img.getMinY(),
           srcw, srch, img.getScanlineStride(), skipFlush);
Parameters
img:Image

the image data to be uploaded to this texture

dstx:int

the x-offset of the image data, in pixels, relative to the contentX of this texture

dsty:int

the y-offset of the image data, in pixels, relative to the contentY of this texture

srcw:int

the width of the pixel region from the source image

srch:int

the height of the pixel region from the source image

skipFlush:boolean

if true, the vertex buffer will not be flushed

updateback to summary
public void update(Buffer buffer, PixelFormat format, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan, boolean skipFlush)

Updates this texture using the contents of the given Buffer. The upper-left corner of the image data will be positioned at (contentX+dstx, contentY+dsty) of the texture, and the source region to be uploaded will be srcw by srch pixels. This method will cause the vertex buffer to be flushed unless skipFlush is true.

Parameters
format:PixelFormat

the format of the data contained in the pixel buffer

dstx:int

the x-offset of the image data, in pixels, relative to the contentX of this texture

dsty:int

the y-offset of the image data, in pixels, relative to the contentY of this texture

srcx:int

the x-offset into the source buffer, in pixels

srcy:int

the y-offset into the source buffer, in pixels

srcw:int

the width of the pixel region from the source buffer

srch:int

the height of the pixel region from the source buffer

srcscan:int

the scanline stride of the source buffer, in bytes

skipFlush:boolean

if true, the vertex buffer will not be flushed

updateback to summary
public void update(MediaFrame frame, boolean skipFlush)

Updates this texture using the contents of the provided MediaFrame. The source and destination coordinates are implicit, you can only update the entire video texture.

Parameters
frame:MediaFrame

the source video buffer to update the texture data from

skipFlush:boolean

if true, the vertex buffer will not be flushed

com.sun.prism back to summary

public final Enum Texture.Usage

extends Enum<Texture.Usage>
Class Inheritance

A hint indicating whether the contents of the texture will be changing frequently (DYNAMIC) or mostly stable for the lifetime of the texture (STATIC).

Field Summary

Modifier and TypeField and Description
public static final Texture.Usage
public static final Texture.Usage
public static final Texture.Usage

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Texture.Usage
public static Texture.Usage[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DEFAULTback to summary
public static final Texture.Usage DEFAULT
DYNAMICback to summary
public static final Texture.Usage DYNAMIC
STATICback to summary
public static final Texture.Usage STATIC

Constructor Detail

Usageback to summary
private Usage()

Method Detail

valueOfback to summary
public static Texture.Usage valueOf(String name)
valuesback to summary
public static Texture.Usage[] values()
com.sun.prism back to summary

public final Enum Texture.WrapMode

extends Enum<Texture.WrapMode>
Class Inheritance

Specifies the behavior when texels are accessed outside the physical bounds of the texture.

Field Summary

Modifier and TypeField and Description
public static final Texture.WrapMode
CLAMP_NOT_NEEDED

CLAMP_NOT_NEEDED is used for applications where the caller knows that the texture will never be sampled outside the center of the first and last pixels in the content area of the texture.

public static final Texture.WrapMode
CLAMP_TO_EDGE

CLAMP_TO_EDGE is used for applications where the area outside of the defined pixels should be clamped to the value of (the center of) the edge pixels.

public static final Texture.WrapMode
CLAMP_TO_EDGE_SIMULATED

This value can be returned from the getWrapMode() method if the caller asked for CLAMP_TO_EDGE and the mode was not supported by the hardware (due to the content area not fitting tightly into the physical dimensions along one or both axes).

public static final Texture.WrapMode
CLAMP_TO_ZERO

CLAMP_TO_ZERO is used for applications where the area outside of the defined pixels should interpolate from the edge pixel values at the center of those edge pixels to fully transparent at the center of the pixels just outside the content area, and then remain fully transparent out to +/- infinity.

public static final Texture.WrapMode
CLAMP_TO_ZERO_SIMULATED

This value can be returned from the getWrapMode() method if the caller asked for CLAMP_TO_ZERO and the mode was not supported by the hardware (via GL_CLAMP_TO_BORDER for instance) so a guard row of transparent pixels was included surrounding all 4 sides of the content area.

public static final Texture.WrapMode
REPEAT

REPEAT is used for applications where the pixels should be repeated from edge to edge as per the GL_REPEAT mode.

public static final Texture.WrapMode
REPEAT_SIMULATED

This value can be returned from the getWrapMode() method if the caller asked for REPEAT and the mode was not supported by the hardware (due to the content area not fitting tightly into the physical dimensions along one or both axes).

private Texture.WrapMode
private Texture.WrapMode

Constructor Summary

AccessConstructor and Description
private
private

Method Summary

Modifier and TypeMethod and Description
public boolean
public Texture.WrapMode
public static Texture.WrapMode
public static Texture.WrapMode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CLAMP_NOT_NEEDEDback to summary
public static final Texture.WrapMode CLAMP_NOT_NEEDED

CLAMP_NOT_NEEDED is used for applications where the caller knows that the texture will never be sampled outside the center of the first and last pixels in the content area of the texture. For this mode the fitting of the pixels to the physical area and the hardware wrapping or clamping modes will not come into play. The most typical case for this is a back buffer or device-pixel cache where the texture will always be rendered 1:1 on top of pixels in the destination, but any case where the caller knows that the samples will be limited to the "safe area" as described can use this mode.

CLAMP_TO_EDGEback to summary
public static final Texture.WrapMode CLAMP_TO_EDGE

CLAMP_TO_EDGE is used for applications where the area outside of the defined pixels should be clamped to the value of (the center of) the edge pixels. This is commonly used for rendering images in an ImageView or for storing the colors of a NO_CYCLE gradient.

CLAMP_TO_EDGE_SIMULATEDback to summary
public static final Texture.WrapMode CLAMP_TO_EDGE_SIMULATED

This value can be returned from the getWrapMode() method if the caller asked for CLAMP_TO_EDGE and the mode was not supported by the hardware (due to the content area not fitting tightly into the physical dimensions along one or both axes). The resulting content will be packed tightly into the upper left corner of the resulting texture and a copy of the last row and column of pixels will be duplicated so that the samples from 0,0 to the content width and height will all return the correctly clamped values, however sampling more than half a pixel past the content width and height will not necessarily return clamped values. If the application needs the clamped values to be returned out to +infinity on either the X or Y axis, then it should make alternate arrangements to ensure that the data is fully padded to the physical dimensions of the texture (currently only needed to support NO_CYCLE gradients and the Rectangle Wrap texture, both of which adjust for this limitation).

CLAMP_TO_ZEROback to summary
public static final Texture.WrapMode CLAMP_TO_ZERO

CLAMP_TO_ZERO is used for applications where the area outside of the defined pixels should interpolate from the edge pixel values at the center of those edge pixels to fully transparent at the center of the pixels just outside the content area, and then remain fully transparent out to +/- infinity. The most common uses will be cached renderings that might be stretched, scaled, rotated, or otherwise be subjected to situations where samples may be taken outside the "safe area" as described for the CLAMP_NOT_NEEDED mode and those samples should fade to zero (for instance, effect inputs and results).

CLAMP_TO_ZERO_SIMULATEDback to summary
public static final Texture.WrapMode CLAMP_TO_ZERO_SIMULATED

This value can be returned from the getWrapMode() method if the caller asked for CLAMP_TO_ZERO and the mode was not supported by the hardware (via GL_CLAMP_TO_BORDER for instance) so a guard row of transparent pixels was included surrounding all 4 sides of the content area. The content coordinates will indicate the proper region to render just the "true" content of the texture, but samples outside of that area should accurately return fully transparent pixels if they are included in the sampled areas.

REPEATback to summary
public static final Texture.WrapMode REPEAT

REPEAT is used for applications where the pixels should be repeated from edge to edge as per the GL_REPEAT mode. This is typically used for ImagePattern, though it could be used for REPEAT or REFLECT gradients with a properly initialized color texture and with the caveat that the GL_REPEAT type of math does not exactly match the Gradient REPEAT/REFLECT math.

REPEAT_SIMULATEDback to summary
public static final Texture.WrapMode REPEAT_SIMULATED

This value can be returned from the getWrapMode() method if the caller asked for REPEAT and the mode was not supported by the hardware (due to the content area not fitting tightly into the physical dimensions along one or both axes). The resulting content will be packed tightly into the upper left corner of the resulting texture and a copy of the first row and column of pixels will be duplicated and placed after the last row and column so that samples from between the center of the last row and column of pixels to the center of the next row or column after that will interpolate back to the left or top edge of the image. The application should shift the texture coordinates and restrict their access to texture coordinates in the range [HALF_TEXEL, content_size+HALF_TEXEL] which will represent exactly one whole cell of the infinite field of repeating copies of the image, though shifted by half a texel in position.

simulatedByback to summary
private Texture.WrapMode simulatedBy
simulatesback to summary
private Texture.WrapMode simulates

Constructor Detail

WrapModeback to summary
private WrapMode(Texture.WrapMode simulates)
WrapModeback to summary
private WrapMode()

Method Detail

isCompatibleWithback to summary
public boolean isCompatibleWith(Texture.WrapMode requestedMode)
simulatedVersionback to summary
public Texture.WrapMode simulatedVersion()
valueOfback to summary
public static Texture.WrapMode valueOf(String name)
valuesback to summary
public static Texture.WrapMode[] values()