get_layer_rect_page_units

 

Description

get graphic layer's bounding box in page coordinate

Syntax

bool get_layer_rect_page_units( const GraphLayer & grl, int & nLeft, int & nTop, int & nRight, int & nBottom )

Parameters

grl
[input] the layer to get the bounding box
nLeft
[output] layer's left position in page coordinate
nTop
[output] layer's top position in page coordinate
nRight
[output] layer's right position in page coordinate
nBottom
[output] layer's bottom position in page coordinate

Return

true for success

Examples

EX1

//Before run this code, make sure the layer to get the bounding box is active
void show_layer_in_page_percet()
{
    GraphLayer grl = Project.ActiveLayer();
    double dPageW, dPageH;
    LT_get_var("page.width",&dPageW);
    LT_get_var("page.height",&dPageH);
    int left, top, right, bottom;
    get_layer_rect_page_units(grl, left, top, right, bottom);
    printf("layer width is %g percent of page width, height is %g percent\n", (right-left) * 100./dPageW, (bottom - top) * 100./dPageH);
}

Remark

See Also

header to Include

origin.h

Reference