CompositePaint

Parent Paint
Library display.*
Revision Release 2024.3703
Keywords composite paint, multitexture
See also object.fill
object.stroke
Filters, Generators, Composites (guide)

Overview

Composite paints contain multiple images, thus enabling multi-texturing.

Syntax

local paint = {
    type = "composite",
    paint1 = ,
    paint2 =
}
type (required)

String. String value of "composite".

paint1 (required)

Table. A table that specifies a BitmapPaint. See Limitations below.

paint2 (required)

Table. A table that specifies a BitmapPaint. See Limitations below.

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.

Limitations

Because of the way multi-texturing works, both paint1 and paint2 will be rendered using the same texture coordinates. Because GradientPaints and ImageSheetPaints use different texture coordinates from plain BitmapPaints, you will get unexpected results unless you use plain BitmapPaints for paint1 and paint2.

Properties

(Inherits properties from Paint)

Example

local paint = {
    type = "composite",
    paint1 = { type="image", filename="wood.png" },
    paint2 = { type="image", filename="dust.png" }
}

local rect = display.newRect( 200, 200, 300, 300 )
rect.fill = paint
rect.fill.effect = "composite.average"