Code Monkey home page Code Monkey logo

Comments (8)

wieslawsoltes avatar wieslawsoltes commented on May 24, 2024

Are you referring to Avalonia controls? If so it's not trivial task. You can style original svg via css and reload.

from svg.skia.

arkadym avatar arkadym commented on May 24, 2024

Oh, but i found following from the source codes:

  • There s Svg control, it could be added there (lets start from simple) - two new properties: Stroke & Fill
  • It need to be passed into SvgSource.LoadPicture -> SvgDocument, after SvgDocument loaded.

I understand is very limited scenario, but could you give more details how it should looks like ?

from svg.skia.

arkadym avatar arkadym commented on May 24, 2024

So i did exactly as i wrote above:

  • Copy Svg and SvgSource to my project
  • Added 2 properties: Stroke & Fill
  • Load method of Svg is private so rewrite it to pass these 2 new properties to LoadPicture method of SvgSource
  • in SvgSource.LoadPicture set Stroke/Fill properties of the SvgDocument

It works!

So my understanding is - it would help to add kind of array SvgProps which we will build in Svg in Load method. Then pass the SvgProps into SvgSource.LoadPicture, where it will be applied to the SvgDocument.
I'm sure there could be a better way to implement that. but at least idea is works for me!

Appreciate if you could suggest me better way, then i would be able to create PR.

See attached files for working example.
SvgStrokeAndFill.zip

PS. Realized it cause need to Reload image on every Stroke/Fill changes, would be need to may be improve that and apply changes to AvaloniaPicture.Commands. For me current solution is good enough, but yet would agree it may be need bit more thinking.

from svg.skia.

wieslawsoltes avatar wieslawsoltes commented on May 24, 2024

Not planning that feature currently

from svg.skia.

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.