Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Picture/Picture Scale/Picture.ScaleMBS
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 Scale/Picture.ScaleMBS
This example is the version from Sun, 10th Dec 2016.
Project "Picture.ScaleMBS.rbp"
Filetype text
Filetype special/any
End FileTypes
Class Window1 Inherits Window
Control c1 Inherits Canvas
ControlInstance c1 Inherits Canvas
End Control
Control c2 Inherits Canvas
ControlInstance c2 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 scale Inherits Slider
ControlInstance scale Inherits Slider
EventHandler Sub Open() me.Value=25 End EventHandler
EventHandler Sub ValueChanged() if pic<>Nil then draw end if v.text = "Drawing at: "+str((me.value/50)*100)+"%" End EventHandler
End Control
Control out Inherits Label
ControlInstance out Inherits Label
End Control
Control v Inherits Label
ControlInstance v Inherits Label
End Control
Sub draw() dim p,p2 as picture dim i as integer dim scalefactor as double dim w,h as double dim time as Double dim d1,d2 as Double //get an image we can use for an rgb surface p = new Picture(pic.width,pic.height,32) p.graphics.drawpicture pic,0,0 scalefactor = scale.value/50 w = pic.width*scalefactor h = pic.height*scalefactor //rgbsurface scale time = microseconds p2=p.ScaleMBS(w,h,false) d1=(microseconds-time)/1000000.0 c1.backdrop = p2 //rbscale p = new Picture(w,h,32) time = microseconds p.graphics.drawpicture pic,0,0,w,h,0,0,pic.width,pic.height d2=(microseconds-time)/1000000.0 c2.backdrop = p out.text = "Plugin: "+str(d1)+", RB:"+str(d2) End Sub
Property pic As picture
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() dim f as FolderItem dim p as Picture f=GetOpenFolderItem("special/any") if f<>nil then p=f.OpenAsPicture if p<>nil then Window1.pic=p Window1.draw end if end if End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

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

MBS Xojo Plugins