Platforms to show: All Mac Windows Linux Cross-Platform
/MacFrameworks/IKImageEditPanel2
Required plugins for this example: MBS MacCF Plugin, MBS MacBase Plugin, MBS MacCG Plugin, MBS Picture Plugin, MBS Main Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin, MBS AVFoundation Plugin
Last modified Fri, 17th Nov 2016.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /MacFrameworks/IKImageEditPanel2
Download this example: IKImageEditPanel2.zip
Project "IKImageEditPanel2.xojo_binary_project"
FileTypes
Filetype text
Filetype special/any
End FileTypes
Class Window1 Inherits Window
EventHandler Sub Close()
panel.close
End EventHandler
EventHandler Sub DropObject(obj As DragItem, action As Integer)
dim f as folderitem
dim p as picture
do
if obj.folderItemavailable then
f=obj.folderItem
if f<>nil then
p=f.openaspicture
if p<>Nil then
pic=p
panel.reloadData
refresh
end if
end if
end if
loop until not obj.nextItem
End EventHandler
EventHandler Sub Open()
dim p,mask as picture
dim w,h as integer
me.acceptfileDrop "special/any"
p=screenshotMBS
w=p.width/2
h=p.height/2
pic = New Picture(w,h,32)
pic.graphics.drawpicture p,0,0,w,h,0,0,p.width,p.height
// try with mask
pic.mask.graphics.foreColor=&cFFFFFF
pic.mask.graphics.fillrect 0,0,pic.width,pic.height
pic.mask.graphics.foreColor=&c000000
pic.mask.graphics.filloval 0,0,pic.width,pic.height
// resize window to match picture
width=w
height=h
// show panel
panel=new imageeditPanel
panel.left=w+me.left
panel.top=screen(0).height-me.top-panel.height
panel.show
End EventHandler
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect)
g.drawpicture pic,0,0
End EventHandler
Property Protected panel As imageeditPanel
Property pic As picture
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
Class ImageEditPanel Inherits IKImageEditPanelMBS
EventHandler Sub Changed(pic as picture, CGImageHandle as integer, metaData as dictionary)
window1.pic=pic
window1.refresh
End EventHandler
EventHandler Function Image() As picture
return window1.pic
End EventHandler
End Class
End Project
Download this example: IKImageEditPanel2.zip
The items on this page are in the following plugins: MBS MacFrameworks Plugin.