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 bitmap drawing #45

Open
msx80 opened this issue Feb 8, 2019 · 4 comments
Open

Color bitmap drawing #45

msx80 opened this issue Feb 8, 2019 · 4 comments

Comments

@msx80
Copy link

msx80 commented Feb 8, 2019

Hi there, i'm trying to draw a color image on the screen with some drawBitmap variants. I noticed that it takes a 2D matrix, but it might be useful to have a version with takes a single array (of size wh2). For example in GIMP you can save a file in C format and it outputs a ready made 16 bit 5,6,5 array.

Should be trivial to implement.

Thanks!

@Nkawu
Copy link
Owner

Nkawu commented Feb 18, 2019

If you want to attempt to do this, please make the code changes and create a pull request. Thanks!

@lordmundi
Copy link

was just looking for this exact feature. this would be really great to have so that you don't have to load up an entire gfx library and an SD library or something if all you need to do is define the color bitmap in memory and draw it. you could even procedurally draw the color bitmap in memory as well.

@lordmundi
Copy link

just an update here... i think this DOES exist but perhaps it is just not documented? In the TFT_22_ILI9225.cpp file I see a few functions like this defined:

//High speed color bitmap
void TFT_22_ILI9225::drawBitmap(uint16_t x1, uint16_t y1, const uint16_t** bitmap, int16_t w, int16_t h) {

@Nkawu
Copy link
Owner

Nkawu commented Aug 9, 2022

Just looked at this again after the recent comment, @lordmundi does the GIMP export look like this?

/* GIMP RGBA C-Source image dump (Cassandra.c) */

static const struct {
  guint      width;
  guint      height;
  guint      bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ 
  guint8     pixel_data[300 * 549 * 4 + 1];
} gimp_image = {
  300, 549, 4,
  "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
...
,};

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

No branches or pull requests

3 participants