Coder Social home page Coder Social logo

Comments (2)

charlenni avatar charlenni commented on September 21, 2024

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.

from mapsui.

pauldendulk avatar pauldendulk commented on September 21, 2024

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 Patterns

It 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/):

image

Combining colors

As 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).

from mapsui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.