19066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* libs/android_runtime/android/graphics/PorterDuff.cpp
29066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project**
39066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project** Copyright 2006, The Android Open Source Project
49066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project**
59066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project** Licensed under the Apache License, Version 2.0 (the "License");
69066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project** you may not use this file except in compliance with the License.
79066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project** You may obtain a copy of the License at
89066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project**
99066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project**     http://www.apache.org/licenses/LICENSE-2.0
109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project**
119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project** Unless required by applicable law or agreed to in writing, software
129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project** distributed under the License is distributed on an "AS IS" BASIS,
139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project** See the License for the specific language governing permissions and
159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project** limitations under the License.
169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project*/
179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// This file was generated from the C++ include file: SkPorterDuff.h
199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// Any changes made to this file will be discarded by the build.
209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// To change this file, either edit the include, or device/tools/gluemaker/main.cpp,
219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project// or one of the auxilary file specifications in device/tools/gluemaker.
229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#include "jni.h"
249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#include "GraphicsJNI.h"
259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#include <android_runtime/AndroidRuntime.h>
269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project#include "SkPorterDuff.h"
289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectnamespace android {
309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectclass SkPorterDuffGlue {
329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpublic:
339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3436bef0bf30d6bae48cf3837df351075ca4fce654Ashok Bhat    static jlong CreateXfermode(JNIEnv* env, jobject, jint modeHandle) {
3536bef0bf30d6bae48cf3837df351075ca4fce654Ashok Bhat        SkPorterDuff::Mode mode = static_cast<SkPorterDuff::Mode>(modeHandle);
3636bef0bf30d6bae48cf3837df351075ca4fce654Ashok Bhat        return reinterpret_cast<jlong>(SkPorterDuff::CreateXfermode(mode));
379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project};
409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectstatic JNINativeMethod methods[] = {
4236bef0bf30d6bae48cf3837df351075ca4fce654Ashok Bhat    {"nativeCreateXfermode","(I)J", (void*) SkPorterDuffGlue::CreateXfermode},
439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project};
449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectint register_android_graphics_PorterDuff(JNIEnv* env) {
469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    int result = AndroidRuntime::registerNativeMethods(env,
479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                                "android/graphics/PorterDuffXfermode", methods,
489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project                                        sizeof(methods) / sizeof(methods[0]));
499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    return result;
509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
53