From 15dd06fa7048bd3128b2e54d0bccce136cce18f2 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 2 May 2024 14:49:34 +0100 Subject: [PATCH] pebblepp: Fix automatic coloring of middle of clockinfo images if clockinfo image goes right to the top or left --- apps/pebblepp/ChangeLog | 3 ++- apps/pebblepp/app.js | 10 +++++----- apps/pebblepp/metadata.json | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/pebblepp/ChangeLog b/apps/pebblepp/ChangeLog index 1b64fefe3..35c67281d 100644 --- a/apps/pebblepp/ChangeLog +++ b/apps/pebblepp/ChangeLog @@ -4,4 +4,5 @@ 0.03: Use smaller font if clock_info test doesn't fit in area 0.04: Ensure we only scale down clockinfo text if it really won't fit 0.05: Minor code improvements -0.06: Use the clockbg library to allow custom image backgrounds \ No newline at end of file +0.06: Use the clockbg library to allow custom image backgrounds +0.07: Fix automatic coloring of middle of clockinfo images if clockinfo image goes right to the top or left \ No newline at end of file diff --git a/apps/pebblepp/app.js b/apps/pebblepp/app.js index 09691bab8..50e35034b 100644 --- a/apps/pebblepp/app.js +++ b/apps/pebblepp/app.js @@ -65,7 +65,7 @@ loadThemeColors(); // Load the clock infos let clockInfoW = 0|(w/2); let clockInfoH = 0|(h/2); -let clockInfoG = Graphics.createArrayBuffer(25, 25, 2, {msb:true}); +let clockInfoG = Graphics.createArrayBuffer(26, 26, 2, {msb:true}); clockInfoG.transparent = 3; clockInfoG.palette = new Uint16Array([g.theme.bg, g.theme.fg, g.toColor("#888"), g.toColor("#888")]); let clockInfoItems = require("clock_info").load(); @@ -91,10 +91,10 @@ let clockInfoDraw = (itm, info, options) => { the middle of it to be white. So what we do is we draw a slightly bigger rectangle in white, draw the image, and then flood-fill the rectangle back to the background color. floodFill was only added in 2v18 so we have to check for it and fallback if not. */ - clockInfoG.setBgColor(0).clearRect(0,0,24,24); - clockInfoG.setColor(1).drawImage(info.img, 0,0); - clockInfoG.floodFill(24,24,3); - g.drawImage(clockInfoG, midx-24,y,{scale:2}); + clockInfoG.setBgColor(0).clearRect(0,0,25,25); + clockInfoG.setColor(1).drawImage(info.img, 1,1); + clockInfoG.floodFill(0,0,3); + g.drawImage(clockInfoG, midx-26,y-2,{scale:2}); } else { // fallback g.drawImage(info.img, midx-24,y,{scale:2}); } diff --git a/apps/pebblepp/metadata.json b/apps/pebblepp/metadata.json index 148682e73..4f328e0f5 100644 --- a/apps/pebblepp/metadata.json +++ b/apps/pebblepp/metadata.json @@ -2,7 +2,7 @@ "id": "pebblepp", "name": "Pebble++ Clock", "shortName": "Pebble++", - "version": "0.06", + "version": "0.07", "description": "A pebble style clock (based on the 'Pebble Clock' app) but with two configurable ClockInfo items at the top", "icon": "app.png", "screenshots": [{"url":"screenshot.png"}],