Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QtTextureView.java
Go to the documentation of this file.
1// Copyright (C) 2014 BogDan Vatra <bogdan@kde.org>
2// Copyright (C) 2016 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5package org.qtproject.qt.android;
6
7import android.annotation.SuppressLint;
8import android.content.Context;
9import android.graphics.SurfaceTexture;
10import android.view.Surface;
11import android.view.TextureView;
12
13@SuppressLint("ViewConstructor")
14class QtTextureView extends TextureView implements TextureView.SurfaceTextureListener
15{
16 private final QtSurfaceInterface m_surfaceCallback;
17 private boolean m_staysOnTop;
18 private Surface m_surface;
19
20 QtTextureView(Context context, QtSurfaceInterface surfaceCallback, boolean isOpaque)
21 {
22 super(context);
23 setFocusable(false);
24 setFocusableInTouchMode(false);
25 m_surfaceCallback = surfaceCallback;
26 setSurfaceTextureListener(this);
27 setOpaque(isOpaque);
28 setSurfaceTexture(new SurfaceTexture(false));
29 }
30
31 @Override
32 public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) {
33 m_surface = new Surface(surfaceTexture);
34 m_surfaceCallback.onSurfaceChanged(m_surface);
35 }
36
37 @Override
38 public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int width, int height) {
39 m_surface = new Surface(surfaceTexture);
40 m_surfaceCallback.onSurfaceChanged(m_surface);
41 }
42
43 @Override
44 public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
45 m_surfaceCallback.onSurfaceChanged(null);
46 return true;
47 }
48
49 @Override
50 public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
51 }
52}
QPainter Context
static const QString context()
Definition java.cpp:398
GLint GLsizei width