Surfacepublic class Surface extends Object implements android.os.ParcelableHandle on to a raw buffer that is being managed by the screen compositor. |
Fields Summary |
---|
private static final String | LOG_TAG | public static final int | HIDDENSurface is created hidden | public static final int | HARDWAREThe surface is to be used by hardware accelerators or DMA engines | public static final int | GPUImplies "HARDWARE", the surface is to be used by the GPU
additionally the backbuffer is never preserved for these
surfaces. | public static final int | SECUREThe 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. | public static final int | NON_PREMULTIPLIEDCreates 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. | public static final int | PUSH_BUFFERSCreates 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. | public static final int | FX_SURFACE_NORMALCreates a normal surface. This is the default | public static final int | FX_SURFACE_BLURCreates 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. | public static final int | FX_SURFACE_DIMCreates 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. | public static final int | FX_SURFACE_MASKMask used for FX values above | public static final int | SURFACE_HIDDENHide the surface. Equivalent to calling hide() | public static final int | SURACE_FROZENFreeze the surface. Equivalent to calling freeze() | public static final int | SURFACE_DITHEREnable dithering when compositing this surface | public static final int | SURFACE_BLUR_FREEZE | public static final int | ROTATION_0 | public static final int | ROTATION_90 | public static final int | ROTATION_180 | public static final int | ROTATION_270 | public static final int | FLAGS_ORIENTATION_ANIMATION_DISABLEDisable the orientation animation
{@hide} | private int | mSurface | private int | mSaveCount | private Canvas | mCanvas | public static final Parcelable.Creator | CREATOR |
Constructors Summary |
---|
public Surface(SurfaceSession s, int pid, int display, int w, int h, int format, int flags)create a surface
{@hide} nativeClassInit();
mCanvas = new Canvas();
init(s,pid,display,w,h,format,flags);
| public Surface()Create an empty surface, which will later be filled in by
readFromParcel().
{@hide}
mCanvas = new Canvas();
| private Surface(android.os.Parcel source)
init(source);
|
Methods Summary |
---|
public native void | clear()Call this free the surface up. {@hide}
| public static native void | closeTransaction(){@hide}
| public native void | copyFrom(android.view.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.
{@hide}
| public int | describeContents()
return 0;
| protected void | finalize()
/* no user serviceable parts here ... */
clear();
| public native void | freeze()
| public static native 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 native void | hide()
| private native void | init(SurfaceSession s, int pid, int display, int w, int h, int format, int flags)
| private native void | init(android.os.Parcel source)
| public native 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
/* the dirty rectangle may be expanded to the surface's size, if
* for instance it has been resized or if the bits were lost, since
* the last call.
*/
return lockCanvasNative(dirty);
| private native Canvas | lockCanvasNative(Rect dirty)
| private static native void | nativeClassInit()
| public static native void | openTransaction()start/end a transaction {@hide}
| public native void | readFromParcel(android.os.Parcel source)
| public native void | setAlpha(float alpha)
| public native void | setFlags(int flags, int mask)
| public native void | setFreezeTint(int tint)
| public native void | setLayer(int zorder)set surface parameters.
needs to be inside open/closeTransaction block
| public native void | setMatrix(float dsdx, float dtdx, float dsdy, float dtdy)
| public static native void | setOrientation(int display, int orientation, int flags)set the orientation of the given display.
| public static void | setOrientation(int display, int orientation)set the orientation of the given display.
setOrientation(display, orientation, 0);
| public native void | setPosition(int x, int y)
| public native void | setSize(int w, int h)
| public native void | setTransparentRegionHint(Region region)
| public native void | show()
| public java.lang.String | toString()
return "Surface(native-token=" + mSurface + ")";
| public native void | unfreeze()
| public static native void | unfreezeDisplay(int display)resume updating the specified display.
| public native void | unlockCanvas(Canvas canvas)unlock the surface. the screen won't be updated until
post() or postAll() is called
| public native void | unlockCanvasAndPost(Canvas canvas)unlock the surface and asks a page flip
| public native void | writeToParcel(android.os.Parcel dest, int flags)
|
|