init -3 python:


###################### PUNISHMENTS ACTIONS COMPOSITES ###########################

# define composites for the action button states
# the specifics of the matrix transformation styles are defined in script.rpy
# selected is only called for disciplinarian, position, and dress options that show state
# tinted and disabled and normal are called for all buttons, the blank will not
# show unless the passed-in image has transparency

    def disabled(img):
        return Composite((65,65),(0,0),change_black("pui_blank.png","#2D2D2C"),(0,0),pui_disabled(img))

    def selected(img):
        return Composite((65,65),(0,0),pui_selected("pui_blank.png"),(0,0),img)

    def tinted(img):
         return Composite((65,65),(0,0),"pui_blank.png",(0,0),tint_hover(img,0.19))

    def normal(img):
         return Composite((65,65),(0,0),"pui_blank.png",(0,0),img)


##########################################################################

########################## OTHER COMPOSITES ##############################


    # set a default tinting effect on hover for all imagebutton sprites
    def tint_hover(imagepath, tint=0.12):
        return im.MatrixColor(imagepath,im.matrix.brightness(tint))

    # set a default invert effect for action buttons on hover
    def invert_hover(imagepath):
    #    return im.MatrixColor(imagepath,im.matrix.invert()*im.matrix.brightness(-0.62))
        return im.MatrixColor(imagepath,im.matrix.saturation(0.5)*im.matrix.invert())

    # for the lake arrows - keep the black black, turn the white to purple
    def purple_hover(imagepath):
        return change_white(imagepath,"#ff00ff")

    # for PC power button and cheat menu +/- - keep the black black, turn the white to blue
    def blue_hover(imagepath):
        return change_white(imagepath,"#405dc4")

     # for PC power button - keep the black black, turn the white to red
    def red_hover(imagepath):
        return change_white(imagepath,"#c45d40")

    # specifically for teach/patrol/coach action buttons on hover, but is the same behavior as invert_hover
    def action_hover(imagepath):
        return im.MatrixColor(imagepath,im.matrix.saturation(0.5)*im.matrix.invert())

    def pui_disabled(imagepath): # grey out unavailable punishment actions
        return im.MatrixColor(imagepath,im.matrix.saturation(0.0))

    def pui_selected(imagepath): # turn the black background blue for selected state
        return change_black(imagepath,"#405dc4")

    def pui_hover(imagepath): # change free play view mode restart and hide/show
       return change_black(imagepath,"#3f68e0")
       # return im.MatrixColor(imagepath,im.matrix.brightness(0.5)*im.matrix.opacity(1)*im.matrix.colorize("#5f7ce5","#fff"))

    def white_hover(imagepath): # give the stats icons (except money) a little flash
        return im.MatrixColor(imagepath,im.matrix.brightness(0.5)*im.matrix.opacity(1))

    #PC button tinting
    def pc_idle(imagepath,hexcolor="#fff"):
        return change_white(imagepath,hexcolor)

    def pc_hover(imagepath,hexcolor="#fff"):
        return im.MatrixColor(imagepath,im.matrix.colorize("#9aa0a0",hexcolor))

    def change_black(imagepath,hexcolor="#000"):
        return im.MatrixColor(imagepath,im.matrix.colorize(hexcolor,"#fff"))

    def change_white(imagepath,hexcolor="#fff"):
        return im.MatrixColor(imagepath,im.matrix.colorize("#000",hexcolor))

    def flip_bw(imagepath):
        return im.MatrixColor(imagepath,im.matrix.colorize("#fff","#000"))
