API referenceRendering & Viewer

rasInitBaseObjectsV3

Size the page-cache's viewport and compute its initial

C
int32_t __stdcall rasInitBaseObjects(IPGC CachePtr, int32_t Width, int32_t Height, TInitCacheFlags Flags);
int32_t __stdcall rasInitBaseObjectsV3(IPGC CachePtr, TPDFDisplayTile DisplayTile, void* UserData, float Width, float Height, TInitCacheFlags Flags);
Delphi
function rasInitBaseObjects(CachePtr: IPGC; Width, Height: Integer; Flags: TInitCacheFlags): Integer; stdcall;
function rasInitBaseObjectsV3(CachePtr: IPGC; DisplayTile: TPDFDisplayTile; UserData: Pointer; Width, Height: Single; Flags: TInitCacheFlags): Integer; stdcall;

Purpose. Size the page-cache's viewport and compute its initial fit-to-view zoom level (rasInitBaseObjects); V3 is nominally the tile-callback-based variant of the same initialization.

Description. rasInitBaseObjects is genuinely real and does substantial work; rasInitBaseObjectsV3 is a confirmed complete stub (Result := Integer(0), one line, CachePtr/DisplayTile/ UserData/Width/Height/Flags all unread) — a stark divergence between two functions with near-identical names and purposes. rasInitBaseObjects stores Width/Height (also into BaseCtrlW/BaseCtrlH), defaults CurrPage to 1 if unset, and — only when the cache doesn't already have an explicit zoom (C.Zoom <= 0) and isn't in the explicit psFitZoom mode — computes a real fit zoom: scans every page for the widest media-box width (maxw, used for width-fit so a multi-size document's fit doesn't jump per page), and depending on PageScale computes psFitHeight (fit to viewport height), psFitBest (the smaller of width-fit/height-fit — true "fit whole page"), or the default psFitWidth.

Parameters.

ParameterDescription
CachePtrTarget page cache.
Width, HeightViewport pixel size.
Flags*(plain form)* Accepted; not observed to be consulted in the excerpted logic.
DisplayTile, UserData*(V3 only)* Never read — the whole function is a stub.

Return value. rasInitBaseObjects: the resolved current page number (1 if none was set). rasInitBaseObjectsV3: always 0.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int rasInitBaseObjectsV3(IntPtr CachePtr, TPDFDisplayTile DisplayTile, IntPtr UserData, float Width, float Height, uint Flags);
Area
Rendering & Viewer
Category

Rasterizer/Rendering

Exported names

rasInitBaseObjectsV3

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.