Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Picture Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Picture/Picture manipulation
This example is the version from Wed, 14th May 2019.
Project "Picture manipulation.xojo_binary_project"
FileTypes
Filetype special/any
End FileTypes
Class Window1 Inherits Window
Control TabPanel1 Inherits TabPanel
ControlInstance TabPanel1 Inherits TabPanel
EventHandler Sub Change()
update
End EventHandler
End Control
Control Canvass Inherits Canvas
ControlInstance Canvass(0) Inherits Canvas
ControlInstance Canvass(1) Inherits Canvas
ControlInstance Canvass(2) Inherits Canvas
ControlInstance Canvass(3) Inherits Canvas
EventHandler Sub Paint(index as Integer, g As Graphics, areas() As REALbasic.Rect)
if ausgabe<>nil then
g.DrawPicture ausgabe,0,0
end if
End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control Sliders Inherits Slider
ControlInstance Sliders(0) Inherits Slider
ControlInstance Sliders(1) Inherits Slider
ControlInstance Sliders(2) Inherits Slider
ControlInstance Sliders(3) Inherits Slider
ControlInstance Sliders(4) Inherits Slider
ControlInstance Sliders(5) Inherits Slider
ControlInstance Sliders(6) Inherits Slider
ControlInstance Sliders(7) Inherits Slider
ControlInstance Sliders(8) Inherits Slider
ControlInstance Sliders(9) Inherits Slider
ControlInstance Sliders(10) Inherits Slider
EventHandler Sub ValueChanged(index as Integer)
StaticTexts(index).text=Format(me.Value/faktor(index),"-0.00")
update
End EventHandler
End Control
Control StaticTexts Inherits Label
ControlInstance StaticTexts(0) Inherits Label
ControlInstance StaticTexts(1) Inherits Label
ControlInstance StaticTexts(2) Inherits Label
ControlInstance StaticTexts(3) Inherits Label
ControlInstance StaticTexts(4) Inherits Label
ControlInstance StaticTexts(5) Inherits Label
ControlInstance StaticTexts(6) Inherits Label
ControlInstance StaticTexts(7) Inherits Label
ControlInstance StaticTexts(8) Inherits Label
ControlInstance StaticTexts(9) Inherits Label
ControlInstance StaticTexts(10) Inherits Label
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
Control StaticText9 Inherits Label
ControlInstance StaticText9 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control StaticText7 Inherits Label
ControlInstance StaticText7 Inherits Label
End Control
Control StaticText8 Inherits Label
ControlInstance StaticText8 Inherits Label
End Control
Control StaticText10 Inherits Label
ControlInstance StaticText10 Inherits Label
End Control
Control StaticText11 Inherits Label
ControlInstance StaticText11 Inherits Label
End Control
Control StaticText12 Inherits Label
ControlInstance StaticText12 Inherits Label
End Control
EventHandler Sub DropObject(obj As DragItem, action As Integer)
dim p as Picture
dim f as FolderItem
dim b as Boolean
do
if obj.PictureAvailable then
p=obj.Picture
if p<>nil then
current=p
b=true
end if
elseif obj.FolderItemAvailable then
f=obj.FolderItem
if f<>nil then
p = Picture.Open(f)
if p<>nil then
current=p
b=true
end if
end if
end if
loop until not obj.NextItem
if b then
update
end if
End EventHandler
EventHandler Sub Open()
dim i as integer
me.AcceptPictureDrop
me.AcceptFileDrop "special/any"
// Faktors to move slider in range
faktor(0)=100
faktor(1)=1
faktor(2)=1
faktor(3)=1
faktor(4)=1
faktor(5)=1
faktor(6)=1
faktor(7)=1
faktor(8)=255
faktor(9)=255
faktor(10)=255
for i=0 to 10
StaticTextS(i).text=Format(Sliders(i).Value/faktor(i),"-0.00")
next
if TargetMacOS then
current = LogoMBS(500) 'app.ResourceFork.GetPicture(148)
update
end if
End EventHandler
Sub update()
dim p as Picture
dim g as Graphics
dim n as integer
if Current<>nil then
p=current.CloneMBS
n=TabPanel1.Value
Select case n
case 0
p=p.ChangeCustomMBS(Sliders(0).Value/100.0,Sliders(1).Value)
case 1
p=p.ChangeBrightnessLinearMBS(Sliders(2).Value,Sliders(3).Value,Sliders(4).Value)
case 2
p=p.ChangeBrightnessAbsoluteMBS(Sliders(5).Value,Sliders(6).Value,Sliders(7).Value)
case 3
p=p.ChangeContrastMBS(Sliders(8).Value/100.0,Sliders(9).Value/100.0,Sliders(10).Value/100.0)
end Select
if p<>nil then
ausgabe=p
end if
Canvass(n).Invalidate
end if
End Sub
Property Protected ausgabe As picture
Property Protected current As picture
Property Protected faktor(10) As integer
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu7 = ""
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu6 = ""
MenuItem UntitledMenu5 = ""
MenuItem UntitledMenu4 = ""
End MenuBar
Class App Inherits Application
End Class
End Project
See also:
- /Picture/Picture blending/blend with mask
- /Picture/Picture blending/blend with plugin
- /Picture/Picture Copy Fast Test
- /Picture/Picture Hash/Picture Hash
- /Picture/Picture MinMax/mmx_demo
- /Picture/Picture MinMax/mmx_demo with plugin
- /Picture/Picture Mirror
- /Picture/Picture Scale/Scale Compare
- /Picture/Picture Scale/Scale Test
- /Picture/Picture to Binary Data Test
The items on this page are in the following plugins: MBS Picture Plugin.