Platforms to show: All Mac Windows Linux Cross-Platform

Back to Picture class.

Picture.CountColorMBS(col as color) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 3.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Counts the pixels with the given colors.
Example
dim p as Picture
dim n1,n2 as Integer

p=New Picture(300,300,32)

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

n1=p.CountColorMBS(&cFF0000)
n2=p.CountColorMBS(&cFFFFFF)

if n1=100*100 then
if n2=300*300-100*100 then
MsgBox "OK"
else
MsgBox "white failed"
end if
else
MsgBox "red failed"
end if

Returns the number of pixels found.

Blog Entries

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


The biggest plugin in space...