0

Trying to send an image to the Pebble smartwatch, from an Android app. It seems like this may be applicable, but the purpose is different and I don't understand enough to know whether it applies to my image and output.

I have an RGB_565 image courtesy of BitmapFactory, that is known to be black & white and known 96x96 size. In order to send it to the Pebble, I need it in their .pbi format:

  • 1 bit for 1 pixel
  • Padded to 32 bits wide (not necessary with 96x96 - hence my choice!)
  • 1 => White; 0 => Black

I'm trying:

int pbi[][] = new int[96][96];
for (int row = 0; row < 96; row++ ){
    for (int col = 0; col < 96; col++){
        if (bmp.getPixel(row, col) == 0xFFFFFFFF) pbi[row][col] = 1;
        else pbi[row][col] = 0;
    }
}

Does this make sense? I can't really test it, as for that I need first to implement the harder next step of transmitting it to the Pebble.. but in order to do that I need this bit-per-pixel format.

Or is there an easier built in method? Something like this, but in reverse? Thanks.

Community
  • 1
  • 1
OJFord
  • 10,522
  • 8
  • 64
  • 98

1 Answers1

-1

Don't you mean to check the color not set it in the if statement? (== instead of =)

i = 144x144
current_pix = find_first()
for i < 0
    if (pix_colour(current_pix) == white) add_binary_weight_to_output(i)
    i -= 1
ErstwhileIII
  • 4,829
  • 2
  • 23
  • 37