Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Picture/Picture MinMax/mmx_demo with plugin
Function:
Required plugins for this example: MBS Picture Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Picture/Picture MinMax/mmx_demo with plugin
This example is the version from Fri, 17th Nov 2016.
Project "mmx_demo with plugin.rbp"
Class Fenster1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() quit End EventHandler
End Control
Control scr Inherits Canvas
ControlInstance scr Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) show_image End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() dim t as integer t=ticks find_minimax(intern,result) t=ticks-t res_list.deleteAllRows res_list.AddRow "ticks "+str(t) addpoint "red max",result(0),result(1) addpoint "grn max",result(2),result(3) addpoint "blu max",result(4),result(5) addpoint "sum max",result(6),result(7) addpoint "red min",result(8),result(9) addpoint "grn min",result(10),result(11) addpoint "blu min",result(12),result(13) addpoint "sum min",result(14),result(15) min_btn.enabled=true max_btn.enabled=true me.Enabled=false End EventHandler
End Control
Control res_list Inherits Listbox
ControlInstance res_list Inherits Listbox
End Control
Control min_btn Inherits PushButton
ControlInstance min_btn Inherits PushButton
EventHandler Sub Action() intern.graphics.drawpicture test,0,0 draw_mark intern, result(0),result(1),red draw_mark intern, result(2),result(3),grn draw_mark intern, result(4),result(5),blu draw_mark intern, result(6),result(7),blk End EventHandler
End Control
Control max_btn Inherits PushButton
ControlInstance max_btn Inherits PushButton
EventHandler Sub Action() intern.graphics.drawpicture test,0,0 draw_mark intern, result(8),result(9),red draw_mark intern, result(10),result(11),grn draw_mark intern, result(12),result(13),blu draw_mark intern, result(14),result(15),blk End EventHandler
End Control
EventHandler Sub Open() intern = New Picture(256,256,32) intern.graphics.drawpicture test,0,0 red=rgb(255,0,0) grn=rgb(0,255,0) blu=rgb(0,0,255) blk=rgb(0,0,0) wht=rgb(255,255,255) End EventHandler
Sub addpoint(s as string, x as integer, y as integer) dim c as color c=Intern.RGBSurface.Pixel(x,y) res_list.addrow s+" x "+str(x) res_list.cell(res_list.LastIndex,1)=str(c.red) res_list.cell(res_list.LastIndex,2)=str(c.green) res_list.cell(res_list.LastIndex,3)=str(c.blue) res_list.addrow s+" y "+str(y) End Sub
Sub draw_mark(pic as picture, x as integer, y as integer, col as color) pic.graphics.penwidth=1 pic.graphics.penheight=1 pic.graphics.forecolor=blk pic.graphics.drawOval x-5,y-5,11,11 pic.graphics.forecolor=wht pic.graphics.drawOval x-4,y-4,9,9 pic.graphics.forecolor=col pic.graphics.drawline x-5,y,x-1,y pic.graphics.drawline x+1,y,x+5,y pic.graphics.drawline x,y-5,x,y-1 pic.graphics.drawline x,y+5,x,y+1 show_image End Sub
Sub find_minimax(pic as picture, byref res() as integer) dim f as PictureMinMaxMBS f=new PictureMinMaxMBS if f.FindAll(pic) then res(0)=f.redmaxx res(1)=f.redmaxy res(2)=f.greenmaxx res(3)=f.greenmaxy res(4)=f.bluemaxx res(5)=f.bluemaxy res(6)=f.summaxx res(7)=f.summaxy res(8)=f.redminx res(9)=f.redminy res(10)=f.greenminx res(11)=f.greenminy res(12)=f.blueminx res(13)=f.blueminy res(14)=f.summinx res(15)=f.summiny end if End Sub
Sub show_image() scr.graphics.drawpicture intern,0,0 End Sub
Property Protected blk As color
Property Protected blu As color
Property Protected grn As color
Property Protected intern As picture
Property Protected red As color
Property Protected result(15) As integer
Property Protected wht As color
End Class
MenuBar Menü
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "Ablage"
MenuItem FileQuit = "Beenden"
MenuItem UntitledMenu0 = "Bearbeiten"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Ausschneiden"
MenuItem EditCopy = "Kopieren"
MenuItem EditPaste = "Einfügen"
MenuItem EditClear = "Löschen"
End MenuBar
Class App Inherits Application
End Class
ExternalFile TEST
End ExternalFile
End Project

See also:

Feedback, Comments & Corrections

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





Links
MBS Xojo Chart Plugins