Total Pageviews

Tuesday, June 3, 2014

នេះជា Type SnapshotObject របស់ Corona SDK

នេះជា Type SnapshotObject របស់ Corona SDK
សំរាប់ SnapShot objects ប្រើសំរាប់ capture a group of display objects and render them into a flattened image
នេះជា Properties របស់វាះ
object.canvas
សំរាប់ក្រុមនេះគឺ special offscreen group ដែលអាចឪ្យយក draw to the snapshot’s texture ដោយគ្មានការ redrawing the objects in snapshot.group
Syntax: snapshot.canvas
សូមមើលកូដះ
local w,h = display.contentWidth,display.contentHeight
local snapshot = display.newSnapshot( w, h )
local brush = display.newImage( "brush.png" )
snapshot.canvas:insert( brush )
snapshot:invalidate( "canvas" )

object.canvasMode
នេះជា canvasMode ដែលគ្រប់គ្រង់នៅអ្វីដែលកើតឡើងទៅកាន់ children of the snapshot’s canvas។ សំរាប់​ mode នេះវានឹងធ្វើការនៅពេលដែល canvas is invalidated, the mode controls where those children go:
Append: this is the default, the children will be appended to the snapshot’s group on the next render pass
Discard the children will be discarded on the next render pass
Syntax: snapshot.canvasMode

object.clearColor
ប្រើសំរាប់ clear color controls how the snapshot’s texture us cleared when the snapshot is invalidated។ ដោយតំលៃដើម the texture is cleared with 0 for all color channels
Syntax: snapshot.clearColor
សូមមើលកូដះ
--clear with red
Snapshot.clearColor = {1,0,0,1}

object.group
សំរាប់ក្រុមនេះគឺ special offscreen group ដែលកំនត់នៅ what is rendered in the snapshot
Syntax: snapshot.group

object.textureFilter
នេះជាការគ្រប់គ្រង់នៅ texture filter mode សំរាប់ snapshot, សូមមើល Texture key’s section of display.setDefault() for valid filter values
Syntax: snapshot.textureFilter

object.textureWrapX
ប្រើសំរាប់គ្រប់គ្រង់នៅ texture wrap in the x-direction សំរាប់ snapshot
Syntax: snapshot.textureWrapX

object.textureWrapY
ប្រើសំរាប់គ្រប់គ្រង់នៅ texture wrap in the x-direction សំរាប់ snapshot
Syntax: snapshot.textureWrapY

Methods
object:invalidate()
​នេះជា invalidating snapshots ដែលប្រាប់នៅ Corona to invalidate its texture cache and re-enter the children to a texture on the next render pass វាមិនដូច other objects in Corona, snapshots មិនស្គាល់when the children have been modified
Syntax: snapshot:invalidate()
Snapshot:invalidate (“canvas”)



No comments:

Post a Comment