@@ -532,11 +532,43 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_draw_line_obj, 0, bitmaptools_obj_draw_li
532
532
//| """Draw a polygon conecting points on provided bitmap with provided value
533
533
//|
534
534
//| :param bitmap dest_bitmap: Destination bitmap that will be written into
535
- //| :param int xs: x-pixel position of the polygon's vertices
536
- //| :param int ys: y-pixel position of the polygon's vertices
535
+ //| :param ReadableBuffer xs: x-pixel position of the polygon's vertices
536
+ //| :param ReadableBuffer ys: y-pixel position of the polygon's vertices
537
537
//| :param int value: Bitmap palette index that will be written into the
538
538
//| line in the destination bitmap
539
539
//| :param bool close: (Optional) Wether to connect first and last point. (True)
540
+ //|
541
+ //| .. code-block:: Python
542
+ //|
543
+ //| import board
544
+ //| import displayio
545
+ //| import bitmaptools
546
+ //|
547
+ //| display = board.DISPLAY
548
+ //| main_group = displayio.Group()
549
+ //| display.root_group = main_group
550
+ //|
551
+ //| palette = displayio.Palette(3)
552
+ //| palette[0] = 0xffffff
553
+ //| palette[1] = 0x0000ff
554
+ //| palette[2] = 0xff0000
555
+ //|
556
+ //| bmp = displayio.Bitmap(128,128, 3)
557
+ //| bmp.fill(0)
558
+ //|
559
+ //| xs = bytes([4, 101, 101, 19])
560
+ //| ys = bytes([4, 19, 121, 101])
561
+ //| bitmaptools.draw_polygon(bmp, xs, ys, 1)
562
+ //|
563
+ //| xs = bytes([14, 60, 110])
564
+ //| ys = bytes([14, 24, 90])
565
+ //| bitmaptools.draw_polygon(bmp, xs, ys, 2)
566
+ //|
567
+ //| tilegrid = displayio.TileGrid(bitmap=bmp, pixel_shader=palette)
568
+ //| main_group.append(tilegrid)
569
+ //|
570
+ //| while True:
571
+ //| pass
540
572
//| """
541
573
//| ...
542
574
//|
0 commit comments