Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous. You can also use this link to report any problems registering or logging in.

CTS 10 - Relative coordinates

  • 1 Replies
  • 800 Views
*

Offline Phil

  • Global Moderator
  • Hero Member
  • *****
  • 809
    • View Profile
CTS 10 - Relative coordinates
« March 24, 2019, 09:15:30 PM »
When hand-coding large runs of graphical calls, it is easier to think in terms of relative position to the current point, than to add offsets to the current point (to get absolute coordinates). Graphical languages such as SVG offer both absolute and relative coordinates in many places, which is often very convenient.

There are a number of ways this might be done. One would be to offer "relative" versions of path-drawing methods: rarc(), rline(), rellipse(), etc., where all coordinates are relative the the Current Point. The current methods might take an option or optional parameter to declare that coordinates are relative and not absolute. The current methods might accept string coordinates with the number prefixed by R (this would be slower, as string coordinates would each have to be examined, any 'R' removed, converted to a number, and added to the Current Point if it's relative).

A final choice would be to implement a new graphics path method, very similar to SVG's path call. It would be a new language (like SVG's 'd' parameter to path) to do lines, curves, etc., with any mix of absolute and relative coordinates. Something similar might be done to augment text methods, so relative coordinates could be used.

*

Offline Phil

  • Global Moderator
  • Hero Member
  • *****
  • 809
    • View Profile
Re: CTS 10 - Relative coordinates
« Reply #1: December 30, 2020, 06:56:52 PM »
One of the items on my Builder enhancements list is to implement SVG, in the sense of another image format. This might be a practical answer to this request. That is, rather than implementing a new path-like version of graphics calls, PDF::Builder would implement a large subset of true SVG (it's probably too much to do all of SVG). See CTS 14 (#89). This would then be in lieu of enhanced "regular" PDF graphics (arc, circle, spline, etc.).