import pygame

def blit_alpha(target, source, location, opacity):

    x = location[0]
    y = location[1]
    temp = pygame.Surface((source.get_width(), source.get_height()), pygame.SRCALPHA)
    #if opacity < 255:
    #    temp = temp.convert()
    temp.blit(target, (-x, -y))
    temp.blit(source, (0, 0))
    if opacity < 255:
        temp.set_alpha(opacity)
    target.blit(temp, location)

def drawBox(s,x,y,w,h,c):
    # top
    pygame.draw.line(s,c,(x,y),(x+w,y))
    # bottom
    pygame.draw.line(s,c,(x,y+h),(x+w,y+h))
    # left
    pygame.draw.line(s,c,(x,y),(x,y+h))
    # right
    pygame.draw.line(s,c,(x+w,y),(x+w,y+h))
