v9 is an Android library that provides the ability to dynamically resize Path objects as you would 9-patch bitmaps

Related tags

Images Processing v9
Overview

v9

v9 Android build status

v9 is an Android library that provides the ability to dynamically resize Path objects as you would 9-patch bitmaps. In the example below, the chat bubble is dynamically resized while preserving the corners:

v9-demo.mov

Each slice of the original path (indicated by the shaded areas in the example above) defines a horizontal or vertical region of the path that needs to be stretched. A path can be resized using multiple slices:

Screen.Recording.2022-08-26.at.2.42.35.PM.mov

When multiple slices are used, the amount of stretch applied is proportional to the size of each slice. This behavior is used in the example above to keep the dark bars centered vertically and to spaced them equally horizontally, thus properly preserving details inside the path.

v9 is compatible with API 21+.

Maven

repositories {
    // ...
    mavenCentral()
}

dependencies {
    implementation 'dev.romainguy:v9:0.1.0'
}

How to use

Slicing a Path gives you a PathResizer. The easiest way to slice is to use a single vertical and a single horizontal slice:

val pathResizer = path.slice(Slices(9.0f, 7.0f, 15.0f, 13.0f))

This syntax follows the rectangle convention on Android of passing the top, left, right, and bottom coordinates: there's a vertical slice from 9.0 to 15.0 and a horizontal slice from 7.0 to 13.0.

You can also explicitly declare a list of slices:

val pathResizer = path.slice(
    Slices(
        listOf(Slice(9.0f, 10.0f), Slice(14.0f, 15.0f)),
        listOf(Slice(5.0f, 6.0f),  Slice(18.0f, 19.0f))
    )
)

Once you have a PathResizer, you can call the resize() method to create a new path derived from the original, at the desired size:

val resizedPath = pathResizer.resize(width, height)

For performance considerations, you can pass an existing path to resize(). This path will be rewound and returned:

val resizedPath = pathResizer.resize(width, height, destinationpath)
// resizedPath === destinationpath

License

Please see LICENSE.

You might also like...
Image Cropping Library for Android, optimised for Camera / Gallery.
Image Cropping Library for Android, optimised for Camera / Gallery.

Image Cropping Library for Android, optimised for Camera / Gallery.

An image loading library for android.

Bilder Download Add following to your project's build.gradle allprojects { repositories { ... maven { url 'https://jitpack.io' } } }

An Android transformation library providing a variety of image transformations for Coil, Glide, Picasso, and Fresco.
An Android transformation library providing a variety of image transformations for Coil, Glide, Picasso, and Fresco.

An Android transformation library providing a variety of image transformations for Coil, Glide, Picasso, and Fresco.

🎨 Modern image loading library for Android. Simple by design, powerful under the hood.
🎨 Modern image loading library for Android. Simple by design, powerful under the hood.

Simple Image Loader Modern image loading library for Android. Simple by design, powerful under the hood. Kotlin: Simple Image Loader is Kotlin-native

An Android library for scanning documents based on CameraX API and a tiny version of OpenCV

Document Scanner with tiny OpenCV example1.mp4 Document Scanner is an Android library (kotlin based) for scanning documents based on CameraX API and a

Image Cropping Library for Android
Image Cropping Library for Android

Image Cropping Library for Android

A small customizable library useful to handle an gallery image pick action built-in your app. :sunrise_over_mountains::stars:
A small customizable library useful to handle an gallery image pick action built-in your app. :sunrise_over_mountains::stars:

Louvre A small customizable image picker. Useful to handle an gallery image pick action built-in your app. *Images from Google Image Search Installati

Awesome Image Picker library will pick images/gifs with beautiful interface. Supports image or gif, Single and Multiple Image selection.

Awesome Image Picker Awesome Image Picker library will pick images/gifs with beautiful interface. Supports image or gif, Single and Multiple Image sel

Library to save image locally and shows options to open and share !

Image Save and Share Library to save image locally and shows options to open and share ! Download Demo APK from HERE Kindly use the following links to

