Top Fields Constructors Methods
com.sun.prism.impl

public abstract Class BaseTexture<T extends ManagedResource>

extends Object
implements Texture
Class Inheritance
All Implemented Interfaces
com.sun.prism.Texture, com.sun.prism.GraphicsResource
Known Direct Subclasses
com.sun.prism.j2d.J2DTexture, com.sun.prism.null3d.DummyTexture, com.sun.prism.d3d.D3DTexture, com.sun.prism.es2.ES2Texture
Imports
com.sun.prism.Image, .PixelFormat, .Texture, java.nio.Buffer

Field Summary

Modifier and TypeField and Description
protected int
protected int
private final int
private final int
private final PixelFormat
private int
private boolean
private final int
private final int
private final int
private final int
protected final T
private final boolean
private final Texture.WrapMode

Constructor Summary

AccessConstructor and Description
protected
BaseTexture(BaseTexture<T> sharedTex, Texture.WrapMode newMode, boolean useMipmap)

protected
BaseTexture(T resource, PixelFormat format, Texture.WrapMode wrapMode, int width, int height)

protected
BaseTexture(T resource, PixelFormat format, Texture.WrapMode wrapMode, int physicalWidth, int physicalHeight, int contentX, int contentY, int contentWidth, int contentHeight, boolean useMipmap)

protected
BaseTexture(T resource, PixelFormat format, Texture.WrapMode wrapMode, int physicalWidth, int physicalHeight, int contentX, int contentY, int contentWidth, int contentHeight, int maxContentWidth, int maxContentHeight, boolean useMipmap)

Method Summary

Modifier and TypeMethod and Description
public final void
protected void
checkUpdateParams(Buffer buf, PixelFormat fmt, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan)

public final void
public final void
protected abstract Texture

Returns:

a new Texture object sharing the underlying resource.
createSharedTexture
(Texture.WrapMode
the WrapMode to use for the new texture.
newMode
)

Create a new version of this texture which shares the same ManagedResource reference.

public final void
public final int
getContentHeight()

Implements com.sun.prism.Texture.getContentHeight.

Returns the content height of this texture, in pixels.

public final int
getContentWidth()

Implements com.sun.prism.Texture.getContentWidth.

Returns the content width of this texture, in pixels.

public final int
getContentX()

Implements com.sun.prism.Texture.getContentX.

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

public final int
getContentY()

Implements com.sun.prism.Texture.getContentY.

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

public final int
public final boolean
getLinearFiltering()

Implements com.sun.prism.Texture.getLinearFiltering.

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

public final int
public int
getMaxContentHeight()

Implements com.sun.prism.Texture.getMaxContentHeight.

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

public int
getMaxContentWidth()

Implements com.sun.prism.Texture.getMaxContentWidth.

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

public final int
getPhysicalHeight()

Implements com.sun.prism.Texture.getPhysicalHeight.

Returns the physical height of this texture, in pixels.

public final int
getPhysicalWidth()

Implements com.sun.prism.Texture.getPhysicalWidth.

Returns the physical width of this texture, in pixels.

public final PixelFormat
getPixelFormat()

Implements com.sun.prism.Texture.getPixelFormat.

Returns the PixelFormat of this texture.

public Texture
getSharedTexture(Texture.WrapMode altMode)

Implements com.sun.prism.Texture.getSharedTexture.

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
getUseMipmap()

Implements com.sun.prism.Texture.getUseMipmap.

Returns the true if mipmapping is used for this texture.

public final Texture.WrapMode
getWrapMode()

Implements com.sun.prism.Texture.getWrapMode.

Returns the WrapMode for this texture.

public final boolean
public final boolean
isSurfaceLost()

Implements com.sun.prism.Texture.isSurfaceLost.

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

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

Implements com.sun.prism.Texture.setContentHeight.

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.
contentW
)

Implements com.sun.prism.Texture.setContentWidth.

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

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

Implements com.sun.prism.Texture.setLinearFiltering.

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

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

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

Implements com.sun.prism.Texture.update.

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
)

Implements com.sun.prism.Texture.update.

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
w
,
int
the height of the pixel region from the source image
h
)

