Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_CLEARCOLOR evety color EXCEPT ...?
#2
(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
Reply


Messages In This Thread
_CLEARCOLOR evety color EXCEPT ...? - by madscijr - 04-27-2025, 03:21 PM
RE: _CLEARCOLOR evety color EXCEPT ...? - by hsiangch_ong - 04-27-2025, 07:28 PM
RE: _CLEARCOLOR evety color EXCEPT ...? - by Petr - 04-27-2025, 08:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question using $color:32 colour names mid-program? hskakw 2 227 01-14-2026, 09:30 AM
Last Post: hskakw
  Detecting color depth-16 color, 256 color, or 32 bit color dano 20 3,913 08-17-2024, 03:08 AM
Last Post: TerryRitchie
Bug Color CONST Warning v1.5+ bplus 3 840 05-05-2022, 06:13 PM
Last Post: Pete

Forum Jump:


Users browsing this thread: 2 Guest(s)