BitmapPaint

Parent Paint
Library display.*
Revision Release 2024.3703
Keywords bitmap paint
See also object.fill
object.stroke
Effects Guide

Overview

A bitmap paint contains a single texture.

If desired, bitmap fills can be repeated (tiled) across the span of a display object. See the textureWrapX and textureWrapY properties in the Texture Keys section of display.setDefault() for more information.

Syntax

local paint = {
    type = "image",
    filename = ,
    baseDir = 
}
type (required)

String. String value of "image".

filename (required)

String. Filename of the image file.

baseDir (optional)

Constant. Specifies the base directory where filename is located. Options include system.ResourceDirectory, system.DocumentsDirectory, system.TemporaryDirectory and system.CachesDirectory. Default is system.ResourceDirectory.

Properties

(Inherits properties from Paint)

fill.rotation

fill.scaleX

fill.scaleY

fill.x

fill.y

Example

-- Create a vector rectangle
local rect = display.newRect( 200, 200, 300, 300 )

-- Set the fill (paint) to use the bitmap image
local paint = {
    type = "image",
    filename = "texture1.png"
}

-- Fill the rectangle
rect.fill = paint