TUpdScrollbar __stdcall rasPaint(IPGC CachePtr, HDC DC, int32_t* ScrollX, int32_t* ScrollY);
function rasPaint(CachePtr: IPGC; DC: HDC; var ScrollX, ScrollY: Integer): TUpdScrollbar; stdcall;
Purpose. The real, complete interactive paint routine — clamps scroll, fills the background, renders and blits every page that intersects the viewport (continuous mode) or just the current page (single-page mode), and updates CurrPage from scroll position.
Description. ScrollX/ScrollY are declared as pure out in the C/generated-reference parameter table, but the real behavior is in/out: the incoming values are clamped to the valid scroll range (0..VwContentH(C) - C.Height, floor 0) and then written back into C.ScrollX/ScrollY — the same parameters serve as both the requested scroll position and the clamped result. In continuous (non-single-page) mode, the function iterates every page, skips any whose vertical span doesn't intersect the visible viewport, renders each visible page at its unrotated size via the shared CacheRenderPage (a real bitmap cache — a page not already cached is rasterized on demand, cached hits return immediately), applies RotateRGB to match the cache's Rotate setting only if non-zero, centers it horizontally (respecting HBorder), and blits it via ViewerBlitRGB — with a page shadow/border drawn only when HBorder/VBorder are both > 0 (so an icon/thumbnail use-case with zero borders renders flush and frameless). C.CurrPage is continuously updated during the scan to whichever page's top is at or above roughly the top third of the viewport ("topmost mostly-visible" heuristic). Single-page mode instead loops exactly once, over C.CurrPage only (clamped into range), ignoring all other pages entirely regardless of scroll position.
Parameters.
| Parameter | Description |
|---|---|
CachePtr | Target page cache. |
DC | Destination device context. |
ScrollX, ScrollY | In/out, despite the reference table's "out" designation — input is the requested scroll, output is the actual clamped/applied scroll (also stored into C.ScrollX/ScrollY). |
Return value. TUpdScrollbar(3) (usbVertRange \| usbHorzRange — signals the host should update its scrollbar ranges) if CachePtr/the document resolve; TUpdScrollbar(0) otherwise.
C# (P/Invoke)
public static extern uint rasPaint(IntPtr CachePtr, UIntPtr DC, ref int ScrollX, ref int ScrollY);
Rasterizer/Rendering
rasPaint
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.