diff --git a/images-src/film.svg b/images-src/film.svg deleted file mode 100644 index dc52f01..0000000 --- a/images-src/film.svg +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/film.png b/images/film.png deleted file mode 100644 index 78a102f..0000000 Binary files a/images/film.png and /dev/null differ diff --git a/photoboite/__init__.py b/photoboite/__init__.py index f653a28..b9b693a 100644 --- a/photoboite/__init__.py +++ b/photoboite/__init__.py @@ -1,4 +1,4 @@ -import io, os, sys, time, pygame +import io, os, sys, time, pygame, random import photoboite.screens, photoboite.buttons, photoboite.buttons.config try: @@ -70,7 +70,12 @@ class Photo: def take(self, camera): self.name = "photos/%s-%04d-%04d" % (time.strftime('%Y%m%d-%H%M%S'), self.cid, self.uid) - self.capture = pygame.transform.smoothscale(pygame.image.load(camera.take(self.name)), (638, 480)) + + surface = pygame.Surface((646, 488)) + surface.fill((255, 255, 255)) + surface.blit(pygame.transform.smoothscale(pygame.image.load(camera.take(self.name)), (638, 480)), (4, 4)) + + self.capture = pygame.transform.rotate(surface.convert_alpha(), random.randrange(-20, 20, 4)) return self diff --git a/photoboite/buttons/__init__.py b/photoboite/buttons/__init__.py index ccd7711..0840bb4 100644 --- a/photoboite/buttons/__init__.py +++ b/photoboite/buttons/__init__.py @@ -150,8 +150,6 @@ class CaptureButton(Button): self.font = pygame.font.Font(None, 80) - self.photo_film = pygame.image.load(os.path.dirname(os.path.realpath(__file__)) + '/../../images/film.png').convert_alpha() - def draw_on(self, screen): if self.enabled: if self.pressed: @@ -194,9 +192,17 @@ class CaptureButton(Button): capture.take(self.photoboite.camera) pygame.time.wait(600) + self.photoboite.screen().fill((200,200,200)) + + width = self.photoboite.screen().get_width() + height = self.photoboite.screen().get_height() + for photo in capture.photos: - self.photoboite.screen().blit(photo.capture, (81, 0)) - self.photoboite.screen().blit(self.photo_film, (0, 0)) + photo_width = photo.capture.get_width() + photo_height = photo.capture.get_height() + + lefttop = ((width - photo_width) / 2, (height - photo_height) / 2) + self.photoboite.screen().blit(photo.capture, lefttop) pygame.display.flip() pygame.time.wait(800) self.photoboite.event()