Created
September 7, 2013 08:55
-
-
Save halcat0x15a/6474004 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn points [^BufferedImage image ^BufferedImage screen] | |
(let [width (.getWidth image) | |
height (.getHeight image) | |
xrange (range width) | |
yrange (range height)] | |
(for [points | |
(for [sx (range (- (.getWidth screen) width)) | |
sy (range (- (.getHeight screen) height))] | |
(for [tx xrange | |
ty yrange] | |
[sx sy tx ty])) | |
:when (every? (fn [[sx sy tx ty]] | |
(= (.getRGB screen (+ sx tx) (+ sy ty)) | |
(.getRGB image tx ty))) | |
points) | |
[x y _ _] points] | |
[(+ x (/ width 2)) (+ y (/ height 2))]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment