Difference between revisions of "gc:clipRect"

From Inspired-Lua Wiki
Jump to navigation Jump to search
(Created page with " Category:gc")
 
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
'''clipRect''' is a function that is part of [[:Category:gc|gc]].
  
 +
Sets the clipping rectangle for subsequent graphics operations.
  
 +
<br /> {{Since|3.0}}
 +
 +
==Syntax==
 +
gc:'''clipRect'''(op, x, y, width, height)
 +
{| class="wikitable"
 +
|-
 +
! Parameter !! Type !! Description
 +
|-
 +
| <u><center>op</center></u> || string || Can either be "set", "intersect", "reset", or "null"
 +
|-
 +
| <u><center>x</center></u> || number || x coordinate
 +
|-
 +
| <u><center>y</center></u> || number || y coordinate
 +
|-
 +
| <u><center>width</center></u> || number || the width of the rectangle
 +
|-
 +
| <u><center>height</center></u> || number || the height of the rectangle
 +
|-
 +
|}
 +
 +
 +
Details about the "op" parameter :
 +
Parameter op takes one of the strings “set”, “reset”, “intersect”, or “null”.
 +
* '''reset'''        sets the clipping rectangle to include the entire window. The remaining parameters is ignored and can be left out.
 +
* '''set'''            sets the clipping rectangle to the x, y coordinates with the specified width and height. The remaining parameters default to the system window location and size.
 +
* '''intersect'''  sets the clipping rectangle to the intersection of the current clipping rectangle with the rectangle specified in the routine parameters. <b>It has been removed in platform.apilevel = 2.0 ([[Changes in OS 3.2|OS 3.2]])</b>
 +
* '''null'''          sets the clipping rectangle to empty. All subsequent graphics commands will be ignored.
 +
Typically the “set” operation is called before drawing, say, a text string. It is important to call the “reset” operation after drawing the last clipped graphic so that you don’t leave a lingering clipping rectangle as a side effect.
 +
 +
== Example ==
 +
<syntaxhighlight>gc:clipRect("set", 20, 20, 50, 10)</syntaxhighlight>
 +
<br /><br />
 
[[Category:gc]]
 
[[Category:gc]]

Latest revision as of 15:06, 10 June 2012

clipRect is a function that is part of gc.

Sets the clipping rectangle for subsequent graphics operations.


This has been introduced in TI-Nspire OS 3.0 (Changes).


Syntax

gc:clipRect(op, x, y, width, height)

Parameter Type Description
op
string Can either be "set", "intersect", "reset", or "null"
x
number x coordinate
y
number y coordinate
width
number the width of the rectangle
height
number the height of the rectangle


Details about the "op" parameter : Parameter op takes one of the strings “set”, “reset”, “intersect”, or “null”.

  • reset sets the clipping rectangle to include the entire window. The remaining parameters is ignored and can be left out.
  • set sets the clipping rectangle to the x, y coordinates with the specified width and height. The remaining parameters default to the system window location and size.
  • intersect sets the clipping rectangle to the intersection of the current clipping rectangle with the rectangle specified in the routine parameters. It has been removed in platform.apilevel = 2.0 (OS 3.2)
  • null sets the clipping rectangle to empty. All subsequent graphics commands will be ignored.

Typically the “set” operation is called before drawing, say, a text string. It is important to call the “reset” operation after drawing the last clipped graphic so that you don’t leave a lingering clipping rectangle as a side effect.

Example

gc:clipRect("set", 20, 20, 50, 10)