bumptech / bumptech/glide

getAlphaSafeBitmap and getAlphaSafeConfig should be public for use in custom transforms

Open
#4,889 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

Glide has a documented feature [Custom Transforms](https://bumptech.github.io/glide/doc/transformations.html#custom-transformations). There is no sample code, but the [RoundedCorners](https://github.com/bumptech/glide/blob/d2bb3e8a6a2296b20ecaeb7759c16ef15aacbb28/library/src/main/java/com/bumptech/glide/load/resource/bitmap/RoundedCorners.java) class provides an adequate example for anyone wanting to make their own. However, **reproducing RoundedCorners in user code— or in general, creating almost any useful Custom Transform— requires getAlphaSafeBitmap and getAlphaSafeConfig from [TransformationUtils.java](https://github.com/bumptech/glide/blob/a287253579d4e68f993a4fabcf9f29f5fde2562d/library/src/main/java/com/bumptech/glide/load/resource/bitmap/TransformationUtils.java#L413). These methods are private**. This means **Custom Transformations currently cannot have performance parity with Glide's builtin transformations**.

I recently attempted to make a custom transform in a [PR to an Android app](https://github.com/mcclure/Tusky/blob/image-focus/app/src/main/java/com/keylesspalace/tusky/components/compose/dialog/FocusDialog.kt#L54). Because of the private method problem, I had to cut and paste the entire getAlphaSafeBitmap and getAlphaSafeConfig methods into our code. Because our app is written in Kotlin, this was impractical.

Expected behavior: **Make TransformationUtils.getAlphaSafeBitmap and TransformationUtils.getAlphaSafeConfig public.**

**Glide Version**: 4.13.1
**Integration libraries**: No
**Device/Android Version**: n/a, issue is API design

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.