1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-14 22:19:29 +01:00

Merge branch 'freeyourgadget_master'

This commit is contained in:
Gordon Williams 2022-06-10 12:14:34 +01:00
commit 71b1a140f6

View File

@ -139,6 +139,10 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
/// Maximum amount of characters to store in receiveHistory /// Maximum amount of characters to store in receiveHistory
public static final int MAX_RECEIVE_HISTORY_CHARS = 100000; public static final int MAX_RECEIVE_HISTORY_CHARS = 100000;
<<<<<<< HEAD
=======
>>>>>>> freeyourgadget_master
// Local Intents - for app manager communication // Local Intents - for app manager communication
public static final String BANGLEJS_COMMAND_TX = "banglejs_command_tx"; public static final String BANGLEJS_COMMAND_TX = "banglejs_command_tx";
public static final String BANGLEJS_COMMAND_RX = "banglejs_command_rx"; public static final String BANGLEJS_COMMAND_RX = "banglejs_command_rx";
@ -1106,6 +1110,27 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
// Now write the image out bit by bit // Now write the image out bit by bit
BitWriter bits = new BitWriter(bmp, headerLen); BitWriter bits = new BitWriter(bmp, headerLen);
n = 0; n = 0;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int pixel = pixels[n++];
for (int b=bpp-1;b>=0;b--)
bits.push(((pixel>>b)&1) != 0);
}
// rewrite any transparent pixels as the correct color for transparency
for (n=0;n<pixels.length;n++)
if (pixels[n]==PIXELCOL_TRANSPARENT)
pixels[n] = transparentColorIndex;
}
// Write the header
int headerLen = isTransparent ? 4 : 3;
byte bmp[] = new byte[(((height * width * bpp) + 7) >> 3) + headerLen];
bmp[0] = (byte)width;
bmp[1] = (byte)height;
bmp[2] = (byte)(bpp + (isTransparent?128:0));
if (isTransparent) bmp[3] = transparentColorIndex;
// Now write the image out bit by bit
BitWriter bits = new BitWriter(bmp, headerLen);
n = 0;
for (int y = 0; y < height; y++) { for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
int pixel = pixels[n++]; int pixel = pixels[n++];