Example: /Images/LargePicture/PictureMBS

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/Images/LargePicture/PictureMBS


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

This example is the version from Wed, 25th Apr 2017.

Project "PictureMBS.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() p=new PictureMBS(10000,10000,PictureMBS.ImageFormatRGB) Title="Height: "+str(p.Height) End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() dim t as integer t=ticks p.FillRect(0,0,1000,1000,255) t=ticks-t Title=str(t/60)+" seconds for fill" End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action() dim t as integer t=ticks p.FillRect(127) t=ticks-t Title=str(t/60)+" seconds for fill" End EventHandler
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action() dim file as FolderItem dim size as integer // you may need to change file paths if TargetLinux then file=GetFolderItem("/tmp.test",folderitem.PathTypeShell) elseif TargetWin32 then file=SpecialFolder.desktop.Child("tmp.test") else file=GetFolderItem("/tmp/tmp.test",folderitem.PathTypeShell) end if // size of the window: size=100*1024*1024 p=new PictureMBS(40000,40000,PictureMBS.ImageFormatRGB, size, file) Title="Height: "+str(p.Height)+" MappingBlockSize: "+str(p.MappingBlockSize) End EventHandler
End Control
Control PushButton5 Inherits PushButton
ControlInstance PushButton5 Inherits PushButton
EventHandler Sub Action() dim t as integer t=ticks dim a as PictureMBS a=p.RedChannel a.FillRect(200) t=ticks-t Title=str(t/60)+" seconds for fill" End EventHandler
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control PushButton6 Inherits PushButton
ControlInstance PushButton6 Inherits PushButton
EventHandler Sub Action() canvas1.Backdrop=p.CopyPicture(0,0,Canvas1.Width,Canvas1.Height) End EventHandler
End Control
Control PushButton7 Inherits PushButton
ControlInstance PushButton7 Inherits PushButton
EventHandler Sub Action() dim t as integer t=ticks p.FillRect(0,0,1000,1000,0) t=ticks-t Title=str(t/60)+" seconds for fill" End EventHandler
End Control
Control PushButton8 Inherits PushButton
ControlInstance PushButton8 Inherits PushButton
EventHandler Sub Action() dim file as FolderItem dim size as integer file = nil // swap or plugin managed temp file // size of the window: size=100*1024*1024 p=new PictureMBS(40000,40000,PictureMBS.ImageFormatRGB, size, file) Title="Height: "+str(p.Height)+" MappingBlockSize: "+str(p.MappingBlockSize) End EventHandler
End Control
Control PushButton9 Inherits PushButton
ControlInstance PushButton9 Inherits PushButton
EventHandler Sub Action() dim pic as Picture pic=logombs(500) p=new PictureMBS(pic) Title="Height: "+str(p.Height) End EventHandler
EventHandler Sub Open() me.Enabled=TargetWin32 or TargetMacOS End EventHandler
End Control
Control PushButton10 Inherits PushButton
ControlInstance PushButton10 Inherits PushButton
EventHandler Sub Action() if p.Target=nil then MsgBox "This works only for PictureMBS objects which reference a REALbasic picture object." else canvas1.Backdrop=p.Target end if End EventHandler
End Control
Control PushButton11 Inherits PushButton
ControlInstance PushButton11 Inherits PushButton
EventHandler Sub Action() ShowInfo p End EventHandler
End Control
Control PushButton13 Inherits PushButton
ControlInstance PushButton13 Inherits PushButton
EventHandler Sub Action() dim logo as Picture logo=logombs(500) dim q as Picture q=New Picture(logo.Width, logo.Height, 32) q.Graphics.DrawPicture logo,0,0 p=new PictureMBS(q) Title="Height: "+str(p.Height) End EventHandler
EventHandler Sub Open() me.Enabled=TargetWin32 or TargetMacOS End EventHandler
End Control
Control PushButton14 Inherits PushButton
ControlInstance PushButton14 Inherits PushButton
EventHandler Sub Action() dim old as PictureMBS = p p=new PictureMBS(3000,3000,PictureMBS.ImageFormatRGB) // copy RGB to RGB call p.CopyPixels(old, 0, 0, 1000, 1000) // copy Gray to RGB call p.CopyPixels(old.RedChannel, 500, 0, 1000, 1000) call p.CopyPixels(old.GreenChannel, 0, 500, 1000, 1000) call p.CopyPixels(old.BlueChannel, 500, 500, 1000, 1000) // copy Gray to Gray in red channel call p.RedChannel.CopyPixels(old.RedChannel, 1000, 0, 1000, 1000) // copy RGB to Gray in red channel call p.RedChannel.CopyPixels(old, 1000, 500, 1000, 1000) // make a gray copy of this image dim q as new PictureMBS(500,500,PictureMBS.ImageFormatG) call q.CopyPixels(old) // copy gray image into RGB call p.CopyPixels(q, 1500,0,500,500) // make a RGB copy of this image dim rgb as new PictureMBS(500,500,PictureMBS.ImageFormatRGB) call rgb.CopyPixels(old) // copy new RGB image into RGB and test clipping dim clip as PictureMBS=p.clipimage(1500,500, 500, 500) call clip.CopyPixels(rgb) canvas1.Backdrop=p.CopyPicture End EventHandler
EventHandler Sub Open() me.Enabled=TargetWin32 or TargetMacOS End EventHandler
End Control
Control PushButton15 Inherits PushButton
ControlInstance PushButton15 Inherits PushButton
EventHandler Sub Action() dim t as integer dim b as Boolean t=ticks b=p.AutoLevel t=ticks-t Title=str(t/60)+" seconds for autolevel" if not b then MsgBox "this works only for RGB pictures." end if End EventHandler
End Control
EventHandler Sub Open() self.Maximize p=new PictureMBS(100,100,PictureMBS.ImageFormatRGB) Title="Height: "+str(p.Height) End EventHandler
Sub ShowInfo(p as picturembs) dim lines(-1) as string lines.Append "Width: "+str(p.Width) lines.Append "Height: "+str(p.Height) lines.Append "ImageFormat: "+str(p.ImageFormatString) lines.Append "TotalSize: "+str(p.TotalSize) lines.Append "PixelSize: "+str(p.PixelSize) MsgBox Join(lines,EndOfLine) End Sub
Property p As PictureMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

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


💬 Ask a question or report a problem