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
Last modified Sun, 10th Dec 2016.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /Images/Tiff/Tiff Picture Save with Mask
Download this example: Tiff Picture Save with Mask.zip
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:
- /Images/Tiff/Tiff Combine
- /Images/Tiff/Tiff Copy Test/Tiff Copy Test
- /Images/Tiff/TIFF Picture Info
- /Images/Tiff/Tiff Picture Save
- /Images/Tiff/Tiff Speed Test
- /Images/Tiff/TIFF Split
- /Images/Tiff/tiff with LUT
- /Images/Tiff/Tiff Write Gray Test
- /Images/Tiff/Tiff WriteBW Tests
Download this example: Tiff Picture Save with Mask.zip
The items on this page are in the following plugins: MBS Images Plugin.