Beispiel #1
0
    def raw_circle_border(self, circle, width, color):
        safe_operator = self._no_error
        x, y = trunc(circle.x), trunc(self.height - circle.y)
        renderer = self._renderer

        if width == 1:
            radius = trunc(circle.radius)
            safe_operator(gfx.aacircleRGBA(renderer, x, y, radius, *color))
        else:
            # Very ugly hack! can it be better?
            min_r = trunc(circle.radius - width / 2)
            max_r = trunc(circle.radius + width / 2)
            for r in range(min_r, max_r):
                safe_operator(gfx.aacircleRGBA(renderer, x, y, r, *color))
Beispiel #2
0
    def raw_circle_border(self, circle, width, color):
        safe_operator = self._no_error
        x, y = trunc(circle.x), trunc(self.height - circle.y)
        renderer = self._renderer

        if width == 1:
            radius = trunc(circle.radius)
            safe_operator(gfx.aacircleRGBA(renderer, x, y, radius, *color))
        else:
            # Very ugly hack! can it be better?
            min_r = trunc(circle.radius - width / 2)
            max_r = trunc(circle.radius + width / 2)
            for r in range(min_r, max_r):
                safe_operator(gfx.aacircleRGBA(renderer, x, y, r, *color))
Beispiel #3
0
def hint_stone(x, y, intensity=0.5, isFirst=False):
    r, g, b, a = HINT_COLOR
    a = int(255 * intensity)
    main = r, g, b, a
    border = PV_COLOR if isFirst else HINT_COLOR

    r = STONE_RADIUS
    circle(x, y, r - 2, main)
    gfx.aacircleRGBA(renderer, x, y, r - 2, *main)
    gfx.aacircleRGBA(renderer, x, y, r - 1, *border)
    gfx.aacircleRGBA(renderer, x, y, r, *border)
    if isFirst: gfx.aacircleRGBA(renderer, x, y, r + 1, *border)
Beispiel #4
0
    def raw_circle_solid(self, circle, color):
        self._no_error(
            gfx.filledCircleRGBA(self._renderer, trunc(circle.x),
                                 trunc(self.height - circle.y),
                                 trunc(circle.radius), *color))

        self._no_error(
            gfx.aacircleRGBA(self._renderer, trunc(circle.x),
                             trunc(self.height - circle.y),
                             trunc(circle.radius), *color))
Beispiel #5
0
    def draw_raw_circle_solid(self, circle, color):
        self._no_error(
            gfx.filledCircleRGBA(
                self._renderer, trunc(circle.x), trunc(self.height - circle.y), trunc(circle.radius), *color
            )
        )

        self._no_error(
            gfx.aacircleRGBA(
                self._renderer, trunc(circle.x), trunc(self.height - circle.y), trunc(circle.radius), *color
            )
        )
Beispiel #6
0
def stone(x, y, owner, mode="texture"):

    if mode == "texture":
        if owner == "black" and tblackstone != None:
            w, h = 2 * STONE_RADIUS, 2 * STONE_RADIUS
            x, y = x - w // 2, y - w // 2
            SDL_RenderCopy(renderer, tblackstone, None,
                           SDL_Rect(x, y, w + 1, h + 1))
            return None
        if owner == "white" and twhitestone != None:
            w, h = 2 * STONE_RADIUS, 2 * STONE_RADIUS
            x, y = x - w // 2, y - w // 2
            SDL_RenderCopy(renderer, twhitestone, None,
                           SDL_Rect(x, y, w + 1, h + 1))
            return None

    main, border = (BLACK, WHITE) if owner == "black" else (WHITE, BLACK)
    r = STONE_RADIUS

    if owner == "white":
        circle(x, y, r, border)

    circle(x, y, r - 2, main)
    gfx.aacircleRGBA(renderer, x, y, r - 2, *main)
    gfx.aacircleRGBA(renderer, x, y, r - 1, *border)
    gfx.aacircleRGBA(renderer, x, y, r, *border)
Beispiel #7
0
    def raw_circle_solid(self, circle, color=None):
        self._no_error(
            gfx.filledCircleRGBA(
                self._renderer,
                trunc(circle.x),
                trunc(self.height - circle.y),
                trunc(circle.radius), *(color or self._black)))

        self._no_error(
            gfx.aacircleRGBA(
                self._renderer,
                trunc(circle.x),
                trunc(self.height - circle.y),
                trunc(circle.radius), *color))
Beispiel #8
0
def circ_mark(x, y, owner):
    main, border = (BLACK, WHITE) if owner == "black" else (WHITE, BLACK)
    r = STONE_RADIUS // 2
    gfx.aacircleRGBA(renderer, x, y, r, *border)