A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.circuitpython.org/en/latest/shared-bindings/vectorio/index.html below:

Website Navigation


vectorio – Lightweight 2D shapes for displays — Adafruit CircuitPython 1 documentation

vectorio – Lightweight 2D shapes for displays

The vectorio module provide simple filled drawing primitives for use with displayio.

group = displayio.Group()

palette = displayio.Palette(1)
palette[0] = 0x125690

circle = vectorio.Circle(pixel_shader=palette, radius=25, x=70, y=40)
group.append(circle)

rectangle = vectorio.Rectangle(pixel_shader=palette, width=40, height=30, x=55, y=45)
group.append(rectangle)

points=[(5, 5), (100, 20), (20, 20), (20, 100)]
polygon = vectorio.Polygon(pixel_shader=palette, points=points, x=0, y=0)
group.append(polygon)
Available on these boards
class vectorio.Circle(pixel_shader: displayio.ColorConverter | displayio.Palette, radius: int, x: int, y: int)

Circle is positioned on screen by its center point.

Parameters:
  • pixel_shader (Union[ColorConverter,Palette]) – The pixel shader that produces colors from values

  • radius (int) – The radius of the circle in pixels

  • x (int) – Initial x position of the axis.

  • y (int) – Initial y position of the axis.

  • color_index (int) – Initial color_index to use when selecting color from the palette.

radius: int

The radius of the circle in pixels.

color_index: int

The color_index of the circle as 0 based index of the palette.

x: int

X position of the center point of the circle in the parent.

y: int

Y position of the center point of the circle in the parent.

hidden: bool

Hide the circle or not.

location: Tuple[int, int]

(X,Y) position of the center point of the circle in the parent.

pixel_shader: displayio.ColorConverter | displayio.Palette

The pixel shader of the circle.

class vectorio.Polygon(pixel_shader: displayio.ColorConverter | displayio.Palette, points: List[Tuple[int, int]], x: int, y: int)

Represents a closed shape by ordered vertices. The path will be treated as ‘closed’, the last point will connect to the first point.

Parameters:
  • pixel_shader (Union[ColorConverter,Palette]) – The pixel shader that produces colors from values

  • points (List[Tuple[int,int]]) – Vertices for the polygon

  • x (int) – Initial screen x position of the 0,0 origin in the points list.

  • y (int) – Initial screen y position of the 0,0 origin in the points list.

  • color_index (int) – Initial color_index to use when selecting color from the palette.

points: List[Tuple[int, int]]

Vertices for the polygon.

color_index: int

The color_index of the polygon as 0 based index of the palette.

x: int

X position of the 0,0 origin in the points list.

y: int

Y position of the 0,0 origin in the points list.

hidden: bool

Hide the polygon or not.

location: Tuple[int, int]

(X,Y) position of the 0,0 origin in the points list.

pixel_shader: displayio.ColorConverter | displayio.Palette

The pixel shader of the polygon.

class vectorio.Rectangle(pixel_shader: displayio.ColorConverter | displayio.Palette, width: int, height: int, x: int, y: int)

Represents a rectangle by defining its bounds

Parameters:
  • pixel_shader (Union[ColorConverter,Palette]) – The pixel shader that produces colors from values

  • width (int) – The number of pixels wide

  • height (int) – The number of pixels high

  • x (int) – Initial x position of the top left corner.

  • y (int) – Initial y position of the top left corner.

  • color_index (int) – Initial color_index to use when selecting color from the palette.

width: int

The width of the rectangle in pixels.

height: int

The height of the rectangle in pixels.

color_index: int

The color_index of the rectangle in 1 based index of the palette.

x: int

X position of the top left corner of the rectangle in the parent.

y: int

Y position of the top left corner of the rectangle in the parent.

hidden: bool

Hide the rectangle or not.

location: Tuple[int, int]

(X,Y) position of the top left corner of the rectangle in the parent.

pixel_shader: displayio.ColorConverter | displayio.Palette

The pixel shader of the rectangle.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4