Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Main Plugin, MBS Images Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/JPEG/JPEG Thread Test
This example is the version from Sat, 22th Feb 2013.
Project "JPEG Thread Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open()
// we run a lot of threads in parallel to see if it doesn't crash.
dim pic as Picture = LogoMBS(200)
dim data as string = PictureToJPEGStringMBS(pic, 80)
dim t as TestThread
t = new TestThread
t.data = data
t.run
Threads.Append t
t = new TestThread
t.data = data
t.run
Threads.Append t
t = new TestThread
t.data = data
t.run
Threads.Append t
t = new TestThread
t.data = data
t.run
Threads.Append t
t = new TestThread
t.data = data
t.run
Threads.Append t
t = new TestThread
t.data = data
t.run
Threads.Append t
t = new TestThread
t.data = data
t.run
Threads.Append t
t = new TestThread
t.data = data
t.run
Threads.Append t
End EventHandler
Property threads() As TestThread
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class TestThread Inherits Thread
EventHandler Sub Run()
do
test
loop
End EventHandler
Sub test()
dim j as new JPEGImporterMBS
j.YieldTicks = 1
j.Data = data
if j.InitJPEG then
dim h as integer =j.Height
dim w as integer =j.Width
j.FinishJPEG
else
break
end if
End Sub
Property data As string
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Images Plugin.