Skip to content

Commit

Permalink
added ability to write to an existing pygame.Surface
Browse files Browse the repository at this point in the history
  • Loading branch information
justis committed Jun 20, 2012
1 parent 84f5e3d commit b19d236
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pytagcloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,11 @@ def create_tag_image(
fontname=fontname,
rectangular=rectangular)

image_surface = Surface((sizeRect.w, sizeRect.h), SRCALPHA, 32)
image_surface.fill(background)
if type(output) == pygame.Surface:
image_surface = output
else:
image_surface = Surface((sizeRect.w, sizeRect.h), SRCALPHA, 32)
image_surface.fill(background)
for tag in tag_store:
image_surface.blit(tag.image, tag.rect)
pygame.image.save(image_surface, output)
Expand Down

0 comments on commit b19d236

Please sign in to comment.