Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color space #8

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Color space #8

wants to merge 5 commits into from

Conversation

dburckh
Copy link
Owner

@dburckh dburckh commented May 6, 2024

No description provided.

Copy link
Collaborator

@caraesten caraesten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very very small thing but thank you so much for doing this!

* @param bitmapConfig Currently only {@link Bitmap.Config#ARGB_8888}
* and {@link Bitmap.Config#RGBA_F16}
*/
public native Bitmap getMutableBitmap(Bitmap.Config bitmapConfig) throws IllegalArgumentException;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small thing around naming: given non-hardware bitmaps can also be immutable (and there's a lot of reasons to make a non-hardware bitmap immutable), maybe it's better to separate out mutability from the bitmap config, and name this something like getNonHardwareBitmap, getSoftwareBitmap (both of these are terrible, I know!) or even getRAMBitmap and getVRAMBitmap? obviously all these names kind of suck in various ways but separating out mutability does seem nice. totally fine to keep it as is too.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the way the bitmap is created it is always mutable. In the C code I'm called Bitmap.createBitmap(). The code was modified in this PR to support ColorSpace, so it should be easy to find. If you need an immutable version you can call Bitmap.copy(). I'm not sure I can create an immutable Bitmap because I need to mutate it to copy in the pixels from LibRaw.

FYI: Hardware Bitmaps are technically mutable if the underlying HardwareBuffer is.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah good point, any bitmap created by createBitmap is mutable, and can be made immutable. this is great, thanks!

*/
@RequiresApi(26)
@Nullable
public HardwareBuffer getHardwareBuffer(int format) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is nice, I love the ability to just get a buffer rather than a bitmap. will make passing it around way easier.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you said you had a need for this, so I exposed it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants