Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Images/LargePicture/Image data to string
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/Image data to string
This example is the version from Sun, 17th Mar 2012.
Project "Image data to string.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() dim logo as Picture = LogoMBS(500) current=new PictureMBS(logo) canvas1.Backdrop=current.CopyPicture End EventHandler
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() dim logo as Picture = LogoMBS(500) dim temp as new PictureMBS(logo) current=new PictureMBS(logo.width,logo.height,picturembs.ImageFormatG) call current.CopyPixels(temp, 0, 0, temp.Width, temp.Height, 0,0) canvas1.Backdrop=current.CopyPicture End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action() dim n as integer dim s as string dim i,c as integer dim rows(-1) as string c=current.Height-1 for i=0 to c s=current.RowStringInFormat(i, current.ImageFormatRGB) rows.Insert 0,s next for i=0 to c current.RowStringInFormat(i, current.ImageFormatRGB)=rows(i) next canvas1.Backdrop=current.CopyPicture End EventHandler
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action() dim s as string s=current.DataStringInFormat(current.ImageFormat) MsgBox str(lenb(s))+" bytes needed for image data" current.DataStringInFormat(current.ImageFormat)=s canvas1.Backdrop=current.CopyPicture End EventHandler
End Control
Control PushButton5 Inherits PushButton
ControlInstance PushButton5 Inherits PushButton
EventHandler Sub Action() dim s as string dim f as integer = current.ImageFormat // Make a copy of the data in current format s=current.DataStringInFormat(f) MsgBox str(lenb(s))+" bytes needed for image data" // create a new grayscale image current=new pictureMBS(current.Width, Current.Height, picturembs.ImageFormatG) // put the existing data into the new picture. That will make a RGB to G current.DataStringInFormat(f)=s canvas1.Backdrop=current.CopyPicture End EventHandler
End Control
Property Protected current 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
End Project

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins