Open yuhr opened 4 years ago
After some inspect I've noticed that SATySFi's path implementation is sufficient and almost straitforward to the path construction operators that PDF supports, and all I need to do is just "map" exactly the same structure of path repres in OCaml into SATySFi code. Seems I need more inspect on PDF spec.
Hello, I'm going to make a library which improves experience of SATySFi's graphics functionality, especially flexibility to draw complex diagrams.
The concern is, if we want to do some complex manipulation on paths, it instantly becomes required to access internal representations of paths. How do you think about exposing these repres as some primitive? (Somehow, for example, converting
path
andpre-path
to something likepath-element list
and back?)On my local proof-of-concept work, some interesting functions achieved using existing
current_point
and implementing (on OCaml's side)current_tangent
which returns current tangent of a prepath. See below:arc-around: point -> float -> pre-path -> pre-path
draws an arc around specific centerpoint by specific angle from wherecurrent-point
tells.rline-for-length: point -> length -> pre-path -> pre-path
takes a relative direction vector and extend thepre-path
towards the direction by specific length.therminate-path-with-arrowhead: pre-path -> path
literally adds an arrowhead path wherecurrent-point
tells, and its orientation is automatically computed from whatcurrent-tangent
tells.(These functions are implemented as SATySFi code, with the exception of
current-point
andcurrent-tangent
)But I believe it is super exciting if entire path data become available to users so that we can write useful functions on user's side. I'll not be thrilled to touch SATySFi's OCaml implementation (that is, maybe, having breaking changes and/or bloating standard APIs) in order to implement complex functions, such as boolean operations, cutting and joining of paths.
Anotherly if such operations are to be implemented as standard APIs, there'd be nothing to stop me sending PRs about this constantly to SATySFi though... but even so, I think there should be some ways to access raw path data as a kind of last resort for diagram-oriented users 👻