-
Notifications
You must be signed in to change notification settings - Fork 86
Add drawPngFromBuffer #210
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
base: dev
Are you sure you want to change the base?
Add drawPngFromBuffer #210
Conversation
3aedfaf
to
aa6ee82
Compare
e9302da
to
aa6ee82
Compare
Thanks, this is great -- I was looking for this function. Any way we can get this merged so it's easier to use? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code works for me, too!
if (!buf) | ||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate code, it's already defined further down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix this up if the maintainers ever consider merging this. Personally I don't see why not but looks like they haven't merged any PRs from non-SolderedElectronics members in years...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to keep this earlier one rather than the one below. That prevents a possible memory leak from pngle_new()
.
ret = 0; | ||
|
||
pngle_destroy(pngle); | ||
free(buf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither drawBitmapFromBuffer()
or drawJpegFromBuffer()
free the buffers passed into them. In order to be consistent with the existing methods, free(buf);
should be removed.
Noticed the library has methods to draw bmp and jpg from buffer but not png, so I added it.
Tried it on my Inkplate10 (v1) and behaves identically to
drawPngFromWeb
Personally I need a function like this as I download png data using a custom function (need to also read HTTP headers) and needed a way to write to the display without drawing again from a URL or SD card.