Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Images/LargePicture/PictureMBS rotate benchmark
Function:
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 rotate benchmark
This example is the version from Thu, 6th Apr 2016.
Project "PictureMBS rotate benchmark.rbp"
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 PushButton11 Inherits PushButton
ControlInstance PushButton11 Inherits PushButton
EventHandler Sub Action() Current.Rotate180 update End EventHandler
End Control
Control PushButton12 Inherits PushButton
ControlInstance PushButton12 Inherits PushButton
EventHandler Sub Action() dim t as integer = ticks current=Current.Rotate270 Title=Str((ticks-t)/60.0)+" seconds" update End EventHandler
End Control
Control PushButton14 Inherits PushButton
ControlInstance PushButton14 Inherits PushButton
EventHandler Sub Action() dim t as integer = ticks current=Current.Rotate270slow Title=Str((ticks-t)/60.0)+" seconds" update End EventHandler
End Control
Control PushButton13 Inherits PushButton
ControlInstance PushButton13 Inherits PushButton
EventHandler Sub Action() dim t as integer = ticks current=Current.Rotate90 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.Rotate90slow 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 PushButton17 Inherits PushButton
ControlInstance PushButton17 Inherits PushButton
EventHandler Sub Action() Current=Picturembs.CreatePictureMBS(1000,1000,PictureMBS.ImageFormatRGB) call Current.CopyPixels(logo, 0, 0,500,500,0,0) call Current.CopyPixels(logo, 0,500,500,500,0,0) call Current.CopyPixels(logo,500, 0,500,500,0,0) call Current.CopyPixels(logo,500,500,500,500,0,0) update End EventHandler
End Control
Control PushButton18 Inherits PushButton
ControlInstance PushButton18 Inherits PushButton
EventHandler Sub Action() 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 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=current.Height t.Width=Current.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=Current.Height-1 for i as integer=0 to h t.Scanline(i)=Current.RowInFormat(i, PictureMBS.ImageFormatRGB) next t.Close end if end if 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 Return new PictureMBS(Width, Height, ImageFormat, size, file) 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:

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins