Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/CoreImage/Ripple Transition filter/Ripple Transition filter
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/CoreImage/Ripple Transition filter/Ripple Transition filter
This example is the version from Thu, 31th Jul 2019.
Project "Ripple Transition filter.rbp"
Class Window1 Inherits Window
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() count=count+1 // trigger paint event Refresh(False) End EventHandler
End Control
EventHandler Sub Open() dim n as CIAttributeMBS dim file as FolderItem dim logo as Picture dim image as CGImageMBS cifilter=new CIFilterRippleTransitionMBS CIFilter.SetDefaults // Pictures from Apples FunHouse Example project. file=FindFile("Flowers.jpg") inputImage=NewCIImagewithFileMBS(file) if inputImage=nil then // Fails always on Mac OS X 10.3... MsgBox "Failed to load image file "+file.AbsolutePath quit end if CIFilter.inputImage=inputImage file=FindFile("Copenhagen.jpg") inputTargetImage=NewCIImagewithFileMBS(file) if inputTargetImage=nil then // Fails always on Mac OS X 10.3... MsgBox "Failed to load image file "+file.AbsolutePath quit end if CIFilter.inputTargetImage=inputTargetImage file=FindFile("restrictedshine.tiff") inputShadingImage=NewCIImagewithFileMBS(file) if inputShadingImage=nil then // Fails always on Mac OS X 10.3... MsgBox "Failed to load image file "+file.AbsolutePath quit end if CIFilter.inputShadingImage=inputShadingImage CIFilter.inputScale=50 CIFilter.inputWidth=100 CIFilter.inputTime=0 End EventHandler
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) draw End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
Protected Sub draw() dim cicontext as CIContextMBS dim time as integer dim result as CIImageMBS time=ticks dim c as CGContextMBS #if TargetCocoa then // draw in context of paint event c = GetCurrentCGContextMBS #else // draw in context of window c = me.CGContextMBS #endif cicontext=new CIContextMBS(c) if count<300 then CIFilter.inputTime=count/100.0 elseif count<500 then elseif count<800 then CIFilter.inputTime=(800.0-count)/100.0 elseif count=1000 then count=0 end if result=cifilter.outputImage if result<>nil then cicontext.drawImageRect result, result.Extent,result.Extent end if System.DebugLog "Paint needed "+str((ticks-time)/60.0)+" seconds." End Sub
Property Protected CIFilter As CIFilterRippleTransitionMBS
Property Protected count As integer
Property Protected inputImage As CIImageMBS
Property Protected inputShadingImage As CIImageMBS
Property Protected inputTargetImage As CIImageMBS
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.

The biggest plugin in space...

MBS FileMaker Plugins