Creates a new [[Quad]].

The purpose of a Quad is to use a fraction of an image to draw objects, as opposed to drawing entire image. It is most useful for sprite sheets and atlases: in a sprite atlas, multiple sprites reside in same image, quad is used to draw a specific sprite from that image; in animated sprites with all frames residing in the same image, quad is used to draw specific frame from the animation.

{{newobjectnotice}}
== Function ==
=== Synopsis ===
<source lang="lua">
quad = love.graphics.newQuad( x, y, width, height, sw, sh )
</source>
=== Arguments ===
{{param|number|x|The top-left position in the [[Image]] along the x-axis.}}
{{param|number|y|The top-left position in the [[Image]] along the y-axis.}}
{{param|number|width|The width of the Quad in the [[Image]]. (Must be greater than 0.)}}
{{param|number|height|The height of the Quad in the [[Image]]. (Must be greater than 0.)}}
{{param|number|sw|The reference width, the width of the [[Image]]. (Must be greater than 0.)}}
{{param|number|sh|The reference height, the height of the [[Image]]. (Must be greater than 0.)}}

=== Returns ===
{{param|Quad|quad|The new Quad.}}
== Examples ==
=== Use a Quad to display part of an Image: ===
<source lang="lua">
img = love.graphics.newImage("mushroom-64x64.png")

-- Let's say we want to display only the top-left 
-- 32x32 quadrant of the Image:
top_left = love.graphics.newQuad(0, 0, 32, 32, img:getDimensions())

-- And here is bottom left:
bottom_left = love.graphics.newQuad(0, 32, 32, 32, img:getDimensions())

function love.draw()
	love.graphics.draw(img, top_left, 50, 50)
	love.graphics.draw(img, bottom_left, 50, 200)
	-- v0.8:
	-- love.graphics.drawq(img, top_left, 50, 50)
	-- love.graphics.drawq(img, bottom_left, 50, 200)
end
</source>

== See Also ==
* [[parent::love.graphics]]
* [[Constructs::Quad]]
[[Category:Functions]]
[[Sub-Category::Object Creation| ]]
{{#set:Description=Creates a new [[Quad]].}}
{{#set:Since=000}}
== Other Languages ==
{{i18n|love.graphics.newQuad}}