API referenceRendering & Viewer

rasGetObjTypeAtV3

Real, working object hit-testing and selection — the

C
TSelObjAction __stdcall rasSelectObject(IPGC CachePtr, BOOL32 Down, int32_t X, int32_t Y, uint32_t SelColor, PPDFObjectInfo Info);
TSelObjAction __stdcall rasSelectObjectV3(IPGC CachePtr, uint32_t PageNum, BOOL32 Down, int32_t X, int32_t Y, PPDFObjectInfo Info);
TSelectObjType __stdcall rasGetObjTypeAt(IPGC CachePtr, int32_t X, int32_t Y, TPDFObjectInfo* Info);
TSelectObjType __stdcall rasGetObjTypeAtV3(IPGC CachePtr, uint32_t PageNum, int32_t X, int32_t Y, TPDFObjectInfo* Info);
Delphi
function rasSelectObject(CachePtr: IPGC; Down: LongBool; X, Y: Integer; SelColor: Cardinal; Info: PPDFObjectInfo): TSelObjAction; stdcall;
function rasSelectObjectV3(CachePtr: IPGC; PageNum: Cardinal; Down: LongBool; X, Y: Integer; Info: PPDFObjectInfo): TSelObjAction; stdcall;
function rasGetObjTypeAt(CachePtr: IPGC; X, Y: Integer; var Info: TPDFObjectInfo): TSelectObjType; stdcall;
function rasGetObjTypeAtV3(CachePtr: IPGC; PageNum: Cardinal; X, Y: Integer; var Info: TPDFObjectInfo): TSelectObjType; stdcall;

Purpose. Real, working object hit-testing and selection — the explicit counterpart to Mouse and Keyboard Input's stubbed 2/3/V3 mouse-event object variants.

Description. rasGetObjTypeAt(V3) both call a shared ObjTypeAtImpl(C, PageNum, X, Y, Info) (the plain form always passes C.CurrPage; V3 takes an explicit PageNum) which hit-tests annotations/fields at the device point and fills Info with the hit object's device bounding box and subtype. rasSelectObject(V3) share a SelectObjImpl that calls the same ObjTypeAtImpl, and on a hit, sets the marquee selection rectangle to the hit object's own bounding box (C.SelAX/AY/BX/BY := Inf.BBox...) — so selecting an object via this function makes it simultaneously reportable through rasGetSelRect/rasGetSelectionPath, unifying object selection and marquee selection into the same underlying state. Both rasSelectObject variants only act on Down = True (mouse-button-down) — a Down = False call is an explicit no-op (soaIgnored), not a hit-test. SelColor is accepted by rasSelectObject's ABI but this chapter did not find it consulted by SelectObjImpl (no selection-color state is set from it here — the highlight/render color for a selected object, if any, appears to be a paint-time concern rather than stored per selection).

Parameters.

ParameterDescription
CachePtrTarget page cache.
PageNum*(V3 only)* Explicit page to hit-test; plain forms always use the current page.
Down*(SelectObject only)* Must be True to perform the hit-test/select; False is ignored.
X, YDevice pixel position.
SelColor*(SelectObject only)* Accepted; not observed to be consulted.
InfoOutput: the hit object's bounding box and subtype.

Return value. rasGetObjTypeAt(V3): the hit object's TSelectObjType (0 if nothing hit or CachePtr doesn't resolve). rasSelectObject(V3): soaSelected on a hit, soaNoSelection if nothing was hit, soaIgnored if Down = False, soaError if CachePtr doesn't resolve.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern uint rasGetObjTypeAtV3(IntPtr CachePtr, uint PageNum, int X, int Y, ref TPDFObjectInfo Info);
Area
Rendering & Viewer
Category

Rasterizer/Rendering

Exported names

rasGetObjTypeAtV3

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.