EngoEngine/engo

Circle fill transparency

kayon opened this issue · 6 comments

kayon commented

I've seen changes, But new problems are coming.
When the fill color has transparency, it looks like this.
01

How are you setting transparency? It's working for me using the following code:

rectangle := MyShape{BasicEntity: ecs.NewBasic()}
rectangle.SpaceComponent = common.SpaceComponent{Position: engo.Point{100, 100}, Width: 50, Height: 50}
rectangle.RenderComponent = common.RenderComponent{Drawable: common.Rectangle{}, Color: color.RGBA{0, 255, 0, 255}}

circle := MyShape{BasicEntity: ecs.NewBasic()}
circle.SpaceComponent = common.SpaceComponent{Position: engo.Point{100, 100}, Width: 50, Height: 50}
circle.RenderComponent = common.RenderComponent{Drawable: common.Circle{BorderWidth: 1, BorderColor: color.White}, Color: color.Transparent}

image

kayon commented

When the fill color has transparency, It's not about borders.
01
common.RenderComponent{Drawable: common.Circle{}, Color: color.RGBA{R:0xFF, G:0, B:0, A:0xA0}}

kayon commented

01

common.Circle{Arc: 180}

theta := float32(2.0*math.Pi/355.0) * shape.Arc / 360

fmt.Println(2.0*math.Pi/355.0*180/360)
fmt.Println(float32(2.0*math.Pi/355.0*180/360))
// output
// 0.008849556770675475
// 0.008849557

And this, float32 losing precision.

My point with my code was that I'm using color.Transparent for the circle fill color and it works, the border was only there to show the location of the transparent circle.

Unfortunately I'll have to leave the circle maths to @Noofbiz for the time being, until I've figured that out.

Hello! Thanks for looking into this so well. It really helps us improve things! Check out #767 and let me know if that helps ^_^

Oh and I kind of missed it until now, to add support for Chinese characters you need to set 'common.UnicodeCap' to a high enough value