Commit Graph

12 Commits

Author SHA1 Message Date
Taku Fukada 54a342a7f5 Add and correct some type hints 2020-07-24 18:20:03 +09:00
dherrada 9e3fa863f1
Merge branch 'main' into type_hints 2020-07-21 16:18:51 -04:00
Kenny efeae0d84f fix 3169: Polygon.points property
The getter for vectorio.Polygon#points was not updated with the data type change of the stored points list.

This moves the implementation to shared_module and updates the data type to reflect the actual state.
2020-07-19 12:27:35 -07:00
dherrada d0d949cd24 Made every init return None 2020-07-03 14:23:34 -04:00
Diego Elio Pettenò dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
warriorofwire dde66cadde remove a duplication in polygon.c 2020-05-18 13:32:06 -07:00
warriorofwire 4bbb80e31a vectorio: speed up polygon
This change takes polygon from 126k pixels per second fill to 240k pps fill
  on a reference 5 point star 50x66px polygon, updating both location and shape
  at 10hz.  Tested on an m4 express feather.

As a curiosity, the flat-out fill rate of a shape whose get_pixel is `return 0;`
  fills just shy of 375k pixels per second.
2020-05-18 13:32:06 -07:00
Scott Shawcroft 4e646ee6e4
Move vectorio to stubs 2020-05-12 18:40:02 -07:00
warriorofwire 78444a1018 fix VectorShape on_dirty callback registration being set for the wrong type 2020-05-11 21:21:05 -07:00
warriorofwire 040beb0577 Clean up circle documentation 2020-05-11 21:15:40 -07:00
warriorofwire 4086600b61 vectorio: switch per-shape transform to Display
Rather than maintain a transform per-shape, we'll just use whatever
  settings are on the Display.  Currently only transpose is done.
2020-05-09 22:15:51 -07:00
warriorofwire 206d0e598a Add vectorio: for drawing shapes
vectorio builds on m4 express feather

Concrete shapes are composed into a VectorShape which is put into a displayio Group for display.

VectorShape provides transpose and x/y positioning for shape implementations.

Included Shapes:

* Circle
  - A radius; Circle is positioned at its axis in the VectorShape.
  - You can freely modify the radius to grow and shrink the circle in-place.

* Polygon
  - An ordered list of points.
  - Beteween each successive point an edge is inferred.  A final edge closing the shape is inferred between the last
    point and the first point.
  - You can modify the points in a Polygon.  The points' coordinate system is relative to (0, 0) so if you'd like a
      top-center justified 10x20 rectangle you can do points [(-5, 0), (5, 0), (5, 20), (0, 20)] and your VectorShape
      x and y properties will position the rectangle relative to its top center point

* Rectangle
  A width and a height.
2020-05-09 15:38:22 -07:00