Differences between revisions 2 and 3
 ⇤ ← Revision 2 as of 2007-06-08 09:53:47 → Size: 1784 Editor: OlegKobchenko Comment: ← Revision 3 as of 2008-12-08 10:45:47 → ⇥ Size: 1798 Editor: anonymous Comment: converted to 1.6 markup Deletions are marked like this. Additions are marked like this. Line 1: Line 1: || inline:panview.png|| (./) Download: attachment:panview.ijs || {{attachment:panview.png}}|| (./) Download: [[attachment:panview.ijs]] Line 13: Line 13: [[latex( $$\begin{array}{ll} O_{xy}=max\{0,{V_{wh} - P_{wh}\over 2}\}, \\ \\ S_{xy}=max\{0,min\{S_{xy},P_{wh} - V_{wh}\}\} \end{array}$$ )]] <> Line 21: Line 21: inline:panparams.png {{attachment:panparams.png}} Line 31: Line 31: An additional performance boost comes from extended [wiki:JUser:gl2_commands glpixelsx] An additional performance boost comes from extended [[JUser:gl2_commands|glpixelsx]] Line 34: Line 34: one [wiki:JDic:d520 { From]. one [[JDic:d520|{ From]]. Line 40: Line 40: The image is loaded from a file using Self:Addons/media/platimg. The image is loaded from a file using [[Addons/media/platimg]]. Line 48: Line 48: * [:../Zoom View:Zoom View] * [:../Color Adjust:Color Adjust] * Self:Addons/media/paint * [[../Zoom View|Zoom View]] * [[../Color Adjust|Color Adjust]] * [[Addons/media/paint]] Line 52: Line 52: [[BR]] <
>

Pan View is a prototype of fast image panning using indexed subset of the original image in a view. The speed is such that the real-time mouse shift produces continuous seamless view update.

Given picture dimensions Pwh and view dimensions Vwh, the origin offset Oxy and origin shift Sxy are calculated as follows (all values represented as coordinate pairs).

The second step is to produce indices that correspond to the visible portion of the image.

  Ixy=: Sxy (+ i.)each Pwh <. Vwh

With base mouse position Bxy and base shift Bs saved on mouse down, panning is performed on mouse move, by adjusting the origin shift Sxy using the base values and current mouse position xy, and updating the view.

  Sxy=: Bs + Bxy - xy

An additional performance boost comes from extended glpixelsx command, which accepts pointer to data values as opposed to actual values. Subset of indices along both axes can be taken with one { From.

  p=. (<|.Ixy) { PIC
glpixelsx Oxy,(|.\$p),symdat symget <'p'

The image is loaded from a file using Addons/media/platimg. A public verb in z locale is defined to open an arbitrary picture.

  panview jpath'~system/examples/data/jbw.bmp'
panview wd 'mbopen'