def draw_shapes():
	context.clear(WHITE)
	sdlgfx.filledPolygonRGBA(context.renderer, xarray, yarray, ptcnt, *GREEN)
	sdlgfx.filledCircleRGBA(context.renderer, 300, 50, 20, *BLUE) 
	sdlgfx.ellipseRGBA(context.renderer, 320, 240, 20, 40, *RED)
	sdlgfx.boxRGBA(context.renderer, 200, 150, 300, 200, *RED)

	sdlgfx.thickLineRGBA(context.renderer, 60, 60, 120, 60, 4, *BLUE)
	sdlgfx.lineRGBA(context.renderer, 120, 60, 60, 120, *BLUE)
	sdlgfx.thickLineRGBA(context.renderer, 60, 120, 120, 120, 4, *BLUE)


	points = [380, 280, 382, 282, 384, 284, 386, 286, 388, 288]
	context.draw_point(points, BLACK)
Пример #2
0
 def draw(self, renderer, rect):
     width = self.env.scaled(1)
     r1 = self.d / 4
     r2 = self.d / 2
     c = rect.center
     for idx, a in enumerate(self.angles):
         x1 = c.x + int(math.cos(a) * r1)
         y1 = c.y + int(math.sin(a) * r1)
         x2 = c.x + int(math.cos(a) * r2)
         y2 = c.y + int(math.sin(a) * r2)
         shade = 80 + (((idx - (self.step // 4)) % self.lines) * 6)
         thickLineRGBA(renderer, x1, y1, x2, y2, width, shade, shade, shade, 200)
     self.step += 1
     self.window.needs_render = True
Пример #3
0
 def raw_segment(self, segment, width, color):
     height = self.height
     pt1, pt2 = segment
     if width == 1:
         self._no_error(
             gfx.aalineRGBA(self._renderer, trunc(pt1.x),
                            trunc(height - pt1.y), trunc(pt2.x),
                            trunc(height - pt2.y), *color))
     else:
         self._no_error(
             gfx.thickLineRGBA(self._renderer, trunc(pt1.x),
                               trunc(height - pt1.y), trunc(pt2.x),
                               trunc(height - pt2.y), trunc(width), *color))
Пример #4
0
 def draw_raw_segment(self, segment, width, color):
     height = self.height
     pt1, pt2 = segment
     if width == 1:
         self._no_error(
             gfx.aalineRGBA(
                 self._renderer, trunc(pt1.x), trunc(height - pt1.y), trunc(pt2.x), trunc(height - pt2.y), *color
             )
         )
     else:
         self._no_error(
             gfx.thickLineRGBA(
                 self._renderer,
                 trunc(pt1.x),
                 trunc(height - pt1.y),
                 trunc(pt2.x),
                 trunc(height - pt2.y),
                 trunc(width),
                 *color
             )
         )