Platforms to show: All Mac Windows Linux Cross-Platform
/ComputerControl/Gamma/Invert Video
Required plugins for this example: MBS ComputerControl Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /ComputerControl/Gamma/Invert Video
This example is the version from Sun, 15th Feb 2014.
Project "Invert Video.xojo_binary_project"
Class Window1 Inherits Window
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action()
update me.Value
End EventHandler
End Control
EventHandler Sub Open()
dim c as integer = ScreenCount
if TargetWin32 then
c = 1 // on windows only first screen
end if
for j as integer = 0 to c-1
dim g as new gammaMBS(self, j)
if not g.available then
msgBox "Can't get gamma."
else
dim u as integer = g.Size-1
// newer Macs have 1024 entries in the table, older and Windows 256.
redim OriginalBlue(u)
redim originalRed(u)
redim originalGreen(u)
for i as integer = 0 to u
originalBlue(i) = g.Blue(i)
originalRed(i) = g.Red(i)
originalGreen(i)= g.Green(i)
next
gamma.Append g
end if
next
End EventHandler
Sub update(invert as boolean)
for each g as GammaMBS in gamma
dim u as integer = g.Size-1
if invert then
for i as integer = 0 to u
g.Blue(i) = originalBlue(u-i)
g.Red(i) = originalRed(u-i)
g.Green(i)= originalGreen(u-i)
next
else
for i as integer = 0 to u
g.Blue(i) = originalBlue(i)
g.Red(i) = originalRed(i)
g.Green(i)= originalGreen(i)
next
end if
if not g.SetGamma then
msgBox "Failed to set gamma"
end if
next
End Sub
Property Protected OriginalBlue(256) As double
Property Protected OriginalGreen(256) As double
Property Protected OriginalRed(256) As double
Property Protected gamma() As gammambs
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project
The items on this page are in the following plugins: MBS ComputerControl Plugin.