Platforms to show: All Mac Windows Linux Cross-Platform
/MacCG/CoreImage/Load Raw File
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/Load Raw File
This example is the version from Wed, 19th Dec 2017.
Project "Load Raw File.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect)
if pic <> nil then
dim faktor as Double = min( Height / Pic.Height, Width / Pic.Width)
// Calculate new size
dim w as Integer = Pic.Width * faktor
dim h as Integer = Pic.Height * faktor
// draw picture in the new size
g.DrawPicture Pic, 0, 0, w, h, 0, 0, Pic.Width, Pic.Height
end if
End EventHandler
End Control
Control OpenButton Inherits PushButton
ControlInstance OpenButton Inherits PushButton
EventHandler Sub Action()
dim f as FolderItem = GetOpenFolderItem("")
if f = nil then Return
file = f
update
End EventHandler
End Control
Control BaselineExposureSlider Inherits Slider
ControlInstance BaselineExposureSlider Inherits Slider
EventHandler Sub ValueChanged()
update
End EventHandler
End Control
Control BoostSlider Inherits Slider
ControlInstance BoostSlider Inherits Slider
EventHandler Sub ValueChanged()
update
End EventHandler
End Control
Control BoostShadowAmountSlider Inherits Slider
ControlInstance BoostShadowAmountSlider Inherits Slider
EventHandler Sub ValueChanged()
update
End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Sub update()
dim options as new Dictionary
dim d1 as Double = BaselineExposureSlider.Value
dim d2 as Double = BoostSlider.Value
dim d3 as Double = BoostShadowAmountSlider.Value
options.Value(CIFilterMBS.kCIInputBaselineExposureKey ) = d1/100.0
options.Value(CIFilterMBS.kCIInputBoostKey ) = d2/100.0
options.Value(CIFilterMBS.kCIInputBoostShadowAmountKey) = d3/100.0
dim f as CIFilterMBS = CIFilterMBS.filterWithImageFile(file, options)
pic = f.outputImage.RenderPictureWithAlpha
canvas1.Invalidate
End Sub
Property file As FolderItem
Property pic As Picture
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
The items on this page are in the following plugins: MBS MacCG Plugin.