+ def lostUserCB(self, *args, **kw) :
+ print 'lostUserCB', args, kw
+
+
+ def capture(self) :
+ rgb_frame = numpy.fromstring(self.imgGene.get_raw_image_map_bgr(), dtype=numpy.uint8).reshape(480, 640, 3)
+ image = cv.fromarray(rgb_frame)
+ cv.CvtColor(cv.fromarray(rgb_frame), image, cv.CV_BGR2RGB)
+ pyimage = pygame.image.frombuffer(image.tostring(), cv.GetSize(image), 'RGB')
+ return pyimage
+
+ def update(self) :
+ self.context.wait_any_update_all()
+ #self.context.wait_and_update_all()
+ #return self.context.wait_one_update_all(self.imgGene)
+
+
+class RGBSprite(pygame.sprite.DirtySprite, RGB) :
+
+ def __init__(self, alpha=255, size=SCREEN_SIZE) :
+ pygame.sprite.DirtySprite.__init__(self)
+ RGB.__init__(self)
+ self.dirty = 2 # toujours dirty !
+ self.size = size
+ self.image = pygame.Surface(size)
+ self.workSur = pygame.Surface(SCREEN_SIZE)
+ self.image.set_alpha(alpha)
+ self.rect = pygame.Rect((0, 0), (0, 0))
+
+ def update(self) :
+ RGB.update(self)
+ img = self.capture()
+ self.workSur.blit(img, (0, 0))
+ self.workSur = pygame.transform.flip(self.workSur, True, False) # miroir
+ if self.size != SCREEN_SIZE :
+ pygame.transform.scale(self.workSur, self.size, self.image) # étirement, blit implicite
+ else :
+ self.image.blit(self.workSur, (0, 0))
+
+
+def main() :