diff options
author | Romain Guy <romainguy@google.com> | 2011-04-28 18:40:04 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2011-04-28 18:46:19 -0700 |
commit | aa6c24c21c727a196451332448d4e3b11a80be69 (patch) | |
tree | 27114ab3852d31723d885f3846ee874a07247126 /core/java/android/view/HardwareLayer.java | |
parent | 9fc27819d75e24ad63d7b383d80f5cb66a577a0d (diff) | |
download | frameworks_base-aa6c24c21c727a196451332448d4e3b11a80be69.zip frameworks_base-aa6c24c21c727a196451332448d4e3b11a80be69.tar.gz frameworks_base-aa6c24c21c727a196451332448d4e3b11a80be69.tar.bz2 |
New widget: TextureView
Bug #4343984
TextureView can be used to render media content (video, OpenGL,
RenderScript) inside a View.
The key difference with SurfaceView is that TextureView does
not create a new Surface. This gives the ability to seamlessly
transform, animate, fade, etc. a TextureView, which was hard
if not impossible to do with a SurfaceView.
A TextureView also interacts perfectly with ScrollView,
ListView, etc. It allows application to embed media content
in a much more flexible way than before.
For instance, to render the camera preview at 50% opacity,
all you need to do is the following:
mTextureView.setAlpha(0.5f);
Camera c = Camera.open();
c.setPreviewTexture(mTextureView.getSurfaceTexture());
c.startPreview();
TextureView uses a SurfaceTexture to get the job done. More
APIs are required to make it easy to create OpenGL contexts
for a TextureView. It can currently be done with a bit of
JNI code.
Change-Id: Iaa7953097ab5beb8437bcbbfa03b2df5b7f80cd7
Diffstat (limited to 'core/java/android/view/HardwareLayer.java')
-rw-r--r-- | core/java/android/view/HardwareLayer.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/java/android/view/HardwareLayer.java b/core/java/android/view/HardwareLayer.java index d01b8ce..86dec3f 100644 --- a/core/java/android/view/HardwareLayer.java +++ b/core/java/android/view/HardwareLayer.java @@ -26,12 +26,24 @@ import android.graphics.Canvas; * drawn several times. */ abstract class HardwareLayer { + /** + * Indicates an unknown dimension (width or height.) + */ + static final int DIMENSION_UNDEFINED = -1; + int mWidth; int mHeight; final boolean mOpaque; /** + * Creates a new hardware layer with undefined dimensions. + */ + HardwareLayer() { + this(DIMENSION_UNDEFINED, DIMENSION_UNDEFINED, false); + } + + /** * Creates a new hardware layer at least as large as the supplied * dimensions. * |