Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw clock with using DrawArc provide unexpected result #37

Closed
vit1251 opened this issue Mar 8, 2018 · 6 comments
Closed

Draw clock with using DrawArc provide unexpected result #37

vit1251 opened this issue Mar 8, 2018 · 6 comments

Comments

@vit1251
Copy link

vit1251 commented Mar 8, 2018

I start implement clock widget and use your 2D render. My result is

image

I can not understand how to draw sector. I am start drawing from 150, 150 and call DrawArc.
It create path from 150, 150 to right draw arc and later I expect return back in 150, 150 but
I receive wrong join path. How to draw direct line.

@fogleman
Copy link
Owner

fogleman commented Mar 8, 2018

Can you post the code?

@vit1251
Copy link
Author

vit1251 commented Mar 8, 2018

Yes, sure:

func DrawSector(dc *gg.Context) {
    var start_angle float64 = Radians(-90)
    var end_angle float64 = Radians(0)
    var radius float64 = 240 / 2 - 18

    dc.ClearPath()
    dc.MoveTo(150, 150)
    dc.DrawArc(150, 150, radius, start_angle, stop_angel)
    dc.ClosePath()
    dc.SetRGB(...)
    dc.Stroke()
}

@fogleman
Copy link
Owner

fogleman commented Mar 8, 2018

I pushed a fix.

c97f757

@vit1251
Copy link
Author

vit1251 commented Mar 8, 2018

I redesign code and before draw arc make LineTo to start arc point and it fix problem.

Little later I replace DrawArc on series of LineTo call instead DrawArc and Fill.
But in any case tanks for help and support.

@vit1251 vit1251 closed this as completed Mar 8, 2018
@vit1251
Copy link
Author

vit1251 commented Mar 8, 2018

My result is

image

@fogleman
Copy link
Owner

fogleman commented Mar 8, 2018

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants