Platforms to show: All Mac Windows Linux Cross-Platform

Back to Picture class.

Picture.ReplaceColorMBS(SearchColor as color, ReplaceWithColor as color) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 7.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Searches the given color and replaces it with the second color.
Example
dim p as Picture

p=New Picture(300,300,32)

p.Graphics.ForeColor=&cFF0000
p.Graphics.FillRect 000,100,100,100

p.Graphics.ForeColor=&c00FF00
p.Graphics.FillRect 100,100,100,100

p.Graphics.ForeColor=&c0000FF
p.Graphics.FillRect 200,100,100,100

p.Graphics.ForeColor=&c777700
p.Graphics.FillRect 100,200,100,100

// shows a violet box on the left. Other pixels unchanged
backdrop=p.ReplaceColorMBS(&cFF0000,&cFF00FF)

All other pixels are copied to the new picture.
Returns nil on any error.

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


The biggest plugin in space...