Permalink
Browse files

more packer stub stuff to packer.py

  • Loading branch information...
jmoiron committed Apr 12, 2010
1 parent bc2590a commit 170500eda18467238dd09501066cbb3114c19223
Showing with 21 additions and 1 deletion.
  1. +21 −1 pyxie/packer.py
@@ -59,10 +59,30 @@ def bottom_left(self, placed, new, place=False):
"""Attempt to place a new rectangle on the bottom left corner of a
previously placed rectangle. Return the amt that the overall area of
the field would increase, or None if a collision is detected."""
if placed.bl:
return None
# the corner we're adding it to is here:
corner = (placed.x, placed.y + placed.rect.y)
if not self.collision(corner, new):
return self.new_area(corner, new)
def bottom_left(self, placed, new, place=False):
def top_right(self, placed, new, place=False):
if placed.tr:
return None
corner = (placed.x + placed.rect.x, placed,y)
if not self.collision(corner, new):
return self.new_area(corner, new)
def new_area(self, corner, new):
"""Return the new area of the field given a rectangle is positioned
with its top left corner at `corner`."""
pass
def collision(self, corner, new):
return True
def autopack(*files):
"""Autopack a bunch of image files into a reasonably optimized Field."""
pass

0 comments on commit 170500e

Please sign in to comment.