I'm struggling with a compile error on cloudpebble.
I would like to get the pointer to de pixel data of a GBitmap.
static void canvas_update_proc(Layer *layer, GContext *ctx) {
// Custom drawing happens here!
GBitmap *fb = graphics_capture_frame_buffer(ctx);
// Manipulate the image data...
GRect bounds = layer_get_bounds(layer);
uint8_t *byte_offset = (uint8_t *)fb->addr; // <------- error
int skip_bytes = fb->row_bytes_size - bounds.size.w; // <------- error
The compiler returns this error.
../src/c/hello_world.c: In function 'canvas_update_proc':
../src/c/hello_world.c:25:38: error: dereferencing pointer to incomplete type
../src/c/hello_world.c:27:24: error: dereferencing pointer to incomplete type
I was checking this yt video. https://youtu.be/lYoHh19RNy4?t=2473
How should I solve this?
As I was googling, I think it might had something to do with GBitmap isn't known? (at least it's members?)
The structure of GBitmap changed in an SDK update released after that video was published. You can no longer directly access the
addrmember of any GBitmap.You should now use
gbitmap_get_data_row_info, and modify that row's info through the data it provides to you.I'd recommend reading the documentation on Pebble Developer as well.