surface 译

public          
        class
公共类

Surface

    extends Object
 
   
          implements
              Parcelable







java.lang.Object
   ? android.view.Surface

Class Overview类的概述



Handle onto a raw buffer that is being managed by the screen compositor.被屏幕合成器所管理的 原生缓冲区 的句柄。

Summary




               
             
   







Nested Classes内嵌的类
       
        
        
       
        class

Surface.OutOfResourcesException

surface没有资源异常

Exception thrown when a Canvas couldn‘t be locked with lockCanvas(Rect),
or when a SurfaceTexture could not successfully be allocated.

当一个canvas不能通过lockCanvas(Rect)被锁定时,或者一个SurfaceTexture不能成功的被分配。


       
       
       
               
       
       
       
               
       
       
       
               
       
       
       
               
   



















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

          public
          static
          final
          Creator<Surface>
CREATOR  

           
       






Public Constructors公共构造方法

           
           
           
           
           
           
       

Surface(SurfaceTexture
surfaceTexture)

  从一个SurfaceTexture中创建surface

Create Surface from a SurfaceTexture.


           
           
       
           
       
           
       
           
       
           
       
           
       
           
       
           
       
       






























Public Methods公共方法

           
           
           
           
           
            int
       

describeContents()

描述在这个Parcelables
马歇尔陈述中包含的各种对象

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


           
           
           
           
           
            boolean
       

isValid()

如果这个对象持有一个有效的surface,则返回true。

Returns true if this object holds a valid
surface.


           
           
           
           
           
            Canvas
       

lockCanvas(Rect
inOutDirty)

获取一张画布用来向这个surface中画画。

Gets a Canvas
for drawing into this surface.


           
           
           
           
           
            void
       

readFromParcel(Parcel
source)

从打包中读取数据(打包数据源)


           
           
           
           
           
            void
       

release()

释放指向服务端surface的本地连接。

Release the local reference to the server-side
surface.


           
           
           
           
           
            String
       

toString()

返回一个包含了精确,人类可读懂的这个对象的描述。

Returns a string containing a concise,
human-readable description of this object.


           
           
           
           
           
            void
       

unlockCanvas(Canvas
canvas)

在API7中这个方法被弃用了。

      This method
was deprecated       in API level 17.
    This API has been removed and is not supported. 
Do not use.


           
           
           
           
           
            void
       

unlockCanvasAndPost(Canvas
canvas)

提交这个canvas中新的内容到surface,并释放这个canvas。

Posts the new contents of the Canvas
to the surface and releases the Canvas.


           
           
           
           
           
            void
       

writeToParcel(Parcel
dest, int flags)

写到打包(目标导报对象,标记)。扁平化这个对象到一个包中。

Flatten this object in to a
Parcel.

   
       
       






Protected Methods受保护的方法

           
           
           
           
           
            void
       

finalize()

当垃圾回收器侦测到这个实例不再可读时,被调用。

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

Constants



public
        static
        final
        int      
        ROTATION_0

Added
in API
level 1

Rotation constant: 0 degree rotation (natural orientation)

Constant
Value:        
           
               
0
               
(0x00000000)

public
        static
        final
        int      
        ROTATION_180

Added
in API
level 1

Rotation constant: 180 degree rotation.

Constant
Value:        
           
               
2
               
(0x00000002)

public
        static
        final
        int      
        ROTATION_270

Added
in API
level 1

Rotation constant: 270 degree rotation.

Constant
Value:        
           
               
3
               
(0x00000003)

public
        static
        final
        int      
        ROTATION_90

Added
in API
level 1

Rotation constant: 90 degree rotation.

Constant
Value:        
           
               
1
               
(0x00000001)

Fields



public
        static
        final
        Creator<Surface>
     
        CREATOR

Added
in API
level 1

Public Constructors共有构造方法



public
        
        
        
        
             
      Surface
      (SurfaceTexture
surfaceTexture)

Added in API
level 14

从一个SurfaceTexture中创建surface。被画到surface的图像将会被SurfaceTexture可得到。SurfaceTexture可以通过updateTextImage()方法附加他们到一个开放的图形ES
texture。
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().

Parameters
     
       
         
             




surfaceTexture          

The SurfaceTexture
that is updated by this Surface.

通过这个Surface更新的surfaceTexture

Throws
       
       
           
             




Surface.OutOfResourcesException

抛出surface资源不可获得异常

if the surface could not be created.

如果这个surface不能创建

Public Methods



public
        
        
        
        
        int      
      describeContents       ()

Added in API
level 1

用这个包的
marshalled 描述方法来描述这个包内的 不同的对象。

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

Returns
     返回一个bitmask指示了这个包的marshalled的集合对象的类型
  • a bitmask indicating the set of special object types marshalled by the
    Parcelable.

public
        
        
        
        
        boolean
            isValid       ()

