* commit 'a420e3ad0fc92501c7744a462c7d4e531f1d5117': Fix whitespace in TextureView
This commit is contained in:
@@ -30,21 +30,21 @@ import android.util.Log;
|
||||
* <p>A TextureView can be used to display a content stream. Such a content
|
||||
* stream can for instance be a video or an OpenGL scene. The content stream
|
||||
* can come from the application's process as well as a remote process.</p>
|
||||
*
|
||||
*
|
||||
* <p>TextureView can only be used in a hardware accelerated window. When
|
||||
* rendered in software, TextureView will draw nothing.</p>
|
||||
*
|
||||
*
|
||||
* <p>Unlike {@link SurfaceView}, TextureView does not create a separate
|
||||
* window but behaves as a regular View. This key difference allows a
|
||||
* TextureView to be moved, transformed, animated, etc. For instance, you
|
||||
* can make a TextureView semi-translucent by calling
|
||||
* <code>myView.setAlpha(0.5f)</code>.</p>
|
||||
*
|
||||
*
|
||||
* <p>Using a TextureView is simple: all you need to do is get its
|
||||
* {@link SurfaceTexture}. The {@link SurfaceTexture} can then be used to
|
||||
* render content. The following example demonstrates how to render the
|
||||
* render content. The following example demonstrates how to render the
|
||||
* camera preview into a TextureView:</p>
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* public class LiveCameraActivity extends Activity implements TextureView.SurfaceTextureListener {
|
||||
* private Camera mCamera;
|
||||
@@ -85,19 +85,19 @@ import android.util.Log;
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>A TextureView's SurfaceTexture can be obtained either by invoking
|
||||
* {@link #getSurfaceTexture()} or by using a {@link SurfaceTextureListener}.
|
||||
* It is important to know that a SurfaceTexture is available only after the
|
||||
* TextureView is attached to a window (and {@link #onAttachedToWindow()} has
|
||||
* been invoked.) It is therefore highly recommended you use a listener to
|
||||
* be notified when the SurfaceTexture becomes available.</p>
|
||||
*
|
||||
*
|
||||
* <p>It is important to note that only one producer can use the TextureView.
|
||||
* For instance, if you use a TextureView to display the camera preview, you
|
||||
* cannot use {@link #lockCanvas()} to draw onto the TextureView at the same
|
||||
* time.</p>
|
||||
*
|
||||
*
|
||||
* @see SurfaceView
|
||||
* @see SurfaceTexture
|
||||
*/
|
||||
@@ -127,7 +127,7 @@ public class TextureView extends View {
|
||||
|
||||
/**
|
||||
* Creates a new TextureView.
|
||||
*
|
||||
*
|
||||
* @param context The context to associate this view with.
|
||||
*/
|
||||
public TextureView(Context context) {
|
||||
@@ -137,7 +137,7 @@ public class TextureView extends View {
|
||||
|
||||
/**
|
||||
* Creates a new TextureView.
|
||||
*
|
||||
*
|
||||
* @param context The context to associate this view with.
|
||||
* @param attrs The attributes of the XML tag that is inflating the view.
|
||||
*/
|
||||
@@ -148,7 +148,7 @@ public class TextureView extends View {
|
||||
|
||||
/**
|
||||
* Creates a new TextureView.
|
||||
*
|
||||
*
|
||||
* @param context The context to associate this view with.
|
||||
* @param attrs The attributes of the XML tag that is inflating the view.
|
||||
* @param defStyleAttr An attribute in the current theme that contains a
|
||||
@@ -193,7 +193,7 @@ public class TextureView extends View {
|
||||
/**
|
||||
* Indicates whether the content of this TextureView is opaque. The
|
||||
* content is assumed to be opaque by default.
|
||||
*
|
||||
*
|
||||
* @param opaque True if the content of this TextureView is opaque,
|
||||
* false otherwise
|
||||
*/
|
||||
@@ -258,7 +258,7 @@ public class TextureView extends View {
|
||||
* considered to act as a hardware layer. The optional paint supplied to this
|
||||
* method will however be taken into account when rendering the content of
|
||||
* this TextureView.
|
||||
*
|
||||
*
|
||||
* @param layerType The ype of layer to use with this view, must be one of
|
||||
* {@link #LAYER_TYPE_NONE}, {@link #LAYER_TYPE_SOFTWARE} or
|
||||
* {@link #LAYER_TYPE_HARDWARE}
|
||||
@@ -297,7 +297,7 @@ public class TextureView extends View {
|
||||
/**
|
||||
* Subclasses of TextureView cannot do their own rendering
|
||||
* with the {@link Canvas} object.
|
||||
*
|
||||
*
|
||||
* @param canvas The Canvas to which the View is rendered.
|
||||
*/
|
||||
@Override
|
||||
@@ -312,7 +312,7 @@ public class TextureView extends View {
|
||||
/**
|
||||
* Subclasses of TextureView cannot do their own rendering
|
||||
* with the {@link Canvas} object.
|
||||
*
|
||||
*
|
||||
* @param canvas The Canvas to which the View is rendered.
|
||||
*/
|
||||
@Override
|
||||
@@ -435,7 +435,7 @@ public class TextureView extends View {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mLayer.prepare(getWidth(), getHeight(), mOpaque);
|
||||
mLayer.updateSurfaceTexture();
|
||||
|
||||
@@ -449,17 +449,17 @@ public class TextureView extends View {
|
||||
* The specified transform applies to the underlying surface
|
||||
* texture and does not affect the size or position of the view
|
||||
* itself, only of its content.</p>
|
||||
*
|
||||
*
|
||||
* <p>Some transforms might prevent the content from drawing
|
||||
* all the pixels contained within this view's bounds. In such
|
||||
* situations, make sure this texture view is not marked opaque.</p>
|
||||
*
|
||||
*
|
||||
* @param transform The transform to apply to the content of
|
||||
* this view.
|
||||
*
|
||||
* @see #getTransform(android.graphics.Matrix)
|
||||
* @see #isOpaque()
|
||||
* @see #setOpaque(boolean)
|
||||
*
|
||||
* @see #getTransform(android.graphics.Matrix)
|
||||
* @see #isOpaque()
|
||||
* @see #setOpaque(boolean)
|
||||
*/
|
||||
public void setTransform(Matrix transform) {
|
||||
mMatrix.set(transform);
|
||||
@@ -469,14 +469,14 @@ public class TextureView extends View {
|
||||
|
||||
/**
|
||||
* Returns the transform associated with this texture view.
|
||||
*
|
||||
*
|
||||
* @param transform The {@link Matrix} in which to copy the current
|
||||
* transform. Can be null.
|
||||
*
|
||||
*
|
||||
* @return The specified matrix if not null or a new {@link Matrix}
|
||||
* instance otherwise.
|
||||
*
|
||||
* @see #setTransform(android.graphics.Matrix)
|
||||
*
|
||||
* @see #setTransform(android.graphics.Matrix)
|
||||
*/
|
||||
public Matrix getTransform(Matrix transform) {
|
||||
if (transform == null) {
|
||||
@@ -499,21 +499,21 @@ public class TextureView extends View {
|
||||
* <p>Returns a {@link android.graphics.Bitmap} representation of the content
|
||||
* of the associated surface texture. If the surface texture is not available,
|
||||
* this method returns null.</p>
|
||||
*
|
||||
*
|
||||
* <p>The bitmap returned by this method uses the {@link Bitmap.Config#ARGB_8888}
|
||||
* pixel format and its dimensions are the same as this view's.</p>
|
||||
*
|
||||
*
|
||||
* <p><strong>Do not</strong> invoke this method from a drawing method
|
||||
* ({@link #onDraw(android.graphics.Canvas)} for instance).</p>
|
||||
*
|
||||
*
|
||||
* <p>If an error occurs during the copy, an empty bitmap will be returned.</p>
|
||||
*
|
||||
*
|
||||
* @return A valid {@link Bitmap.Config#ARGB_8888} bitmap, or null if the surface
|
||||
* texture is not available or the width <= 0 or the height <= 0
|
||||
*
|
||||
* @see #isAvailable()
|
||||
* @see #getBitmap(android.graphics.Bitmap)
|
||||
* @see #getBitmap(int, int)
|
||||
*
|
||||
* @see #isAvailable()
|
||||
* @see #getBitmap(android.graphics.Bitmap)
|
||||
* @see #getBitmap(int, int)
|
||||
*/
|
||||
public Bitmap getBitmap() {
|
||||
return getBitmap(getWidth(), getHeight());
|
||||
@@ -523,24 +523,24 @@ public class TextureView extends View {
|
||||
* <p>Returns a {@link android.graphics.Bitmap} representation of the content
|
||||
* of the associated surface texture. If the surface texture is not available,
|
||||
* this method returns null.</p>
|
||||
*
|
||||
*
|
||||
* <p>The bitmap returned by this method uses the {@link Bitmap.Config#ARGB_8888}
|
||||
* pixel format.</p>
|
||||
*
|
||||
*
|
||||
* <p><strong>Do not</strong> invoke this method from a drawing method
|
||||
* ({@link #onDraw(android.graphics.Canvas)} for instance).</p>
|
||||
*
|
||||
*
|
||||
* <p>If an error occurs during the copy, an empty bitmap will be returned.</p>
|
||||
*
|
||||
*
|
||||
* @param width The width of the bitmap to create
|
||||
* @param height The height of the bitmap to create
|
||||
*
|
||||
*
|
||||
* @return A valid {@link Bitmap.Config#ARGB_8888} bitmap, or null if the surface
|
||||
* texture is not available or width is <= 0 or height is <= 0
|
||||
*
|
||||
* @see #isAvailable()
|
||||
* @see #getBitmap(android.graphics.Bitmap)
|
||||
* @see #getBitmap()
|
||||
*
|
||||
* @see #isAvailable()
|
||||
* @see #getBitmap(android.graphics.Bitmap)
|
||||
* @see #getBitmap()
|
||||
*/
|
||||
public Bitmap getBitmap(int width, int height) {
|
||||
if (isAvailable() && width > 0 && height > 0) {
|
||||
@@ -555,21 +555,21 @@ public class TextureView extends View {
|
||||
* bitmap. If the surface texture is not available, the copy is not executed.
|
||||
* The content of the surface texture will be scaled to fit exactly inside
|
||||
* the specified bitmap.</p>
|
||||
*
|
||||
*
|
||||
* <p><strong>Do not</strong> invoke this method from a drawing method
|
||||
* ({@link #onDraw(android.graphics.Canvas)} for instance).</p>
|
||||
*
|
||||
*
|
||||
* <p>If an error occurs, the bitmap is left unchanged.</p>
|
||||
*
|
||||
*
|
||||
* @param bitmap The bitmap to copy the content of the surface texture into,
|
||||
* cannot be null, all configurations are supported
|
||||
*
|
||||
*
|
||||
* @return The bitmap specified as a parameter
|
||||
*
|
||||
* @see #isAvailable()
|
||||
* @see #getBitmap(int, int)
|
||||
* @see #getBitmap()
|
||||
*
|
||||
*
|
||||
* @see #isAvailable()
|
||||
* @see #getBitmap(int, int)
|
||||
* @see #getBitmap()
|
||||
*
|
||||
* @throws IllegalStateException if the hardware rendering context cannot be
|
||||
* acquired to capture the bitmap
|
||||
*/
|
||||
@@ -609,21 +609,21 @@ public class TextureView extends View {
|
||||
* to implement
|
||||
* {@link SurfaceTextureListener#onSurfaceTextureAvailable(android.graphics.SurfaceTexture, int, int)}
|
||||
* to find out when the Surface is available for use.</p>
|
||||
*
|
||||
*
|
||||
* <p>The content of the Surface is never preserved between unlockCanvas()
|
||||
* and lockCanvas(), for this reason, every pixel within the Surface area
|
||||
* must be written. The only exception to this rule is when a dirty
|
||||
* rectangle is specified, in which case, non-dirty pixels will be
|
||||
* preserved.</p>
|
||||
*
|
||||
*
|
||||
* <p>This method can only be used if the underlying surface is not already
|
||||
* owned by another producer. For instance, if the TextureView is being used
|
||||
* to render the camera's preview you cannot invoke this method.</p>
|
||||
*
|
||||
*
|
||||
* @return A Canvas used to draw into the surface.
|
||||
*
|
||||
* @see #lockCanvas(android.graphics.Rect)
|
||||
* @see #unlockCanvasAndPost(android.graphics.Canvas)
|
||||
*
|
||||
* @see #lockCanvas(android.graphics.Rect)
|
||||
* @see #unlockCanvasAndPost(android.graphics.Canvas)
|
||||
*/
|
||||
public Canvas lockCanvas() {
|
||||
return lockCanvas(null);
|
||||
@@ -639,12 +639,12 @@ public class TextureView extends View {
|
||||
* available (see {@link #isAvailable()} or if the surface texture is
|
||||
* already connected to an image producer (for instance: the camera,
|
||||
* OpenGL, a media player, etc.)
|
||||
*
|
||||
*
|
||||
* @param dirty Area of the surface that will be modified.
|
||||
|
||||
* @return A Canvas used to draw into the surface.
|
||||
*
|
||||
* @see #lockCanvas()
|
||||
*
|
||||
* @see #lockCanvas()
|
||||
* @see #unlockCanvasAndPost(android.graphics.Canvas)
|
||||
* @see #isAvailable()
|
||||
*/
|
||||
@@ -670,11 +670,11 @@ public class TextureView extends View {
|
||||
* current pixels will be shown on the screen, but its content is lost,
|
||||
* in particular there is no guarantee that the content of the Surface
|
||||
* will remain unchanged when lockCanvas() is called again.
|
||||
*
|
||||
*
|
||||
* @param canvas The Canvas previously returned by lockCanvas()
|
||||
*
|
||||
*
|
||||
* @see #lockCanvas()
|
||||
* @see #lockCanvas(android.graphics.Rect)
|
||||
* @see #lockCanvas(android.graphics.Rect)
|
||||
*/
|
||||
public void unlockCanvasAndPost(Canvas canvas) {
|
||||
if (mCanvas != null && canvas == mCanvas) {
|
||||
@@ -691,8 +691,8 @@ public class TextureView extends View {
|
||||
* Returns the {@link SurfaceTexture} used by this view. This method
|
||||
* may return null if the view is not attached to a window or if the surface
|
||||
* texture has not been initialized yet.
|
||||
*
|
||||
* @see #isAvailable()
|
||||
*
|
||||
* @see #isAvailable()
|
||||
*/
|
||||
public SurfaceTexture getSurfaceTexture() {
|
||||
return mSurface;
|
||||
@@ -746,8 +746,8 @@ public class TextureView extends View {
|
||||
/**
|
||||
* Returns the {@link SurfaceTextureListener} currently associated with this
|
||||
* texture view.
|
||||
*
|
||||
* @see #setSurfaceTextureListener(android.view.TextureView.SurfaceTextureListener)
|
||||
*
|
||||
* @see #setSurfaceTextureListener(android.view.TextureView.SurfaceTextureListener)
|
||||
* @see SurfaceTextureListener
|
||||
*/
|
||||
public SurfaceTextureListener getSurfaceTextureListener() {
|
||||
@@ -757,8 +757,8 @@ public class TextureView extends View {
|
||||
/**
|
||||
* Sets the {@link SurfaceTextureListener} used to listen to surface
|
||||
* texture events.
|
||||
*
|
||||
* @see #getSurfaceTextureListener()
|
||||
*
|
||||
* @see #getSurfaceTextureListener()
|
||||
* @see SurfaceTextureListener
|
||||
*/
|
||||
public void setSurfaceTextureListener(SurfaceTextureListener listener) {
|
||||
@@ -781,7 +781,7 @@ public class TextureView extends View {
|
||||
public static interface SurfaceTextureListener {
|
||||
/**
|
||||
* Invoked when a {@link TextureView}'s SurfaceTexture is ready for use.
|
||||
*
|
||||
*
|
||||
* @param surface The surface returned by
|
||||
* {@link android.view.TextureView#getSurfaceTexture()}
|
||||
* @param width The width of the surface
|
||||
@@ -791,7 +791,7 @@ public class TextureView extends View {
|
||||
|
||||
/**
|
||||
* Invoked when the {@link SurfaceTexture}'s buffers size changed.
|
||||
*
|
||||
*
|
||||
* @param surface The surface returned by
|
||||
* {@link android.view.TextureView#getSurfaceTexture()}
|
||||
* @param width The new width of the surface
|
||||
@@ -804,7 +804,7 @@ public class TextureView extends View {
|
||||
* If returns true, no rendering should happen inside the surface texture after this method
|
||||
* is invoked. If returns false, the client needs to call {@link SurfaceTexture#release()}.
|
||||
* Most applications should return true.
|
||||
*
|
||||
*
|
||||
* @param surface The surface about to be destroyed
|
||||
*/
|
||||
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface);
|
||||
@@ -812,7 +812,7 @@ public class TextureView extends View {
|
||||
/**
|
||||
* Invoked when the specified {@link SurfaceTexture} is updated through
|
||||
* {@link SurfaceTexture#updateTexImage()}.
|
||||
*
|
||||
*
|
||||
* @param surface The surface just updated
|
||||
*/
|
||||
public void onSurfaceTextureUpdated(SurfaceTexture surface);
|
||||
|
||||
Reference in New Issue
Block a user