PDA

View Full Version : Image Sequence Player


MZ
04-21-2012, 02:16 PM
this is my code for playing image sequences.my question is how we can completely free memory after opening an image?

rollout PlayerRol "Image Sequence Player" width:700 height:700
(
dotNetControl Pnl_Player "Panel" pos:[0,35] width:600 height:600
checkbutton btn_Play "Play" pos:[0,0] width:80 height:30

local PlrTimer = dotNetObject "System.Windows.Forms.Timer"
local PlrCunt=1
local PlrBtn
local ImgSeq =(getfiles ("F:\Projects\Scripts\Player\Test\\*.bmp")) -- Image Sequence path.

fn AddPlayer =
(
PlrBtn = dotNetObject "button"
PlrBtn.size = dotNetObject "System.Drawing.Size" 600 600
Pnl_Player.controls.add PlrBtn
dotNet.setLifetimeControl PlrBtn #dotnet
)

fn PapulateTimer =
(
fn Play =
(
PlrCunt+=1
if PlrCunt< ImgSeq.count then
(
Try
(
setClipboardBitmap (openbitmap ImgSeq[PlrCunt])
PlrBtn.image = (dotNetClass "System.Windows.Forms.Clipboard").GetImage()
--we must free memory here!
)catch()
)
else PlrCunt = 1
)

dotnet.addEventHandler PlrTimer "tick" Play
PlrTimer.interval = 30
)

on PlayerRol open do
(
PapulateTimer()
AddPlayer()
)

on btn_Play changed state do
(
PlrTimer.Enabled = state
)

)
Createdialog PlayerRol

CGTalk Moderation
04-21-2012, 02:16 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.