API referenceRendering & Viewer

rasSetAsyncPaint

Turn background rasterisation on or off for a page cache,

C
BOOL32 __stdcall rasSetAsyncPaint(IPGC CachePtr, BOOL32 Enable);
Delphi
function rasSetAsyncPaint(CachePtr: IPGC; Enable: LongBool): LongBool; stdcall;

Purpose. Turn background rasterisation on or off for a page cache, so a host application can paint flicker-free: the paint path never renders on the UI thread.

Description. With async paint enabled, a cache miss during painting draws a stand-in (the most recent rendering of the same page at another zoom, stretched, or a blank sheet), queues the page for the cache's worker thread, and returns immediately; when the worker finishes the bitmap it fires the cache's paint callback so the host invalidates and the next paint blits the real rendering. Enabling lazily starts the worker thread on first use. Disabling returns the paint path to synchronous rendering; an already-started worker simply idles and is joined when the cache is deleted. On SDK slices built without the viewer (mobile targets, where the library must not create threads) the request is refused rather than armed without a worker.

Parameters.

ParameterDescription
CachePtrPage cache handle (rasCreatePageCache).
EnableTrue = background rasterisation, False = synchronous painting.

Return value. True on success; False for a NULL cache or on a slice where background rendering is unavailable.

See also. rasCreatePageCache, rasUpdateScrollBars.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Rendering & Viewer
Category

Rasterizer/Rendering

Exported names

rasSetAsyncPaint

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.