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

drawArc #24

Closed
biancashouse opened this issue Dec 5, 2018 · 6 comments
Closed

drawArc #24

biancashouse opened this issue Dec 5, 2018 · 6 comments

Comments

@biancashouse
Copy link

biancashouse commented Dec 5, 2018

Dave, great looking library.
My app draws a lot of canvas.
I notice the Microsoft Graphics doc has a drawEllipsis(), but not drawArc().
Are you planning to add ?
Or is there any current way to produce arcs and rounded rects ?
Would I need to workaround by covering an ellipsis with rects to achieve an arc ? etc ?
Thanks anyway,
Ian

@DavBfr
Copy link
Owner

DavBfr commented Dec 5, 2018

I think you should be able to create the drawArc() function from the drawEllipsis() content. To draw the ellipsis, I draw 4 cubic bézier curves. If you create a new function that draws only one, that should do the trick.

Or directly expose a bézier curve function in graphics.dart:

void curveTo(double x1, double y1, double x2, double y2, double x3, double y3) {
    buf.putString("$x1 $y1 $x2 $y2 $x3 $y3 c\n");
  }

Such curves are defined by four points: the current point (use moveTo()), the final point (x3, y3), and two control points (x1, y1) and (x2, y2).
https://en.wikipedia.org/wiki/B%C3%A9zier_curve

From that, you can find how to create an arc on the Internet.

@biancashouse
Copy link
Author

Dave,

Your response is much appreciated. Now I have multiple options: generate pdf, generate png from screen. Will try to use both. Many thanks.

@DavBfr
Copy link
Owner

DavBfr commented Dec 6, 2018

If you manage to create the function or some others, don't hesitate to create a pull request. I will be happy to get contributions.

@biancashouse
Copy link
Author

biancashouse commented Dec 6, 2018 via email

@DavBfr
Copy link
Owner

DavBfr commented Dec 6, 2018

I don't know if there is a widget to scroll in both directions.

@magnatronus
Copy link

magnatronus commented Dec 6, 2018

@biancashouse I have been 'playing around' with a high level wrapper for Dave's PDF library here. I use a Flutter plugin to view the generated PDF flutter_full_pdf_viewer. It does not scroll in both directions but it will allow pinch and zoom of each page of the viewer (just take a look at the example project)

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

3 participants