IT. Expert System.

Android Reference



Class Surface

  • All Implemented Interfaces:

    public class Surface
    extends Object
    implements Parcelable
    Handle onto a raw buffer that is being managed by the screen compositor.
    • Field Detail

      • ROTATION_0

        public static final int ROTATION_0
        Rotation constant: 0 degree rotation (natural orientation)
        See Also:
        Constant Field Values
      • ROTATION_90

        public static final int ROTATION_90
        Rotation constant: 90 degree rotation.
        See Also:
        Constant Field Values
      • ROTATION_180

        public static final int ROTATION_180
        Rotation constant: 180 degree rotation.
        See Also:
        Constant Field Values
      • ROTATION_270

        public static final int ROTATION_270
        Rotation constant: 270 degree rotation.
        See Also:
        Constant Field Values

        public static final int BUILT_IN_DISPLAY_ID_MAIN
        Built-in physical display id: Main display. Use only with #getBuiltInDisplay().
        See Also:
        Constant Field Values

        public static final int BUILT_IN_DISPLAY_ID_HDMI
        Built-in physical display id: Attached HDMI display. Use only with #getBuiltInDisplay().
        See Also:
        Constant Field Values
      • HIDDEN

        public static final int HIDDEN
        Surface creation flag: Surface is created hidden
        See Also:
        Constant Field Values
      • SECURE

        public static final int SECURE
        Surface creation flag: 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

        public static final int NON_PREMULTIPLIED
        Surface creation flag: 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
      • OPAQUE

        public static final int OPAQUE
        Surface creation flag: Indicates that the surface must be considered opaque, even if its pixel format is set to translucent. This can be useful if an application needs full RGBA 8888 support for instance but will still draw every pixel opaque.
        See Also:
        Constant Field Values

        public static final int PROTECTED_APP
        Surface creation flag: Application requires a hardware-protected path to an external display sink. If a hardware-protected path is not available, then this surface will not be displayed on the external sink.
        See Also:
        Constant Field Values

        public static final int FX_SURFACE_NORMAL
        Surface creation flag: Creates a normal surface. This is the default.
        See Also:
        Constant Field Values

        public static final int FX_SURFACE_BLUR
        Surface creation flag: 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

        public static final int FX_SURFACE_DIM
        Surface creation flag: Creates a Dim surface. Everything behind this surface is dimmed by the amount specified in setAlpha(float). It is an error to lock a Dim surface, since it doesn't have a backing store.
        See Also:
        Constant Field Values

        public static final int FX_SURFACE_MASK
        Mask used for FX values above.
        See Also:
        Constant Field Values

        public static final int SURFACE_HIDDEN
        Surface flag: Hide the surface. Equivalent to calling hide().
        See Also:
        Constant Field Values
    • Constructor Detail

      • Surface

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

        public Surface(SurfaceSession session,
               String name,
               int w,
               int h,
               int format,
               int flags)
                throws Surface.OutOfResourcesException
        Create a surface with a name. The surface creation flags specify what kind of surface to create and certain options such as whether the surface can be assumed to be opaque and whether it should be initially hidden. Surfaces should always be created with the HIDDEN flag set to ensure that they are not made visible prematurely before all of the surface's properties have been configured. Good practice is to first create the surface with the HIDDEN flag specified, open a transaction, set the surface layer, layer stack, alpha, and position, call show() if appropriate, and close the transaction.
        session - The surface session, must not be null.
        name - The surface name, must not be null.
        w - The surface initial width.
        h - The surface initial height.
        flags - The surface creation flags. Should always include HIDDEN in the creation flags.
    • Method Detail

      • finalize

        protected void finalize()
                         throws Throwable
        Description copied from class: Object
        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.

        finalize in class Object
      • release

        public void release()
        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.
      • destroy

        public void destroy()
        Free all server-side state associated with this surface and release this object's reference. This method can only be called from the process that created the service.
      • isValid

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

        public int getGenerationId()
        Gets the generation number of this surface, incremented each time the native surface contained within this object changes.
        The current generation number.
      • isConsumerRunningBehind

        public boolean isConsumerRunningBehind()
        Returns true if the consumer of this Surface is running behind the producer.
        True if the consumer is more than one buffer ahead of the producer.
      • lockCanvas

        public Canvas lockCanvas(Rect dirty)
                          throws Surface.OutOfResourcesException,
        Gets a Canvas for drawing into this surface. After drawing into the provided Canvas, the caller should invoke unlockCanvasAndPost( to post the new contents to the surface.
        dirty - 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 should redraw the entire dirty region as represented by the contents of the dirty rect upon return from this function. The caller may also pass null instead, in the case where the entire surface should be redrawn.
        A canvas for drawing into the surface.
      • unlockCanvas

        public void unlockCanvas(Canvas canvas)
        Deprecated. This API has been removed and is not supported. Do not use.
      • screenshot

        public static Bitmap screenshot(int width,
                        int height,
                        int minLayer,
                        int maxLayer)
        Copy the current screen contents into a bitmap and return it.
        width - The desired width of the returned bitmap; the raw screen will be scaled down to this size.
        height - The desired height of the returned bitmap; the raw screen will be scaled down to this size.
        minLayer - The lowest (bottom-most Z order) surface layer to include in the screenshot.
        maxLayer - The highest (top-most Z order) surface layer to include in the screenshot.
        Returns a Bitmap containing the screen contents, or null if an error occurs.
      • openTransaction

        public static void openTransaction()
        start a transaction @hide
      • closeTransaction

        public static void closeTransaction()
        end a transaction @hide
      • setAnimationTransaction

        public static void setAnimationTransaction()
        flag the transaction as an animation @hide
      • setLayer

        public void setLayer(int zorder)
      • setPosition

        public void setPosition(int x,
                       int y)
      • setPosition

        public void setPosition(float x,
                       float 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)
      • setFlags

        public void setFlags(int flags,
                    int mask)
      • setWindowCrop

        public void setWindowCrop(Rect crop)
      • setLayerStack

        public void setLayerStack(int layerStack)
      • getBuiltInDisplay

        public static IBinder getBuiltInDisplay(int builtInDisplayId)
      • createDisplay

        public static IBinder createDisplay(String name,
                            boolean secure)
      • setDisplaySurface

        public static void setDisplaySurface(IBinder displayToken,
                             Surface surface)
      • setDisplayLayerStack

        public static void setDisplayLayerStack(IBinder displayToken,
                                int layerStack)
      • setDisplayProjection

        public static void setDisplayProjection(IBinder displayToken,
                                int orientation,
                                Rect layerStackRect,
                                Rect displayRect)
      • blankDisplay

        public static void blankDisplay(IBinder displayToken)
      • unblankDisplay

        public static void unblankDisplay(IBinder displayToken)
      • copyFrom

        public void copyFrom(Surface other)
        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. This is for use by the window manager when returning a window surface back from a client, converting it from the representation being managed by the window manager to the representation the client uses to draw in to it.
      • transferFrom

        public void transferFrom(Surface other)
        Transfer the native state from 'other' to this surface, releasing it from 'other'. This is for use in the client side for drawing into a surface; not guaranteed to work on the window manager side. This is for use by the client to move the underlying surface from one Surface object to another, in particular in SurfaceFlinger.
      • 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
        a bitmask indicating the set of special object types marshalled by the Parcelable.
      • readFromParcel

        public void readFromParcel(Parcel source)
      • toString

        public String toString()
        Description copied from class: Object
        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.

        toString in class Object
        a printable representation of this object.


Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)





Java Script








Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 395 / 159524271. Delta: 0.04151 с