Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Receiving pixel
#1
I have to check for pixel inside some window. But window takes space on screen... So would be nice to move window out and find some way to check for pixel outside of working screen area. Need some help Smile
#2
Try dialog "Find image". Select "Color of single pixel". Capture. Check "The window can be in background". Test. If does not find, try to select "Window" instead of "Control". If need, specify a RECT variable. Uncheck "Error..." and "Move mouse...". OK.

Example.
Macro Macro2459
Code:
Copy      Help
int w=win("Calculator" "CalcFrame")
int x(22) y(211) ;;in client area; to know client coordinates, look in QM status bar
RECT r; SetRect &r x y x+1 y+1 ;;1x1 rectangle, to check color of single pixel
if(scan("color:0x5B391E" w r 16|0x100))
,out "yes"
else out "no"

It works when the window is under other windows or offscreen. Not when minimized.
#3
this is really nice way, thx
#4
Is there any way to save bitmap of such offscreen\under window or part first?(if this faster) Or any way to avoid scan area changes during scan time.
#5
Do you want to find multiple colors, like this algorithm?

Get all pixels (bitmap) ;;this is the slowest part
If find(color1 in bitmap) ;;fast
,...
else if find(color2 in bitmap) ;;fast
,...
else if find(color3 in bitmap) ;;fast
,...
...
#6
Macro Macro2519
Code:
Copy      Help
int w=win("Paint" "MSPaintApp")

;get all pixels of window client area
PerfFirst
dll- user32 #PrintWindow hwnd hdcBlt nFlags
if(_winver<0x501) end "unavailable on Windows 2000"
RECT r; GetClientRect w &r
__MemBmp m.Create(r.right r.bottom)
if(!PrintWindow(w m.dc 1)) end "failed"

;find two colors
int f1 f2
PerfNext
f1=scan("color:0x1de6b5" m.bm 0 0x200)
PerfNext
f2=scan("color:0x1de6b6" m.bm 0 0x200)
PerfNext
PerfOut
out "%i %i" f1 f2

;__TempFile t.Init(".bmp"); SaveBitmap(m.bm t); run t; 1 ;;debug. PrintWindow does not work with some windows, then the bitmap is black. Some window parts may be different.

;The PerfX functions measure speed. Remove.
#7
Nice and seems fast enough. Thx Big Grin Yeah i would like to search for fixed colors like <if find(color1 in bitmap)...> but for some(less amount) with colorDiff. So would be nice to have RGB components based colorDiff in scan. Like 40 difference possible only in blue. Not necessary tho but will cost in usage of higher number overall.
#8
In QM 2.4.3 scan can search for multiple images, and can be faster.
Download here:
How to speed up Scan in Widows 8.1?


Forum Jump:


Users browsing this thread: 1 Guest(s)