Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Images/Tiff/Tiff Picture Save
Function:
Required plugins for this example: MBS Images Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/Tiff/Tiff Picture Save
This example is the version from Sun, 10th Dec 2016.
Project "Tiff Picture Save.rbp"
FileTypes
Filetype image/tiff
End FileTypes
Class Window1 Inherits Window
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() dim p as Picture dim g as Graphics p = new Picture(300,300,32) g=p.Graphics g.ForeColor=&cFF0000 g.FillRect 0,0,100,100 g.ForeColor=&c00FF00 g.FillRect 100,0,100,100 g.ForeColor=&c0000FF g.FillRect 200,0,100,100 g.ForeColor=&cFFFF00 g.FillRect 0,100,100,100 g.ForeColor=&c00FFFF g.FillRect 100,100,100,100 g.ForeColor=&cFF00FF g.FillRect 200,100,100,100 g.ForeColor=&c000000 g.FillRect 0,200,100,100 g.ForeColor=&c777777 g.FillRect 100,200,100,100 g.ForeColor=&cFFFFFF g.FillRect 200,200,100,100 current=p run End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action() dim p as Picture dim g as Graphics p = new Picture(300,300,32) g=p.Graphics g.ForeColor=&c000000 g.FillRect 0, 0,100,100 g.ForeColor=&c202020 g.FillRect 100, 0,100,100 g.ForeColor=&c404040 g.FillRect 200, 0,100,100 g.ForeColor=&c606060 g.FillRect 0,100,100,100 g.ForeColor=&c808080 g.FillRect 100,100,100,100 g.ForeColor=&cA0A0A0 g.FillRect 200,100,100,100 g.ForeColor=&cC0C0C0 g.FillRect 0,200,100,100 g.ForeColor=&cE0E0E0 g.FillRect 100,200,100,100 g.ForeColor=&cFFFFFF g.FillRect 200,200,100,100 current=p run End EventHandler
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() SaveRGB End EventHandler
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action() SaveBW End EventHandler
End Control
Protected Sub SaveBW() dim f as FolderItem dim t as TiffPictureMBS f=GetsaveFolderItem("image/tiff","test.tiff") if f<>Nil then t=new TiffPictureMBS if t.Create(f) then t.Pict=current if t.WriteBW then MsgBox "Wrote tiff file "+f.name else MsgBox "Failed to write tiff file "+f.Name end if t.Close end if end if End Sub
Protected Sub SaveRGB() dim f as FolderItem dim t as TiffPictureMBS f=GetsaveFolderItem("image/tiff","test.tiff") if f<>Nil then t=new TiffPictureMBS if t.Create(f) then t.Pict=current if t.WriteRGB then MsgBox "Wrote tiff file "+f.name else MsgBox "Failed to write tiff file "+f.Name end if t.Close end if end if End Sub
Protected Sub run() Canvas1.Backdrop=current End Sub
Property Protected current As picture
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

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Images Plugin.




Links
MBS FileMaker blog