From: pin Date: Mon, 4 Mar 2013 10:14:40 +0000 (+0000) Subject: Étirement de la vidéo de la kinect. X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/commitdiff_plain/5fd262589f4c98f0f37c7b9806c12446fd1f8e92 Étirement de la vidéo de la kinect. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@419 fe552daf-6dbe-4428-90eb-1537e0879342 --- diff --git a/src/kinect/pygamedisplay.py b/src/kinect/pygamedisplay.py index fbf0b77..7b646ad 100755 --- a/src/kinect/pygamedisplay.py +++ b/src/kinect/pygamedisplay.py @@ -40,21 +40,25 @@ class RGB : class RGBSprite(pygame.sprite.DirtySprite, RGB) : - def __init__(self, alpha=255) : + def __init__(self, alpha=255, size=SCREEN_SIZE) : pygame.sprite.DirtySprite.__init__(self) - self.dirty = 2 # toujours dirty ! RGB.__init__(self) - - self.image = pygame.Surface((640, 480)) - self._regular = pygame.Surface((640, 480)) + 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._regular.blit(img, (0, 0)) - self.image.blit(pygame.transform.flip(self._regular, True, False), (0, 0)) + 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() : diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py index cd0ba54..66d05a3 100755 --- a/src/minwii/widgets/playingscreen.py +++ b/src/minwii/widgets/playingscreen.py @@ -20,6 +20,7 @@ from minwii.config import FIRST_HUE from minwii.config import MIDI_VELOCITY_RANGE from minwii.config import MIDI_PAN_RANGE from minwii.config import MIDI_VELOCITY_WRONG_NOTE_ATTN +from minwii.config import SCREEN_RESOLUTION from minwii.globals import BACKGROUND_LAYER from minwii.globals import CURSOR_LAYER from minwii.globals import PLAYING_MODES_DICT @@ -45,7 +46,7 @@ class PlayingScreenBase(pygame.sprite.LayeredDirty, EventHandlerMixin) : self.columns = {} self._initColumns() self._running = False - self.kinectRgb = kinect.RGBSprite(alpha=128) + self.kinectRgb = kinect.RGBSprite(alpha=128, size=SCREEN_RESOLUTION) self.add(self.kinectRgb, layer=CURSOR_LAYER) self._initCursor()