Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/Gauss Blur Filter
Function:
Required plugins for this example: MBS MacCG Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/Gauss Blur Filter
This example is the version from Sun, 17th Mar 2012.
Project "Gauss Blur Filter.rbp"
Class Window1 Inherits Window
Control SliderB Inherits Slider
ControlInstance SliderB Inherits Slider
EventHandler Sub ValueChanged() if me.Enabled then canvas1.Invalidate end if End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
EventHandler Sub Paint(g As Graphics) dim cgcontext as CGContextMBS if TargetCocoa then cgcontext = GetCurrentCGContextMBS else CGContext = self.CGContextMBS end if dim cicontext as new CIContextMBS(CGContext) cifilter.inputRadius=SliderB.Value/100.0 dim result as CIImageMBS = cifilter.outputImage if result<>nil then dim d as new CGRectMBS(result.Extent) d.Left = d.Left + canvas1.Left d.Top = d.top + window1.Height - canvas1.top - canvas1.Height cicontext.drawImageRect result, d, result.Extent end if End EventHandler
End Control
EventHandler Sub Open() logo = LogoMBS(500) // draw black border so you see gauss blur better dim g as Graphics = logo.Graphics g.ForeColor = &c000000 g.PenWidth = 10 g.PenHeight = 10 g.DrawRect 0, 0, g.Width, g.Height cifilter=new CIFilterGaussianBlurMBS dim n as CIAttributeMBS = CIFilter.AttributeinputRadius if n<>Nil then SliderB.Minimum=n.SliderMinNumber SliderB.Maximum=n.SliderMaxNumber sliderB.Value=n.DefaultNumber SliderB.enabled=true end if dim CGImage as CGImageMBS = CGCreateImageMBS(logo) dim ciimage as CIImageMBS = NewCIImagewithCGImageMBS(CGImage) CIFilter.inputImage = CIImage End EventHandler
Property Protected CIFilter As CIFilterGaussianBlurMBS
Property Protected count As integer
Property Protected logo As Picture
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() if TargetMachO then else MsgBox "This project needs a MachO target." end if End EventHandler
End Class
End Project

Feedback, Comments & Corrections

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





Links
MBS Xojo PDF Plugins