aboutsummaryrefslogtreecommitdiff
path: root/operationscore/PixelMapper.py
diff options
context:
space:
mode:
authorGravatar Russell Cohen <rcoh@mit.edu>2010-11-26 00:07:14 -0500
committerGravatar Russell Cohen <rcoh@mit.edu>2010-11-26 00:07:14 -0500
commit9c9babfa7032b443138c4b457aabaf79fad385b3 (patch)
treef9bf3e8b51423bf6769d2c655ffa15d81a42333f /operationscore/PixelMapper.py
parent1754a1f4511ef52f0a093dd0f9915196bd4261e7 (diff)
Add PixelMapper functionality to abstract away from mapping locations->Pixels.
Diffstat (limited to 'operationscore/PixelMapper.py')
-rw-r--r--operationscore/PixelMapper.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/operationscore/PixelMapper.py b/operationscore/PixelMapper.py
new file mode 100644
index 0000000..bbbfcf4
--- /dev/null
+++ b/operationscore/PixelMapper.py
@@ -0,0 +1,17 @@
+from operationscore.SmootCoreObject import *
+import Util
+import pdb
+class PixelMapper(SmootCoreObject):
+ def init(self):
+ self.mem = {} #Dictionary of all seen events
+ def mapEvent(self, eventLocation, screen):
+ if eventLocation in self.mem:
+ return self.mem[eventLocation]
+ else:
+ self.mem[eventLocation] = self.mappingFunction(eventLocation, screen)
+ return self.mem[eventLocation]
+ #Takes a Screen and returns a list of tuples
+ #(pixel, weight), with the sum of weights = 1
+ #TODO: consider abstracting away from pixels
+ def mappingFunction(self,eventLocation, screen):
+ pass