Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/Open Image using CoreImage


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/Open Image using CoreImage

This example is the version from Tue, 16th Sep 2019.

Project "Open Image using CoreImage.xojo_binary_project"
MyFileTypes1
Filetype text
Filetype all
End MyFileTypes1
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 UntitledMenu5 = ""
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu4 = ""
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = ""
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

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


The biggest plugin in space...