[Android Doc] SurfaceView

박주호·2022년 4월 18일
0

SurfaceView

원본 문서

Provides a dedicated drawing surface embedded inside of a view hierarchy. You can control the format of this surface and, if you like, its size; the SurfaceView takes care of placing the surface at the correct location on the screen

뷰 계층 내부에 내재된 그리기 전용 화면(=표면 직역)을 제공한다. 이 화면 형식(포맷)을 조작할 수 있고 만약 사이즈를 조절하기 원한다면 SurfaceView(이하 서피스뷰)는 화면의 적절한 위치에 화면에 위치하는걸 처리한다.

The surface is Z ordered so that it is behind the window holding its SurfaceView; the SurfaceView punches a hole in its window to allow its surface to be displayed. The view hierarchy will take care of correctly compositing with the Surface any siblings of the SurfaceView that would normally appear on top of it. This can be used to place overlays such as buttons on top of the Surface, though note however that it can have an impact on performance since a full alpha-blended composite will be performed each time the Surface changes.

surface는 해당 서피스뷰를 홀딩하는 윈도우 뒤에 있기 때문에 Z축에 정렬된다. 서피스뷰는 해당 화면이 표시되도록 하기위해서 창에 공간을 뚫는다. 뷰 계층은 일반적으로 서피스뷰 위에 표시되는 유사 뷰를 적절하게 합성처리한다. 서피스뷰는 화면 위에 버튼 같은 중첩들을 배치하는데 사용할 수 있다. 그렇지만 매 화면 변화에 실행되는 전체 알파블렌디드 합성 떄문에 퍼포먼스에 영향을 끼칠 수 있다.

The transparent region that makes the surface visible is based on the layout positions in the view hierarchy. If the post-layout transform properties are used to draw a sibling view on top of the SurfaceView, the view may not be properly composited with the surface.

화면을 보여줄수 있는 투명 영역은 뷰 계층의 레이아웃 위치를 기반으로 한다. 만약 투명 레이아웃 속성이 서피스뷰 상단에 뷰를 그리는데 사용된다면 뷰는 적절하게 합성작업이 되지 않을 수 있다.

Access to the underlying surface is provided via the SurfaceHolder interface, which can be retrieved by calling getHolder(). The Surface will be created for you while the SurfaceView's window is visible; you should implement SurfaceHolder.Callback#surfaceCreated and SurfaceHolder.Callback#surfaceDestroyed to discover when the Surface is created and destroyed as the window is shown and hidden.

밑에 있는 서피스에 접근은 getHolder 함수를 불러올 수 있는 서피스홀더 인터페이스를 통해 제공된다. 화면은 서피스 화면이 보이는 동안 유저를 위해 생성될 수 있다. 화면이 생성되고 삭제될 때를 발견하기 위해 surfaceHolder 콜백을 사용해야한다.

One of the purposes of this class is to provide a surface in which a secondary thread can render into the screen. If you are going to use it this way, you need to be aware of some threading semantics:

이런 클래스를 사용하는 목적 중 하나는 화면으로 두번째 스레드를 만드는 것을 제공하는 것이다. 만약 이런 방식으로 사용한다면 스레딩 시스템의 의미를 알아야한다.

All SurfaceView and SurfaceHolder.Callback methods will be called from the thread running the SurfaceView's window (typically the main thread of the application). They thus need to correctly synchronize with any state that is also touched by the drawing thread.

모든 서피스뷰와 서피스홀더 메소드는 서페이스뷰 화면을 실행하는 스레드로부터 호출된다. (특히 앱의 메인스레드) 그러므로 그 스레드들은 화면을 그리는 뷰로부터 접촉하는 상태에 적절하게 동기화할 필요가 있다.

You must ensure that the drawing thread only touches the underlying Surface while it is valid -- between SurfaceHolder.Callback.surfaceCreated() and SurfaceHolder.Callback.surfaceDestroyed().

화면을 그리는 스레드는 서피스뷰홀더 사이에서 하단 화면이 유효한 동안에만 접촉해야한다.

Note: Starting in platform version Build.VERSION_CODES.N, SurfaceView's window position is updated synchronously with other View rendering. This means that translating and scaling a SurfaceView on screen will not cause rendering artifacts. Such artifacts may occur on previous versions of the platform when its window is positioned asynchronously.

빌드버전 N(api 24)부터 서피스뷰 화면 위치는 다른 뷰 렌더링과 동기적으로 갱신된다.

📗 단어 정리 📘

영어한글
dedicated전용
take care of처리하다
be ordered정렬된다
compositing합성 작업
be used to~에 사용되어
though(비록)~이긴 하지만
properties속성
underlying(다른 것의)밑에 있는
discover발견하다
be aware of~을 알다
semantics(시스템의)의미
profile
항상 배우려는 자세로

0개의 댓글