java.lang.Object | |
↳ | android.view.Surface |
Handle onto a raw buffer that is being managed by the screen compositor.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Surface.OutOfResourcesException |
Exception thrown when a Canvas couldn't be locked with
lockCanvas(Rect)
, or
when a SurfaceTexture could not successfully be allocated.
|
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ROTATION_0 | Rotation constant: 0 degree rotation (natural orientation) | |||||||||
int | ROTATION_180 | Rotation constant: 180 degree rotation. | |||||||||
int | ROTATION_270 | Rotation constant: 270 degree rotation. | |||||||||
int | ROTATION_90 | Rotation constant: 90 degree rotation. |
[Expand]
Inherited Constants
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
CREATOR |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Create Surface from a
SurfaceTexture
.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
|
||||||||||
|
Returns true if this object holds a valid surface.
|
||||||||||
|
Gets a
Canvas
for drawing into this surface.
|
||||||||||
|
|
||||||||||
|
Release the local reference to the server-side surface.
|
||||||||||
|
Returns a string containing a concise, human-readable description of this
object.
|
||||||||||
|
This method was deprecated
in API level 17.
This API has been removed and is not supported. Do not use.
|
||||||||||
|
|
||||||||||
|
Flatten this object in to a Parcel.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
|||||||||||
From interface
android.os.Parcelable
|
Rotation constant: 0 degree rotation (natural orientation)
Rotation constant: 180 degree rotation.
Rotation constant: 270 degree rotation.
Rotation constant: 90 degree rotation.
Create Surface from a
SurfaceTexture
.
Images drawn to the Surface will be made available to the
SurfaceTexture
, which can attach them to an OpenGL ES texture via
updateTexImage()
.
surfaceTexture |
The
SurfaceTexture
that is updated by this
Surface.
|
---|
Surface.OutOfResourcesException | if the surface could not be created. |
---|
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Returns true if this object holds a valid surface.
Gets a
Canvas
for drawing into this surface.
After drawing into the provided
Canvas
, the caller must
invoke
unlockCanvasAndPost(Canvas)
to post the new contents to the surface.
inOutDirty |
A rectangle that represents the dirty region that the caller wants
to redraw. This function may choose to expand the dirty rectangle if for example
the surface has been resized or if the previous contents of the surface were
not available. The caller must redraw the entire dirty region as represented
by the contents of the inOutDirty rectangle upon return from this function.
The caller may also pass
null
instead, in the case where the
entire surface should be redrawn.
|
---|
IllegalArgumentException | If the inOutDirty rectangle is not valid. |
---|---|
Surface.OutOfResourcesException | If the canvas cannot be locked. |
Release the local reference to the server-side surface. Always call release() when you're done with a Surface. This will make the surface invalid.
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See
Writing a useful
toString
method
if you intend implementing your own
toString
method.
This method was deprecated
in API level 17.
This API has been removed and is not supported. Do not use.
canvas |
The canvas previously obtained from
lockCanvas(Rect)
.
|
---|
Flatten this object in to a Parcel.
dest | The Parcel in which the object should be written. |
---|---|
flags |
Additional flags about how the object should be written.
May be 0 or
PARCELABLE_WRITE_RETURN_VALUE
.
|
Invoked when the garbage collector has detected that this instance is no longer reachable. The default implementation does nothing, but this method can be overridden to free resources.
Note that objects that override
finalize
are significantly more expensive than
objects that don't. Finalizers may be run a long time after the object is no longer
reachable, depending on memory pressure, so it's a bad idea to rely on them for cleanup.
Note also that finalizers are run on a single VM-wide finalizer thread,
so doing blocking work in a finalizer is a bad idea. A finalizer is usually only necessary
for a class that has a native peer and needs to call a native method to destroy that peer.
Even then, it's better to provide an explicit
close
method (and implement
Closeable
), and insist that callers manually dispose of instances. This
works well for something like files, but less well for something like a
BigInteger
where typical calling code would have to deal with lots of temporaries. Unfortunately,
code that creates lots of temporaries is the worst kind of code from the point of view of
the single finalizer thread.
If you
must
use finalizers, consider at least providing your own
ReferenceQueue
and having your own thread process that queue.
Unlike constructors, finalizers are not automatically chained. You are responsible for
calling
super.finalize()
yourself.
Uncaught exceptions thrown by finalizers are ignored and do not terminate the finalizer thread. See Effective Java Item 7, "Avoid finalizers" for more.
Throwable |
---|