You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/Tiff/BigTiff Test
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
WriteTiff true, "big.tif"
WriteTiff false, "normal.tif"
MainWindow.Canvas1.Backdrop = ReadTiff( "big.tif")
MainWindow.Canvas2.Backdrop = ReadTiff("normal.tif")
End EventHandler
Function ReadTiff(name as string) As Picture
dim f as FolderItem = SpecialFolder.Desktop.Child(name)
dim t as new TiffPictureMBS
if not t.Open(f, "r") then
Break
MsgBox "Failed to open file."
Return nil
end if
if t.ReadRGB then
Return t.Pict
else
Break // failed to read RGB
end if
End Function
Sub WriteTiff(big as Boolean, name as string)
dim p as new Picture(100, 100, 32)
dim g as Graphics = p.Graphics
g.ForeColor = &cFF0000
g.FillRect 50, 50, 50, 50
g.ForeColor = &c00FF00
g.FillRect 50, 0, 50, 50
g.ForeColor = &c0000FF
g.FillRect 0, 50, 50, 50
dim f as FolderItem = SpecialFolder.Desktop.Child(name)
dim t as new TiffPictureMBS
dim mode as string
if big then
mode = "w8"
else
mode = "w"
end if
// b = big endian
// l = little endian
// B = Fill Order MSB to LSB
// L = Fill Order LSB to MSB
// H = Fill Order Host
// M = Mapped
// m = not mapped
// C = StripChop
// c = no StripChop
// h = Header only
// 8 = Big Mode
if not t.Open(f, mode) then
Break
MsgBox "Failed to create file."
Return
end if
t.Pict = p
call t.WriteRGB
End Sub
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
Class MainWindow Inherits Window
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control Canvas2 Inherits Canvas
ControlInstance Canvas2 Inherits Canvas
End Control
End Class