Platforms to show: All Mac Windows Linux Cross-Platform

/Picture/Threaded Picture Functions Test
Feedback.

Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /Picture/Threaded Picture Functions Test
This example is the version from Mon, 27th Dec 2009.
Notes: Last modified: Mon, 27th Dec 2009
Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = E&xit
Const kEditClear = &Delete
End Class

Class Window1
Inherits Window
// Controls
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
Map3

End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
Map1

End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
Mandelbrot

End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
Mandelbrot 1.0, 1.0, -1.0, -1.0

End Sub
End ControlInstance

// Properties
Dim logo As Picture
Dim r(255) As Integer
Dim g(255) As Integer
Dim b(255) As Integer
Dim m(16777215) As color

// Event implementations
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 Sub

// Methods
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
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
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 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
End Class





Links
MBS Filemaker Plugins - Pfarrgemeinde Messdiener Nickenich