API reference › Rendering & Viewer
rasRenderTile
Render one tile of a page directly into the cache's "main
BOOL32 __stdcall rasRenderTile(IPGC CachePtr, uint32_t PageNum, uint32_t PageW, uint32_t PageH, uint32_t NRows, uint32_t NCols, TPDFTile* Tile);
function rasRenderTile(CachePtr: IPGC; PageNum, PageW, PageH, NRows, NCols: Cardinal; var Tile: TPDFTile): LongBool; stdcall;
Purpose. Render one tile of a page directly into the cache's "main buffer" (attached via rasInitMainTile, Rasterizer and Page-Cache Lifecycle) — the real, on-demand tile-rendering primitive underlying the whole tiled-viewer model.
Description. Supports two independent tile-addressing schemes, selected by whether Tile.Scale > 0: (1) an arbitrary zoom+pan mode where Tile.Scale is device pixels per page unit and Tile.SrcX/SrcY is the page-space bottom-left origin of the shown region (so the tile source rect is [SrcX, SrcY, TileW/Scale, TileH/Scale]); or (2) a fixed NRows×NCols grid mode where the page is divided evenly and Tile.IndexX/IndexY select a cell (IndexY counted from the bottom, per the NRows - 1 - IndexY flip). Genuinely honors OCG (layer) visibility: it collects the cache's HiddenOCG handle list and calls D.GetPageContentFiltered to strip hidden-layer content before rendering — a tile rendered after rasSetOCGState hides a layer will not show that layer's content. Renders via the general RenderPageToRGB (the same engine RenderPageBMP/E01 uses), then blits pixel-by-pixel into C.MainBuf at the tile's destination rect, converting to BGR order if C.MainPixFmt = pxfBGR (an explicit per-pixel channel swap, not a format flag passed through). Caches the rendered tile's metadata as C.LastTile/HasLastTile := True, consumed by rasGetCurrTile (Rasterizer and Page-Cache Lifecycle).
Parameters.
| Parameter | Description |
|---|---|
CachePtr | Target page cache; requires a main tile buffer already attached via rasInitMainTile. |
PageNum | 1-based page to render. |
PageW, PageH | Accepted; not observed to be read (page size comes from D.GetPageSize instead). |
NRows, NCols | Grid dimensions for the fixed-grid addressing mode (Tile.Scale ≤ 0); ignored in arbitrary-scale mode. |
Tile | In: DstRect, TileW/TileH, Scale/SrcX/SrcY (arbitrary mode) or IndexX/IndexY (grid mode). Out: PageW, TileW/TileH (possibly clamped), and it becomes the new C.LastTile. |
Return value. True on successful render and blit; False if CachePtr/document/main buffer/page size doesn't resolve, or the computed tile dimensions are non-positive.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Rasterizer/Rendering
rasRenderTile
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.