Exemple #1
0
def generate_facemasks():
    white = Image.new("L", (24,24), 255)
    
    top = Image.new("L", (24,24), 0)
    left = Image.new("L", (24,24), 0)
    whole = Image.new("L", (24,24), 0)
    
    toppart = textures.transform_image(white)
    leftpart = textures.transform_image_side(white)
    
    # using the real PIL paste here (not alpha_over) because there is
    # no alpha channel (and it's mode "L")
    top.paste(toppart, (0,0))
    left.paste(leftpart, (0,6))
    right = left.transpose(Image.FLIP_LEFT_RIGHT)
    
    # Manually touch up 6 pixels that leave a gap, like in
    # textures._build_block()
    for x,y in [(13,23), (17,21), (21,19)]:
        right.putpixel((x,y), 255)
    for x,y in [(3,4), (7,2), (11,0)]:
        top.putpixel((x,y), 255)
    
    # special fix for chunk boundary stipple
    for x,y in [(13,11), (17,9), (21,7)]:
        right.putpixel((x,y), 0)
    
    return (top, left, right)
def generate_facemasks():
    white = Image.new("L", (24,24), 255)
    
    top = Image.new("L", (24,24), 0)
    left = Image.new("L", (24,24), 0)
    whole = Image.new("L", (24,24), 0)
    
    toppart = textures.transform_image(white)
    leftpart = textures.transform_image_side(white)
    
    top.paste(toppart, (0,0))
    left.paste(leftpart, (0,6))
    right = left.transpose(Image.FLIP_LEFT_RIGHT)
    
    # Manually touch up 6 pixels that leave a gap, like in
    # textures._build_block()
    for x,y in [(13,23), (17,21), (21,19)]:
        right.putpixel((x,y), 255)
    for x,y in [(3,4), (7,2), (11,0)]:
        top.putpixel((x,y), 255)
    
    return (top, left, right)
def generate_facemasks():
    white = Image.new("L", (24, 24), 255)

    top = Image.new("L", (24, 24), 0)
    left = Image.new("L", (24, 24), 0)
    whole = Image.new("L", (24, 24), 0)

    toppart = textures.transform_image(white)
    leftpart = textures.transform_image_side(white)

    # using the real PIL paste here (not alpha_over) because there is
    # no alpha channel (and it's mode "L")
    top.paste(toppart, (0, 0))
    left.paste(leftpart, (0, 6))
    right = left.transpose(Image.FLIP_LEFT_RIGHT)

    # Manually touch up 6 pixels that leave a gap, like in
    # textures._build_block()
    for x, y in [(13, 23), (17, 21), (21, 19)]:
        right.putpixel((x, y), 255)
    for x, y in [(3, 4), (7, 2), (11, 0)]:
        top.putpixel((x, y), 255)

    return (top, left, right)