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/FindPicture test
This example is the version from Wed, 20th Oct 2015.
Project "FindPicture test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open()
dim p as Picture = LogoMBS(100)
dim t as new Picture(Width, Height, 32)
// put pictures somewhere randomly
dim g as Graphics = t.Graphics
for i as integer = 1 to 10
dim y as integer = rnd * Height - 50
dim x as integer = rnd * Width - 50
g.DrawPicture p, x, y
next
// now find one by looking for a smaller part of it
dim part as new Picture(20, 20, 32)
part.Graphics.DrawPicture p, 0, 0, 20, 20, 40, 40, 20, 20
dim x, y as integer
while t.FindPictureMBS(part, x, y, x, y)
g.ForeColor = &cFF0000
dim xx as integer = x - 40
dim yy as integer = y - 40
dim x2 as integer = xx + p.Width
dim y2 as integer = yy + p.Height
g.DrawRect xx, yy, p.Width, p.Height
g.DrawLine xx, yy, x2, y2
g.DrawLine xx, y2, x2, yy
x = x + 1
wend
Backdrop = t
End EventHandler
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
The items on this page are in the following plugins: MBS Picture Plugin.