Hello,
I'm trying to make GPUimageview (com.bongole.ti.gpuimage) work with my appcelator project.
I've managed to get it to work on iOS with this xCode code:
- (void)initGreenscreen { self.videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPresetHigh cameraPosition:AVCaptureDevicePositionBack]; self.videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait; [self initFilter]; [self.videoCamera addTarget:self.filter]; self.cameraView = [[GPUImageView alloc] initWithFrame:self.view.frame]; self.cameraView.fillMode = kGPUImageFillModePreserveAspectRatioAndFill; [self.view addSubview:self.cameraView]; self.backgroundPicture = [[GPUImagePicture alloc] initWithImage:self.backgroundImage smoothlyScaleOutput:YES]; [self.backgroundPicture processImage]; [self.backgroundPicture addTarget:self.filter]; [self.filter addTarget:self.cameraView]; [self.backgroundPicture processImage]; }It works perfect! But now i'm trying for Android but it's not my best side :-)
I work with this code for Android to do the same as with xCODE:
@Kroll.method public TiViewProxy openCameraOnView(TiViewProxy proxy) { TiUIView view = proxy.getOrCreateView(); GPUImage imgView = new GPUImage(view.getNativeView().getContext()); imgView.setGLSurfaceView((GLSurfaceView) new GLSurfaceView(view.getNativeView().getContext())); //imgView.setImage(imageUri); // this loads image on the current thread, should be run in a thread imgView.setFilter(new GPUImageSepiaFilter()); mCamera = Camera.open(); imgView.setUpCamera(mCamera, 0, false, false); proxy.setView(view); return proxy; }And then call it from Appcelerator with this code:
var win = Ti.UI.createWindow({backgroundColor: '#c00000'}); var GI = require('com.bongole.ti.gpuimage'); var btn = Ti.UI.createButton({title: 'GO'}); win.add(btn); btn.addEventListener('click', function(e) { var startView = Ti.UI.createView({width: '100%', height: '100%',}); var cameraView = GI.openCameraOnView(startView); Ti.API.info('------------'); Ti.API.info('------------'); Ti.API.info('------------'); Ti.API.info(cameraView); Ti.API.info(typeof cameraView); Ti.API.info('------------'); Ti.API.info('------------'); Ti.API.info('------------'); win.add(cameraView); }); win.open();I don't get an error from the native Android module, and the Ti.API.info's show me "[object View]" and "object" but nothing happens in my app, i don't get to see an cameraview.
Does anybody has any experience with this?
Applicationtype: mobile Titanium SDK 3.5.1.GA Platform: Android Host: OSX Titanium Studio: Appcelerator Studio 4.0.0