类型 函数 库 graphics.* 返回值 表 修订 版本 2024.3703 关键词 轮廓, 物理, 刚体, 图形 另请参阅 物理刚体 (指南) 图像表单 (指南) physics.addBody() 
此函数生成从图像文件或图像表单中帧获得的形状轮廓。形状由图像的
返回值是一个包含内容空间中 **x** 和 **y** 坐标的表,可用作 physics.addBody() 函数的轮廓
graphics.newOutline( coarsenessInTexels, imageFileName [, baseDir] )
数字. 以纹素为单位的粗糙度。值越高,轮廓分辨率越低。值越低,轮廓越大,可能会影响性能。
字符串. 要跟踪的图像的文件名。
常量. 加载图像的路径。默认为 system.ResourceDirectory(项目文件夹;与 main.lua 相同的位置)。有效值请参阅 system.pathForFile())。
graphics.newOutline( coarsenessInTexels, imageSheet, frameIndex )
数字. 以纹素为单位的粗糙度。值越高,轮廓分辨率越低。值越低,轮廓越大,可能会影响性能。
图像表单. 使用 graphics.newImageSheet() 创建的图像表单对象的引用。
local imageFile = "star.png"
local imageOutline = graphics.newOutline( 2, imageFile )
local image = display.newImage( imageFile )
physics.addBody( image, { outline=imageOutline, bounce=0.5, friction=0.1 } )
local options =
{
    width = 64,
    height = 64,
    numFrames = 12,
    sheetContentWidth = 256,  -- width of original 1x size of entire sheet
    sheetContentHeight = 192  -- height of original 1x size of entire sheet
}
local letterSheet = graphics.newImageSheet( "first_12_letters_of_the_alphabet.png", options )
local frameIndex = 9
local letterOutline = graphics.newOutline( 2, letterSheet, frameIndex )
local letterImage = display.newImageRect( letterSheet, frameIndex, 64, 64 )
physics.addBody( letterImage, { outline=letterOutline, bounce=0.5, friction=0.1 } )