xaml-math icon indicating copy to clipboard operation
xaml-math copied to clipboard

Extract WPF-dependent code into a separate project

Open gsomix opened this issue 7 years ago • 10 comments

As part of #18 and #17.

gsomix avatar Feb 26 '17 20:02 gsomix

Yep. An abstract rendering API might take a bit more thought than simply refactoring, but I am all for this!

alexreg avatar Feb 26 '17 22:02 alexreg

I thought we could use visitor pattern to abstract this. We already have very similar code in Draw and RenderGrometry methods; that could be a basis for that refactoring. After extracting these to separate visitors, we could probably just split WPF part and the parser.

The parser still use some WPF features (I think fonts), so we should abstract those, also.

ForNeVeR avatar Feb 27 '17 03:02 ForNeVeR

OK, this is next huge step after #93 got merged.

gsomix avatar Dec 06 '17 06:12 gsomix

We'll definitely need to discuss that. Now I have a bit of insight on how our code works, so I could probably provide a useful advice.

ForNeVeR avatar Dec 06 '17 10:12 ForNeVeR

@ForNeVeR, hello!

Do you update the 17-avalonia branch yourself? Or can I make edits to this thread without updates?

P.S. I have no goals yet. I'm just eyeing :)

rstm-sf avatar Jan 11 '20 13:01 rstm-sf

I would accept a pull request to that branch.

ForNeVeR avatar Jan 11 '20 13:01 ForNeVeR

Can we replace bg / fg Brush with RgbaColor (maybe also new struct with color and opacity) and only create a Brush when rendering? https://github.com/ForNeVeR/wpf-math/search?p=1&q=brush&unscoped_q=brush

rstm-sf avatar Feb 24 '20 20:02 rstm-sf

Yeah, this seems like a right course of action. We'll lose some flexibility though (e.g. it won't be possible to create a texture background and such).

Could you think of a better solution, which will preserve ability to pass arbitrary Brush (or whatever is Avalonia equivalent called) as a fore/background for our atoms?

ForNeVeR avatar Feb 25 '20 16:02 ForNeVeR

It seems that we only need to know the color information:

rstm-sf avatar Feb 29 '20 09:02 rstm-sf

Yes, I'm not talking about defining texture backgrounds from LaTeX code. I'm talking about providing an externally-defined Brush for background/foreground, which may actually be useful.

ForNeVeR avatar Mar 02 '20 15:03 ForNeVeR

Closed by #327.

There are now some basic abstractions for:

  • colors,
  • brushes,
  • fonts,
  • geometry.

Some of those were taken from the Avalonia branch, and ultimately everything is done with it in mind.

This has unlocked us from further work on #17.

ForNeVeR avatar Jan 25 '23 22:01 ForNeVeR