Implements com.sun.prism.Texture.update.

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
)

Implements com.sun.prism.Texture.update.

Updates this texture using the contents of the given Image.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

contentHeightback to summary
protected int contentHeight
contentWidthback to summary
protected int contentWidth
contentXback to summary
private final int contentX
contentYback to summary
private final int contentY
formatback to summary
private final PixelFormat format
lastImageSerialback to summary
private int lastImageSerial
linearFilteringback to summary
private boolean linearFiltering
maxContentHeightback to summary
private final int maxContentHeight
maxContentWidthback to summary
private final int maxContentWidth
physicalHeightback to summary
private final int physicalHeight
physicalWidthback to summary
private final int physicalWidth
resourceback to summary
protected final T resource
useMipmapback to summary
private final boolean useMipmap
wrapModeback to summary
private final Texture.WrapMode wrapMode

Constructor Detail

BaseTextureback to summary
protected BaseTexture(BaseTexture<T> sharedTex, Texture.WrapMode newMode, boolean useMipmap)
BaseTextureback to summary
protected BaseTexture(T resource, PixelFormat format, Texture.WrapMode wrapMode, int width, int height)
BaseTextureback to summary
protected BaseTexture(T resource, PixelFormat format, Texture.WrapMode wrapMode, int physicalWidth, int physicalHeight, int contentX, int contentY, int contentWidth, int contentHeight, boolean useMipmap)
BaseTextureback to summary
protected BaseTexture(T resource, PixelFormat format, Texture.WrapMode wrapMode, int physicalWidth, int physicalHeight, int contentX, int contentY, int contentWidth, int contentHeight, int maxContentWidth, int maxContentHeight, boolean useMipmap)

Method Detail

assertLockedback to summary
public final void assertLocked()

Implements com.sun.prism.Texture.assertLocked.

Annotations
@Override
checkUpdateParamsback to summary
protected void checkUpdateParams(Buffer buf, PixelFormat fmt, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan)
contentsNotUsefulback to summary
public final void contentsNotUseful()

Implements com.sun.prism.Texture.contentsNotUseful.

Annotations
@Override
contentsUsefulback to summary
public final void contentsUseful()

Implements com.sun.prism.Texture.contentsUseful.

Annotations
@Override
createSharedTextureback to summary
protected abstract Texture createSharedTexture(Texture.WrapMode newMode)

Create a new version of this texture which shares the same ManagedResource reference. The lock counts for the shared resource reference are not changed in the processing of this method.

Parameters
newMode:Texture.WrapMode

the WrapMode to use for the new texture.

Returns:Texture

a new Texture object sharing the underlying resource.

disposeback to summary
public final void dispose()

Implements com.sun.prism.GraphicsResource.dispose.

Annotations
@Override
getContentHeightback to summary
public final int getContentHeight()

Implements com.sun.prism.Texture.getContentHeight.

Doc from com.sun.prism.Texture.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

Annotations
@Override
getContentWidthback to summary
public final int getContentWidth()

Implements com.sun.prism.Texture.getContentWidth.

Doc from com.sun.prism.Texture.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

Annotations
@Override
getContentXback to summary
public final int getContentX()

Implements com.sun.prism.Texture.getContentX.

Doc from com.sun.prism.Texture.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

Annotations
@Override
getContentYback to summary
public final int getContentY()

Implements com.sun.prism.Texture.getContentY.

Doc from com.sun.prism.Texture.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

Annotations
@Override
getLastImageSerialback to summary
public final int getLastImageSerial()

Implements com.sun.prism.Texture.getLastImageSerial.

Annotations
@Override
getLinearFilteringback to summary
public final boolean getLinearFiltering()

Implements com.sun.prism.Texture.getLinearFiltering.

Doc from com.sun.prism.Texture.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

Annotations
@Override
getLockCountback to summary
public final int getLockCount()

Implements com.sun.prism.Texture.getLockCount.

Annotations
@Override
getMaxContentHeightback to summary
public int getMaxContentHeight()

Implements com.sun.prism.Texture.getMaxContentHeight.

