Platforms to show: All Mac Windows Linux Cross-Platform
/Images/LargePicture/Gray 16bit test
Required plugins for this example: MBS Images Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/LargePicture/Gray 16bit test
This example is the version from Fri, 23th Jan 2014.
Project "Gray 16bit test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
// get a picture
dim pic as Picture = LogoMBS(500)
dim w as integer = pic.Width
dim h as integer = pic.Height
dim p1 as new PictureMBS(pic)
show p1, "original RGB"
// now make it 8bit gray
dim p2 as new PictureMBS(w, h, PictureMBS.ImageFormatG)
if not p2.CopyPixels(p1, 0, 0, w, h, 0, 0) then
Break
end if
show p2, "gray 8 bit"
// now make it 16bit gray
dim p3 as new PictureMBS(w, h, PictureMBS.ImageFormatGray16)
if not p3.CopyPixels(p2, 0, 0, w, h, 0, 0) then
Break
end if
show p3, "gray 16 bit"
// scale up
dim p4 as new PictureMBS(w*2, h*2, PictureMBS.ImageFormatGray16)
if not p4.Scale(p3, nil, PictureMBS.ScaleCubic, w*2, h*2) then
Break
end if
show p4, "gray 16 bit, scaled to 200%"
// scale down
dim p5 as new PictureMBS(w/2, h/2, PictureMBS.ImageFormatGray16)
if not p5.Scale(p3, nil, PictureMBS.ScaleCubic, w/2, h/2) then
Break
end if
show p5, "gray 16 bit, scaled to 50%"
// now make it 8bit gray again
dim p6 as new PictureMBS(w, h, PictureMBS.ImageFormatG)
if not p6.CopyPixels(p3, 0, 0, w, h, 0, 0) then
Break
end if
show p6, "gray 8 bit again"
// invert
p3.Invert
show p3, "gray 16 bit, inverted"
End EventHandler
Sub Show(p as PictureMBS, title as string)
dim w as new PicWindow
w.Backdrop = p.CopyPicture
w.Title = title
w.show
End Sub
End Class
Class PicWindow Inherits Window
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
The items on this page are in the following plugins: MBS Images Plugin.