Platforms to show: All Mac Windows Linux Cross-Platform
/MacCG/CoreImage/Gauss Blur Filter 2
Required plugins for this example: MBS Main Plugin, MBS MacCI Plugin, MBS MacCG Plugin, MBS MacCF Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/CoreImage/Gauss Blur Filter 2
This example is the version from Mon, 17th Feb 2013.
Project "Gauss Blur Filter 2.xojo_binary_project"
Class Window1 Inherits Window
Control SliderB Inherits Slider
ControlInstance SliderB Inherits Slider
EventHandler Sub ValueChanged()
if me.Enabled then
update
end if
End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
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
update
End EventHandler
Protected Sub Update()
// this variant uses CIContextMBS targeting a picture
dim dest as new Picture(500, 500)
dim cicontext as new CIContextMBS(dest)
cifilter.inputRadius=SliderB.Value/100.0
dim result as CIImageMBS = cifilter.outputImage
if result<>nil then
cicontext.drawImageRect result, result.Extent, result.Extent
cicontext.Flush
end if
canvas1.Backdrop = Dest
End Sub
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 TargetCocoa then
else
MsgBox "This project needs a Cocoa target."
end if
End EventHandler
End Class
End Project
The items on this page are in the following plugins: MBS MacCG Plugin.