Platforms to show: All Mac Windows Linux Cross-Platform
/Images/Tiff/Tiff Picture Save with Mask
Required plugins for this example: MBS Images Plugin, MBS Picture Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/Tiff/Tiff Picture Save with Mask
This example is the version from Sun, 10th Dec 2016.
Project "Tiff Picture Save with Mask.xojo_binary_project"
FileTypes
Filetype image/tiff
End FileTypes
Class Window1 Inherits Window
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
SaveRGB
End EventHandler
End Control
EventHandler Sub Open()
dim g as Graphics
mask = new Picture(300,300,32)
g=mask.Graphics
g.ForeColor=&c000000
g.FillRect 0,0,300,300
g.ForeColor=&cFFFFFF
g.FillOval 0,0,300,300
dim p as Picture
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
p.Mask.Graphics.DrawPicture mask.InvertMBS,0,0
current=p
run
End EventHandler
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
t.Mask = mask
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
Property Protected mask 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:
The items on this page are in the following plugins: MBS Images Plugin.