Feedback
  • press ENTER to search or ESC to cancel

Table of content

Overview

Globals namespaces

Constants

Classes/objects


Edit page

GraphicsContext

Dialog():canvas{
  onpaint = function(ev)
    local ctx = ev.context
    -- ctx is a GraphicsContext
  end
}

GraphicsContext.width

Gets the width of the visible area in pixels.

GraphicsContext.height

Gets the height of the visible area in pixels.

GraphicsContext.antialias

It's true or false in case that you want to paint paths using antialiasing.

GraphicsContext.color

local color = gc.color
gc.color = Color(255)

Gets or sets the color to paint with the path functions.

GraphicsContext.strokeWidth

GraphicsContext:save()

gc:save()

Saves current clipping information to restore it later.

GraphicsContext:restore()

gc:restore()

GraphicsContext:clip()

gc:clip()

Sets the current path as a clipping area for following drawing operations.

GraphicsContext:strokeRect()

gc:strokeRect(rectangle)

Paints the edges of the given rectangle with the current color.

GraphicsContext:fillRect()

gc:fillRect(rectangle)

Fills the given rectangle with the current color.

GraphicsContext:fillText()

gc:fillText(string, x, y)

GraphicsContext:measureText()

local size = gc:measureText(string)

Returns the size of the text using the current font.

GraphicsContext:drawImage()

gc:drawImage(image, x, y)
gc:drawImage(image, srcRect, dstRect)
gc:drawImage(image, srcX, srcY, srcW, srcH, dstX, dstY, dstW, dstH)

GraphicsContext:drawThemeImage()

gc:drawThemeImage(partId, point)
gc:drawThemeImage(partId, x, y)

GraphicsContext:drawThemeRect()

gc:drawThemeRect(partId, rectangle)
gc:drawThemeRect(partId, x, y, w, h)

GraphicsContext:beginPath()

gc:beginPath()

GraphicsContext:closePath()

gc:closePath()

GraphicsContext:moveTo()

gc:moveTo(x, y)

GraphicsContext:lineTo()

gc:lineTo(x, y)

GraphicsContext:cubicTo()

gc:cubicTo(cp1x, cp1y, cp2x, cp2y, x, y)

GraphicsContext:rect()

gc:rect(rectangle)

GraphicsContext:roundedRect()

gc:roundedRect(rectangle, rx, ry)

GraphicsContext:stroke()

gc:stroke()

Paints the edges of the current path with the current color.

GraphicsContext:fill()

gc:fill()

Fills the current path with the current color.