Android
android.view
public class

android.view.Surface

java.lang.Object
android.view.Surface Parcelable
Nested Classes
Surface.OutOfResourcesException Exception thrown when a surface couldn't be created or resized  

Summary

Constants

      Value  
Creator<Surface CREATOR       
int  FX_SURFACE_BLUR  Creates a Blur surface.  65536  0x00010000 
int  FX_SURFACE_DIM  Creates a Dim surface.  131072  0x00020000 
int  FX_SURFACE_MASK  Mask used for FX values above   983040  0x000f0000 
int  FX_SURFACE_NORMAL  Creates a normal surface.  0x00000000 
int  GPU  Implies "HARDWARE", the surface is to be used by the GPU additionally the backbuffer is never preserved for these surfaces.  40  0x00000028 
int  HARDWARE  The surface is to be used by hardware accelerators or DMA engines   16  0x00000010 
int  HIDDEN  Surface is created hidden   0x00000004 
int  NON_PREMULTIPLIED  Creates a surface where color components are interpreted as "non pre-multiplied" by their alpha channel.  256  0x00000100 
int  PUSH_BUFFERS  Creates a surface without a rendering buffer.  512  0x00000200 
int  ROTATION_0    0x00000000 
int  ROTATION_180    0x00000002 
int  ROTATION_270    0x00000003 
int  ROTATION_90    0x00000001 
int  SECURE  The surface contains secure content, special measures will be taken to disallow the surface's content to be copied from another process.  128  0x00000080 
int  SURACE_FROZEN  Freeze the surface.  0x00000002 
int  SURFACE_BLUR_FREEZE    16  0x00000010 
int  SURFACE_DITHER  Enable dithering when compositing this surface   0x00000004 
int  SURFACE_HIDDEN  Hide the surface.  0x00000001 
Constants inherited from interface android.os.Parcelable

Public Constructors

            Surface(SurfaceSession s, int pid, int display, int w, int h, int format, int flags)
create a surface
            Surface()
Create an empty surface, which will later be filled in by readFromParcel().

Public Methods

          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.
          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.

Protected Methods

          void  finalize()
Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
Methods inherited from class java.lang.Object
Methods inherited from interface android.os.Parcelable

Details

Constants

public static final Creator<Surface> CREATOR

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.
Constant Value: 65536 (0x00010000)

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.
Constant Value: 131072 (0x00020000)

public static final int FX_SURFACE_MASK

Mask used for FX values above
Constant Value: 983040 (0x000f0000)

public static final int FX_SURFACE_NORMAL

Creates a normal surface. This is the default
Constant Value: 0 (0x00000000)

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.
Constant Value: 40 (0x00000028)

public static final int HARDWARE

The surface is to be used by hardware accelerators or DMA engines
Constant Value: 16 (0x00000010)

public static final int HIDDEN

Surface is created hidden
Constant Value: 4 (0x00000004)

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.
Constant Value: 256 (0x00000100)

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.
Constant Value: 512 (0x00000200)

public static final int ROTATION_0

Constant Value: 0 (0x00000000)

public static final int ROTATION_180

Constant Value: 2 (0x00000002)

public static final int ROTATION_270

Constant Value: 3 (0x00000003)

public static final int ROTATION_90

Constant Value: 1 (0x00000001)

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.
Constant Value: 128 (0x00000080)

public static final int SURACE_FROZEN

Freeze the surface. Equivalent to calling freeze()
Constant Value: 2 (0x00000002)

public static final int SURFACE_BLUR_FREEZE

Constant Value: 16 (0x00000010)

public static final int SURFACE_DITHER

Enable dithering when compositing this surface
Constant Value: 4 (0x00000004)

public static final int SURFACE_HIDDEN

Hide the surface. Equivalent to calling hide()
Constant Value: 1 (0x00000001)

Public Constructors

public Surface(SurfaceSession s, int pid, int display, int w, int h, int format, int flags)

create a surface

public Surface()

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

Public Methods

public void clear()

Call this free the surface up.

public static void closeTransaction()

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.

public int describeContents()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

public void freeze()

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.

public void hide()

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.

public Canvas lockCanvas(Rect dirty)

draw into a surface

public static void openTransaction()

start/end a transaction

public void readFromParcel(Parcel source)

public void setAlpha(float alpha)

public void setFlags(int flags, int mask)

public void setFreezeTint(int tint)

public void setLayer(int zorder)

set surface parameters. needs to be inside open/closeTransaction block

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

public static void setOrientation(int display, int orientation)

set the orientation of the given display.

public void setPosition(int x, int y)

public void setSize(int w, int h)

public void setTransparentRegionHint(Region region)

public void show()

public String toString()

Returns a string containing a concise, human-readable description of the receiver.

Returns

  • String a printable representation for the receiver.

public void unfreeze()

public static void unfreezeDisplay(int display)

resume updating the specified display.

public void unlockCanvas(Canvas canvas)

unlock the surface. the screen won't be updated until post() or postAll() is called

public void unlockCanvasAndPost(Canvas canvas)

unlock the surface and asks a page flip

public void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Protected Methods

protected void finalize()

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.

Throws

Throwable
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48