ó
Ä‚Œ\c        
   @  si  d  d l  m Z d  d l Z e d  d l Z d  d l Z d  d l Z d „  Z d „  Z d „  Z	 e j
 d k rš i d d 6d	 d
 6d d 6d d 6d d 6Z n) i d d 6d d
 6d	 d 6d d 6d d 6Z d a d „  Z d „  Z d „  Z e j Z d „  Z d d „ Z d „  Z d „  Z d d d d d d d d d d „	 Z e j Z e j Z d „  Z d „  Z d „  Z d S(   iÿÿÿÿ(   t   print_functionNc         G  sO   | j  ƒ  d d k | j  ƒ  d d k k r; t d ƒ ‚ n  |  | | | Œ d S(   sú   
    This calls the function with the source and destination
    surface. The surfaces must have the same alpha.

    If the surfaces are not 24 or 32 bits per pixel, or don't have the
    same format, they are converted and then converted back.
    i   i    s   Surface alphas do not match.N(   t	   get_maskst	   Exception(   t   functiont   srct   dstt   args(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyt   convert_and_call"   s    ,c         C  s#   t  t j |  | | | | | ƒ d S(   s;  
    This pixellates the source surface. First, every pixel in the
    source surface is projected onto a virtual surface, such that
    the average value of every avgwidth x avgheight pixels becomes
    one virtual pixel. It then gets projected back onto the
    destination surface at a ratio of one virtual pixel to every
    outwidth x outheight destination pixels.

    If either src or dst is not a 24 or 32 bit surface, they are
    converted... but that may be a significant performance hit.

    The two surfaces must either have the same alpha or no alpha.
    N(   R   t   _renpyt	   pixellate(   R   R   t   avgwidtht	   avgheightt   outwidtht	   outheight(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyR	   4   s    	c         C  s)   t  j j j | t ƒ } t |  | ƒ | S(   sƒ   
    Scales down the supplied pygame surface by the given X and Y
    factors.

    Always works, but may not be high quality.
    (   t   renpyt   displayt   pgrendert   surfacet   Truet   bilinear_scale(   t   st   sizet   d(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyt   scaleI   s    t   bigi   iÿ   i   i ÿ  i   i  ÿ i    l      ~ i   ÿc         C  s6   t  d k r2 g  |  j ƒ  D] } t | ^ q a  n  t  S(   sÏ   
    Given the surface src, returns a 4-tuple giving the byte offsets
    for the red, green, blue, and alpha components of the pixels in
    the surface. If a component doesn't exist, None is returned.
    N(   t   bo_cachet   NoneR   t   bo32(   R   t   i(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyt   byte_offsetd   s    	&c         C  se   t  d  k r t |  ƒ n  | | | | g } x3 t | | | | f t  ƒ D] \ } } | | | <qG W| S(   N(   R   R   R   t   zip(   R   t   rt   gt   bt   at   rvR   t   index_i(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyt   endian_orders   s    (c      
   C  s,   t  t j |  | t | | | | | ƒ Œ d S(   s„   
    This maps the colors between two surfaces. The various map
    parameters should be fixed-point integers, with 1.0 == 256.
    N(   R   R   t   linmapR%   (   R   R   t   rmapt   gmapt   bmapt   amap(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyR&   €   s    	c      
   C  s,   t  t j |  | t | | | | | ƒ Œ d S(   së   
    This maps the colors between two surfaces. The various map
    parameters must be 256 character long strings, with the value
    of a character at a given offset being what a particular pixel
    component value is mapped to.
    N(   R   R   t   mapR%   (   R   R   R'   R(   R)   R*   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyR+   Ž   s    	c         C  s    t  t j |  | | | | ƒ d S(   sÇ  
    This blurs the source surface. It approximates a Gaussian blur
    using several box blurs with box sizes based on the desired
    standard deviation.

    Unlike other operations, blur requires an additional surface
    to use as a holding location for intermediate results. This
    surface should not be expected to contain anything usable and
    it's final state is not defined.

    The surfaces must all be the same size and colour depth.
    N(   R   R   t   blur(   R   t   wrkR   t   xradt   yrad(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyR,   ›   s    c      	   C  sæ   | d } | d } | d } | d } | d } | d }	 | d }
 t  j j j } | d k r¥ |	 d k r¥ |
 d k r¥ t |  | | d | d | d | d ƒ n= t |  | | | | ƒ | |	 | ƒ | |
 | ƒ | d | ƒ ƒ d S(   sx   
    Given colors for white and black, linearly maps things
    appropriately, taking the alpha channel from white.
    i    i   i   i   N(   R   R   t   imt   rampR&   R+   (   R   R   t   whitet   blackt   wrt   wgt   wbt   wat   brt   bgt   bbR1   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyt   twomap¬   s&    






$		c         C  st   |  j  ƒ  | j  ƒ  k r d St |  ƒ d } t | ƒ d } | d k	 rp | d k	 rp t j |  | | | | ƒ n  d S(   sw   
    This samples the red channel from src, maps it through amap, and
    place it into the alpha channel of amap.
    Ni    i   (   t   get_sizeR   R   R   t   alpha_munge(   R   R   R*   t   redt   alpha(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyR=   Ë   s    c         C  s3  | d  k r! |  j ƒ  \ } } n  | d  k rB | j ƒ  \ } }	 n  x¼ t r | | d k ro | |	 d k ro Pn  t | d | ƒ } t | d |	 ƒ } t j j j | | f |  j ƒ  d ƒ } t	 j
 |  | | | | | d |
 ƒd } d } | } | } | }  qE Wt	 j
 |  | | | | | | | | |	 d |
 ƒ
d  S(   Ni   i   t   precisei    (   R   R<   R   t   maxR   R   R   R   R   R   t   bilinear(   R   R   t   sxt   syt   swt   sht   dxt   dyt   dwt   dhR@   t   nswt   nsht   nsrc(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyR   Û   s"    	 ("
c         C  s0   t  | ƒ d } t j |  | | | | | ƒ d  S(   Ni   (   R   R   t
   imageblend(   R"   R!   R   t   imgR*   R?   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyRN   ý   s    c         C  sï  | d d !| d d !| d d !| d d !g } t  |  ƒ } d  g d } x% t d d ƒ D] } | | | | <qW Wt j |  | | | d | d | | d | d | | d | d | | d | d	 | | d d | | d | d | | d | d | | d | d | | d | d	 | | d d | | d | d | | d | d | | d | d | | d | d	 | | d d | | d	 | d | | d	 | d | | d	 | d | | d	 | d	 | | d	 d ƒ d  S(
   Ni    i   i
   i   i   i   i   i   i   (   R   R   t   rangeR   t   colormatrix(   R   R   t   matrixt   ct   offst   oR   (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyRQ     s    .[[[c         C  s-   |  j  ƒ  d } t j |  | | | | ƒ d  S(   Ni   (   t
   get_shiftsR   t   subpixel(   R   R   t   xt   yt   shift(    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyRW     s    (   t
   __future__R    t   pygame_sdl2t   renpy.displayR   R   t   sysR   R	   R   t	   byteorderR   R   R   R   R%   R&   t   save_pngR+   R,   R;   R=   R   t	   transformt   blendRN   RQ   RW   (    (    (    sm   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\module.pyt   <module>   s4    			,)							$				