Added in API
level 1

如果这个对象持有一个有效的surface,则返回true

Returns true if this object holds a valid surface.

Returns
     如果它持有一个物理的surface,则返回true,因此lockCanvas()将会成功。否则返回false。
  • True if it holds a physical surface, so lockCanvas() will succeed.
    Otherwise returns false.

public
        
        
        
        
        Canvas
            lockCanvas       (Rect
inOutDirty)

Added in API
level 1

   获取一个canvas,用来画东西到这个surface中。当画到一个提供的Canvas中时,这个caller必需调用unlockCanvasAndPost(Canvas)来提交新的内容到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.

Parameters
     
       
         
             




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.

一个矩形代表dirty区域,调用者想在这个区域重画。这个功能可以选择去扩展这个dirty区域,如果例如这个surface大小被改变或者如果说surface先前的内容不再可以得到了。这个调用者必需重新绘制整个dirty区域
根据return这个函数返回的inOutDirty矩形区域。这个调用者或许也传递null,在这种情况下,整个surface应该被重画。

Returns
     返回一个canvas用来画到surface上
  • A canvas for drawing into the surface.

Throws
       
       
           
         
       
           
             







IllegalArgumentException
      非法参数异常     
If the inOutDirty rectangle is not valid.矩形无效的
Surface.OutOfResourcesException
     surface资源不可得异常      
If the canvas cannot be locked.如果这个画布不能被锁定

public
        
        
        
        
        void      
      readFromParcel       (Parcel
source)

Added in API
level 1

从这个包中读取资源

public
        
        
        
        
        void      
      release
      ()

Added in API
level 14

释放本地对服务端surface的连接指引。总是调用release()当你完成一个surface相关工作时。这会让surface无效。

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.

public
        
        
        
        
        String
            toString       ()

Added in API
level 1

         

    返回一个字符串,包含一个精确的,人类可读懂的对于这个对象的描述。子类被鼓励去重写这个方法并且提供一个实现。这个实现需要考虑这个对象的类型和数据。默认的实现与下面的表达相等
getClass().getName()+‘@‘+Integer,toHexString(hashCode())

请看一个有效的写的方法 toString()。如果你打算实现你自己的同String方法时。

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.

Returns
     
  • a printable representation of this object.返回一个打印的这个对象的描述。

public
        
        
        
        
        void      
      unlockCanvas
      (Canvas
canvas)

Added in API
level 1

      This method was
deprecated       in API level
17.

    This API has been removed and is not
supported.  Do not use.

public
        
        
        
        
        void      
      unlockCanvasAndPost       (Canvas
canvas)

Added in API
level 1

Posts the new contents of the Canvas
to the surface and releases the Canvas.

Parameters
     
       
         
             




canvas           The canvas previously obtained from lockCanvas(Rect).

public
        
        
        
        
        void      
      writeToParcel
      (Parcel
dest, int flags)

Added in API
level 1

扁平化这个对象到一个打包中。

Flatten this object in to a Parcel.

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

附加的标记关于这个对象被怎么写入。或许为0或许为PARCELABLE_WRITE_RETURN_VALUE

Protected Methods



protected
        
        
        
        
        void      
      finalize
      ()

Added in API
level 1

         

     
   调用当垃圾回收期侦测到这个实例不再可读时。虽然这个默认的实现没有做任何事情,但是这个方法可以重写到自由的资源。

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.
 注意对象重写finalize
值得注意的它比不重写的对象是更昂贵。当这个对象不再可读时,Finalizers或许运行很长一段时间,这依赖于内存的压力,因此依赖这个方法来实现cleanup是很不好的一个注意。另外也要注意finalizers运行在一个单独的VM
wide
finalizer线程,因此在一个finalizer中进行一个堵塞性的工作是非常不好的。一个finalizer通常仅仅在一个类有一个本地的peer而且需要调用一个本地方法去销毁那个同龄的peer。即使如此,最好提供一个明确的close方法(并实现Closeable),并且坚持这个callers人为的处理这个instance。这个有时工作的很好,例如对于files,但是对于一些像BigInteger这些典型的调用代码则会处理很多临时性的问题。不幸的是,创建很多临时性的代码是最烂的代码之一,就view的
单finalizer线程而言。

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.
如果你必须finalizers,考虑一下至少提供你自己的ReferenceQueue并且有你自己的队列线程。

If you must use finalizers, consider at least providing your own
ReferenceQueue
and having your own thread process that queue.
不像构造方法,finalizers不是自动的链接上的。你要自己负责调用super.finalize()方法。

Unlike constructors, finalizers are not automatically chained. You are
responsible for calling super.finalize() yourself.
由finalizers抛出的未捕捉的异常,被忽略。并且不决定这个finalizer线程。看
Effective Java Item7的“Avoid finalizers”获得更多的内容。

