Skip to content

class Graphics


methods


Graphics.drawPixel


function Graphics.drawPixel(
  X: integer,
  Y: integer,
  color: color
)

@param X - X coordinate

@param Y - Y coordinate

@param color - the color of the pixel

Changes the color of a specific pixel

@see color

Graphics.drawRect


function Graphics.drawRect(
  X: integer,
  Y: integer,
  width: integer,
  height: integer,
  color: color
)

@param X - X coordinate for top left corner of the rectangle

@param Y - Y coordinate for top left corner of the rectangle

@param width - rectangle width

@param height - rectangle height

@param color - the color of the rectangle

Graphics.drawLine


function Graphics.drawLine(
  X: integer,
  Y: integer,
  X2: integer,
  Y2: integer,
  color: color
)

@param X - X coordinate for begining of line

@param Y - Y coordinate for begining of line

@param X2 - X coordinate for end of the line

@param Y2 - Y coordinate for end of the line

@param color - the color of the line

Graphics.drawCircle


function Graphics.drawCircle(
  X: integer,
  Y: integer,
  radius: integer,
  color: color,
  fill: integer
)

@param X - X coordinate for circle center

@param Y - Y coordinate for circle center

@param radius - circle radius

@param color - circle color

@param fill - 1:draw a filled circle, 0:draw only the perimeter of the circle. Optional parameter: 0 is the default

Graphics.drawTriangle


function Graphics.drawTriangle(
  x: number,
  y: number,
  x2: number,
  y2: number,
  x3: number,
  y3: number,
  color: color
)

@param x - Coordinates for first vertice

@param y - Coordinates for first vertice

@param x2 - Coordinates for second vertice

@param y2 - Coordinates for second vertice

@param x3 - Coordinates for third vertice

@param y3 - Coordinates for third vertice

Graphics.drawQuad


function Graphics.drawQuad(
  x: number,
  y: number,
  x2: number,
  y2: number,
  x3: number,
  y3: number,
  x4: number,
  y4: number,
  color: color
)

@param x - coordinates for first corner

@param y - coordinates for first corner

@param x2 - coordinates for second corner

@param y2 - coordinates for second corner

@param x3 - coordinates for third corner

@param y3 - coordinates for third corner

@param x4 - coordinates for fourth corner

@param y4 - coordinates for fourth corner

Graphics.drawQuad


function Graphics.drawQuad(
  x: number,
  y: number,
  x2: number,
  y2: number,
  x3: number,
  y3: number,
  x4: number,
  y4: number,
  color: color,
  color2: color,
  color3: color,
  color4: color
)

@param x - coordinates for first corner

@param y - coordinates for first corner

@param x2 - coordinates for second corner

@param y2 - coordinates for second corner

@param x3 - coordinates for third corner

@param y3 - coordinates for third corner

@param x4 - coordinates for fourth corner

@param y4 - coordinates for fourth corner

Graphics.loadImage


function Graphics.loadImage(
  path: string,
  delayed: boolean
) -> texture Texture?

@param path - location of the image to load

@param delayed - Whether the texture manager will be used or not. Optional Param: true by default

Loads a PNG/JPG/BMP image from a file

Graphics.threadLoadImage


function Graphics.threadLoadImage(
  path: string,
  delayed: boolean
)

@param path - location of the image to load

@param delayed - Whether the texture manager will be used or not. Optional Param: true by default

Threaded version of Graphics.loadImage

@see Graphics.loadImage

Graphics.getLoadState


function Graphics.getLoadState() -> stat integer

@return stat - status of the threaded image load return values can be:
- -2: no thread running, no texture avaiable for pickup
- -1: error creating thread
- 0: thread running
- 1: thread finished, texture avaiable for pickup with getLoadData
- 2: thread finished, failed to load texture

@see Graphics.threadLoadImage Graphics.getLoadData

Graphics.getLoadData


function Graphics.getLoadData() -> texture Texture?

@return texture - texture loaded by threadLoadImage. returns nil if there is no instance of threadLoadImage running

@see Graphics.threadLoadImage Graphics.getLoadState

Graphics.drawImage


function Graphics.drawImage(
  image: Texture,
  X: integer,
  Y: integer,
  color: color
)

@param image - The image texture

@param X - the X coordinates for the top left corner of the image

@param Y - the Y coordinates for the top left corner of the image

@param color - [Optional]: if not specified default is RGBA #80808080

Draws an image on screen with it's original size

Graphics.drawRotateImage


function Graphics.drawRotateImage(
  image: Texture,
  X: integer,
  Y: integer,
  angle: integer,
  color: color
)

@param image - The image texture

@param X - the X coordinates for the top left corner of the image

@param Y - the Y coordinates for the top left corner of the image

@param angle - Angle of rotation

@param color - A color created by Color.new. [Optional Parameter]

Draws an image on screen with it's original size and a rotation angle

Graphics.drawScaleImage


function Graphics.drawScaleImage(
  image: Texture,
  X: integer,
  Y: integer,
  scale_x: integer,
  scale_y: integer,
  color: color
)

@param image - The image texture

@param X - the X coordinates for the top left corner of the image

@param Y - the Y coordinates for the top left corner of the image

@param scale_x - width of the draw space for the image

@param scale_y - height of the draw space for the image

@param color - A color created by Color.new. [Optional Parameter]

Draws an image with a specified width and height

Graphics.drawPartialImage


function Graphics.drawPartialImage(
  image: Texture,
  X: integer,
  Y: integer,
  start_x: integer,
  start_y: integer,
  width: integer,
  height: integer,
  color: color
)

@param image - The image texture

@param X - the X coordinates for the top left corner of the image

@param Y - the Y coordinates for the top left corner of the image

@param start_x - coordinates for the portion of the image you want to display (top left corner)

@param start_y - coordinates for the portion of the image you want to display (top left corner)

@param width - width of the desired portion to be drawn

@param height - height of the desired portion to be drawn

@param color - A color created by Color.new. [Optional Parameter]

Draws a portion of an image

Graphics.drawImageExtended


function Graphics.drawImageExtended(
  image: Texture,
  X: integer,
  Y: integer,
  start_x: integer,
  start_y: integer,
  width: integer,
  height: integer,
  scale_x: integer,
  scale_y: integer,
  angle: integer,
  color: color
)

@param image - The image texture

@param X - the X coordinates for the top left corner of the image

@param Y - the Y coordinates for the top left corner of the image

@param start_x - coordinates for the portion of the image you want to display (top left corner)

@param start_y - coordinates for the portion of the image you want to display (top left corner)

@param width - width of the desired portion to be drawn

@param height - height of the desired portion to be drawn

@param scale_x - width of the draw space for the image

@param scale_y - height of the draw space for the image

@param angle - Angle of rotation

@param color - A color created by Color.new. [Optional Parameter]

extended image drawing

Graphics.setImageFilters


function Graphics.setImageFilters(
  image: Texture,
  filter: Filter {
    NEAREST = 0,
    LINEAR = 1,
}
)

@param image - The image texture

@param filter - texture filtering mode: [NEAREST, LINEAR]

Changes the filtering mode of the specified texture

@see Filter

Graphics.getImageWidth


function Graphics.getImageWidth(image: Texture) -> width integer

@param image - The image texture

Obtains the width of this texture

Graphics.getImageHeight


function Graphics.getImageHeight(image: Texture) -> Height integer

@param image - The image texture

Obtains the Height of this texture

Graphics.freeImage


function Graphics.freeImage(image: Texture)

@param image - The image texture

destroys the texture and frees the allocated buffer where it was stored