INNER CODE UNIT · Python

d

dddevid/Musly · tools/generate_dmg_background.py:64

                d = math.hypot(x - circ_x, y - cy if False else y - circ_y)
                if d <= radius - 0.5:
                    set_pixel(x, y, r, g, b, a)
                elif d < radius + 0.5:
                    aa = (radius + 0.5 - d) * a
                    set_pixel(x, y, r, g, b, int(aa))

    # Helper: draw antialiased line
    def draw_line(x0, y0, x1, y1, thickness, r, g, b, a):
        length = math.hypot(x1 - x0, y1 - y0)
        if length == 0:
            return
        steps = int(length * 3)
        for i in range(steps + 1):
            t = i / steps
            px = x0 + t * (x1 - x0)
            py = y0 + t * (y1 - y0)
            draw_circle(px, py, thickness / 2.0, r, g, b, a)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…