Uncaught exceptions thrown by finalizers are ignored and do not terminate the
finalizer thread.
See Effective Java Item 7, "Avoid finalizers"
for more.

Throws
       
       
           




Throwable
           
 

surface 译,布布扣,bubuko.com

时间: 2024-10-17 08:18:25

surface 译的相关文章

Visualize Surface by Delaunay Triangulator

Visualize Surface by Delaunay Triangulator [email protected] Abstract. Delaunay Triangulation is the core algorithm for mesh generation. By Delaunay Triangulator you can make a general method to visualize geometry surfaces, so does OpenCascade. The p

OpenCASCADE Linear Extrusion Surface

OpenCASCADE Linear Extrusion Surface [email protected] Abstract. OpenCASCADE linear extrusion surface is a generalized cylinder. Such a surface is obtained by sweeping a curve (called the “extruded curve” or “basis”) in a given direction (referred to

CSharpGL(56)[译]Vulkan入门(转)

阅读目录(Content) Background 背景 System Setup 系统安装 Linux Windows Building and Running 建设和运行 Linux Windows General Comments 基础命令 Code Structure 代码结构 Source walkthru 源代码浏览 CSharpGL(56)[译]Vulkan入门 本文是对(http://ogldev.atspace.co.uk/www/tutorial50/tutorial50.ht

关于机械英语翻译公司正确的译文,以下是英译中对照示例

今天为大家带来一篇关于机械英语翻译公司正确译文对照示例鉴赏文章,这篇文章是道壹翻译公司请添加链接描述张老师个人感悟,欢迎大家一起交流,感谢张老师在做英语翻译百忙之中给大家带来的文章. 机械英语翻译公司译文,以下是英译中对照示例: Surface dressing. In order to make the axle sleeve surface reach the accuracy of form and position as well as the surface roughness req

译:SOS_SCHEDULER_YIELD类型等待在虚拟机环境中的增多

原文出处:Increased SOS_SCHEDULER_YIELD waits on virtual machines 注: 原文的用词是Increased,想译作增强(增长),或者加强,这么译起来是褒义词,而原文要表达的Increased并没有褒义的含义,最起码是一个中性的含义,想来想起用一个“滋长”偏编译的含义还是比较合适的,感觉还是有点过于贬义了,还是用最通俗的增多吧.个人英语水平有限,另外就是对于文中提到的“rdtsc周期”也不是非常清楚,翻译的也不是很清楚,权当是自娱自乐.总是原文的

《100种过度医疗大公开》:转译自日文版,日文版依据的是美国的“Choosing Wisely”项目。三星推荐

本书转译自日文,日文版则是在美国的“Choosing Wisely”项目中选择了100个相对常见的过度医疗项目做解说.Choosing Wisely项目,是由美国多个专业医学组织发起的列出过度医疗项目的活动. 日文作者是兽医专业的新闻记者,中文译者不是医学专业人员,个别专业词语翻译有误,“随机对照试验”翻译成“随机比较试验”了,有些句子翻译的也比较别扭.基于以上两点,这本书的权威性可信度我认为都不算太高,只能给三星.感兴趣的话还是应该直接上网看英文原版. 以下是书中部分信息的摘抄: 1:以美国内

博译有道——关于外文书籍的翻译

有人说,中国古代曾经被人津津乐道的诸如木流牛马之类的工匠发明和创造之所以没有被后人所重现,是因为创作者只知其术,不懂传道.在门户之见成风,传道授艺大多通过手把手教.口口相传的古代,可想而知像<本草纲目>这样的著作的重要性.同样在今天,无论是原创,还是转载,通过互联网广泛传播碎片化知识的同时,作为系统性的.汇总性的书籍显得颇为难能可贵,即便是将一本国外早已出版的书籍引入到国内出版. 经过长达六个月的付出和守候,由IDF实验室成员翻译.机械工业出版社出版的<Hacking with Kali

[email&#160;protected]一个高效的配置管理工具--Ansible configure management--翻译(六)

无书面许可请勿转载 高级playbook Finding files with variables All modules can take variables as part of their arguments by dereferencing them with {{ and }} . You can use this to load a particular file based on a variable. For example, you might want to select a

【译】Unity3D Shader 新手教程(2/6) &mdash;&mdash; 积雪Shader

如果你是一个shader编程的新手,并且你想学到下面这些酷炫的技术,我觉得你可以看看这篇教程: 实现一个积雪效果的shader 创建一个具有凹凸纹理的shader 为每个像素修改其对应纹理值 在表面着色器中修改模型的顶点数据 引论 这是我们系列教程的第二部分,我们将在此部分实现些有用的技术.在学习完第一部分的所有背景知识后,我们将利用所学的知识实现一个简单的积雪效果的shader.效果如下: 准备工作 我们想做的其实很简单,简单介绍一下: 随着Snow Level(表示积雪的程度,该值越大,积雪