diff --git a/.metadata b/.metadata deleted file mode 100644 index 63ffe230fd79916fa237c79785f42404d76fe4e5..0000000000000000000000000000000000000000 --- a/.metadata +++ /dev/null @@ -1,33 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: "db7ef5bf9f59442b0e200a90587e8fa5e0c6336a" - channel: "stable" - -project_type: plugin - -# Tracks metadata for the flutter migrate command -migration: - platforms: - - platform: root - create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - - platform: android - create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - - platform: ios - create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - - # User provided section - - # List of Local paths (relative to this file) that should be - # ignored by the migrate tool. - # - # Files that are not part of the templates will be ignored by default. - unmanaged_files: - - 'lib/main.dart' - - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/CHANGELOG.md b/CHANGELOG.md index a951c930a7252ff18e7704a8c75694a6d76ec824..0c338046169eed6f26868f4b204bb1afdd901843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,3 @@ -## 0.2.0 - -* fix: Add support for android gradle version 8.1.3 -* feat: Implement RGB overlay operation - ## 0.1.3 * Bump ffi to 2.0.1 diff --git a/OAT.xml b/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..57b4334deceb7f01cdb74544213ccbedf925b25b --- /dev/null +++ b/OAT.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 11200f928590b6a9360abda26f8c44bd0d8980e8..8f6d8583badd4cc6ec6a8fd355aa09476e52df19 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -![transform image dog](https://raw.githubusercontent.com/bluefireteam/bitmap/9cd10ebf04/transform.jpg) +![transform image dog](transform.jpg) # Flutter Bitmap @@ -17,7 +17,7 @@ Some of the algorithms here are heavily inspired by this awesome lib. ## Why this exists? -I started to use [dart image](https://pub.dartlang.org/packages/image) to create [LetsPicture](https://play.google.com/store/apps/details?id=app.letspicture.letspicture) (cool app, check it out) but since the beginning, I've noticed that the performance was really bad. +I started to use [dart image](https://pub.dartlang.org/packages/image) to create [LetsPicture](https://github.com/renancaraujo/letspicture/) (cool app, check it out) but since the beginning, I've noticed that the performance was really bad. [Dart image](https://pub.dartlang.org/packages/image) has its own Image format, so between decoding, putting some transformations and then displaying the result on the app you had to convert the image two times (at least). So this package is just this: We deal [bitmaps](https://en.wikipedia.org/wiki/BMP_file_format) (duh) and we focus only on Flutter use cases. @@ -26,6 +26,7 @@ So this package is just this: We deal [bitmaps](https://en.wikipedia.org/wiki/BM - Every image is decoded to [RGBA32](https://en.wikipedia.org/wiki/RGBA_color_space) by the framework trough ImageStreamListener, so we can rely on Flutter to do the decoding job; - Dart FFI: we are porting some of our functions to C (or C++) making it blazing fast. - With this package, you can easily take advantage of stuff like [compute](https://api.flutter.dev/flutter/foundation/compute.html) ([Isolates](https://www.didierboelens.com/2019/01/futures---isolates---event-loop/)) on only the manipulations you want to free the UI thread of heavy computation. +- [Niks](https://github.com/renancaraujo/niks) Want to create your own image editor? Niks and bitmap are awesome for the job. ## Alternatives diff --git a/android/build.gradle b/android/build.gradle index fe793eb76305ddfa6e204ada265e0e00ee887975..a11e9f235137546d4a42fbfb81d70a518120d411 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,14 +2,14 @@ group 'com.example.bitmap' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.9.0' + ext.kotlin_version = '1.7.10' repositories { google() - mavenCentral() + jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:8.1.3' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -17,7 +17,7 @@ buildscript { rootProject.allprojects { repositories { google() - mavenCentral() + jcenter() } } @@ -25,11 +25,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - if (project.android.hasProperty("namespace")) { - namespace "com.example.bitmap" - } - - compileSdkVersion 33 + compileSdkVersion 30 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -38,15 +34,6 @@ android { minSdkVersion 16 } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - externalNativeBuild { cmake { path "CMakeLists.txt" diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 8bc9958ab0cfe54c122c0baf33acbc7ab9adc545..e358b1242d0977634b47205aa74cc240dfd54f0d 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip +distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.4-bin.zip diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 94cbbcfc396aca20240417158bac4d52ba4e1a14..054709809af6ccfc5ced307902b691d184d147b0 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1 +1,3 @@ - + + diff --git a/android/src/test/kotlin/com/example/bitmap/BitmapPluginTest.kt b/android/src/test/kotlin/com/example/bitmap/BitmapPluginTest.kt deleted file mode 100644 index 5e4303a015867d47e7b18ab766ed5a64efbe8dae..0000000000000000000000000000000000000000 --- a/android/src/test/kotlin/com/example/bitmap/BitmapPluginTest.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.example.bitmap - -import io.flutter.plugin.common.MethodCall -import io.flutter.plugin.common.MethodChannel -import kotlin.test.Test -import org.mockito.Mockito - -/* - * This demonstrates a simple unit test of the Kotlin portion of this plugin's implementation. - * - * Once you have built the plugin's example app, you can run these tests from the command - * line by running `./gradlew testDebugUnitTest` in the `example/android/` directory, or - * you can run them directly from IDEs that support JUnit such as Android Studio. - */ - -internal class BitmapPluginTest { - @Test - fun onMethodCall_getPlatformVersion_returnsExpectedValue() { - val plugin = BitmapPlugin() - - val call = MethodCall("getPlatformVersion", null) - val mockResult: MethodChannel.Result = Mockito.mock(MethodChannel.Result::class.java) - plugin.onMethodCall(call, mockResult) - - Mockito.verify(mockResult).success("Android " + android.os.Build.VERSION.RELEASE) - } -} diff --git a/example/.gitignore b/example/.gitignore index 7da7de3543eeb3abf297c136b214944bdcd20aa3..ae1f1838ee7e87b1fa976268adc723e1020af38e 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -35,4 +35,3 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages - diff --git a/example/.metadata b/example/.metadata index d22992edbae57df9313ded9087057abaf6f1fb56..7e944301c478023d8e9b85afcff5358688988f10 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,42 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: "db7ef5bf9f59442b0e200a90587e8fa5e0c6336a" - channel: "stable" + revision: 7bf9aea25435ae7b7afae3e0f2cc781a3db26c23 + channel: master project_type: app - -# Tracks metadata for the flutter migrate command -migration: - platforms: - - platform: root - create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - - platform: android - create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - - platform: ios - create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - - platform: linux - create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - - platform: macos - create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - - platform: web - create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - - platform: windows - create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a - - # User provided section - - # List of Local paths (relative to this file) that should be - # ignored by the migrate tool. - # - # Files that are not part of the templates will be ignored by default. - unmanaged_files: - - 'lib/main.dart' - - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/android/.gitignore b/example/android/.gitignore index 6f568019d3c69d4966bb5a0f759980a1472afc1e..0a741cb43d66c6790a2a913fa24c8878fb1ab7b5 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -9,5 +9,3 @@ GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app key.properties -**/*.keystore -**/*.jks diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 118ee1d926e81b1ee48217b130e161765b4c35eb..1784342a897f66c10dad4c483bb4126af27ab5ce 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,9 +1,3 @@ -plugins { - id "com.android.application" - id "kotlin-android" - id "dev.flutter.flutter-gradle-plugin" -} - def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -12,6 +6,11 @@ if (localPropertiesFile.exists()) { } } +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -22,19 +21,12 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -android { - namespace "com.example.example" - compileSdkVersion flutter.compileSdkVersion - ndkVersion flutter.ndkVersion - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - kotlinOptions { - jvmTarget = '1.8' - } +android { + compileSdkVersion 31 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -42,11 +34,9 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.example" - // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion + applicationId "com.example.bitmap_example" + minSdkVersion 16 + targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } @@ -64,4 +54,6 @@ flutter { source '../..' } -dependencies {} +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index 399f6981d5d35475eb18e6068ae67cdd7c731978..ca9dd7c27d8180cf2f4970c79d67006a09a041ff 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 19b862ec8a79b148b27847bba08f26fc3bcecfa6..d9092c15f2814ee4a22614d7db067d6a41c968f4 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,11 +1,10 @@ - - + + + diff --git a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt deleted file mode 100644 index e793a000d6a911207c50329f12e6e3a1e036c8af..0000000000000000000000000000000000000000 --- a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.example - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml index 06952be745f9fa6fa75196e830d9578eb2ee631d..449a9f930826851b495d039f0c0d57f247536615 100644 --- a/example/android/app/src/main/res/values-night/styles.xml +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -3,14 +3,14 @@