Home | History | Annotate | Download | only in cameraanalyzer
      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 #define LOG_NDEBUG 0
     17 
     18 #define LOG_TAG "FindColorCheckerJNI"
     19 #include <utils/Log.h>
     20 #include "com_android_cts_verifier_camera_analyzer_ColorCheckerTest.h"
     21 
     22 #include <string.h>
     23 #include "android/bitmap.h"
     24 #include "colorcheckertest.h"
     25 #include "testingimage.h"
     26 
     27 jlong Java_com_android_cts_verifier_camera_analyzer_ColorCheckerTest_createColorCheckerTest(
     28         JNIEnv*      env,
     29         jobject      thiz,
     30         jint         debugHeight,
     31         jint         debugWidth) {
     32     ColorCheckerTest* testHandler = new ColorCheckerTest(debugHeight,
     33                                                          debugWidth);
     34     long testHandlerAddress = (long)testHandler;
     35     return testHandlerAddress;
     36 }
     37 
     38 void Java_com_android_cts_verifier_camera_analyzer_ColorCheckerTest_createColorCheckerClass(
     39         JNIEnv*      env,
     40         jobject      thiz,
     41         jlong        inputImageAddress,
     42         jlong        inputHandlerAddress) {
     43     ALOGV("JNI createColorCheckerClass starts!");
     44 
     45     TestingImage *testImage = (TestingImage*) (long) inputImageAddress;
     46     ColorCheckerTest *testHandler = (ColorCheckerTest*)
     47             (long) inputHandlerAddress;
     48 
     49     testHandler->addTestingImage(testImage);
     50 }
     51 
     52 jboolean Java_com_android_cts_verifier_camera_analyzer_ColorCheckerTest_processColorCheckerTest(
     53         JNIEnv*      env,
     54         jobject      thiz,
     55         jlong        inputHandlerAddress) {
     56 
     57     ColorCheckerTest *testHandler = (ColorCheckerTest*)
     58             (long) inputHandlerAddress;
     59     testHandler->processData();
     60     return testHandler->getSuccess();
     61 }
     62 
     63 jlong Java_com_android_cts_verifier_camera_analyzer_ColorCheckerTest_getColorCheckerRadiusAdd(
     64         JNIEnv*      env,
     65         jobject      thiz,
     66         jlong        inputHandlerAddress) {
     67 
     68     ColorCheckerTest *testHandler = (ColorCheckerTest*)
     69             (long) inputHandlerAddress;
     70     long rtn = (long) testHandler->getCheckerRadiusAdd();
     71     return rtn;
     72 }
     73 
     74 jlong Java_com_android_cts_verifier_camera_analyzer_ColorCheckerTest_getColorCheckerCenterAdd(
     75         JNIEnv*      env,
     76         jobject      thiz,
     77         jlong        inputHandlerAddress) {
     78 
     79     ColorCheckerTest *testHandler = (ColorCheckerTest*)
     80             (long) inputHandlerAddress;
     81 
     82     long rtn = (long) testHandler->getCheckerCenterAdd();
     83     return rtn;
     84 }
     85