Platforms to show: All Mac Windows Linux Cross-Platform
/Win/AVI Write/AVI Write Console
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 Console
Download this example: AVI Write Console.zip
Project "AVI Write Console.xojo_binary_project"
Class App Inherits ConsoleApplication
EventHandler Function Run(args() as String) As Integer
Var w as new WindowsAVIWriteMBS
const width = 320
const height = 200
Var p as new Picture(Width, Height)
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
print "Failed to create file"+EndOfLine+w.LastErrorString
Break
Return 1
end if
if not w.CreateVideoStream then
print "Failed to create file"+EndOfLine+w.LastErrorString
Break
Return 2
end if
if not w.SetOptions then
print "Failed to set options"+EndOfLine+w.LastErrorString
Break
Return 3
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
file = SpecialFolder.Desktop.Child("last.jpg")
p.Save(file, p.SaveAsJPEG)
print "done"
End EventHandler
End Class
Sign
End Sign
End Project
See also:
Download this example: AVI Write Console.zip
The items on this page are in the following plugins: MBS Win Plugin.