Loading core/jni/android/graphics/MaskFilter.cpp +21 −0 Original line number Diff line number Diff line #include "GraphicsJNI.h" #include "SkMaskFilter.h" #include "SkBlurMaskFilter.h" #include "SkTableMaskFilter.h" #include <jni.h> Loading Loading @@ -39,6 +40,19 @@ public: ThrowIAE_IfNull(env, filter); return filter; } static SkMaskFilter* createTable(JNIEnv* env, jobject, jbyteArray jtable) { AutoJavaByteArray autoTable(env, jtable, 256); return new SkTableMaskFilter((const uint8_t*)autoTable.ptr()); } static SkMaskFilter* createClipTable(JNIEnv* env, jobject, int min, int max) { return SkTableMaskFilter::CreateClip(min, max); } static SkMaskFilter* createGammaTable(JNIEnv* env, jobject, float gamma) { return SkTableMaskFilter::CreateGamma(gamma); } }; static JNINativeMethod gMaskFilterMethods[] = { Loading @@ -53,6 +67,12 @@ static JNINativeMethod gEmbossMaskFilterMethods[] = { { "nativeConstructor", "([FFFF)I", (void*)SkMaskFilterGlue::createEmboss } }; static JNINativeMethod gTableMaskFilterMethods[] = { { "nativeNewTable", "([B)I", (void*)SkMaskFilterGlue::createTable }, { "nativeNewClip", "(II)I", (void*)SkMaskFilterGlue::createClipTable }, { "nativeNewGamma", "(F)I", (void*)SkMaskFilterGlue::createGammaTable } }; #include <android_runtime/AndroidRuntime.h> #define REG(env, name, array) \ Loading @@ -67,6 +87,7 @@ int register_android_graphics_MaskFilter(JNIEnv* env) REG(env, "android/graphics/MaskFilter", gMaskFilterMethods); REG(env, "android/graphics/BlurMaskFilter", gBlurMaskFilterMethods); REG(env, "android/graphics/EmbossMaskFilter", gEmbossMaskFilterMethods); REG(env, "android/graphics/TableMaskFilter", gTableMaskFilterMethods); return 0; } Loading graphics/java/android/graphics/TableMaskFilter.java 0 → 100644 +46 −0 Original line number Diff line number Diff line /* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.graphics; /** * @hide */ public class TableMaskFilter extends MaskFilter { public TableMaskFilter(byte[] table) { if (table.length < 256) { throw new RuntimeException("table.length must be >= 256"); } native_instance = nativeNewTable(table); } private TableMaskFilter(int ni) { native_instance = ni; } public static TableMaskFilter CreateClipTable(int min, int max) { return new TableMaskFilter(nativeNewClip(min, max)); } public static TableMaskFilter CreateGammaTable(float gamma) { return new TableMaskFilter(nativeNewGamma(gamma)); } private static native int nativeNewTable(byte[] table); private static native int nativeNewClip(int min, int max); private static native int nativeNewGamma(float gamma); } Loading
core/jni/android/graphics/MaskFilter.cpp +21 −0 Original line number Diff line number Diff line #include "GraphicsJNI.h" #include "SkMaskFilter.h" #include "SkBlurMaskFilter.h" #include "SkTableMaskFilter.h" #include <jni.h> Loading Loading @@ -39,6 +40,19 @@ public: ThrowIAE_IfNull(env, filter); return filter; } static SkMaskFilter* createTable(JNIEnv* env, jobject, jbyteArray jtable) { AutoJavaByteArray autoTable(env, jtable, 256); return new SkTableMaskFilter((const uint8_t*)autoTable.ptr()); } static SkMaskFilter* createClipTable(JNIEnv* env, jobject, int min, int max) { return SkTableMaskFilter::CreateClip(min, max); } static SkMaskFilter* createGammaTable(JNIEnv* env, jobject, float gamma) { return SkTableMaskFilter::CreateGamma(gamma); } }; static JNINativeMethod gMaskFilterMethods[] = { Loading @@ -53,6 +67,12 @@ static JNINativeMethod gEmbossMaskFilterMethods[] = { { "nativeConstructor", "([FFFF)I", (void*)SkMaskFilterGlue::createEmboss } }; static JNINativeMethod gTableMaskFilterMethods[] = { { "nativeNewTable", "([B)I", (void*)SkMaskFilterGlue::createTable }, { "nativeNewClip", "(II)I", (void*)SkMaskFilterGlue::createClipTable }, { "nativeNewGamma", "(F)I", (void*)SkMaskFilterGlue::createGammaTable } }; #include <android_runtime/AndroidRuntime.h> #define REG(env, name, array) \ Loading @@ -67,6 +87,7 @@ int register_android_graphics_MaskFilter(JNIEnv* env) REG(env, "android/graphics/MaskFilter", gMaskFilterMethods); REG(env, "android/graphics/BlurMaskFilter", gBlurMaskFilterMethods); REG(env, "android/graphics/EmbossMaskFilter", gEmbossMaskFilterMethods); REG(env, "android/graphics/TableMaskFilter", gTableMaskFilterMethods); return 0; } Loading
graphics/java/android/graphics/TableMaskFilter.java 0 → 100644 +46 −0 Original line number Diff line number Diff line /* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.graphics; /** * @hide */ public class TableMaskFilter extends MaskFilter { public TableMaskFilter(byte[] table) { if (table.length < 256) { throw new RuntimeException("table.length must be >= 256"); } native_instance = nativeNewTable(table); } private TableMaskFilter(int ni) { native_instance = ni; } public static TableMaskFilter CreateClipTable(int min, int max) { return new TableMaskFilter(nativeNewClip(min, max)); } public static TableMaskFilter CreateGammaTable(float gamma) { return new TableMaskFilter(nativeNewGamma(gamma)); } private static native int nativeNewTable(byte[] table); private static native int nativeNewClip(int min, int max); private static native int nativeNewGamma(float gamma); }