Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Black.="|<0>*140$5.R6AMlWu"
- Black.="|<1>*140$5.4MEV24S"
- Black.="|<2>*140$5.S48F4Ey"
- Black.="|<3>*140$5.S49UV2u"
- Black.="|<4>*140$5.6QeTV26"
- Black.="|<5>*140$5.SV3kV2u"
- Black.="|<6>*140$5.CW7clmu"
- Black.="|<7>*140$5.S48l68m"
- Black.="|<8>*140$5.R6/dlWu"
- Black.="|<9>*140$5.R6ALV6u"
- Fat.="|<0>*114$5.RiAMlqu"
- Fat.="|<1>*114$5.BslX6By"
- Fat.="|<2>*114$5.xAMnity"
- Fat.="|<3>*114$5.zAPVV7u"
- Fat.="|<4>*114$5.CRytz6C"
- Fat.="|<5>*114$5.zX7lV7u"
- Fat.="|<6>*114$5.TX7stqu"
- Fat.="|<7>*114$5.yANXANW"
- Fat.="|<8>*114$5.TjDjlny"
- Fat.="|<9>*114$5.RiCTX7u"
- OLD:=FindTextOCR(765, 408, 9, 4, 0.2, 0.1, Fat)
- if (OLD < 0)
- OLD := 0
- s:=10
- x:=0
- Ch:=0
- NEW:=""
- Gui +AlwaysOnTop
- Gui, Font, s264
- Gui, Add, Text,vOLD x0 y0 w550,0
- Gui, Add, Text,vNEW x0 y330 w550,0
- Gui, Show, w560 h700 x1000 y100
- Loop
- {
- if WinActive("Предупреждение")
- {
- SoundPlay *16
- Gui Err:Color, Red
- Gui Err:Font, S64 CDefault Bold, Verdana
- Gui Err:Add, Text, x2 y0 w790 h120 , Пункт выгрузки
- Gui Err:Add, Text, x55 y110 w680 h110 , 1 - приписать
- Gui Err:Add, Edit, vCh x332 y250 w130 h120 , 2
- Gui Err:Add, Button, default gSubmit x582 y280 w170 h80 , ОК
- Gui Err:Show, x100 y200 h392 w798, Пункт выгрузки
- sleep 100
- continue
- }
- if WinActive("Объект заблокирован")
- {
- Send {Left}
- Sleep 100
- Send {Enter}
- continue
- }
- NEW:=FindTextOCR(765, 408, 9, 4, 0.2, 0.1, Fat)
- if (NEW > 0)
- {
- if (OLD != NEW)
- {
- if (OLD > NEW)
- {
- if (x < 5)
- {
- x+=1
- sleep 250
- continue
- }
- else
- {
- SoundPlay *48
- x:=0
- }
- }
- CNT := NEW - OLD
- if (CNT > 5)
- {
- if (x < 5)
- {
- x+=1
- sleep 250
- continue
- }
- else
- {
- Soundplay *48
- x:=0
- }
- }
- if (CNT <= 5)
- {
- Loop, %CNT%
- {
- SoundPlay *-1
- Sleep 200
- }
- }
- GuiControl,,NEW,%NEW%
- sleep 100
- GuiControl,,OLD,%OLD%
- OLD:=NEW
- x:=0
- }
- }
- Sleep 100
- }
- Return
- Submit:
- gui Err:submit, NoHide
- sleep 500
- gui Err:destroy
- if (Ch == 1)
- {
- clipboard := "3023443vsh"
- sleep 250
- send {Left}
- Sleep 250
- send {Enter}
- sleep 250
- send ^{vk56}
- sleep 250
- send {Enter}
- }
- if (Ch != 1)
- {
- sleep 250
- Send {Enter}
- }
- ch:=0
- return
- GuiClose:
- ExitApp
- FindText(x,y,w,h,err1,err0,text)
- {
- xywh2xywh(x-w,y-h,2*w+1,2*h+1,x,y,w,h)
- if (w<1 or h<1)
- return, 0
- bch:=A_BatchLines
- SetBatchLines, -1
- ;--------------------------------------
- GetBitsFromScreen(x,y,w,h,Scan0,Stride,bits)
- ;--------------------------------------
- sx:=0, sy:=0, sw:=w, sh:=h, arr:=[]
- Loop, Parse, text, |
- {
- v:=A_LoopField
- IfNotInString, v, $, Continue
- comment:="", e1:=err1, e0:=err0
- ; You Can Add Comment Text within The <>
- if RegExMatch(v,"<([^>]*)>",r)
- v:=StrReplace(v,r), comment:=Trim(r1)
- ; You can Add two fault-tolerant in the [], separated by commas
- if RegExMatch(v,"\[([^\]]*)]",r)
- {
- v:=StrReplace(v,r), r1.=","
- StringSplit, r, r1, `,
- e1:=r1, e0:=r2
- }
- StringSplit, r, v, $
- color:=r1, v:=r2
- StringSplit, r, v, .
- w1:=r1, v:=base64tobit(r2), h1:=StrLen(v)//w1
- if (r0<2 or h1<1 or w1>sw or h1>sh or StrLen(v)!=w1*h1)
- Continue
- ;--------------------------------------------
- mode:=InStr(color,"*") ? 1:0
- color:=StrReplace(color,"*") . "@"
- StringSplit, r, color, @
- color:=mode=1 ? r1 : ((r1-1)//w1)*Stride+Mod(r1-1,w1)*4
- n:=Round(r2,2)+(!r2), n:=Floor(255*3*(1-n))
- StrReplace(v,"1","",len1), len0:=StrLen(v)-len1
- VarSetCapacity(allpos, 1024*4, 0), k:=StrLen(v)*4
- VarSetCapacity(s1, k, 0), VarSetCapacity(s0, k, 0)
- ;--------------------------------------------
- if (ok:=PicFind(mode,color,n,Scan0,Stride,sx,sy,sw,sh
- ,v,s1,s0,Round(len1*e1),Round(len0*e0),w1,h1,allpos))
- or (err1=0 and err0=0
- and (ok:=PicFind(mode,color,n,Scan0,Stride,sx,sy,sw,sh
- ,v,s1,s0,Round(len1*0.05),Round(len0*0.05),w1,h1,allpos)))
- {
- Loop, % ok
- pos:=NumGet(allpos, 4*(A_Index-1), "uint")
- , rx:=(pos&0xFFFF)+x, ry:=(pos>>16)+y
- , arr.Push( [rx,ry,w1,h1,comment] )
- }
- }
- SetBatchLines, %bch%
- return, arr.MaxIndex() ? arr:0
- }
- PicFind(mode, color, n, Scan0, Stride, sx, sy, sw, sh
- , ByRef text, ByRef s1, ByRef s0
- , err1, err0, w1, h1, ByRef allpos)
- {
- static MyFunc
- if !MyFunc
- {
- x32:="5589E55383EC50C745E8000000008B45242B454083C0018"
- . "945C88B45282B454483C0018945C48B45200FAF45188B551CC"
- . "1E20201D08945C0C745CC000000008B45CC8945D08B45D0894"
- . "5F8C745EC00000000EB78C745F000000000EB638B45EC0FAF4"
- . "5188B55F0C1E20201D08945BC8B45F88D50018955F889C28B4"
- . "52C01D00FB6003C31751C8B45D08D50018955D08D148500000"
- . "0008B453001C28B45BC8902EB1A8B45CC8D50018955CC8D148"
- . "5000000008B453401C28B45BC89028345F0018B45F03B45407"
- . "C958345EC018B45EC3B45447C808B45D03945CC0F4D45CC894"
- . "5B8837D08000F854D020000C745EC00000000E930020000C74"
- . "5F000000000E9140200008B45EC0FAF45188B55F0C1E20201C"
- . "28B45C001D08945F88B45388945D88B453C8945D48B55F88B4"
- . "50C01D08945BC8B45BC83C00289C28B451401D00FB6000FB6C"
- . "08945B48B45BC83C00189C28B451401D00FB6000FB6C08945B"
- . "08B55BC8B451401D00FB6000FB6C08945ACC745F400000000E"
- . "94C0100008B45F43B45D00F8D9A0000008B45F48D148500000"
- . "0008B453001D08B108B45F801D08945BC8B45BC83C00289C28"
- . "B451401D00FB6000FB6C02B45B48945E48B45BC83C00189C28"
- . "B451401D00FB6000FB6C02B45B08945E08B55BC8B451401D00"
- . "FB6000FB6C02B45AC8945DC837DE4007903F75DE4837DE0007"
- . "903F75DE0837DDC007903F75DDC8B55E48B45E001C28B45DC0"
- . "1D03B45107E0E836DD801837DD8000F88EF0000008B45F43B4"
- . "5CC0F8D960000008B45F48D1485000000008B453401D08B108"
- . "B45F801D08945BC8B45BC83C00289C28B451401D00FB6000FB"
- . "6C02B45B48945E48B45BC83C00189C28B451401D00FB6000FB"
- . "6C02B45B08945E08B55BC8B451401D00FB6000FB6C02B45AC8"
- . "945DC837DE4007903F75DE4837DE0007903F75DE0837DDC007"
- . "903F75DDC8B55E48B45E001C28B45DC01D03B45107F0A836DD"
- . "401837DD40078508345F4018B45F43B45B80F8CA8FEFFFF8B4"
- . "5E88D50018955E88D1485000000008B454801D08B4D208B55E"
- . "C01CA89D3C1E3108B4D1C8B55F001CA09DA8910817DE8FF030"
- . "0000F8FFE010000EB0490EB01908345F0018B45F03B45C80F8"
- . "CE0FDFFFF8345EC018B45EC3B45C40F8CC4FDFFFFE9D701000"
- . "08B450C83C00169C0E803000089450CC745EC00000000E98D0"
- . "00000C745F000000000EB788B45EC0FAF45188B55F0C1E2020"
- . "1C28B45C001D08945F88B45F883C00389C28B451401D08B55F"
- . "883C20289D18B551401CA0FB6120FB6D269CA2B0100008B55F"
- . "883C20189D38B551401DA0FB6120FB6D269D24B0200008D1C1"
- . "18B4DF88B551401CA0FB6120FB6D26BD27201DA3B550C0F9CC"
- . "288108345F0018B45F03B45247C808345EC018B45EC3B45280"
- . "F8C67FFFFFF8345C003C745EC00000000E901010000C745F00"
- . "0000000E9E50000008B45EC0FAF45188B55F0C1E20201C28B4"
- . "5C001D08945F88B45388945D88B453C8945D4C745F40000000"
- . "0EB708B45F43B45D07D2E8B45F48D1485000000008B453001D"
- . "08B108B45F801D089C28B451401D00FB6003C01740A836DD80"
- . "1837DD800787B8B45F43B45CC7D2E8B45F48D1485000000008"
- . "B453401D08B108B45F801D089C28B451401D00FB60084C0740"
- . "A836DD401837DD40078488345F4018B45F43B45B87C888B45E"
- . "88D50018955E88D1485000000008B454801D08B4D208B55EC0"
- . "1CA89D3C1E3108B4D1C8B55F001CA09DA8910817DE8FF03000"
- . "07F2BEB0490EB01908345F0018B45F03B45C80F8C0FFFFFFF8"
- . "345EC018B45EC3B45C40F8CF3FEFFFFEB0490EB01908B45E88"
- . "3C4505B5DC244009090"
- x64:="554889E54883EC50894D10895518448945204C894D28C74"
- . "5EC000000008B45482B858000000083C0018945CC8B45502B8"
- . "58800000083C0018945C88B45400FAF45308B5538C1E20201D"
- . "08945C4C745D0000000008B45D08945D48B45D48945FCC745F"
- . "000000000E988000000C745F400000000EB708B45F00FAF453"
- . "08B55F4C1E20201D08945C08B45FC8D50018955FC4863D0488"
- . "B45584801D00FB6003C3175218B45D48D50018955D44898488"
- . "D148500000000488B45604801C28B45C08902EB1F8B45D08D5"
- . "0018955D04898488D148500000000488B45684801C28B45C08"
- . "9028345F4018B45F43B85800000007C858345F0018B45F03B8"
- . "5880000000F8C69FFFFFF8B45D43945D00F4D45D08945BC837"
- . "D10000F8582020000C745F000000000E965020000C745F4000"
- . "00000E9490200008B45F00FAF45308B55F4C1E20201C28B45C"
- . "401D08945FC8B45708945DC8B45788945D88B55FC8B451801D"
- . "08945C08B45C083C0024863D0488B45284801D00FB6000FB6C"
- . "08945B88B45C083C0014863D0488B45284801D00FB6000FB6C"
- . "08945B48B45C04863D0488B45284801D00FB6000FB6C08945B"
- . "0C745F800000000E96C0100008B45F83B45D40F8DAA0000008"
- . "B45F84898488D148500000000488B45604801D08B108B45FC0"
- . "1D08945C08B45C083C0024863D0488B45284801D00FB6000FB"
- . "6C02B45B88945E88B45C083C0014863D0488B45284801D00FB"
- . "6000FB6C02B45B48945E48B45C04863D0488B45284801D00FB"
- . "6000FB6C02B45B08945E0837DE8007903F75DE8837DE400790"
- . "3F75DE4837DE0007903F75DE08B55E88B45E401C28B45E001D"
- . "03B45207E0E836DDC01837DDC000F88090100008B45F83B45D"
- . "00F8DA60000008B45F84898488D148500000000488B4568480"
- . "1D08B108B45FC01D08945C08B45C083C0024863D0488B45284"
- . "801D00FB6000FB6C02B45B88945E88B45C083C0014863D0488"
- . "B45284801D00FB6000FB6C02B45B48945E48B45C04863D0488"
- . "B45284801D00FB6000FB6C02B45B08945E0837DE8007903F75"
- . "DE8837DE4007903F75DE4837DE0007903F75DE08B55E88B45E"
- . "401C28B45E001D03B45207F0A836DD801837DD800785A8345F"
- . "8018B45F83B45BC0F8C88FEFFFF8B45EC8D50018955EC48984"
- . "88D148500000000488B85900000004801D08B4D408B55F001C"
- . "AC1E2104189D08B4D388B55F401CA4409C28910817DECFF030"
- . "0000F8F3A020000EB0490EB01908345F4018B45F43B45CC0F8"
- . "CABFDFFFF8345F0018B45F03B45C80F8C8FFDFFFFE91302000"
- . "08B451883C00169C0E8030000894518C745F000000000E9A40"
- . "00000C745F400000000E9880000008B45F00FAF45308B55F4C"
- . "1E20201C28B45C401D08945FC8B45FC83C0034863D0488B452"
- . "84801D08B55FC83C2024863CA488B55284801CA0FB6120FB6D"
- . "269CA2B0100008B55FC83C2014C63C2488B55284C01C20FB61"
- . "20FB6D269D24B020000448D04118B55FC4863CA488B5528480"
- . "1CA0FB6120FB6D26BD2724401C23B55180F9CC288108345F40"
- . "18B45F43B45480F8C6CFFFFFF8345F0018B45F03B45500F8C5"
- . "0FFFFFF8345C403C745F000000000E926010000C745F400000"
- . "000E90A0100008B45F00FAF45308B55F4C1E20201C28B45C40"
- . "1D08945FC8B45708945DC8B45788945D8C745F800000000E98"
- . "40000008B45F83B45D47D3A8B45F84898488D1485000000004"
- . "88B45604801D08B108B45FC01D04863D0488B45284801D00FB"
- . "6003C01740E836DDC01837DDC000F88910000008B45F83B45D"
- . "07D368B45F84898488D148500000000488B45684801D08B108"
- . "B45FC01D04863D0488B45284801D00FB60084C0740A836DD80"
- . "1837DD80078568345F8018B45F83B45BC0F8C70FFFFFF8B45E"
- . "C8D50018955EC4898488D148500000000488B8590000000480"
- . "1D08B4D408B55F001CAC1E2104189D08B4D388B55F401CA440"
- . "9C28910817DECFF0300007F2BEB0490EB01908345F4018B45F"
- . "43B45CC0F8CEAFEFFFF8345F0018B45F03B45C80F8CCEFEFFF"
- . "FEB0490EB01908B45EC4883C4505DC39090909090909090"
- MCode(MyFunc, A_PtrSize=8 ? x64:x32)
- }
- return, DllCall(&MyFunc, "int",mode
- , "uint",color, "int",n, "ptr",Scan0, "int",Stride
- , "int",sx, "int",sy, "int",sw, "int",sh
- , "AStr",text, "ptr",&s1, "ptr",&s0
- , "int",err1, "int",err0, "int",w1, "int",h1, "ptr",&allpos)
- }
- xywh2xywh(x1,y1,w1,h1,ByRef x,ByRef y,ByRef w,ByRef h)
- {
- SysGet, zx, 76
- SysGet, zy, 77
- SysGet, zw, 78
- SysGet, zh, 79
- left:=x1, right:=x1+w1-1, up:=y1, down:=y1+h1-1
- left:=left<zx ? zx:left, right:=right>zx+zw-1 ? zx+zw-1:right
- up:=up<zy ? zy:up, down:=down>zy+zh-1 ? zy+zh-1:down
- x:=left, y:=up, w:=right-left+1, h:=down-up+1
- }
- GetBitsFromScreen(x,y,w,h,ByRef Scan0,ByRef Stride,ByRef bits)
- {
- VarSetCapacity(bits,w*h*4,0), bpp:=32
- Scan0:=&bits, Stride:=((w*bpp+31)//32)*4
- Ptr:=A_PtrSize ? "UPtr" : "UInt", PtrP:=Ptr . "*"
- win:=DllCall("GetDesktopWindow", Ptr)
- hDC:=DllCall("GetWindowDC", Ptr,win, Ptr)
- mDC:=DllCall("CreateCompatibleDC", Ptr,hDC, Ptr)
- ;-------------------------
- VarSetCapacity(bi, 40, 0), NumPut(40, bi, 0, "int")
- NumPut(w, bi, 4, "int"), NumPut(-h, bi, 8, "int")
- NumPut(1, bi, 12, "short"), NumPut(bpp, bi, 14, "short")
- ;-------------------------
- if hBM:=DllCall("CreateDIBSection", Ptr,mDC, Ptr,&bi
- , "int",0, PtrP,ppvBits, Ptr,0, "int",0, Ptr)
- {
- oBM:=DllCall("SelectObject", Ptr,mDC, Ptr,hBM, Ptr)
- DllCall("BitBlt", Ptr,mDC, "int",0, "int",0, "int",w, "int",h
- , Ptr,hDC, "int",x, "int",y, "uint",0x00CC0020|0x40000000)
- DllCall("RtlMoveMemory", Ptr,Scan0, Ptr,ppvBits, Ptr,Stride*h)
- DllCall("SelectObject", Ptr,mDC, Ptr,oBM)
- DllCall("DeleteObject", Ptr,hBM)
- }
- DllCall("DeleteDC", Ptr,mDC)
- DllCall("ReleaseDC", Ptr,win, Ptr,hDC)
- }
- MCode(ByRef code, hex)
- {
- ListLines, Off
- bch:=A_BatchLines
- SetBatchLines, -1
- VarSetCapacity(code, StrLen(hex)//2)
- Loop, % StrLen(hex)//2
- NumPut("0x" . SubStr(hex,2*A_Index-1,2),code,A_Index-1,"uchar")
- Ptr:=A_PtrSize ? "UPtr" : "UInt"
- DllCall("VirtualProtect", Ptr,&code, Ptr
- ,VarSetCapacity(code), "uint",0x40, Ptr . "*",0)
- SetBatchLines, %bch%
- ListLines, On
- }
- base64tobit(s)
- {
- ListLines, Off
- Chars:="0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- . "abcdefghijklmnopqrstuvwxyz"
- SetFormat, IntegerFast, d
- StringCaseSense, On
- Loop, Parse, Chars
- {
- i:=A_Index-1, v:=(i>>5&1) . (i>>4&1)
- . (i>>3&1) . (i>>2&1) . (i>>1&1) . (i&1)
- s:=StrReplace(s,A_LoopField,v)
- }
- StringCaseSense, Off
- s:=SubStr(s,1,InStr(s,"1",0,0)-1)
- s:=RegExReplace(s,"[^01]+")
- ListLines, On
- return, s
- }
- bit2base64(s)
- {
- ListLines, Off
- s:=RegExReplace(s,"[^01]+")
- s.=SubStr("100000",1,6-Mod(StrLen(s),6))
- s:=RegExReplace(s,".{6}","|$0")
- Chars:="0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- . "abcdefghijklmnopqrstuvwxyz"
- SetFormat, IntegerFast, d
- Loop, Parse, Chars
- {
- i:=A_Index-1, v:="|" . (i>>5&1) . (i>>4&1)
- . (i>>3&1) . (i>>2&1) . (i>>1&1) . (i&1)
- s:=StrReplace(s,v,A_LoopField)
- }
- ListLines, On
- return, s
- }
- ASCII(s)
- {
- if RegExMatch(s,"\$(\d+)\.([\w+/]+)",r)
- {
- s:=RegExReplace(base64tobit(r2),".{" r1 "}","$0`n")
- s:=StrReplace(StrReplace(s,"0","_"),"1","0")
- }
- else s=
- return, s
- }
- ; You can put the text library at the beginning of the script,
- ; and Use Pic(Text,1) to add the text library to Pic()'s Lib,
- ; Use Pic("comment1|comment2|...") to get text images from Lib
- Pic(comments, add_to_Lib=0)
- {
- static Lib:=[]
- if (add_to_Lib)
- {
- re:="<([^>]*)>[^$]+\$\d+\.[\w+/]{3,}"
- Loop, Parse, comments, |
- if RegExMatch(A_LoopField,re,r)
- Lib[Trim(r1)]:=r
- Lib[""]:=""
- }
- else
- {
- text:=""
- Loop, Parse, comments, |
- text.="|" . Lib[Trim(A_LoopField)]
- return, text
- }
- }
- PicN(number)
- {
- return, Pic(Trim(RegExReplace(number,".","$0|"),"|"))
- }
- FindTextOCR(nX, nY, nW, nH, err1, err0, Text, Interval=5)
- {
- OCR:="", Right_X:=nX+nW
- While (ok:=FindText(nX, nY, nW, nH, err1, err0, Text))
- {
- ; For multi text search, This is the number of text images found
- Loop, % ok.MaxIndex()
- {
- ; X is the X coordinates of the upper left corner
- ; and W is the width of the image have been found
- i:=A_Index, x:=ok[i].1, y:=ok[i].2
- , w:=ok[i].3, h:=ok[i].4, comment:=ok[i].5
- ; We need the leftmost X coordinates
- if (A_Index=1 or x<Left_X)
- Left_X:=x, Left_W:=w, Left_OCR:=comment
- }
- ; If the interval exceeds the set value, add "*" to the result
- OCR.=(A_Index>1 and Left_X-Last_X>Interval ? "*":"") . Left_OCR
- ; Update nX and nW for next search
- x:=Left_X+Left_W, nW:=(Right_X-x)//2, nX:=x+nW, Last_X:=x
- }
- Return, OCR
- }
- /***** C source code of machine code *****
- int __attribute__((__stdcall__)) PicFind(
- int mode, int c, int n, unsigned char * Bmp
- , int Stride, int sx, int sy, int sw, int sh
- , char * text, int * s1, int * s0
- , int err1, int err0, int w1, int h1, int * allpos)
- {
- int o, i, j, k, x, y, w, h, ok=0;
- int r, g, b, rr, gg, bb, e1, e0, len1, len0, max;
- w=sw-w1+1; h=sh-h1+1; k=sy*Stride+sx*4;
- // Generate Lookup Table
- o=len1=len0=0;
- for (y=0; y<h1; y++)
- {
- for (x=0; x<w1; x++)
- {
- j=y*Stride+x*4;
- if (text[o++]=='1')
- s1[len1++]=j;
- else
- s0[len0++]=j;
- }
- }
- max=len1>len0 ? len1 : len0;
- // Color Mode
- if (mode==0)
- {
- for (y=0; y<h; y++)
- {
- for (x=0; x<w; x++)
- {
- o=y*Stride+x*4+k; e1=err1; e0=err0;
- j=o+c; rr=Bmp[2+j]; gg=Bmp[1+j]; bb=Bmp[j];
- for (i=0; i<max; i++)
- {
- if (i<len1)
- {
- j=o+s1[i]; r=Bmp[2+j]-rr; g=Bmp[1+j]-gg; b=Bmp[j]-bb;
- if (r<0) r=-r; if (g<0) g=-g; if (b<0) b=-b;
- if (r+g+b>n && (--e1)<0) goto NoMatch1;
- }
- if (i<len0)
- {
- j=o+s0[i]; r=Bmp[2+j]-rr; g=Bmp[1+j]-gg; b=Bmp[j]-bb;
- if (r<0) r=-r; if (g<0) g=-g; if (b<0) b=-b;
- if (r+g+b<=n && (--e0)<0) goto NoMatch1;
- }
- }
- allpos[ok++]=(sy+y)<<16|(sx+x);
- if (ok>=1024) goto Return1;
- NoMatch1:
- continue;
- }
- }
- goto Return1;
- }
- // Gray Threshold Mode
- c=(c+1)*1000;
- for (y=0; y<sh; y++)
- {
- for (x=0; x<sw; x++)
- {
- o=y*Stride+x*4+k;
- Bmp[3+o]=Bmp[2+o]*299+Bmp[1+o]*587+Bmp[o]*114<c ? 1:0;
- }
- }
- k=k+3;
- for (y=0; y<h; y++)
- {
- for (x=0; x<w; x++)
- {
- o=y*Stride+x*4+k; e1=err1; e0=err0;
- for (i=0; i<max; i++)
- {
- if (i<len1 && Bmp[o+s1[i]]!=1 && (--e1)<0) goto NoMatch2;
- if (i<len0 && Bmp[o+s0[i]]!=0 && (--e0)<0) goto NoMatch2;
- }
- allpos[ok++]=(sy+y)<<16|(sx+x);
- if (ok>=1024) goto Return1;
- NoMatch2:
- continue;
- }
- }
- Return1:
- return ok;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement