279 Commits

Author SHA1 Message Date
Gordon Williams
3f83b20c77 Graphics: fix for images in drawString when completely offscreen (regression after drawImage optimisation) 2023-08-10 10:37:48 +01:00
Gordon Williams
c66fc7ddbe Fix for last image scaling commit 2023-08-07 14:26:41 +01:00
Gordon Williams
5257dc6e1f Graphics: drawImage(...,{filter:1}) added to allow smooth downscaling of images 2023-08-07 14:05:45 +01:00
Gordon Williams
64a97104bb fix tests/test_graphics_drawImageFrame.js - don't even start to draw image if no data available 2023-08-07 11:55:36 +01:00
Gordon Williams
075353feef Graphics: drawImage now avoids getting pixels top/bottom of an image that might be cropped/offscreen 2023-07-25 11:30:45 +01:00
Gordon Williams
93aa347f37 Graphics: g.dump() will now work without allocating huge buffers 2023-07-06 17:17:19 +01:00
Gordon Williams
f04ca8655a Add fixes for when images are embedded in UTF8 strings. 2023-06-20 12:18:22 +01:00
Gordon Williams
e066161321 Fix regression with g.wrapString and long UTF8 strings (fix #2385) 2023-06-19 16:05:12 +01:00
Gordon Williams
1bbfc8415a Improve image parsing, and attempt to make it work on UTF8 strings
Added test cases for + where we fail at the moment
2023-06-16 17:13:44 +01:00
Gordon Williams
aa64b17d4f Much improved UTF8 support
* if we're not given a valid UTF8 code sequence then we don't lex the string as UTF8 (more compatible with old code)
* If we got non-ASCII chars and *then* a proper UTF8 code, convert all previous chars
* String.join/split fixed for UTF8
2023-06-16 16:24:28 +01:00
Gordon Williams
e955693abe Graphics: Allow setFont(...) to work with >1bpp and PBF fonts 2023-06-13 16:28:06 +01:00
Gordon Williams
730d6c745f fix save_on_flash gfx builds 2023-06-08 10:24:39 +01:00
Gordon Williams
10dce25c8d Making pebble fonts defineable with ESPR_PBF_FONTS, add to ChangeLog 2023-06-06 16:49:23 +01:00
Gordon Williams
d77ea4b4bd Fix Graphics.createImage if the last character is a newline
Graphics: Fix issue if drawImage given a non-image
2023-06-06 11:44:34 +01:00
Gordon Williams
566344f4e8 Added PBF font file loading 2023-05-26 12:14:13 +01:00
Gordon Williams
5fe2e6ae95 Added E.asUTF8 and extra functionality to work with UTF8 strings in Espruino 2023-05-25 12:35:42 +01:00
Gordon Williams
e6114e42b2 Allow Graphics.createImage to use '.' as a placeholder for an empty area 2023-05-18 10:07:12 +01:00
Gordon Williams
d7e760bc78 Graphics: g.asImage() now reads palette+transparent fields (if they exist) in a Graphics object 2023-05-15 13:18:34 +01:00
Gordon Williams
a0d5544eb4 Ensure Graphics uses jswrap_math_sin/jswrap_math_cos (saves ~5k on SAVE_ON_FLASH_MATH builds) 2023-05-15 10:34:30 +01:00
Gordon Williams
f276338794 Graphics: g.drawImage(gfx) now reads palette+transparent fields if they exist in a Graphics object
Graphics: g.asImage() now reads transparent field (if it exists) in a Graphics object
Needed for https://github.com/espruino/BangleApps/issues/2749
2023-05-15 09:44:49 +01:00
Gordon Williams
f49cd98c23 Fix minor regression after last createImage tweaks - that broke tests/test_graphics_drawStringImage.js 2023-05-12 10:02:16 +01:00
Gordon Williams
f95832c9dc Small floodfill tweak 2023-05-12 09:12:12 +01:00
Gordon Williams
7db329b481 Graphics: Added .floodFill method to allow flood fill 2023-05-11 12:14:27 +01:00
Gordon Williams
25648d5fc9 As intended, handle only first and last char as newline 2023-05-10 16:50:26 +01:00
Gordon Williams
d41f98cfae Fix issue with Graphics.createImage if more than the first line was empty (fix #2296) 2023-05-10 16:44:43 +01:00
Gordon Williams
9b30f17227 Added jsvObjectGetChildIfExists to avoid the jsvObjectGetChild(... ,0) case - saves ~300b of flash space 2023-04-25 10:59:34 +01:00
Gordon Williams
c55f8a068f Removing some compiler warnings 2023-04-19 10:05:35 +01:00
Gordon Williams
fffcf85b12 Graphics: Ensure fillPoly clips out of range (+/-2048) coordinates (fix https://github.com/espruino/BangleApps/issues/2661) 2023-03-27 11:34:18 +01:00
Danny Zhu
9cd615b776 Fix drawString and setClipRect with 90/270-degree rotation
Previously, the calculation of `minX`, `minY`, `maxX`, and `maxY` inside
`jswrap_graphics_drawString` was what `graphicsToDeviceCoordinates`
does, just written out explicitly. With 90- or 270-degree rotations,
that meant that the final values ended up rotated 180 degrees relative
to what they should have been. As a result, characters could end up
effectively clipped twice and hence incorrectly not being drawn.  What
we actually want instead is to do the _reverse_ transformation of
`graphicsToDeviceCoordinates`, which fortunately already exists as
`deviceToGraphicsCoordinates`.
2023-03-09 20:36:17 -07:00
Gordon Williams
b26f53c828 Micro:bit 1: remove support for paletted images to free up flash 2023-02-27 09:25:56 +00:00
Gordon Williams
bf3b777cde Graphics: Ensure that an error is thrown if a palette is used in >8 bit images. It was previously possible to ask for a palette on a 32 bit image, which caused an overflow 2023-02-20 19:56:14 +00:00
Gordon Williams
51374343c2 Graphics: Fix font clipping on rotated non-square graphics instances (fix #2326) 2023-02-20 11:13:01 +00:00
Rob Pilling
c41ce57050 Add/update types for Graphics::set*Color and Object 2023-02-08 23:06:33 +00:00
Gordon Williams
25226e526b fix microbit build 2023-02-01 14:35:36 +00:00
Gordon Williams
36eb62c256 Graphics: Added g.getVectorFontPolys to allow the underlying polygons behind a vector font to be retrieved 2023-02-01 14:29:53 +00:00
Gordon Williams
dc45b9f5c2 Graphics: Add color mappings when rendering 3->4bpp and 3->8bpp
Bangle.js2: make the 4bpp mac palette more saturated to account for the LCD
2023-01-19 10:22:17 +00:00
Gordon Williams
a8efb2cf0b Graphics: Ensure g.reset() after a custom font was set de-allocates the custom font (fix #2290) 2022-11-14 11:12:49 +00:00
Gordon Williams
cb5fc8e4a3 Move older 'HY' boards to use g for the built-in graphics, not LCD (and change docs) 2022-09-16 11:50:33 +01:00
Gordon Williams
0d323d82fe
Merge pull request #2254 from qucchia/typescript
Typescript
2022-07-28 08:37:50 +01:00
qucchia
57c9f4d188 TypeScript: Fix Graphics.setTheme 2022-07-27 17:05:18 +02:00
Gordon Williams
30b18ee2b6 Merge branch 'bangle2_lcd_overlay' 2022-07-27 16:00:06 +01:00
Gordon Williams
d6d37dfb2e Bangle.js2: Added Bangle.setLCDOverlay(img,x,y) to allow an image to be overlaid on top of screen contents (eg for notifications) 2022-07-27 15:58:22 +01:00
qucchia
c5bb94bf7a Limit documentation comments to 80 characters (#2244) 2022-07-27 15:32:19 +02:00
Gordon Williams
aa58f0ed3c
Merge pull request #2250 from qucchia/typos
Typos
2022-07-27 13:42:50 +01:00
qucchia
ba30e2f018 Typos 2022-07-27 13:31:13 +02:00
qucchia
83f1c338ed TypeScript: Graphics 2022-07-27 12:51:48 +02:00
qucchia
1cb82b2280 Explicitly explain some optional parameters 2022-07-21 12:49:45 +02:00
Gordon Williams
1f2a3b4521 Fix errors creating type files 2022-07-20 15:52:00 +01:00
Gordon Williams
9c0e226a36 Graphics: Add g.blendColor to expose the ability to figure out what color is between two others (fix #2150) 2022-06-08 14:44:41 +01:00
Gordon Williams
48fde7600c Refactor jswrap_object_keys_or_property_names to use flags for better readability/expandability 2022-05-24 14:28:30 +01:00