-
-
Notifications
You must be signed in to change notification settings - Fork 585
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
Comments
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 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). From that, you can find how to create an arc on the Internet. |
Dave, Your response is much appreciated. Now I have multiple options: generate pdf, generate png from screen. Will try to use both. Many thanks. |
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. |
Dave,
BTW - re producing pdfs in flutter, I wonder if you can guid me please...
Suppose my doc is going to be A4 size. Flutter has SingleChildScrollView,
but that only handle the height, but not the width. Are you aware of any
class / approach that would allow for scrolling in both directions ?
I have an idea: detect swipe gesture, and dep on direction toggle direction
of the Scroller widget. I'll play around with that.
…On Wed, Dec 5, 2018 at 11:34 PM David PHAM-VAN ***@***.***> wrote:
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.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#24 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AArVxORZiLEhrxftoWbcQGHE_oqC_VR5ks5u171FgaJpZM4ZCO99>
.
|
I don't know if there is a widget to scroll in both directions. |
@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) |
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
The text was updated successfully, but these errors were encountered: