Build 1.0_r1(from source)

android.view
Class Surface

java.lang.Object
  extended by android.view.Surface
All Implemented Interfaces:
Parcelable

public class Surface
extends Object
implements Parcelable

Handle on to a raw buffer that is being managed by the screen compositor.


Nested Class Summary
static class Surface.OutOfResourcesException
          Exception thrown when a surface couldn't be created or resized
 
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.Creator<T>
 
Field Summary
static Parcelable.Creator<Surface> CREATOR
           
static int FX_SURFACE_BLUR
          Creates a Blur surface.
static int FX_SURFACE_DIM
          Creates a Dim surface.
static int FX_SURFACE_MASK
          Mask used for FX values above
static int FX_SURFACE_NORMAL
          Creates a normal surface.
static int GPU
          Implies "HARDWARE", the surface is to be used by the GPU additionally the backbuffer is never preserved for these surfaces.
static int HARDWARE
          The surface is to be used by hardware accelerators or DMA engines
static int HIDDEN
          Surface is created hidden
static int NON_PREMULTIPLIED
          Creates a surface where color components are interpreted as "non pre-multiplied" by their alpha channel.
static int PUSH_BUFFERS
          Creates a surface without a rendering buffer.
static int ROTATION_0
           
static int ROTATION_180
           
static int ROTATION_270
           
static int ROTATION_90
           
static int SECURE
          The surface contains secure content, special measures will be taken to disallow the surface's content to be copied from another process.
static int SURACE_FROZEN
          Freeze the surface.
static int SURFACE_BLUR_FREEZE
           
static int SURFACE_DITHER
          Enable dithering when compositing this surface
static int SURFACE_HIDDEN
          Hide the surface.
 
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
 
Constructor Summary
Surface()
          Create an empty surface, which will later be filled in by readFromParcel().
Surface(SurfaceSession s, int pid, int display, int w, int h, int format, int flags)
          create a surface
 
Method Summary
 void clear()
          Call this free the surface up.
static void closeTransaction()
          
 void copyFrom(Surface o)
          Copy another surface to this one.
 int describeContents()
          Describe the kinds of special objects contained in this Parcelable's marshalled representation.
protected  void finalize()
          Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
 void freeze()
           
static void freezeDisplay(int display)
          Freezes the specified display, No updating of the screen will occur until unfreezeDisplay() is called.
 void hide()
           
 boolean isValid()
          Does this object hold a valid surface? Returns true if it holds a physical surface, so lockCanvas() will succeed.
 Canvas lockCanvas(Rect dirty)
          draw into a surface
static void openTransaction()
          start/end a transaction
 void readFromParcel(Parcel source)
           
 void setAlpha(float alpha)
           
 void setFlags(int flags, int mask)
           
 void setFreezeTint(int tint)
           
 void setLayer(int zorder)
          set surface parameters.
 void setMatrix(float dsdx, float dtdx, float dsdy, float dtdy)
           
static void setOrientation(int display, int orientation)
          set the orientation of the given display.
 void setPosition(int x, int y)
           
 void setSize(int w, int h)
           
 void setTransparentRegionHint(Region region)
           
 void show()
           
 String toString()
          Returns a string containing a concise, human-readable description of the receiver.
 void unfreeze()
           
static void unfreezeDisplay(int display)
          resume updating the specified display.
 void unlockCanvas(Canvas canvas)
          unlock the surface.
 void unlockCanvasAndPost(Canvas canvas)
          unlock the surface and asks a page flip
 void writeToParcel(Parcel dest, int flags)
          Flatten this object in to a Parcel.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HIDDEN

public static final int HIDDEN
Surface is created hidden

See Also:
Constant Field Values

HARDWARE

public static final int HARDWARE
The surface is to be used by hardware accelerators or DMA engines

See Also:
Constant Field Values

GPU

public static final int GPU
Implies "HARDWARE", the surface is to be used by the GPU additionally the backbuffer is never preserved for these surfaces.

See Also:
Constant Field Values

SECURE

public static final int SECURE
The surface contains secure content, special measures will be taken to disallow the surface's content to be copied from another process. In particular, screenshots and VNC servers will be disabled, but other measures can take place, for instance the surface might not be hardware accelerated.

See Also:
Constant Field Values

NON_PREMULTIPLIED

public static final int NON_PREMULTIPLIED
Creates a surface where color components are interpreted as "non pre-multiplied" by their alpha channel. Of course this flag is meaningless for surfaces without an alpha channel. By default surfaces are pre-multiplied, which means that each color component is already multiplied by its alpha value. In this case the blending equation used is: DEST = SRC + DEST * (1-SRC_ALPHA) By contrast, non pre-multiplied surfaces use the following equation: DEST = SRC * SRC_ALPHA * DEST * (1-SRC_ALPHA) pre-multiplied surfaces must always be used if transparent pixels are composited on top of each-other into the surface. A pre-multiplied surface can never lower the value of the alpha component of a given pixel. In some rare situations, a non pre-multiplied surface is preferable.

See Also:
Constant Field Values

PUSH_BUFFERS

public static final int PUSH_BUFFERS
Creates a surface without a rendering buffer. Instead, the content of the surface must be pushed by an external entity. This is type of surface can be used for efficient camera preview or movie play back.

See Also:
Constant Field Values

