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

Implement API for converting Picture to BufferedImage #144

Merged
merged 3 commits into from
Mar 12, 2024

Conversation

jCabala
Copy link
Collaborator

@jCabala jCabala commented Mar 5, 2024

closes #87

Copy link
Contributor

@noelwelsh noelwelsh left a comment

Choose a reason for hiding this comment

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

I think there are few issues that need to be looked at before this is ready to go.

w.bufferedImage(frame, picture)
}

def bufferedImage[Fmt <: Format] =
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the Fmt type is needed. This type specifies a file format (like PNG or JPEG), which is not relevant for saving to an in-memory bitmap.

If the Fmt types goes the helper classes are no longer necessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just added the format becuase the renderBufferedImage() requires a makeImage() function which defined for each Java2d[Format]Writer object
image
Should I just create a separate object for the BufferedImageConverter with its own makeImage() function and make this the only implicit BufferedImageConverter?

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this compile on the Javascript platform? E.g. does coreJS / fastOptJS succeed?

I suspect the BufferedImage type doesn't exist on JS, and hence it won't compile. This mean either:

  1. this type needs to become generic in the bitmap type or
  2. this type needs to migrate to live only on the JVM platform (and possibly only on the Java2D backend.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are probably right. I was just following what Base64 does. I will move it to the Java2D specific directory.

@jCabala jCabala requested a review from noelwelsh March 7, 2024 09:39
@noelwelsh
Copy link
Contributor

👍 Ok, I think this is good enough to merge. Thanks!

There are some points to consider for improvements which I collected in #145

@noelwelsh noelwelsh merged commit 2e5a290 into creativescala:main Mar 12, 2024
4 checks passed
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.

Convert Picture to BufferedImage
2 participants