GetClippingRectangle

From Spheriki

Jump to: navigation, search

Returns a rectangle object cooresponding to the current clipping rectangle, as set by SetClippingRectangle().


Contents

Usage

Rectangle GetClippingRectangle();

Examples

//restrict all drawing to a 100x80 block with its top right corner
//at (1,2) in screen coordinates (See SetClippingRectangle() for 
//more details
SetClippingRectangle(1,2, 100, 80);


//imagine some stuff is drawn here (say a cup of hot tea).


var rect = GetClippingRectangle();

//now, rect.x = 1, rect.y = 2, rect.w = 100, and rect.h = 80. 


var rect = GetClippingRectangle();

SetClippingRectangle(0,0,100,200);

//draw some stuff

SetClippingRectangle(rect.x, rect.y, rect.w, rect.h);

Notes

  • The GetClippingRectangle() is useful for breaking up your code into organized pieces when SetClippingRectangle() is being used. The second example shows how one can temporarily change the clipping rectangle so that something can be drawn on the left hand part of the screen, and then have the original clipping rectangle is restored.

See also

Personal tools