Skip to content

Transparent draws do not work #71

@bridgesign

Description

@bridgesign

Calls of the type ctx.visual.render_???? when given a color with alpha values draw solid objects. This is likely because pygame requires that transparent objects should be drawn on a surface and should be blit on the screen. As such, rendering does blit the entire surface (which may have multiple entities).

Not clear why the surfaces are not blitting correctly. This can be solved easily while working on #38

Minimum code to reproduce the issue.

import gamms

ctx = gamms.create_context(vis_engine=gamms.visual.Engine.PYGAME)
graph.add_node({'id': 0, 'x': 0, 'y': 0})
ctx.visual.set_graph_visual(width=1980, height=1080)

def transparent_circle(ctx, data):
    ctx.visual.render_circle(0, 0, 20, (255, 0, 0, 80))

ctx.visual.add_artist('circle', gamms.visual.create_artist(ctx, transparent_circle))

try:
    while True:
        ctx.visual.simulate()
except KeyboardInterrupt:
    ctx.terminate()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions