preface

The product took the IOS wechat picture editor to show me and said, “This function should be very simple, you should be able to do it soon.” If there had been 🧱 on my desk, it would have been a different ending. 😂 end of ridicule, first look at the effect of the picture

Come on, show

This picture editor realizes all functions of IOS wechat picture editing except emoticons and stickers, including user experience. The source code is about 1000 lines, which is basically easy to read and ideal for secondary development. Functions: graffiti, stickers, text, Mosaic, cutting

Key points:

  • Canvas
  • Xfermode
  • GestureDetector
  • ScaleGestureDetector

use

Access to the

Step 1: In your project build.gradle add:

allprojects {
	repositories {
		...
		mavenCentral()
	}
}
Copy the code

Step 2: In your application’s build.gradle add:

dependencies {
    implementation 'com. Making. Miaowmiaow. Fragmject: miaow - picture: 1.'
}
Copy the code

Quick to use

PictureEditorDialog.newInstance()
    .setBitmapPath(path)
    .setEditorFinishCallback(object : EditorFinishCallback {
        override fun onFinish(path: String) {
            val bitmap = BitmapFactory.decodeFile(path, BitmapFactory.Options())
        }
    })
    .show(childFragmentManager)
Copy the code

As shown above:

  1. throughPictureEditorDialogCall the picture editor
  2. throughsetBitmapPath(path)Incoming image path
  3. throughsetEditorFinishCallback(callback)Gets the address of the edited picture

Thanks

That’s all for this article. If you have any questions, please point them out and we will make progress together. If you like it, please give me a thumbs-up. Your encouragement is my motivation to move forward. Thank you ~ ~

The project address

  • Making: github.com/miaowmiaow/…