-
Notifications
You must be signed in to change notification settings - Fork 0
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
API shape + Type naming #6
Comments
Visual is identical to Box in wpf-math and Display in CSharpMath. I named it Visual because 1. it sounds more appropriate than Box or Display, and 2. it shows up after MathAtom and TextAtom in Intellisense, which provides visual ordering of operations. Example usage: open MathAtom
open VisualAtom
@"\frac{1}{2}"
|> LaTeX.ToAtom //LaTeX to MathAtom
|> Visual.FromAtom //Visual from MathAtom
|> SKCanvas.DrawOn canvas //Visual on SKCanvas |
Sorry that I've been too overloaded to check in a consolidated Atom type. It's OK to use capital letters to avoid the annotations and I would use
For the math layers there is Atom (the visual structure), Box/Visual (full description of layout) and Rendering (with or without a SkiaSharp dependency). |
I updated the code. I don't expect people to open both
I don't see the namespace conflicting with the type but the module with the type. Renamed |
|
|
My suggestion for structure (dependencies and file order). It doesn't include namespaces but that should be compatible with file/project order. Namespaces can be altered later very easily. I would not recommend distinguishing VisualAtom/Box and an ICanvas. A VisualAtom/Box is a model of the view, and drawing it is just a matter of hooking up the particular drawing engine. We should make it obvious in the VisualAtom/Box structure how it should be rendered. ICanvas then serves no function and is not needed as an abstraction layer. |
Just to be clear about ICanvas, it does not represent the atom but the canvas. type ICanvas =
abstract member DrawLine: x1:float -> y1:float -> x2:float -> y2:float -> thickness:float -> unit
abstract member DrawQuadratc: x1: float -> y1: float -> x2:float -> y2: float -> x3:float -> y3:float -> unit
abstract member DrawCubic: x1: float -> y1: float -> x2:float -> y2: float -> x3:float -> y3:float -> x4: float -> y4: float -> unit
...
|
Yes I understand that. To oversimplify things, imagine we have type Element =
| Glyph of char * Point * size:float
| Line of Point * Point * thickness:float
...
type Box = Element list Then the SkiaSharp project can draw a Box on an SKCanvas, and similarly for any other renderer, and we don't need an intermediate interface layer. |
The current |
I propose the following general API shape:
The text was updated successfully, but these errors were encountered: