父级 绘制 (Paint) 库 display.* 版本 版本 2024.3703 关键词 位图绘制 另请参阅 object.fill(对象填充) object.stroke(对象描边) 效果指南
位图绘制包含单个纹理。
如果需要,位图填充可以重复(平铺)显示对象的整个跨度。有关更多信息,请参阅 display.setDefault() 的**纹理键 (Texture Keys)** 部分中的 textureWrapX 和 textureWrapY 属性。
local paint = {
type = "image",
filename = ,
baseDir =
}
字符串 (String). 字符串值 "image"。
字符串 (String). 图像文件的文件名。
常量 (Constant). 指定文件名所在的基本目录。选项包括 system.ResourceDirectory(资源目录)、system.DocumentsDirectory(文档目录)、system.TemporaryDirectory(临时目录)和 system.CachesDirectory(缓存目录)。默认为 system.ResourceDirectory(资源目录)。
(继承自 绘制 (Paint) 的属性)
-- 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