Module
love.graphics
The graphics module is responsible for things like window management, Images, Animations, Fonts, and more.
Types
Image Represents a drawable image.
Animation Represents a frame-by-frame animation.
Font Represents a font.
Color An object containing color information.
ParticleSystem Contains information for a particle system.
Functions
newImage( filename ) Creates an Image.
newImage( filename, mode ) Creates an Image with a certain mode.
newAnimation( image ) Creates an Animation.
newAnimation( image, fw, fh, delay, frames ) Creates an Animation.
newColor( red, green, blue, alpha ) Creates a color.
newColor( red, green, blue ) Creates a color.
newFont( filename ) Creates a new Font with size 12.
newFont( filename, size ) Creates a new font by loading the font file.
newImageFont( filename, glyphs ) Creates a new font by loading a specifically formatted image.
newImageFont( filename, glyphs, spacing ) Creates a new font by loading a specifically formatted image.
newParticleSystem( image, buffer ) Creates a particle emitter.
checkMode( width, height, fullscreen ) Checks if a display mode is supported.
setMode( width, height, fullscreen, vsync, fsaa ) Changes the display mode.
toggleFullscreen( ) Toggles fullscreen.
isCreated( ) Checks if the display has been set.
getModes( ) Gets a list of supported fullscreen modes.
setCaption( caption ) Sets the window caption.
setColor( color ) Sets the current color.
setColor( red, green, blue ) Sets the current color.
setColor( red, green, blue, alpha ) Sets the current color.
setBackgroundColor( color ) Sets the background color.
setBackgroundColor( red, green, blue ) Sets the background color.
setFont( font ) Sets the current font.
setFont( filename ) Loads a font, and sets it as current.
setFont( filename, size ) Loads a font, and sets it as current.
setLineWidth( width ) Sets the line width.
setLineStyle( style ) Sets line anti-aliasing.
setLine( width ) Sets the width of the line used when drawing outlined primitives.
setLine( width, type ) Sets the width of the line used when drawing outlined primitives.
setLineStipple( ) Disables line stipple.
setLineStipple( pattern ) Sets a new stipple pattern.
setLineStipple( pattern, repeat ) Sets a new stipple pattern.
getLineWidth( ) Gets the current line width.
getLineStyle( ) Gets the current line style.
getLineStipple( ) Gets the current stipple pattern.
setPointSize( size ) Sets the point size.
setPointStyle( style ) Sets the point style.
setPoint( size, style ) Sets the point size and style.
getPointSize( ) Gets the current point size.
getPointStyle( ) Gets the current point style.
getMaxPointSize( ) Gets the max supported point size.
setBlendMode( mode ) Sets the blending mode.
setColorMode( mode ) Sets the color mode.
getBlendMode( ) Gets the current blend mode.
getColorMode( ) Gets the current color mode.
getColor( ) Gets the current color.
getBackgroundColor( ) Gets the current background color.
getFont( ) Gets the current font.
getWidth( ) Gets the width of the window.
getHeight( ) Gets the height of the window.
setScissor( x, y, width, height ) Scissor defines a box such that everything outside that box is discared and not drawn.
setScissor( ) Clears the scissor area.
getScissor( ) Gets the current scissor box.
draw( string, x, y ) Draws text on screen.
draw( string, x, y, angle ) Draws rotated text on screen.
draw( string, x, y, angle, s ) Draws rotated/scaled text on screen.
draw( string, x, y, angle, sx, sy ) Draws rotated/scaled text on screen.
draw( sprite, x, y ) Draws an Image or Animation on screen.
draw( sprite, x, y, angle ) Draws a rotated Image or Animation on screen.
draw( sprite, x, y, angle, s ) Draws a rotated/scaled Image or Animation on screen.
draw( sprite, x, y, angle, sx, sy ) Draws a rotated/scaled Image or Animation on screen.
draw( particlesystem, x, y ) Draws a particle system on screen.
drawf( string, x, y, limit ) Draws formatted text on screen, with word wrap.
drawf( string, x, y, limit, align ) Draws formatted text on screen, with word wrap.
draws( image, x, y, cx, cy, w, h ) Draws a subsprite of an Image.
draws( image, x, y, cx, cy, w, h, angle ) Draws a rotated subsprite of an Image.
draws( image, x, y, cx, cy, w, h, angle, s ) Draws a rotated/scaled subsprite of an Image.
draws( image, x, y, cx, cy, w, h, angle, sx, sy ) Draws a rotated/scaled subsprite of an Image.
draws( image, x, y, cx, cy, w, h, angle, sx, sy, ox, oy ) Draws a rotated/scaled subsprite of an Image, rotating around a different center.
point( x, y ) Draws a point at (x,y).
line( x1, y1, x2, y2 ) Draws a line from (x1,y1) to (x2,y2).
triangle( type, x1, y1, x2, y2, x3, y3 ) Draws a triangle usign the passed coordinates.
rectangle( type, x, y, w, h ) Draws a rectangle.
quad( type, x1, y1, x2, y2, x3, y3, x4, y4 ) Draws a quadrilateral usign the passed coordinates.
circle( type, x, y, radius ) Draws a circle usign the passed information.
circle( type, x, y, radius, points ) Draws a circle usign the passed information.
polygon( type, ... ) Draws a polygon.
screenshot( filename ) Save a screenshot as BMP.
Examples
Example 1: Loading an Image and displaying it
  1. -- Example: Loading an Image and displaying it 
  2.  
  3. function load() 
  4.     image = love.graphics.newImage("images/love-ball.png"
  5. end 
  6.  
  7. function draw() 
  8.     love.graphics.draw(image, 400300
  9. end 
Copyright © 2006-2008 LÖVE Development Team.