Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Picture/MemoryblockGrayToPictureMBS
Function:
Required plugins for this example: MBS Picture Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Picture/MemoryblockGrayToPictureMBS
This example is the version from Sun, 17th Mar 2012.
Project "MemoryblockGrayToPictureMBS.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control RadioButton1 Inherits RadioButton
ControlInstance RadioButton1 Inherits RadioButton
EventHandler Sub Action() mode=0 run End EventHandler
End Control
Control RadioButton2 Inherits RadioButton
ControlInstance RadioButton2 Inherits RadioButton
EventHandler Sub Action() mode=1 run End EventHandler
End Control
Control Slider1 Inherits Slider
ControlInstance Slider1 Inherits Slider
EventHandler Sub ValueChanged() run End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control Slider2 Inherits Slider
ControlInstance Slider2 Inherits Slider
EventHandler Sub ValueChanged() run End EventHandler
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control Slider3 Inherits Slider
ControlInstance Slider3 Inherits Slider
EventHandler Sub ValueChanged() run End EventHandler
End Control
Control RadioButton3 Inherits RadioButton
ControlInstance RadioButton3 Inherits RadioButton
EventHandler Sub Action() mode=2 run End EventHandler
End Control
EventHandler Sub Open() dim x,y,i as integer dim c as integer buf=NewMemoryBlock(512*512) for y=0 to 511 for x=0 to 511 i=y*512+x buf.Byte(i)=(x+y)/4 next next RadioButton1.Value=true End EventHandler
Sub run() dim i as integer dim r,g,b as integer dim rr(255),gg(255),bb(255) as integer Select case mode case 0 canvas1.backdrop=MemoryblockGrayToPictureMBS(buf, 0, 512,512, 1) case 1 r=Slider1.Value g=Slider2.Value b=Slider3.Value canvas1.backdrop=MemoryblockGrayToPictureMBS(buf, 0, 512,512, 1, r, g, b) case 2 for i=0 to 255 rr(i)=rnd*256 gg(i)=rnd*256 bb(i)=rnd*256 next canvas1.backdrop=MemoryblockGrayToPictureMBS(buf, 0, 512,512, 1, rr, gg, bb) end Select End Sub
Property buf As memoryBlock
Property mode As Integer
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

Feedback, Comments & Corrections

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




Links
MBS Xojo PDF Plugins