Comments
  • Depracated?  Complai.nts last few days?

    Depracated? Complai.nts last few days?

    Hacker, Cyberstalker depreciating your app to get at ME. HELP!!!! ADW 3 isn't staying on my pages ND home page and I can't hold onto it. Have you noticed any tweaks in yhe last 2~3 days? Her Dad is Military IT and this is. BAD, like Elon Musk, Trump bad if she gets mad enough.

    opened by antbusktv6 1
Releases(v0.1.1)
  • v0.1.1(Sep 7, 2022)

  • v0.1.0(Aug 29, 2022)

    v9 is an Android library that provides the ability to dynamically resize Path objects as you would 9-patch bitmaps.

    Slicing a Path gives you a PathResizer. The easiest way to slice is to use a single vertical and a single horizontal slice:

    val pathResizer = path.slice(Slices(9.0f, 7.0f, 15.0f, 13.0f))
    

    This syntax follows the rectangle convention on Android of passing the top, left, right, and bottom coordinates: there's a vertical slice from 9.0 to 15.0 and a horizontal slice from 7.0 to 13.0.

    You can also explicitly declare a list of slices:

    val pathResizer = path.slice(
        Slices(
            listOf(Slice(9.0f, 10.0f), Slice(14.0f, 15.0f)),
            listOf(Slice(5.0f, 6.0f),  Slice(18.0f, 19.0f))
        )
    )
    

    Once you have a PathResizer, you can call the resize() method to create a new path derived from the original, at the desired size:

    val resizedPath = pathResizer.resize(width, height)
    

    For performance considerations, you can pass an existing path to resize(). This path will be rewound and returned:

    val resizedPath = pathResizer.resize(width, height, destinationpath)
    // resizedPath === destinationpath
    
    Source code(tar.gz)
    Source code(zip)
Owner
Romain Guy
Engineering director at Google on Android
Romain Guy
Photo picker library for android. Let's you pick photos directly from files, or navigate to camera or gallery.

ChiliPhotoPicker Made with ❤️ by Chili Labs. Library made without DataBinding, RxJava and image loading libraries, to give you opportunity to use it w

Chili Labs 394 Nov 29, 2022
Android library project for cropping images

I guess people are just cropping out all the sadness An Android library project that provides a simple image cropping Activity, based on code from AOS

Jamie McDonald 4.5k Jan 7, 2023
An android image compression library.

Compressor Compressor is a lightweight and powerful android image compression library. Compressor will allow you to compress large photos into smaller

Zetra 6.7k Dec 31, 2022
A simple image cropping library for Android.

SimpleCropView The SimpleCropView is an image cropping library for Android. It simplifies your code for cropping image and provides an easily customiz

Issei Aoki 2.5k Dec 28, 2022
Customizable Android full screen image viewer for Fresco library supporting "pinch to zoom" and "swipe to dismiss" gestures. Made by Stfalcon

This project is no longer supported. If you're able to switch from Fresco to any other library that works with the Android's ImageView, please migrate

Stfalcon LLC 1.8k Dec 19, 2022
Dali is an image blur library for Android. It contains several modules for static blurring, live blurring and animations.

Dali Dali is an image blur library for Android. It is easy to use, fast and extensible. Dali contains several modules for either static blurring, live

Patrick Favre-Bulle 1k Dec 1, 2022
An image resizing library for Android

Resizer Inspired by zetbaitsu's Compressor, Resizer is a lightweight and easy-to-use Android library for image scaling. It allows you to resize an ima

Kakit Ho 426 Dec 22, 2022
Simple android image popup Library

Android Image Popup Show image as a popup on a click event or any event. Simply set the image as drawable and thats it!!!. And also you can set width,

Chathura Lakmal 64 Nov 15, 2022
Image loading library for Android

Image Loader Image loader library for Android. Deprecated. See Glide. Features Image transformations Automatic memory and storage caching Ability to l

Yuriy Budiyev 19 May 28, 2022
SVG rendering library for Android

AndroidSVG AndroidSVG is a SVG parser and renderer for Android. It has almost complete support for the static visual elements of the SVG 1.1 and SVG 1

Paul LeBeau 1.1k Dec 28, 2022