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

Allow providing pre-allocated BufferedImage for awtConvertImage #2129

Merged
merged 1 commit into from Jan 14, 2024

Conversation

Kietyo
Copy link
Contributor

@Kietyo Kietyo commented Jan 13, 2024

BufferedImage itself has internal data buffers that it allocates everytime it's allocated, so this helps reduce memory usage and garbage collection if I'm calling this function often.

For context I have a personal project that grabs the image (a BufferedImage) from HDMI capture device, than sends it over to clients over my network so I can view my surveillance monitor in a different area. Each time I grab the image, I need to convert the image using awtConvertImage so that I can use Korge's Bitmap utils; notably QOI encoding to reduce the size of the data before sending it over the network. Currently, each time awtConvertImage is called, it creates a new BufferedImage.

Copy link
Member

@soywiz soywiz left a comment

Choose a reason for hiding this comment

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

LGTM

@soywiz soywiz merged commit 1f39a40 into korlibs:main Jan 14, 2024
9 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.

None yet

2 participants