Platforms to show: All Mac Windows Linux Cross-Platform
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/MergePictureMBS Test
This example is the version from Fri, 17th Nov 2016.
Project "MergePictureMBS Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control Canvas2 Inherits Canvas
ControlInstance Canvas2 Inherits Canvas
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
EventHandler Sub Open()
FirstPicture = LogoMBS(300)
SecondPicture = New Picture(300,300,32)
SecondPicture.Graphics.ForeColor = &cFF0000
SecondPicture.Graphics.FillRect 0,0,300,300
runRB
runPlugin
End EventHandler
Sub runPlugin()
dim d as Double = Microseconds
dim p as Picture = MergePictureMBS(FirstPicture, SecondPicture)
d = Microseconds - d
canvas2.Backdrop = p
StaticText3.text = str(d)+" Microseconds"
End Sub
Sub runRB()
dim d as Double = Microseconds
dim p as Picture = new Picture(300, 300, 32)
dim r as RGBSurface = p.RGBSurface
dim rf as RGBSurface = FirstPicture.RGBSurface
dim rs as RGBSurface = SecondPicture.RGBSurface
dim col1,col2 as color
dim r1,r2,b1,b2,g1,g2 as integer
const mx = 299
const my = 299
for y as integer = 0 to my
for x as integer = 0 to mx
col2 = rf.pixel(x,y)
r1 = col2.red
g1 = col2.green
b1 = col2.blue
col2 = rs.pixel(x,y)
r2 = col2.red
g2 = col2.green
b2 = col2.blue
r.pixel(x,y) = RGB(max(r1,r2), max(g1,g2), max(b1,b2))
next
next
d = Microseconds - d
canvas1.Backdrop = p
StaticText4.text = str(d)+" Microseconds"
End Sub
Property FirstPicture As Picture
Property SecondPicture As Picture
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
End Project
The items on this page are in the following plugins: MBS Picture Plugin.