MosaicRenderer.java revision eeb94d4de94bfd4e01f3a716803f77a530f5b92c
1/* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.camera.panorama; 18 19/** 20 * The Java interface to JNI calls regarding mosaic preview rendering. 21 * 22 */ 23public class MosaicRenderer 24{ 25 static 26 { 27 System.loadLibrary("jni_mosaic"); 28 } 29 30 /** 31 * Function to be called in onSurfaceCreated() to initialize 32 * the GL context, load and link the shaders and create the 33 * program. 34 */ 35 public static native void init(); 36 37 /** 38 * Pass the drawing surface's width and height to initialize the 39 * renderer viewports and FBO dimensions. 40 * 41 * @param width width of the drawing surface in pixels. 42 * @param height height of the drawing surface in pixels. 43 */ 44 public static native void reset(int width, int height); 45 46 /** 47 * Function to be called in onDrawFrame() to update the screen with 48 * the new frame data. 49 */ 50 public static native void step(); 51 52 /** 53 * Call this function when a new low-res frame has been processed by 54 * the mosaicing library. This will tell the renderer library to 55 * update its texture and warping transformation. Any calls to step() 56 * after this call will use the new image frame and transformation data. 57 */ 58 public static native void ready(); 59 60 /** 61 * This function allows toggling between showing the input image data 62 * (without applying any warp) and the warped image data. This is more 63 * for debugging purposes to see if the image data is being updated 64 * correctly or not. 65 */ 66 public static native void togglewarping(); 67} 68