CoordinateSystems

From Inkscape Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Coordinate systems mentioned in the code or elsewhere:

  • Desktop
  • World
  • Root
  • Document: used for the contents of the document ie the SPObjects and whotnot. Each item in the SVG tree can have a transform, and the SPRoot appears to have yet another transform that can be applied (SPRoot::c2p).

Abbreviations used for coordinate systems:

  • d
  • dt --- usually seems to mean `desktop'
  • doc
  • w --- I think this means `world'. GTK's view of things; used to pass in click positions etc.??

Notes:

Desktop has:

  • SPDesktop::_w2d. Only set in SPDesktop::set_display_area(). This seems to be called to set the viewport, and is set to be a scale of (1/newscale, 1/-newscale). Widely used by event handlers to convert from mouse click coordinates (from GdkEventButton etc.) into desktop coordinates, so I think w2d in this context means "world to desktop" where world is basically GDK's view of things.
  • SPDesktop::_d2w. Only set in the same place as _w2d. Set to (newscale, -newscale), ie the inverse of _w2d.
  • SPDesktop::_doc2dt. Initialised to a scale of (1, -1). After that only _doc2dt[5] is touched, ie the y translation. This is set to the height of the drawing whenever it changes.