Ejemplo n.º 1
0
def draw_polygon(renderer, points, color):
    n_pts = len(points)
    xarray = (sdl2.Sint16 * n_pts)()
    yarray = (sdl2.Sint16 * n_pts)()

    for i in range(n_pts):
        xarray[i] = points[i][0]
        yarray[i] = points[i][1]
    #unecessary
    #xptr = ctypes.cast(xarray, ctypes.POINTER(sdl2.Sint16))
    #yptr = ctypes.cast(yarray, ctypes.POINTER(sdl2.Sint16))

    sdlgfx.filledPolygonRGBA(renderer, xarray, yarray, n_pts, *color)
def draw_polygon(renderer, points, color):
	n_pts = len(points)
	xarray = (sdl2.Sint16 * n_pts)()
	yarray = (sdl2.Sint16 * n_pts)()

	for i in range(n_pts):
		xarray[i] = points[i][0]
		yarray[i] = points[i][1]
	#unecessary
	#xptr = ctypes.cast(xarray, ctypes.POINTER(sdl2.Sint16))
	#yptr = ctypes.cast(yarray, ctypes.POINTER(sdl2.Sint16))

	sdlgfx.filledPolygonRGBA(renderer, xarray, yarray, n_pts, *color)
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)
Ejemplo n.º 4
0
 def raw_poly_solid(self, poly, color):
     N = len(poly)
     X, Y = self._get_poly_xy(poly)
     color = Color(color)
     self._no_error(
         gfx.polygonRGBA(
             self._renderer, X, Y, N, *color))
     self._no_error(
         gfx.filledPolygonRGBA(
             self._renderer, X, Y, N, *color))
Ejemplo n.º 5
0
 def raw_poly_solid(self, poly, color):
     N = len(poly)
     X, Y = self._get_poly_xy(poly)
     color = Color(color)
     self._no_error(gfx.polygonRGBA(self._renderer, X, Y, N, *color))
     self._no_error(gfx.filledPolygonRGBA(self._renderer, X, Y, N, *color))