Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Picture/Picture blending/blend without plugin
Required plugins for this example:
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Picture/Picture blending/blend without plugin
This example is the version from Thu, 16th Nov 2016.
Project "blend without plugin.rbp"
Class main Inherits Window
Control scr Inherits Canvas
ControlInstance scr Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) img_show End EventHandler
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() quit End EventHandler
End Control
Control sld Inherits Slider
ControlInstance sld Inherits Slider
EventHandler Sub ValueChanged() img_proc sld.value End EventHandler
End Control
EventHandler Sub Open() img_a = new Picture(200,200,32) img_a.graphics.drawpicture b1,0,0 img_b = new Picture(200,200,32) img_b.graphics.drawpicture b2,0,0 img_res = new Picture(200,200,32) rgb_a=img_a.rgbSurface rgb_b=img_b.rgBSurface rgb_res=img_res.rgBSurface img_proc sld.value img_show End EventHandler
Sub img_proc(bal as integer) dim xx,yy as integer dim aa,bb as double dim ca,cb as color aa=bal/255.0 bb=1.0-aa for yy=0 to 200 for xx=0 to 200 ca=rgb_a.pixel(xx,yy) cb=rgb_b.pixel(xx,yy) rgb_res.pixel(xx,yy)=rgb(ca.red*aa+cb.red*bb,ca.green*aa+cb.green*bb,ca.blue*aa+cb.blue*bb) next next img_show End Sub
Sub img_show() scr.graphics.drawpicture img_res,0,0 End Sub
Property Protected img_a As picture
Property Protected img_b As picture
Property Protected img_res As picture
Property Protected rgb_a As rgbsurface
Property Protected rgb_b As rgbsurface
Property Protected rgb_res As rgbsurface
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "Ablage"
MenuItem FileQuit = "Beenden"
MenuItem UntitledMenu0 = "Bearbeiten"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Ausschneiden"
MenuItem EditCopy = "Kopieren"
MenuItem EditPaste = "Einfügen"
MenuItem EditClear = "Löschen"
End MenuBar
Class App Inherits Application
End Class
ExternalFile B1
End ExternalFile
ExternalFile B2
End ExternalFile
End Project

See also:

Feedback, Comments & Corrections

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

MBS Xojo PDF Plugins