Difference between revisions of "love.graphics.intersectScissor"
(Created page) |
(Added example.) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...). | The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...). | ||
+ | |||
== Function == | == Function == | ||
− | |||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
Line 12: | Line 12: | ||
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
− | {{param|number|x|x coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.}} | + | {{param|number|x|The x-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.}} |
− | {{param|number|y|y coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.}} | + | {{param|number|y|The y-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.}} |
− | {{param|number|width|width of the rectangle to intersect with the existing scissor rectangle.}} | + | {{param|number|width|The width of the rectangle to intersect with the existing scissor rectangle.}} |
− | {{param|number|height|height of the rectangle to intersect with the existing scissor rectangle.}} | + | {{param|number|height|The height of the rectangle to intersect with the existing scissor rectangle.}} |
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
+ | |||
+ | == Examples == | ||
+ | === Limit the drawing area incrementally === | ||
+ | <source lang="lua"> | ||
+ | function love.draw() | ||
+ | local windowWidth, windowHeight = love.graphics.getDimensions() | ||
+ | local halfWidth = windowWidth/2 | ||
+ | local halfHeight = windowHeight/2 | ||
+ | |||
+ | love.graphics.setScissor(0,0, halfWidth,windowHeight) | ||
+ | love.graphics.clear(0, 0, .5) -- Affects the left side. | ||
+ | love.graphics.intersectScissor(0,0, windowWidth,halfHeight) | ||
+ | love.graphics.circle("fill", halfWidth,halfHeight, 100) -- Affects the top left quadrant. | ||
+ | end | ||
+ | </source> | ||
== See Also == | == See Also == | ||
Line 25: | Line 40: | ||
* [[love.graphics.push]] | * [[love.graphics.push]] | ||
* [[love.graphics.pop]] | * [[love.graphics.pop]] | ||
+ | |||
+ | == Other Languages == | ||
+ | {{i18n|love.graphics.intersectScissor}} | ||
+ | |||
[[Category:Functions]] | [[Category:Functions]] | ||
{{#set:Description=Sets the [[love.graphics.setScissor|scissor]] to the rectangle created by the intersection of the specified rectangle with the existing scissor.}} | {{#set:Description=Sets the [[love.graphics.setScissor|scissor]] to the rectangle created by the intersection of the specified rectangle with the existing scissor.}} | ||
{{#set:Sub-Category=State}} | {{#set:Sub-Category=State}} | ||
− | |||
− |
Latest revision as of 00:57, 1 September 2022
Available since LÖVE 0.10.0 |
This function is not supported in earlier versions. |
Sets the scissor to the rectangle created by the intersection of the specified rectangle with the existing scissor. If no scissor is active yet, it behaves like love.graphics.setScissor.
The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear.
The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...).
Contents
Function
Synopsis
love.graphics.intersectScissor( x, y, width, height )
Arguments
number x
- The x-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.
number y
- The y-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle.
number width
- The width of the rectangle to intersect with the existing scissor rectangle.
number height
- The height of the rectangle to intersect with the existing scissor rectangle.
Returns
Nothing.
Examples
Limit the drawing area incrementally
function love.draw()
local windowWidth, windowHeight = love.graphics.getDimensions()
local halfWidth = windowWidth/2
local halfHeight = windowHeight/2
love.graphics.setScissor(0,0, halfWidth,windowHeight)
love.graphics.clear(0, 0, .5) -- Affects the left side.
love.graphics.intersectScissor(0,0, windowWidth,halfHeight)
love.graphics.circle("fill", halfWidth,halfHeight, 100) -- Affects the top left quadrant.
end
See Also
- love.graphics
- love.graphics.setScissor
- love.graphics.getScissor
- love.graphics.push
- love.graphics.pop
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info