Platforms to show: All Mac Windows Linux Cross-Platform
/Images/LargePicture/PictureMBS filters
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/PictureMBS filters
This example is the version from Thu, 6th Apr 2016.
Project "PictureMBS filters.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
Current=Picturembs.CreatePictureMBS(10000,10000,PictureMBS.ImageFormatRGB)
call Current.CopyPixels(logo, 0, 0,500,500,0,0)
call Current.CopyPixels(logo, 0,9500,500,500,0,0)
call Current.CopyPixels(logo,9500, 0,500,500,0,0)
call Current.CopyPixels(logo,9500,9500,500,500,0,0)
update
End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
Current=Picturembs.CreatePictureMBS(10000,10000,PictureMBS.ImageFormatRGBA)
call Current.CopyPixels(logo, 0, 0,500,500,0,0)
call Current.CopyPixels(logo, 0,9500,500,500,0,0)
call Current.CopyPixels(logo,9500, 0,500,500,0,0)
call Current.CopyPixels(logo,9500,9500,500,500,0,0)
update
End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action()
Current=Picturembs.CreatePictureMBS(10000,10000,PictureMBS.ImageFormatG)
call Current.CopyPixels(logo, 0, 0,500,500,0,0)
call Current.CopyPixels(logo, 0,9500,500,500,0,0)
call Current.CopyPixels(logo,9500, 0,500,500,0,0)
call Current.CopyPixels(logo,9500,9500,500,500,0,0)
update
End EventHandler
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action()
Current=Picturembs.CreatePictureMBS(10000,10000,PictureMBS.ImageFormatGA)
call Current.CopyPixels(logo, 0, 0,500,500,0,0)
call Current.CopyPixels(logo, 0,9500,500,500,0,0)
call Current.CopyPixels(logo,9500, 0,500,500,0,0)
call Current.CopyPixels(logo,9500,9500,500,500,0,0)
update
End EventHandler
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control PushButton13 Inherits PushButton
ControlInstance PushButton13 Inherits PushButton
EventHandler Sub Action()
dim t as integer = ticks
current=Current.BoxBlurFilter(nil,3)
Title=Str((ticks-t)/60.0)+" seconds"
update
End EventHandler
End Control
Control PushButton16 Inherits PushButton
ControlInstance PushButton16 Inherits PushButton
EventHandler Sub Action()
Current=new PictureMBS(500,500,PictureMBS.ImageFormatRGB)
call Current.CopyPixels(logo)
update
End EventHandler
End Control
Control PushButton18 Inherits PushButton
ControlInstance PushButton18 Inherits PushButton
EventHandler Sub Action()
dim f as FolderItem
dim t as TiffPictureMBS
dim p as PictureMBS
f=GetsaveFolderItem("image/tiff","test.tiff")
if f<>Nil then
t=new TiffPictureMBS
p=Current.ClipImage(0,0,1000,1000) // get top left part for saving
if t.Create(f) then
const PLANARCONFIG_CONTIG=1
const PHOTOMETRIC_RGB=2
const FILLORDER_MSB2LSB=1
const RESUNIT_INCH=2
const ORIENTATION_TOPLEFT=1
const COMPRESSION_NONE=1
t.Height=p.Height
t.Width=p.Width
t.RowsPerStrip=1
t.PlanarConfig=PLANARCONFIG_CONTIG
t.Photometric=PHOTOMETRIC_RGB
t.BitsPerSample=8
t.SamplesPerPixel=3
t.FillOrder=FILLORDER_MSB2LSB
t.Orientation=ORIENTATION_TOPLEFT
t.ResolutionUnit=RESUNIT_INCH
t.VerticalResolution=72.0
t.HorizontalResolution=72.0
t.Compression=COMPRESSION_NONE
dim h as integer=p.Height-1
for i as integer=0 to h
t.Scanline(i)=p.RowInFormat(i, PictureMBS.ImageFormatRGB)
next
t.Close
end if
end if
End EventHandler
End Control
Control PushButton14 Inherits PushButton
ControlInstance PushButton14 Inherits PushButton
EventHandler Sub Action()
dim t as integer = ticks
current=Current.SolarizeFilter(nil)
Title=Str((ticks-t)/60.0)+" seconds"
update
End EventHandler
End Control
Control PushButton15 Inherits PushButton
ControlInstance PushButton15 Inherits PushButton
EventHandler Sub Action()
dim t as integer = ticks
current=Current.GammaFilter(nil, Slider1.Value/100.0, Slider2.Value/100.0, Slider3.Value/100.0)
Title=Str((ticks-t)/60.0)+" seconds"
update
End EventHandler
End Control
Control Slider1 Inherits Slider
ControlInstance Slider1 Inherits Slider
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control Slider2 Inherits Slider
ControlInstance Slider2 Inherits Slider
End Control
Control Slider3 Inherits Slider
ControlInstance Slider3 Inherits Slider
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control PushButton19 Inherits PushButton
ControlInstance PushButton19 Inherits PushButton
EventHandler Sub Action()
dim t as integer = ticks
current=Current.DitherFilter(nil, PictureMBS.DitherOrdered4x4Matrix, 16)
Title=Str((ticks-t)/60.0)+" seconds"
update
End EventHandler
End Control
Control PushButton20 Inherits PushButton
ControlInstance PushButton20 Inherits PushButton
EventHandler Sub Action()
dim t as integer = ticks
current=Current.GainFilter(nil, Slider4.Value/10.0, Slider5.Value/10.0)
Title=Str((ticks-t)/60.0)+" seconds"
update
End EventHandler
End Control
Control Slider4 Inherits Slider
ControlInstance Slider4 Inherits Slider
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control Slider5 Inherits Slider
ControlInstance Slider5 Inherits Slider
End Control
Control PushButton21 Inherits PushButton
ControlInstance PushButton21 Inherits PushButton
EventHandler Sub Action()
dim t as integer = ticks
current=Current.stampfilter(nil, 3, 0.5, 1.0, &c000000, &cFFFFFF)
Title=Str((ticks-t)/60.0)+" seconds"
update
End EventHandler
End Control
Control PushButton22 Inherits PushButton
ControlInstance PushButton22 Inherits PushButton
EventHandler Sub Action()
dim r(255) as integer
dim g(255) as integer
dim b(255) as integer
dim i as integer
// reduce light
for i=0 to 255
r(i)=i/2
g(i)=i/2
b(i)=i/2
next
dim t as integer = ticks
current=Current.TransferFilter(nil, r,g,b)
Title=Str((ticks-t)/60.0)+" seconds"
update
End EventHandler
End Control
Control PushButton23 Inherits PushButton
ControlInstance PushButton23 Inherits PushButton
EventHandler Sub Action()
dim t as integer = ticks
current=Current.BoxBlurFractionalFilter(nil,3.3)
Title=Str((ticks-t)/60.0)+" seconds"
update
End EventHandler
End Control
EventHandler Sub Open()
dim f as new Factory
PictureFactoryMBS.SetFactory f
dim l as Picture
l=LogoMBS(500)
logo=new PictureMBS(l)
Current=new PictureMBS(logo.Width,logo.Height, PictureMBS.ImageFormatRGB)
call Current.CopyPixels(logo)
update
End EventHandler
Sub update()
canvas1.Backdrop=Current.CopyPicture(0,0,500,500)
End Sub
Property current As Picturembs
Property logo As PictureMBS
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
Class Factory Inherits PictureFactoryMBS
EventHandler Function NewPictureMBS(Width as integer, Height as integer, ImageFormat as integer) As PictureMBS
window1.Title=str(Width)+" x "+str(Height)
dim file as FolderItem
dim size as integer
n=n+1
// you may need to change file paths
if TargetLinux then
file=GetFolderItem("/tmp"+str(n)+".test",folderitem.PathTypeShell)
elseif TargetWin32 then
file=SpecialFolder.desktop.Child("tmp"+str(n)+".test")
else
file=findvolume("Temp").child("tmp"+str(n)+".test")
end if
// size of the window:
size=100*1024*1024
dim p as new PictureMBS(Width, Height, ImageFormat, size, file)
if p=nil then
beep
end if
Return p
End EventHandler
Function findvolume(name as string) As folderitem
dim i,c as integer
dim v as FolderItem
c=VolumeCount-1
for i=0 to c
v=volume(i)
if v<>nil and v.Name=name then
Return v
end if
next
End Function
Property n As Integer
End Class
FileTypes1
Filetype image/tiff
End FileTypes1
End Project
See also:
- /Images/LargePicture/PictureMBS
- /Images/LargePicture/PictureMBS ApplyMatrix Example
- /Images/LargePicture/PictureMBS as a big memoryblock
- /Images/LargePicture/PictureMBS boxblur benchmark
- /Images/LargePicture/PictureMBS display huge picture
- /Images/LargePicture/PictureMBS Draw methods
- /Images/LargePicture/PictureMBS drawing
- /Images/LargePicture/PictureMBS mirror and rotate
- /Images/LargePicture/PictureMBS rotate benchmark
- /Images/LargePicture/PictureMBS scale
The items on this page are in the following plugins: MBS Images Plugin.