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

Initial implementation of android.graphics.BitmapFactory #460

Merged
merged 1 commit into from
Dec 5, 2022

Conversation

animeavi
Copy link
Contributor

@animeavi animeavi commented Dec 5, 2022

Only what was needed is implemented, compression method is still untested.

This is relevant to #444
it does not fix the issue yet, stuff from android.graphics.Canvas and android.graphics.Rect is still needed (I have not looked into how hard that would be for me, so no promises) to support extensions that manipulate images, but this at least gets the image to the extension.

@AriaMoradi
Copy link
Member

You can steal a lot of source code from android itself usually

@Syer10
Copy link
Collaborator

Syer10 commented Dec 5, 2022

That probably won't help much with Bitmaps or Canvas though, a lot of the source uses native code.

@animeavi
Copy link
Contributor Author

animeavi commented Dec 5, 2022

I have tested the compression code, turns out OpenJDK does not have a native JPEG decoder so I'll default to PNG no matter what.
Trying to replicate Canvas with Graphics2D now, not going so well.

@Syer10
Copy link
Collaborator

Syer10 commented Dec 5, 2022

Feel free to implement libraries that add extra image support. I think there are libraries that add jpeg support for ImageIO

@AriaMoradi
Copy link
Member

Feel free to implement libraries that add extra image support. I think there are libraries that add jpeg support for ImageIO

Also if you need implementations that are available in third party packages you could add them to dependencies and use them, for example to make dateformat work we used icu4j from com.ibm.icu

@animeavi
Copy link
Contributor Author

animeavi commented Dec 5, 2022

I've added the TwelveMonkeys JPEG encoder and now JPEG also works.

I got the the Canvas partially working (works with the MangaReader.to currently, but I believe some extensions use more parts of it, I will have to look into it), should I leave that for a different PR or add it to this?

@AriaMoradi
Copy link
Member

@animeavi
Join the discord server and also let us know when the code is ready to be reviewed

@animeavi
Copy link
Contributor Author

animeavi commented Dec 5, 2022

@animeavi Join the discord server and also let us know when the code is ready to be reviewed

This part of it is ready, I'll do a follow up PR for the Rect and Canvas stuff cause it kinda depends on this being merged first.

Copy link
Member

@AriaMoradi AriaMoradi left a comment

Choose a reason for hiding this comment

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

We probably need to regenerate android.jar after this

AndroidCompat/src/main/java/android/graphics/Bitmap.java Outdated Show resolved Hide resolved
Only what was needed is implemented, compression method is still untested.
@AriaMoradi AriaMoradi merged commit 0a748cd into Suwayomi:master Dec 5, 2022
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.

3 participants