public interface Texture extends GraphicsResource
Modifier and Type | Interface and Description |
---|---|
static class |
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).
|
static class |
Texture.WrapMode
Specifies the behavior when texels are accessed outside the physical
bounds of the texture.
|
Modifier and Type | Method and Description |
---|---|
void |
assertLocked() |
void |
contentsNotUseful() |
void |
contentsUseful() |
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.
|
int |
getPhysicalHeight()
Returns the physical height of this texture, in pixels.
|
int |
getPhysicalWidth()
Returns the physical width of this texture, in pixels.
|
PixelFormat |
getPixelFormat()
Returns the
PixelFormat of this texture. |
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(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 . |
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 . |
void |
update(MediaFrame frame,
boolean skipFlush)
Updates this texture using the contents of the provided
MediaFrame . |
dispose
PixelFormat getPixelFormat()
PixelFormat
of this texture.PixelFormat
of this textureint getPhysicalWidth()
int getPhysicalHeight()
int getContentX()
int getContentY()
int getContentWidth()
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.
int getContentHeight()
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.
int getMaxContentWidth()
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.
int getMaxContentHeight()
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.
void setContentWidth(int contentWidth)
contentWidth
- The actual new width of user pixels.void setContentHeight(int contentHeight)
contentHeight
- The actual new height of user pixels.int getLastImageSerial()
void setLastImageSerial(int serial)
void update(Image img)
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);
img
- the image data to be uploaded to this texturevoid update(Image img, int dstx, int dsty)
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());
img
- 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 texturevoid update(Image img, int dstx, int dsty, int srcw, int srch)
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);
img
- 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 imagevoid update(Image img, int dstx, int dsty, int srcw, int srch, boolean skipFlush)
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);
img
- 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 flushedvoid update(Buffer buffer, PixelFormat format, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan, boolean skipFlush)
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.pixels
- the image data to be uploaded to this textureformat
- the format of the data contained in the pixel bufferdstx
- 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 texturesrcx
- the x-offset into the source buffer, in pixelssrcy
- the y-offset into the source buffer, in pixelssrcw
- the width of the pixel region from the source buffersrch
- the height of the pixel region from the source buffersrcscan
- the scanline stride of the source buffer, in bytesskipFlush
- if true, the vertex buffer will not be flushedvoid update(MediaFrame frame, boolean skipFlush)
MediaFrame
. The source and destination coordinates are implicit,
you can only update the entire video texture.frame
- the source video buffer to update the texture data fromskipFlush
- if true, the vertex buffer will not be flushedTexture.WrapMode getWrapMode()
WrapMode
for this texture.WrapMode
for this textureboolean getUseMipmap()
useMipmap
flag for this textureTexture getSharedTexture(Texture.WrapMode altMode)
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.boolean getLinearFiltering()
void setLinearFiltering(boolean linear)
linear
- if true, enables linear filtering; if false, enables
nearest neighbor filteringvoid lock()
void unlock()
boolean isLocked()
int getLockCount()
void assertLocked()
void makePermanent()
void contentsUseful()
void contentsNotUseful()
boolean isSurfaceLost()
Copyright © 2020. All rights reserved.