Implemented float pos and size rounding

This commit is contained in:
Maximilian Giller 2019-03-08 21:36:21 +01:00
parent f15c9fdb39
commit 545657ecbb

View file

@ -15,7 +15,8 @@ class DesignEntity (object):
self.color_key = color_key
def __init_image__ (self, color = 'white'):
self.__image__ = Image.new('RGB', self.size, color=color)
rounded_size = (int(self.size[0]),int(self.size[1]))
self.__image__ = Image.new('RGB', rounded_size, color=color)
def get_image (self):
if self.__finished_image__ is False:
@ -24,10 +25,11 @@ class DesignEntity (object):
return self.__image__
def draw (self, subimage, pos, mask=False, invert_mask=False, color_key=False):
rounded_pos = (int(pos[0]),int(pos[1]))
img_mask = None
if mask:
img_mask = self.__get_mask__(subimage, invert_mask=invert_mask, color_key=color_key)
self.__image__.paste(subimage, pos, mask=img_mask)
self.__image__.paste(subimage, rounded_pos, mask=img_mask)
def draw_design (self, entity):
self.draw(entity.get_image(), entity.pos, entity.mask, entity.invert_mask, entity.color_key)