Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/Open Image using CoreImage
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/Open Image using CoreImage
This example is the version from Mon, 6th Oct 2013.
Project "Open Image using CoreImage.rbp"
Filetype text
Filetype all
End FileTypes
Class Window1 Inherits Window
EventHandler Sub DropObject(obj As DragItem, action As Integer) if obj.FolderItemAvailable then process obj.FolderItem end if End EventHandler
EventHandler Sub Open() me.AcceptFileDrop "all" End EventHandler
Protected Sub process(f as folderitem) dim p as Picture p=f.OpenAsCoreImage if p<>Nil then Backdrop=p MaxWidth=p.Width MaxHeight=p.Height else MsgBox "Could not read picture from "+f.Name end if End Sub
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
End Class
Module Module1
Function OpenAsCoreImage(extends f as folderitem) As picture // Open using CoreImage 'dim width as integer 'dim height as integer dim c as CIImageMBS 'dim g as CGPictureContextMBS 'dim r as CGRectMBS 'dim cg as CIContextMBS // load image from file c=NewCIImagewithFileMBS(f) if c<>nil then return c.RenderPicture 'r=c.Extent 'width=r.MaxX 'height=r.MaxY ' 'g=new CGPictureContextMBS(width,height) 'if g.Handle<>0 then // valid? 'cg=NewCIContextMBS(g) ' 'if cg<>Nil then 'cg.DrawImageRect c,CGMakeRectMBS(0,0,width,height),r 'cg=nil 'end if ' 'Return g.CopyPicture 'end if end if End Function
End Module
End Project

Feedback, Comments & Corrections

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

MBS Xojo Chart Plugins