abstract class SWTexture extends java.lang.Object implements Texture
Texture.Usage, Texture.WrapMode| Modifier and Type | Field and Description |
|---|---|
(package private) boolean |
allocated |
(package private) int |
contentHeight |
(package private) int |
contentWidth |
(package private) int |
employcount |
private SWResourceFactory |
factory |
private int |
lastImageSerial |
private int |
lockcount |
(package private) boolean |
permanent |
(package private) int |
physicalHeight |
(package private) int |
physicalWidth |
private Texture.WrapMode |
wrapMode |
| Constructor and Description |
|---|
SWTexture(SWResourceFactory factory,
Texture.WrapMode wrapMode,
int w,
int h) |
SWTexture(SWTexture sharedTex,
Texture.WrapMode altMode) |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
allocate() |
(package private) abstract void |
allocateBuffer() |
void |
assertLocked() |
void |
contentsNotUseful() |
void |
contentsUseful() |
(package private) static Texture |
create(SWResourceFactory factory,
PixelFormat formatHint,
Texture.WrapMode wrapMode,
int w,
int h) |
(package private) abstract Texture |
createSharedLockedTexture(Texture.WrapMode altMode)
Returns a new
Texture object sharing all of the information
from this texture, but using the new WrapMode. |
void |
dispose() |
int |
getContentHeight()
Returns the content height of this texture, in pixels.
|
int |
getContentWidth()
Returns the content width of this texture, in pixels.
|
int |
getContentX()
Returns the content x-origin of this texture relative to the upper-left
corner, in pixels.
|
int |
getContentY()
Returns the content y-origin of this texture relative to the upper-left
corner, in pixels.
|
int |
getLastImageSerial() |
boolean |
getLinearFiltering()
Returns whether linear (smooth) filtering will be used when
rendering this texture.
|
int |
getLockCount() |
int |
getMaxContentHeight()
Returns the max content height of this texture, in pixels.
|
int |
getMaxContentWidth()
Returns the max content width of this texture, in pixels.
|
(package private) int |
getOffset() |
int |
getPhysicalHeight()
Returns the physical height of this texture, in pixels.
|
int |
getPhysicalWidth()
Returns the physical width of this texture, in pixels.
|
(package private) SWResourceFactory |
getResourceFactory() |
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. |
boolean |
getUseMipmap()
Returns the true if mipmapping is used for this texture.
|
Texture.WrapMode |
getWrapMode()
Returns the
WrapMode for this texture. |
boolean |
isLocked() |
boolean |
isSurfaceLost()
Called by code wanting to know if the RTTexture's surface is lost.
|
void |
lock() |
void |
makePermanent() |
void |
setContentHeight(int contentHeight)
Allows the content height, which is the current height of the actual content
in pixels, to be adjusted.
|
void |
setContentWidth(int contentWidth)
Allows the content width, which is the current width of the actual content
in pixels, to be adjusted.
|
void |
setLastImageSerial(int serial) |
void |
setLinearFiltering(boolean linear)
Sets whether linear filtering will be used when rendering this texture.
|
void |
unlock() |
void |
update(Image img)
Updates this texture using the contents of the given
Image. |
void |
update(Image img,
int dstx,
int dsty)
Updates this texture using the contents of the given
Image. |
void |
update(Image img,
int dstx,
int dsty,
int srcw,
int srch)
Updates this texture using the contents of the given
Image. |
void |
update(Image img,
int dstx,
int dsty,
int srcw,
int srch,
boolean skipFlush)
Updates this texture using the contents of the given
Image. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPixelFormat, update, updateboolean allocated
int physicalWidth
int physicalHeight
int contentWidth
int contentHeight
private SWResourceFactory factory
private int lastImageSerial
private final Texture.WrapMode wrapMode
private int lockcount
boolean permanent
int employcount
SWTexture(SWResourceFactory factory, Texture.WrapMode wrapMode, int w, int h)
SWTexture(SWTexture sharedTex, Texture.WrapMode altMode)
static Texture create(SWResourceFactory factory, PixelFormat formatHint, Texture.WrapMode wrapMode, int w, int h)
SWResourceFactory getResourceFactory()
int getOffset()
public int getLockCount()
getLockCount in interface Texturepublic void assertLocked()
assertLocked in interface Texturepublic void makePermanent()
makePermanent in interface Texturepublic void contentsUseful()
contentsUseful in interface Texturepublic void contentsNotUseful()
contentsNotUseful in interface Texturepublic boolean isSurfaceLost()
TextureisSurfaceLost in interface Texturepublic void dispose()
dispose in interface GraphicsResourcepublic int getPhysicalWidth()
TexturegetPhysicalWidth in interface Texturepublic int getPhysicalHeight()
TexturegetPhysicalHeight in interface Texturepublic int getContentX()
TexturegetContentX in interface Texturepublic int getContentY()
TexturegetContentY in interface Texturepublic int getContentWidth()
TextureFor 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.
getContentWidth in interface Texturepublic void setContentWidth(int contentWidth)
TexturesetContentWidth in interface TexturecontentWidth - The actual new width of user pixels.public int getContentHeight()
TextureFor 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.
getContentHeight in interface Texturepublic void setContentHeight(int contentHeight)
TexturesetContentHeight in interface TexturecontentHeight - The actual new height of user pixels.public int getMaxContentWidth()
TextureFor 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.
getMaxContentWidth in interface Texturepublic int getMaxContentHeight()
TextureFor 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.
getMaxContentHeight in interface Texturepublic int getLastImageSerial()
getLastImageSerial in interface Texturepublic void setLastImageSerial(int serial)
setLastImageSerial in interface Texturepublic void update(Image img)
TextureImage.
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);
public void update(Image img, int dstx, int dsty)
TextureImage.
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());
public void update(Image img, int dstx, int dsty, int srcw, int srch)
TextureImage.
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);
update in interface Textureimg - the image data to be uploaded to this texturedstx - the x-offset of the image data, in pixels, relative to the
contentX of this texturedsty - the y-offset of the image data, in pixels, relative to the
contentY of this texturesrcw - the width of the pixel region from the source imagesrch - the height of the pixel region from the source imagepublic void update(Image img, int dstx, int dsty, int srcw, int srch, boolean skipFlush)
TextureImage.
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);
update in interface Textureimg - the image data to be uploaded to this texturedstx - the x-offset of the image data, in pixels, relative to the
contentX of this texturedsty - the y-offset of the image data, in pixels, relative to the
contentY of this texturesrcw - the width of the pixel region from the source imagesrch - the height of the pixel region from the source imageskipFlush - if true, the vertex buffer will not be flushedpublic Texture.WrapMode getWrapMode()
TextureWrapMode for this texture.getWrapMode in interface TextureWrapMode for this texturepublic boolean getUseMipmap()
TexturegetUseMipmap in interface TextureuseMipmap flag for this texturepublic Texture getSharedTexture(Texture.WrapMode altMode)
TextureTexture 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.getSharedTexture in interface Texturepublic boolean getLinearFiltering()
TexturegetLinearFiltering in interface Texturepublic void setLinearFiltering(boolean linear)
TexturesetLinearFiltering in interface Texturelinear - if true, enables linear filtering; if false, enables
nearest neighbor filteringvoid allocate()
abstract void allocateBuffer()
abstract Texture createSharedLockedTexture(Texture.WrapMode altMode)
Texture object sharing all of the information
from this texture, but using the new WrapMode.
The new texture will be locked (in contrast to the similarly-named
method in BaseTexture).altMode - the new WrapMode for the new textureWrapMode