@@ -31,8 +31,6 @@ public static void log(String log) {
31
31
System .out .println (log );
32
32
}
33
33
34
- private PApplet applet ;
35
-
36
34
private Camera mCamera ;
37
35
38
36
private static ArrayList <String > camerasList = new ArrayList <String >();
@@ -63,24 +61,24 @@ public static void log(String log) {
63
61
64
62
private boolean isAvailable = false ;
65
63
66
- public Capture (PApplet context ) {
67
- this (context , -1 , -1 );
64
+ public Capture (PApplet parent ) {
65
+ this (parent , -1 , -1 );
68
66
}
69
67
70
- public Capture (final PApplet applet , int width , int height ) {
68
+ public Capture (final PApplet parent , int width , int height ) {
71
69
super ();
72
- this .applet = applet ;
70
+ this .parent = parent ;
73
71
if (width == -1 || height == -1 ) {
74
72
//TODO: Temp hack. Needs to be handled intelligently.
75
73
width = 720 ;
76
74
height = 1280 ;
77
75
}
78
76
init (width , height , ARGB );
79
77
80
- applet .registerMethod ("pause" , this );
81
- applet .registerMethod ("resume" , this );
82
- glView = (GLSurfaceView ) applet .getSurfaceView ();
83
- pg = (PGraphicsOpenGL )applet .g ;
78
+ parent .registerMethod ("pause" , this );
79
+ parent .registerMethod ("resume" , this );
80
+ glView = (GLSurfaceView ) parent .getSurfaceView ();
81
+ pg = (PGraphicsOpenGL )parent .g ;
84
82
// customTexture = new Texture(pg, width, height);
85
83
// customTexture.invertedY(true);
86
84
glView .queueEvent (new Runnable () {
@@ -91,7 +89,7 @@ public void run() {
91
89
}
92
90
});
93
91
// pg.setCache(this, customTexture);
94
- applet .runOnUiThread (new Runnable () {
92
+ parent .runOnUiThread (new Runnable () {
95
93
@ Override
96
94
public void run () {
97
95
mCameraHandler = new CameraHandler (Capture .this );
@@ -303,7 +301,7 @@ public void stopCamera() {
303
301
304
302
@ Override
305
303
public void startPreview () {
306
- if (applet .getSurfaceHolder ().getSurface () == null ) {
304
+ if (parent .getSurfaceHolder ().getSurface () == null ) {
307
305
// preview surface does not exist
308
306
return ;
309
307
}
@@ -417,7 +415,7 @@ private void prepareFrameBuffers() {
417
415
public void getImage (boolean loadPixels ) {
418
416
419
417
if (destpg == null || destpg .width != width || destpg .height != height ) {
420
- destpg = (PGraphicsOpenGL ) applet .createGraphics (width , height , PConstants .P2D );
418
+ destpg = (PGraphicsOpenGL ) parent .createGraphics (width , height , PConstants .P2D );
421
419
destpg .pgl .setGlThread (Thread .currentThread ());
422
420
}
423
421
0 commit comments