Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Audio Plugin
Last modified Sun, 1st Feb 2025.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /Win/AVI Write/AVI Write Test
Download this example: AVI Write Test.zip
Project "AVI Write Test.xojo_binary_project"
Class App Inherits DesktopApplication
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits DesktopWindow
Control Button1 Inherits DesktopButton
ControlInstance Button1 Inherits DesktopButton
EventHandler Sub Pressed()
Var w as new WindowsAVIWriteMBS
Var p as new Picture(600, 400)
w.Width = p.Width
w.Height = p.Height
w.Rate = 30
Var file as FolderItem = SpecialFolder.Desktop.Child("test.avi")
if not w.CreateFile(file) then
MessageBox "Failed to create file"+EndOfLine+w.LastErrorString
Break
Return
end if
if not w.CreateVideoStream then
MessageBox "Failed to create file"+EndOfLine+w.LastErrorString
Break
Return
end if
if not w.SetOptions(Self) then
MessageBox "Failed to set options"+EndOfLine+w.LastErrorString
Break
Return
end if
Var CurrentRed as integer = rnd * 256
Var CurrentGreen as integer = rnd * 256
Var CurrentBlue as integer = rnd * 256
Var TargetRed as integer = rnd * 256
Var TargetGreen as integer = rnd * 256
Var TargetBlue as integer = rnd * 256
for i as integer = 1 to 30 * 10 // 10 seconds
Var gr as Graphics = p.Graphics
gr.DrawingColor = rgb(CurrentRed,CurrentGreen,CurrentBlue)
gr.FillRectangle 0, 0, gr.Width, gr.Height
call w.AddFrame(p)
if CurrentRed = TargetRed and CurrentBlue = TargetBlue and CurrentGreen = TargetGreen then
TargetRed = rnd * 256
TargetGreen = rnd * 256
TargetBlue = rnd * 256
else
if CurrentRed > TargetRed then
CurrentRed = CurrentRed - 1
elseif CurrentRed < TargetRed then
CurrentRed = CurrentRed + 1
end if
if CurrentGreen > TargetGreen then
CurrentGreen = CurrentGreen - 1
elseif CurrentGreen < TargetGreen then
CurrentGreen = CurrentGreen + 1
end if
if CurrentBlue > TargetBlue then
CurrentBlue = CurrentBlue - 1
elseif CurrentBlue < TargetBlue then
CurrentBlue = CurrentBlue + 1
end if
end if
next
self.Backdrop = p
End EventHandler
End Control
EventHandler Sub Opening()
End EventHandler
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
MenuItem HelpMenu = "&Help"
End MenuBar
Sign
End Sign
End Project
See also:
Download this example: AVI Write Test.zip
The items on this page are in the following plugins: MBS Win Plugin.