-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add isStroked overload for IGeometryContext #12617
Conversation
You can test this PR using the following package version. |
/// </summary> | ||
/// <param name="point">The destination point.</param> | ||
/// <param name="isStroked">Whether the segment is stroked</param> | ||
public void LineTo(Point point, bool isStroked) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"hasStroke", "drawStroke" or "includeStroke" might be better names for the parameter. I do prefer "Is" when naming bool; however, "stroked" isn't a standard word. "isStroked" has good symmetry with "isFilled" though... so just ideas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name was taken from wpf's, but if there's better wording for it, I could change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, if naming is coming over from WPF its fine and I don't have concerns other than noted below (line should always have a stroke I think).
Fundamentally, I'm not sure I understand this PR. In WPF, lines have no Fill -- they are only stroke. Therefore, having an isStroked parameter may be a mistake in API and missing something fundamental.
Additionally, Skia doesn't have line fill either.
|
You can test this PR using the following package version. |
In WPF individual parts of the path can be skipped from being filled or stroked. You can ask BeginFigure to not fill the next figure or ask LineTo to not stroke the next path segment. var geo = new StreamGeometry();
using (var c = geo.Open())
{
c.BeginFigure(new Point(10,10), false, true);
c.LineTo(new Point(20,10), true, true);
c.LineTo(new Point(20, 20), true, true);
c.BeginFigure(new Point(40,10), true, true);
c.LineTo(new Point(50, 10), true, true);
c.LineTo(new Point(50, 20), false, true);
c.Close();
}
var drawing = new GeometryDrawing(Brushes.Blue, new Pen(Brushes.Red, 1), geo);
Content = new Image
{
Source = new DrawingImage(drawing)
}; We implement that by maintaining two separate SKPath instances per geometry if paths are actually different. |
@kekekeks Thanks for the explanation. I understand now and especially since this follows WPF I have no concerns. |
Closing this PR temporarily due to inactivity. Please ping me if this needs to be reopened. |
Hi @jmacato I mentioned this last time but etiquette is to comment on the PR asking for status and blockers before closing. Just closing suddenly is very bad practice. Some PRs are blocked for reasons other than the initial author too I believe. |
@timunie Yes, sorry, I don't mean for this PR specifically. It was just the last notification I received so commented here. They are general comments that perhaps are best left somewhere else. Apologies as I do know you discuss these internally as well. |
What does the pull request do?
Adds an
IGeomtryContextEx
interface, with a LineTo method that allow disabling stroke on a line.What is the current behavior?
What is the updated/expected behavior with this PR?
How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues