Commit Graph

50 Commits

Author SHA1 Message Date
Jeff Epler
907c5d387f
Tweak black_bindings
Originally, black_bindings found each contiguous "//|" block and sent
it to black independently. This was slower than it needed to be.

Instead, swap the comment prefix: when running black, take off
"//|" prefixes and put "##|" prefixes on all un-prefixed lines.
Then, after black is run, do the opposite operation

This more than doubles the overall speed of "pre-commit run --all",
from 3m20s to 55s CPU time on my local machine (32.5s to under 10s
"elapsed" time)

It also causes a small amount of churn in the bindings, because
black now sees enough context to know whether one 'def' follows another
or ends the 'def's in a 'class'. In the latter case, it adds an extra
newline, which becomes a "//|" line.

I'm less sure why a trailing comma was omitted before down in
rp2pio/StateMachine.c but let's roll with it.
2022-09-30 11:18:13 -05:00
Jeff Epler
b2cc8d2aad
run black_bindings across all bindings 2022-09-27 15:21:42 -05:00
TimonPeng
1cc4d63c52 Fix bindings typing 2022-09-16 00:02:17 +08:00
foamyguy
b6c7815f83 improving rotozoom() argument docstrings 2022-06-10 18:01:02 -05:00
Alec Delaney
82810085b5 Add note about display guide to bitmaptools 2022-05-13 11:47:21 -04:00
Jeff Epler
fb79d1c1d1 bitmaptools: add missing types
These diagnostics occurred, but weren't treated as errors:
```
[WARN] Missing return type: alphablend on line 38
[WARN] Missing argument type: dest_bitmap on line 38
[WARN] Missing argument type: source_bitmap_1 on line 38
[WARN] Missing argument type: source_bitmap_2 on line 38
```
2021-12-22 11:16:38 -06:00
Jeff Epler
6191696232
bitmaptools: Fix the DitgherAlorithm.FloydStenberg value 2021-11-24 09:51:19 -06:00
Jeff Epler
711f1f833b
bitmaptools: Fix the case where factor's Python type is int
mp_obj_float_get gets the value of an object, which must be
exactly a float.  mp_obj_get_float gets the float value of
an object of various types, including floats & ints.
2021-11-20 21:15:26 -05:00
Jeff Epler
ee5e7161af
bitmaptools: use stream API
this allows `readinto` to succeed in the unix port, where the VFS
is not FAT
2021-11-20 08:51:40 -05:00
Jeff Epler
06bb6ea5a2
use MP_OBJ_NULL in preference to 0 2021-11-12 13:21:53 -06:00
Jeff Epler
167665f8b7
fix build 2021-11-12 11:03:45 -06:00
Jeff Epler
d55388a17d
Add bitmaptools to unix build 2021-11-12 10:47:18 -06:00
Jeff Epler
ff9b10c7b6 fix doc build problems 2021-11-08 16:46:44 -06:00
Jeff Epler
cbfa41f238 Merge remote-tracking branch 'origin/main' into dither3 2021-11-08 16:46:36 -06:00
Jeff Epler
eaf8bc0abe bitmaptools: add dither
This can convert a BGR565_SWAPPED bitmap to B&W in about 82ms on
esp32-s2.
2021-11-08 10:35:44 -06:00
Jeff Epler
dfafab675f Enable L8 mode for alphablend 2021-11-05 11:26:07 -05:00
Jeff Epler
2ec2761ce0 bitmaptools: add alphablend
This blends two "565"-format bitmaps, including byteswapped ones. All
the bitmaps have to have the same memory format.

The routine takes about 63ms on a Kaluga when operating on 320x240 bitmaps.
Of course, displaying the bitmap also takes time.

There's untested code for the L8 (8-bit greyscale) case. This can be
enabled once gifio is merged.
2021-11-05 08:16:48 -05:00
microDev
1977011cfd
use mp_arg_validate_type for keyword args 2021-10-10 15:28:35 +05:30
James Carr
db936f8a20
bitmaptools.__init__ minor update
Update the error message in bitmaptools_readinto() to match the code.
2021-09-18 21:04:45 +01:00
Rob Capellini
b8f2799609 Convert more modules to use MP_REGISTER_MODULE
Convert bitbangio, bitmaptools, _bleio, board, busio, countio, digitalio, framebufferio, frequencyio, gamepadshift, getpass, keypad, math, microcontroller, and msgpack modules to use MP_REGISTER_MODULE.

Related to #5183.
2021-08-26 21:35:02 -04:00
foamyguy
aeeba3904b changed argument names and make replaced_color_value argument optional 2021-08-21 11:08:25 -05:00
foamyguy
6bd8a1d669 ensure bitmap type in argument 2021-08-16 09:10:29 -05:00
foamyguy
029150ac3b validate initial point is in-bounds 2021-08-15 19:46:20 -05:00
foamyguy
4d8494f1cd fix stubs 2021-08-13 10:42:21 -05:00
foamyguy
c1e164e1ff rename to boundary_fill and clean up comments 2021-08-13 09:52:51 -05:00
foamyguy
158048e56b trying to make lists 2021-08-08 14:33:07 -05:00
foamyguy
bcfec10552 starting bitmaptools.paint_fill 2021-08-08 09:31:09 -05:00
Scott Shawcroft
76033d5115
Merge MicroPython v1.11 into CircuitPython 2021-04-26 15:47:41 -07:00
Jeff Epler
78089107bc displayio.Bitmap: Allow modification though the buffer protocol
It is required to call .dirty() with appropriate arguments after modifications through the buffer protocol, or the display might not be updated correctly.
2021-04-03 10:41:20 -05:00
Kevin Matocha
c37a1f45f3 ran pre-commit for formatting fixes 2021-03-17 11:00:32 -05:00
Kevin Matocha
ef91e1752c merge upstream/main 2021-03-17 09:30:51 -05:00
Jeff Epler
074ba1daff more doc fixes 2021-03-16 19:05:06 -05:00
Jeff Epler
5810004bc9 fix doc error 2021-03-16 19:01:38 -05:00
Jeff Epler
e1dd396de7 fix stub docs 2021-03-16 13:37:04 -05:00
Jeff Epler
97b6664201 re-format with uncrustify 2021-03-16 12:20:09 -05:00
Kevin Matocha
870dadc85a update more docstrings 2021-03-16 10:42:46 -05:00
Kevin Matocha
a367e84cea update docstrings 2021-03-16 10:35:40 -05:00
Kevin Matocha
227ac67463 Add reverse_rows option to bitmaptools.readinto 2021-03-16 10:01:12 -05:00
Jeff Epler
542fb58673 add arrayblit 2021-03-15 20:36:44 -05:00
Jeff Epler
651f54b4cc fix docs 2021-03-14 15:47:15 -05:00
Jeff Epler
9133b23a37 bitmaptools: Add readinto
When reading uncompressed bitmap data directly, readinto can work
much more quickly than a Python-coded loop.

On a Raspberry Pi Pico, I benchmarked a modified version of
adafruit_bitmap_font's pcf reader which uses readinto instead of
the existing code. My test font was a 72-point file created from Arial.

This decreased the time to load all the ASCII glyphs from 4.9 seconds to
just 0.44 seconds.

While this attempts to support many pixel configurations (1/2/4/8/16/24/32
bpp; swapped words and pixels) only the single combination used by
PCF fonts was tested.
2021-03-14 13:57:46 -05:00
Kevin Matocha
a9afa0d9d4 Move input checks to shared-module, update docstrings 2021-03-11 16:18:17 -06:00
Kevin Matocha
85f0f07d51 add fill_region and draw_line to bitmaptools 2021-03-10 11:37:27 -06:00
Kevin Matocha
c883bb773b Rearrange input parameters 2021-02-24 16:03:50 -06:00
Kevin Matocha
cd4d55a573 yet another sphinx try 2021-02-24 08:05:40 -06:00
Kevin Matocha
e858db07f0 Another sphinx try 2021-02-24 07:59:32 -06:00
Kevin Matocha
2815c6dafa More sphinx attempts 2021-02-24 07:49:34 -06:00
Kevin Matocha
af5ad50125 More sphinx fixes 2021-02-24 01:18:30 -06:00
Kevin Matocha
18658b77f3 Sphinx docstring updates 2021-02-24 01:00:13 -06:00
Kevin Matocha
b720028642 Add bitmaptools module 2021-02-23 23:23:14 -06:00