FX_SURFACE_NORMAL

public static final int FX_SURFACE_NORMAL
Creates a normal surface. This is the default

See Also:
Constant Field Values

FX_SURFACE_BLUR

public static final int FX_SURFACE_BLUR
Creates a Blur surface. Everything behind this surface is blurred by some amount. The quality and refresh speed of the blur effect is not settable or guaranteed. It is an error to lock a Blur surface, since it doesn't have a backing store.

See Also:
Constant Field Values

FX_SURFACE_DIM

public static final int FX_SURFACE_DIM
Creates a Dim surface. Everything behind this surface is dimmed by the amount specified in setAlpha(). It is an error to lock a Dim surface, since it doesn't have a backing store.

See Also:
Constant Field Values

FX_SURFACE_MASK

public static final int FX_SURFACE_MASK
Mask used for FX values above

See Also:
Constant Field Values

SURFACE_HIDDEN

public static final int SURFACE_HIDDEN
Hide the surface. Equivalent to calling hide()

See Also:
Constant Field Values

SURACE_FROZEN

public static final int SURACE_FROZEN
Freeze the surface. Equivalent to calling freeze()

See Also:
Constant Field Values

SURFACE_DITHER

public static final int SURFACE_DITHER
Enable dithering when compositing this surface

See Also:
Constant Field Values

SURFACE_BLUR_FREEZE

public static final int SURFACE_BLUR_FREEZE
See Also:
Constant Field Values

ROTATION_0

public static final int ROTATION_0
See Also:
Constant Field Values

ROTATION_90

public static final int ROTATION_90
See Also:
Constant Field Values

ROTATION_180

public static final int ROTATION_180
See Also:
Constant Field Values

ROTATION_270

public static final int ROTATION_270
See Also:
Constant Field Values

CREATOR

public static final Parcelable.Creator<Surface> CREATOR
Constructor Detail

Surface

public Surface(SurfaceSession s,
               int pid,
               int display,
               int w,
               int h,
               int format,
               int flags)
        throws Surface.OutOfResourcesException
create a surface

Throws:
Surface.OutOfResourcesException

Surface

public Surface()
Create an empty surface, which will later be filled in by readFromParcel().

Method Detail

copyFrom

public void copyFrom(Surface o)
Copy another surface to this one. This surface now holds a reference to the same data as the original surface, and is -not- the owner.


isValid

public boolean isValid()
Does this object hold a valid surface? Returns true if it holds a physical surface, so lockCanvas() will succeed. Otherwise returns false.


clear

public void clear()
Call this free the surface up.


lockCanvas

public Canvas lockCanvas(Rect dirty)
                  throws Surface.OutOfResourcesException
draw into a surface

Throws:
Surface.OutOfResourcesException

unlockCanvasAndPost

public void unlockCanvasAndPost(Canvas canvas)
unlock the surface and asks a page flip


unlockCanvas

public void unlockCanvas(Canvas canvas)
unlock the surface. the screen won't be updated until post() or postAll() is called


openTransaction

public static void openTransaction()
start/end a transaction


closeTransaction

public static void closeTransaction()


freezeDisplay

public static void freezeDisplay(int display)
Freezes the specified display, No updating of the screen will occur until unfreezeDisplay() is called. Everything else works as usual though, in particular transactions.

Parameters:
display -

unfreezeDisplay

public static void unfreezeDisplay(int display)
resume updating the specified display.

Parameters:
display -

setOrientation

public static void setOrientation(int display,
                                  int orientation)
set the orientation of the given display.

Parameters:
display -
orientation -

setLayer

public void setLayer(int zorder)
set surface parameters. needs to be inside open/closeTransaction block


setPosition

public void setPosition(int x,
                        int y)

setSize

public void setSize(int w,
                    int h)

hide

public void hide()

show

public void show()

setTransparentRegionHint

public void setTransparentRegionHint(Region region)

setAlpha

public void setAlpha(float alpha)

setMatrix

public void setMatrix(float dsdx,
                      float dtdx,
                      float dsdy,
                      float dtdy)

freeze

public void freeze()

unfreeze

public void unfreeze()

setFreezeTint

public void setFreezeTint(int tint)

setFlags

public void setFlags(int flags,
                     int mask)

toString

public String toString()
Description copied from class: Object
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
String a printable representation for the receiver.

describeContents

public int describeContents()
Description copied from interface: Parcelable
Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Specified by:
describeContents in interface Parcelable
Returns:
a bitmask indicating the set of special object types marshalled by the Parcelable.

readFromParcel

public void readFromParcel(Parcel source)

writeToParcel

public void writeToParcel(Parcel dest,
                          int flags)
Description copied from interface: Parcelable
Flatten this object in to a Parcel.

Specified by:
writeToParcel in interface Parcelable
Parameters:
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.PARCELABLE_WRITE_RETURN_VALUE.

finalize

protected void finalize()
                 throws Throwable
Description copied from class: Object
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. Subclasses can use this facility to guarantee that any associated resources are cleaned up before the receiver is garbage collected. Uncaught exceptions which are thrown during the running of the method cause it to terminate immediately, but are otherwise ignored.

Note: The virtual machine assumes that the implementation in class Object is empty.

Overrides:
finalize in class Object
Throws:
Throwable - The virtual machine ignores any exceptions which are thrown during finalization.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature