API reference › Rendering & Viewer
rasGetSelRectPDF
Report the current marquee/text-selection rectangle, in
int32_t __stdcall rasGetSelRect(IPGC CachePtr, TIntRect* Value);
int32_t __stdcall rasGetSelRectPDF(IPGC CachePtr, TBBox* Value);
function rasGetSelRect(CachePtr: IPGC; var Value: TIntRect): Integer; stdcall;
function rasGetSelRectPDF(CachePtr: IPGC; var Value: TBBox): Integer; stdcall;
Purpose. Report the current marquee/text-selection rectangle, in device viewport pixels (rasGetSelRect) or mapped into the current page's PDF user space (rasGetSelRectPDF).
Description. Both require C.HasSel (a prior selection made via the mouse-drag path, Mouse and Keyboard Input/E06) and normalize the selection's two corner points (SelAX/AY/SelBX/BY, which can be stored in either drag-direction order) into a proper x1≤x2, y1≤y2 rect. rasGetSelRectPDF additionally computes the current page's device top-left offset (same accumulation as rasGetPagePos/rasGetPageMatrix) and converts through zoom + the PDF bottom-up Y flip — explicitly documented as "Inverse of the device placement used by rasGetPageMatrix/rasGetPagePos" in an inline comment. Neither function accounts for the cache's rotation (rasSetRotate) — unlike rasClientToPage's hit-test math, which does invert rotation.
Parameters.
| Parameter | Description |
|---|---|
CachePtr | Target page cache. |
Value | Output: the normalized selection rectangle, in device pixels (TIntRect) or PDF user-space points (TBBox). |
Return value. The 1-based page the selection is on (C.CurrPage) if a selection exists; 0 if there is no active selection or CachePtr doesn't resolve.
C# (P/Invoke)
public static extern int rasGetSelRectPDF(IntPtr CachePtr, ref TBBox Value);
Rasterizer/Rendering
rasGetSelRectPDF
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.