04-27-2025, 07:28 PM
(This post was last modified: 04-27-2025, 07:30 PM by hsiangch_ong.
Edit Reason: few typos in example code
)
(04-27-2025, 03:21 PM)madscijr Wrote: Or do we just have to compare POINT for every pixel?what i would do is use _red, _green and _blue as well as point. sometimes _alpha in addition. because point is unreliable. have one "target" color to compare each of the color registers. then use abs with a threshold. could use one threshold for all registers, or a separate threshold for each register for finer control.
sadly for typical 32-bit images it could be a bit sloppy. it could produce dots spread out in far portions of the image. which could look ugly for an user.
Code: (Select All)
dim as long targetcolor, readcolor
dim as integer rr, gg, bb, r1, g1, b1, x, y, threshcolor
targetcolor = _rgba(128, 0, 0, 255)
r1 = _red(targetcolor)
g1 = _green(targetcolor)
b1 = _blue(targetcolor)
threshcolor = 8
':
readcolor = point(x, y)
rr = _red(readcolor)
gg = _green(readcolor)
bb = _blue(readcolor)
if abs(rr - r1) <= threshcolor and abs(gg - g1) <= threshcolor and abs(bb - b1) <= threshcolor then
'do something
end if
