diff --git a/library/src/main/cpp/BlurUtil.cpp b/library/src/main/cpp/BlurUtil.cpp index b43d6c4..b953011 100644 --- a/library/src/main/cpp/BlurUtil.cpp +++ b/library/src/main/cpp/BlurUtil.cpp @@ -19,7 +19,7 @@ jint clamp(jint i, jint minValue, jint maxValue) { JNIEXPORT void JNICALL -Java_com_hoko_ktblur_ext_BitmapExtensionKt_replaceWithPixels(JNIEnv *env, jclass clazz, jobject jbitmap, +Java_com_hoko_ktblur_ext_BitmapExtensionKt_nativeReplaceWithPixels(JNIEnv *env, jclass clazz, jobject jbitmap, jintArray j_inArray, jint j_x, jint j_y, jint j_deltaW, jint j_deltaH) { diff --git a/library/src/main/cpp/include/BlurUtil.h b/library/src/main/cpp/include/BlurUtil.h index cff93ab..299567c 100644 --- a/library/src/main/cpp/include/BlurUtil.h +++ b/library/src/main/cpp/include/BlurUtil.h @@ -22,7 +22,7 @@ enum Direction{ jint clamp(jint i, jint minValue, jint maxValue); JNIEXPORT void JNICALL -Java_com_hoko_ktblur_ext_BitmapExtensionKt_replaceWithPixels(JNIEnv *, jclass , jobject, +Java_com_hoko_ktblur_ext_BitmapExtensionKt_nativeReplaceWithPixels(JNIEnv *, jclass , jobject, jintArray j_inArray, jint, jint, jint, jint); #ifdef __cplusplus diff --git a/library/src/main/java/com/hoko/ktblur/api/BlurBuild.kt b/library/src/main/java/com/hoko/ktblur/api/BlurBuild.kt index 174057c..be463ff 100644 --- a/library/src/main/java/com/hoko/ktblur/api/BlurBuild.kt +++ b/library/src/main/java/com/hoko/ktblur/api/BlurBuild.kt @@ -3,7 +3,6 @@ package com.hoko.ktblur.api import android.content.Context import android.graphics.Bitmap import android.view.View -import com.hoko.ktblur.task.BlurCallback import kotlinx.coroutines.Job interface BlurBuild { diff --git a/library/src/main/java/com/hoko/ktblur/task/BlurCallback.kt b/library/src/main/java/com/hoko/ktblur/api/BlurCallback.kt similarity index 93% rename from library/src/main/java/com/hoko/ktblur/task/BlurCallback.kt rename to library/src/main/java/com/hoko/ktblur/api/BlurCallback.kt index 6f06d93..4e10b4a 100644 --- a/library/src/main/java/com/hoko/ktblur/task/BlurCallback.kt +++ b/library/src/main/java/com/hoko/ktblur/api/BlurCallback.kt @@ -1,4 +1,4 @@ -package com.hoko.ktblur.task +package com.hoko.ktblur.api import android.graphics.Bitmap diff --git a/library/src/main/java/com/hoko/ktblur/api/BlurProcessor.kt b/library/src/main/java/com/hoko/ktblur/api/BlurProcessor.kt index 61d9770..83b3a14 100644 --- a/library/src/main/java/com/hoko/ktblur/api/BlurProcessor.kt +++ b/library/src/main/java/com/hoko/ktblur/api/BlurProcessor.kt @@ -2,7 +2,6 @@ package com.hoko.ktblur.api import android.graphics.Bitmap import android.view.View -import com.hoko.ktblur.task.BlurCallback import kotlinx.coroutines.Job interface BlurProcessor { diff --git a/library/src/main/java/com/hoko/ktblur/ext/BitmapExtension.kt b/library/src/main/java/com/hoko/ktblur/ext/BitmapExtension.kt index d33e4a4..83241ea 100644 --- a/library/src/main/java/com/hoko/ktblur/ext/BitmapExtension.kt +++ b/library/src/main/java/com/hoko/ktblur/ext/BitmapExtension.kt @@ -27,4 +27,8 @@ internal fun Bitmap.translate(translateX: Int, translateY: Int): Bitmap { return Bitmap.createBitmap(this, translateX, translateY, this.width - translateX, this.height - translateY) } -external fun Bitmap.replaceWithPixels(pixels: IntArray, x: Int, y: Int, deltaX: Int, deltaY: Int) \ No newline at end of file +internal fun Bitmap.replaceWithPixels(pixels: IntArray, x: Int, y: Int, deltaX: Int, deltaY: Int) { + this.nativeReplaceWithPixels(pixels, x, y, deltaX, deltaY) +} + +private external fun Bitmap.nativeReplaceWithPixels(pixels: IntArray, x: Int, y: Int, deltaX: Int, deltaY: Int) \ No newline at end of file diff --git a/library/src/main/java/com/hoko/ktblur/filter/NativeBlurFilter.kt b/library/src/main/java/com/hoko/ktblur/filter/NativeBlurFilter.kt index 30c0e90..30bd423 100644 --- a/library/src/main/java/com/hoko/ktblur/filter/NativeBlurFilter.kt +++ b/library/src/main/java/com/hoko/ktblur/filter/NativeBlurFilter.kt @@ -5,7 +5,7 @@ import android.util.Log import com.hoko.ktblur.api.Direction import com.hoko.ktblur.api.Mode -object NativeBlurFilter { +internal object NativeBlurFilter { private const val TAG = "OriginBlurFilter" private var nativeLoaded = false fun doBlur(mode: Mode, bitmap: Bitmap, radius: Int, cores: Int, index: Int, direction: Direction) { diff --git a/library/src/main/java/com/hoko/ktblur/processor/AbstractBlurProcessor.kt b/library/src/main/java/com/hoko/ktblur/processor/AbstractBlurProcessor.kt index db9d736..6b83e87 100644 --- a/library/src/main/java/com/hoko/ktblur/processor/AbstractBlurProcessor.kt +++ b/library/src/main/java/com/hoko/ktblur/processor/AbstractBlurProcessor.kt @@ -10,7 +10,7 @@ import com.hoko.ktblur.ext.translate import com.hoko.ktblur.api.Mode import com.hoko.ktblur.api.Scheme import com.hoko.ktblur.task.BitmapAsyncBlurTask -import com.hoko.ktblur.task.BlurCallback +import com.hoko.ktblur.api.BlurCallback import com.hoko.ktblur.task.ViewAsyncBlurTask import kotlinx.coroutines.Job diff --git a/library/src/main/java/com/hoko/ktblur/processor/HokoBlurBuild.kt b/library/src/main/java/com/hoko/ktblur/processor/HokoBlurBuild.kt index 4dab0b2..8267196 100644 --- a/library/src/main/java/com/hoko/ktblur/processor/HokoBlurBuild.kt +++ b/library/src/main/java/com/hoko/ktblur/processor/HokoBlurBuild.kt @@ -9,10 +9,10 @@ import com.hoko.ktblur.api.BlurResultDispatcher import com.hoko.ktblur.api.Mode import com.hoko.ktblur.api.Scheme import com.hoko.ktblur.task.AndroidBlurResultDispatcher -import com.hoko.ktblur.task.BlurCallback +import com.hoko.ktblur.api.BlurCallback import kotlinx.coroutines.Job -class HokoBlurBuild(var context: Context) : BlurBuild { +internal class HokoBlurBuild(var context: Context) : BlurBuild { internal var radius: Int = 10 internal var mode: Mode = Mode.STACK internal var scheme: Scheme = Scheme.NATIVE diff --git a/library/src/main/java/com/hoko/ktblur/task/AsyncBlurTasks.kt b/library/src/main/java/com/hoko/ktblur/task/AsyncBlurTasks.kt index 73dca5a..30b7f5f 100644 --- a/library/src/main/java/com/hoko/ktblur/task/AsyncBlurTasks.kt +++ b/library/src/main/java/com/hoko/ktblur/task/AsyncBlurTasks.kt @@ -2,13 +2,14 @@ package com.hoko.ktblur.task import android.graphics.Bitmap import android.view.View +import com.hoko.ktblur.api.BlurCallback import com.hoko.ktblur.api.BlurProcessor import com.hoko.ktblur.api.BlurResultDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job import kotlinx.coroutines.launch -abstract class AsyncBlurTask( +internal abstract class AsyncBlurTask( private val block: BlurCallback.() -> Unit, private val target: T, private val dispatcher: BlurResultDispatcher