-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Any way to draw different colors along the normal direction of the line using an offset value? #2480
Comments
I think, that should possible with a shader in the SKPaint of the path. I would start with research in SkiaSharp or Skia. Perhaps you find there a solution. |
This is mostly a SkiaSharp question so you could also ask it there (after you searched for previous questions on this topic of course). https://github.com/mono/SkiaSharp Dash PatternsIt is possible to use dash patterns in SkiaSharp. We use this in our sample "Tests" | "Line", like this: feature = new GeometryFeature(wktReader.Read("LINESTRING (7000000 12000000, 13000000 12000000)"));
feature.Styles.Add(new VectorStyle { Line = new Pen(Color.Blue) { PenStyle = PenStyle.DashDot } }); A screenshot of the sample copied from the blazor samples (https://mapsui.com/samples/): Combining colorsAs far as I know you can use only one color in such a draw operation. My way to go about this would be to have two draw operations. The first color could be a solid line, and on top of that draw the dashed line, so the solid line fill the gaps in the dashed line. Note, that for a good solution where the line looks the same while panning and zooming you need to take into account the offset (of the origin of the path is not visible in the image you need to correct for that) and the scale (the dash pattern is different for different scales to make it appear the same to the user). |
I try to draw some more colorful line on the map but failed,it looks like it's not even supported in SKPath with SKPaint.
Like this, use to show administrative boundaries
or this,use to show transportation information in big resolution with different direction,I think using an offset value may be able to achieve that, but I can't find a simple way to do it.
Many thanks!
The text was updated successfully, but these errors were encountered: