API reference › Rendering & Viewer
rasGetPageAt
Hit-test a viewport device point against the cache's
int32_t __stdcall rasGetPageAt(IPGC CachePtr, int32_t ScrollX, int32_t ScrollY, int32_t X, int32_t Y);
function rasGetPageAt(CachePtr: IPGC; ScrollX, ScrollY, X, Y: Integer): Integer; stdcall;
Purpose. Hit-test a viewport device point against the cache's current continuous-layout column to find which page it falls on.
Description. Walks pages in order from 1, accumulating each page's rendered height (Round(ph * z) + VBorder) starting from VBorder, and returns the first page whose accumulated vertical span contains Y + ScrollY. Only Y/ScrollY participate — X is accepted by the ABI but never read, consistent with a page-cache layout that is always a single vertical column (no side-by-side/grid page layout exists in this engine despite the parameter suggesting horizontal hit-testing might matter).
Parameters.
| Parameter | Description |
|---|---|
CachePtr | Target page cache. |
ScrollX | Accepted but never read. |
ScrollY | Added to Y to get the true document-space vertical position. |
X | Accepted but never read. |
Y | Viewport-relative vertical position to hit-test. |
Return value. The 1-based page number at that position; 0 if none matches (position outside all pages, or CachePtr/document doesn't resolve).
C# (P/Invoke)
public static extern int rasGetPageAt(IntPtr CachePtr, int ScrollX, int ScrollY, int X, int Y);
Rasterizer/Rendering
rasGetPageAt
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.