0

使用graphics_capture_frame_buffer会返回一个 GBitmap。如果我想直接使用它,它的格式是什么。我将如何修改单个像素?

4

2 回答 2

3

在 Pebble 3.0 中,您可以使用gbitmap_*访问器:

当格式为GBitmapFormat8Bit时,每个像素是 ARGB 中的一个字节(每个分量 2 位)。

于 2015-03-03T23:33:14.510 回答
0

我在 SDK 中给出的等距示例中发现了这一点。因此,每次将 ARGB 保持在 2 位时,它似乎是每行每像素一个 uint8_t。

#define GColorFromRGB ((GColor8){ \ .a = 3, \ .r = (uint8_t)(red) >> 6, \ .g = (uint8_t)(green) >> 6, \ .b = (uint8_t)(blue) >> 6, \ })

static void set_pixel(GPoint pixel, GColor color) {
  if(pixel.x >= 0 && pixel.x < 144 && pixel.y >= 0 && pixel.y < 168) {
    memset(&s_fb_data[(pixel.y * s_fb_size.w) + pixel.x], (uint8_t)color.argb, 1);
  }
}
于 2015-03-03T20:23:13.180 回答