Platforms to show: All Mac Windows Linux Cross-Platform

/Images/LargePicture/PictureMBS Draw methods


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 Draw methods

This example is the version from Sun, 10th Dec 2016.

Project "PictureMBS Draw methods.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control Canvas2 Inherits Canvas
ControlInstance Canvas2 Inherits Canvas
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control Canvas3 Inherits Canvas
ControlInstance Canvas3 Inherits Canvas
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control Canvas4 Inherits Canvas
ControlInstance Canvas4 Inherits Canvas
End Control
EventHandler Sub Open() runPicture runPictureMBS runPictureMBS2 runPictureMBS3 End EventHandler
Sub runPicture() // do everything with RB Picture objects dim p as Picture = LogoMBS(300) p.mask.Graphics.ForeColor = &cFFFFFF p.mask.Graphics.FillRect 0,0,300,300 p.mask.Graphics.ForeColor = &c000000 p.mask.Graphics.FillOval 0,0,300,300 dim r as Picture = new Picture(300,300,32) r.Graphics.ForeColor = &cFFCCCC r.Graphics.FillRect 0,0,100,100 r.Graphics.DrawPicture p, 0, 0 Canvas1.Backdrop = r End Sub
Sub runPictureMBS() // here we apply the mask while drawing a RGB picture dim p as Picture = LogoMBS(300) p.mask.Graphics.ForeColor = &cFFFFFF p.mask.Graphics.FillRect 0,0,300,300 p.mask.Graphics.ForeColor = &c000000 p.mask.Graphics.FillOval 0,0,300,300 // now we make dim n as new PictureMBS(300, 300, PictureMBS.ImageFormatRGB) // fill white like RB does for new pictures n.FillRectRGB(0, 0, 300, 300, &hFF, &hFF, &hFF) // fill some red rectangle on the top left n.FillRectRGB(0, 0, 100, 100, &hFF, &hCC, &hCC) // draw picture and apply mask n.DrawMaskedPictureApplyMaskRGB(p, 0, 0, 300, 300, false) Canvas2.Backdrop = n.CopyPicture(0,0,300,300) End Sub
Sub runPictureMBS2() // here we replace pixels in the destination picture and alpha channel is set, too. dim p as Picture = LogoMBS(300) p.mask.Graphics.ForeColor = &cFFFFFF p.mask.Graphics.FillRect 0,0,300,300 p.mask.Graphics.ForeColor = &c000000 p.mask.Graphics.FillOval 0,0,300,300 // now we make dim n as new PictureMBS(300, 300, PictureMBS.ImageFormatRGB) // fill white like RB does for new pictures n.FillRectRGB(0, 0, 300, 300, &hFF, &hFF, &hFF) // fill some red rectangle on the top left n.FillRectRGB(0, 0, 100, 100, &hFF, &hCC, &hCC) // draw picture and apply mask n.DrawMaskedPictureRGB(p, 0, 0, 300, 300, false) Canvas3.Backdrop = n.CopyPicture(0,0,300,300) End Sub
Sub runPictureMBS3() // here we replace pixels in the destination picture dim p as Picture = LogoMBS(300) p.mask.Graphics.ForeColor = &cFFFFFF p.mask.Graphics.FillRect 0,0,300,300 p.mask.Graphics.ForeColor = &c000000 p.mask.Graphics.FillOval 0,0,300,300 // now we make dim n as new PictureMBS(300, 300, PictureMBS.ImageFormatRGB) // fill white like RB does for new pictures n.FillRectRGB(0, 0, 300, 300, &hFF, &hFF, &hFF) // fill some red rectangle on the top left n.FillRectRGB(0, 0, 100, 100, &hFF, &hCC, &hCC) // draw picture and apply mask n.DrawPictureRGB(p, 0, 0, 300, 300) Canvas4.Backdrop = n.CopyPicture(0,0,300,300) End Sub
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

See also:

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


The biggest plugin in space...