Initial commit
This commit is contained in:
commit
d5c932d8e1
710 changed files with 50282 additions and 0 deletions
18
.tmp_axprobe/cmp.swift
Executable file
18
.tmp_axprobe/cmp.swift
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
import Foundation
|
||||
func btnColor(_ path: String) -> String {
|
||||
let data = try! Data(contentsOf: URL(fileURLWithPath: path))
|
||||
let pixOff = data.withUnsafeBytes { $0.load(fromByteOffset: 10, as: UInt32.self) }
|
||||
let w = Int(data.withUnsafeBytes { $0.load(fromByteOffset: 18, as: Int32.self) })
|
||||
let hRaw = Int(data.withUnsafeBytes { $0.load(fromByteOffset: 22, as: Int32.self) }); let h = abs(hRaw)
|
||||
let B = Int(data.withUnsafeBytes { $0.load(fromByteOffset: 28, as: UInt16.self) })/8
|
||||
let rowBytes = (B * w + 3) & ~3
|
||||
// button center in this capture: window-rel (500,548); capture is nominalResolution(1x?) -> check size
|
||||
let sx = 500.0 * Double(w) / 1161.0
|
||||
let sy = 548.0 * Double(h) / 1102.0
|
||||
let x = Int(sx), y = Int(sy)
|
||||
let rowStart = Int(pixOff) + (hRaw > 0 ? (h-1-y) : y) * rowBytes
|
||||
let i = rowStart + x * B
|
||||
return "size=\(w)x\(h) px(\(x),\(y)) BGR=(\(data[i]),\(data[i+1]),\(data[i+2]))"
|
||||
}
|
||||
print("AWAY: " + btnColor("away.bmp"))
|
||||
print("OVER: " + btnColor("over.bmp"))
|
||||
Loading…
Reference in a new issue