Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Picture/Threaded Picture Functions Test
Function:
Required plugins for this example: MBS Main Plugin, MBS Picture Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Picture/Threaded Picture Functions Test
This example is the version from Sun, 17th Mar 2012.
Project "Threaded Picture Functions Test.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PopupMenu1 Inherits PopupMenu
ControlInstance PopupMenu1 Inherits PopupMenu
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() Map3 End EventHandler
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() Map1 End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action() Mandelbrot End EventHandler
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action() Mandelbrot 1.0, 1.0, -1.0, -1.0 End EventHandler
End Control
EventHandler Sub Open() logo = LogoMBS(5000) canvas1.Backdrop=logo const n = 16777216 // = 256*256*256 const n1= 16777215 // = 256*256*256-1 // to red levels for i as integer=0 to n1 m(i)=rgb(i mod 256, 0, 0) next // 50% darker for i as integer=0 to 255 r(i)=i/2 g(i)=i/2 b(i)=i/2 next End EventHandler
Sub Mandelbrot(fx as double = 4.0, fy as double = 4.0, dx as double = -2.0, dy as double = -2.0) dim p as Picture dim m as Double = Microseconds p = MandelbrotSetMBS(NumberOfThreads, 4000, 4000, fx, fy, dx, dy) m = Microseconds-m canvas1.Backdrop = p Report NumberOfThreads,m End Sub
Sub Map1() dim p as Picture dim m as Double = Microseconds p = logo.ThreadedTransformMBS(NumberOfThreads, self.m) m = Microseconds-m canvas1.Backdrop = p Report NumberOfThreads,m End Sub
Sub Map3() dim p as Picture dim m as Double = Microseconds p = logo.ThreadedTransformMBS(NumberOfThreads, r,g,b) m = Microseconds-m canvas1.Backdrop = p Report NumberOfThreads,m End Sub
Function NumberOfThreads() As integer dim n as integer = PopupMenu1.ListIndex-1 Return n End Function
Sub Report(Threads as integer, time as Double) List.AddRow str(Threads) List.cell(List.LastIndex,1)=Format(time/1000000.0,"0.0000")+"s" End Sub
Property b(255) As Integer
Property g(255) As Integer
Property logo As Picture
Property m(16777215) As color
Property r(255) As Integer
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Picture Plugin.





Links
MBS Xojo Plugins