Commit Graph

5 Commits

Author SHA1 Message Date
foamyguy fe8b9728e7 color index for vectorio shapes. 2022-03-19 11:30:37 -05:00
Kenny b5837b157d improve transpose and mirror
* add heuristic to avoid drawing area unnecessarily
* fix Polygon.points
* fix transpose
* fix mirror x and y

Known broken:
Polygon with negative Y coordinates does not work right.
2021-08-07 19:31:22 -07:00
Kenny 8607cdd783 vectorio: add draw protocol
* Removes VectorShape from user python interactions
* Re-integrates vectorio with displayio behind draw protocol implementations
* Implements draw protocol with VectorShape
* Composes VectorShape behaviors into Rectangle, Circle and Polygon
* Fixes terrible pixel garbage being left behind
* Improves redraw performance (heuristically) by tracking dirty area separately from current area.

Known Issues:
It does not work with transposed views.
2021-08-02 20:19:54 -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
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