Doc from com.sun.prism.Texture.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

Annotations
@Override
getMaxContentWidthback to summary
public int getMaxContentWidth()

Implements com.sun.prism.Texture.getMaxContentWidth.

Doc from com.sun.prism.Texture.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

Annotations
@Override
getPhysicalHeightback to summary
public final int getPhysicalHeight()

Implements com.sun.prism.Texture.getPhysicalHeight.

Doc from com.sun.prism.Texture.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

Annotations
@Override
getPhysicalWidthback to summary
public final int getPhysicalWidth()

Implements com.sun.prism.Texture.getPhysicalWidth.

Doc from com.sun.prism.Texture.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

Annotations
@Override
getPixelFormatback to summary
public final PixelFormat getPixelFormat()

Implements com.sun.prism.Texture.getPixelFormat.

Doc from com.sun.prism.Texture.getPixelFormat.

Returns the PixelFormat of this texture.

Returns:PixelFormat

the PixelFormat of this texture

Annotations
@Override
getSharedTextureback to summary
public Texture getSharedTexture(Texture.WrapMode altMode)

Implements com.sun.prism.Texture.getSharedTexture.

Doc from com.sun.prism.Texture.getSharedTexture.

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.

Annotations
@Override
getUseMipmapback to summary
public boolean getUseMipmap()

Implements com.sun.prism.Texture.getUseMipmap.

Doc from com.sun.prism.Texture.getUseMipmap.

Returns the true if mipmapping is used for this texture.

Returns:boolean

the useMipmap flag for this texture

Annotations
@Override
getWrapModeback to summary
public final Texture.WrapMode getWrapMode()

Implements com.sun.prism.Texture.getWrapMode.

Doc from com.sun.prism.Texture.getWrapMode.

Returns the WrapMode for this texture.

Returns:Texture.WrapMode

the WrapMode for this texture

Annotations
@Override
isLockedback to summary
public final boolean isLocked()

Implements com.sun.prism.Texture.isLocked.

Annotations
@Override
isSurfaceLostback to summary
public final boolean isSurfaceLost()

Implements com.sun.prism.Texture.isSurfaceLost.

Doc from com.sun.prism.Texture.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.

Annotations
@Override
lockback to summary
public final void lock()

Implements com.sun.prism.Texture.lock.

Annotations
@Override
makePermanentback to summary
public final void makePermanent()

Implements com.sun.prism.Texture.makePermanent.

Annotations
@Override
setContentHeightback to summary
public void setContentHeight(int contentH)

Implements com.sun.prism.Texture.setContentHeight.

Doc from com.sun.prism.Texture.setContentHeight.

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
contentH:int

The actual new height of user pixels.

Annotations
@Override
setContentWidthback to summary
public void setContentWidth(int contentW)

Implements com.sun.prism.Texture.setContentWidth.

Doc from com.sun.prism.Texture.setContentWidth.

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
contentW:int

The actual new width of user pixels.

Annotations
@Override
setLastImageSerialback to summary
public final void setLastImageSerial(int serial)

Implements com.sun.prism.Texture.setLastImageSerial.

Annotations
@Override
setLinearFilteringback to summary
public void setLinearFiltering(boolean linear)

Implements com.sun.prism.Texture.setLinearFiltering.

Doc from com.sun.prism.Texture.setLinearFiltering.

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

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
unlockback to summary
public final void unlock()

Implements com.sun.prism.Texture.unlock.

Annotations
@Override
updateback to summary
public void update(Image img)

Implements com.sun.prism.Texture.update.

Doc from com.sun.prism.Texture.update.

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

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

Implements com.sun.prism.Texture.update.

Doc from com.sun.prism.Texture.update.

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

Annotations
@Override
updateback to summary
public void update(Image img, int dstx, int dsty, int w, int h)

Implements com.sun.prism.Texture.update.

Doc from com.sun.prism.Texture.update.

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

w:int

the width of the pixel region from the source image

h:int

the height of the pixel region from the source image

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

Implements com.sun.prism.Texture.update.

Doc from com.sun.prism.Texture.update.

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

Annotations
@Override