Paint

Parent Userdata
Library display.*
Revision 2017.3060
Keywords paint, fill, stroke
See also object.fill
object.stroke
Filters/Generators/Composites (guide)

Overview

For object fills and strokes, Corona uses the concept of paint. Once a paint is declared, it can be applied to objects via object.fill and object.stroke.

Solid fills and strokes are specified by an array of color channels. For other fill/stroke types, including images, composites, and gradients, please see:

Syntax

{ gray }
{ gray, alpha }
{ red, green, blue }
{ red, green, blue, alpha }
gray, red, green, blue, alpha (optional)

Numbers. Numbers between 0 and 1 that represent the corresponding value for that channel. alpha represents the opacity of the object.

Properties

Examples

50% Gray Fill
local paint = { 0.5 }
local rect = display.newRect( 200, 300, 300, 300 )
rect.fill = paint
Solid Color Fill
local paint = { 1, 0, 0.5 }
local rect = display.newRect( 200, 300, 300, 300 )
rect.fill = paint