
I]c           @  s  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 Z	 d e
 f d     YZ d e
 f d     YZ e   a d   Z d e j j j f d	     YZ d
 e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ i  Z d   Z e d d  Z d e f d      YZ d! e f d"     YZ  d# e f d$     YZ! d% e f d&     YZ" d' e f d(     YZ# d) e$ f d*     YZ% d+ d, d- f d.  Z& d/ d0 d1 f d+ d, d- f d2  Z' d3   Z( d4   Z) d5 e f d6     YZ* d7 e f d8     YZ+ e, d9  Z- d:   Z. d;   Z/ d<   Z0 d S(=   i(   t   print_functionNt
   CacheEntryc           B  s   e  Z d    Z d   Z RS(   c         C  sI   | |  _  | |  _ | j   \ |  _ |  _ d  |  _ | |  _ d |  _ d  S(   Ni    (	   t   whatt   surft   get_sizet   widtht   heightt   Nonet   texturet   boundst   time(   t   selfR   R   R	   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   __init__(   s    				c         C  s^   d } |  j  d  k	 r, | |  j |  j 7} n  |  j d  k	 rZ | |  j d |  j d 7} n  | S(   Ni    i   i   (   R   R   R   R   R   R	   (   R   t   rv(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   size?   s    (   t   __name__t
   __module__R   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   &   s   	t   Cachec           B  s   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 e
 e
 e
 d  Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C  s   d |  _  i  |  _ g  |  _ t |  _ t j   |  _ t j   |  _ t |  _	 i  |  _
 t   |  _ d |  _ t j d |  j d d  |  _ |  j j t  |  j j   t   |  _ g  |  _ d  S(   Ni    t   targett   namet	   preloader(   R
   t   cachet   preloadst   Truet   first_preload_in_tickt	   threadingt	   Conditiont   lockt   preload_lockt   keep_preloadingt	   pin_cachet   sett   preload_blacklistt   cache_limitt   Threadt   preload_thread_maint   preload_threadt	   setDaemont   startt   addedt   load_log(   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   P   s    								c         C  s#   t  d   |  j j   D  } | S(   sp   
        Returns the total size of the surfaces and textures that make up the
        cache, in pixels.
        c         s  s   |  ] } | j    Vq d  S(   N(   R   (   t   .0t   i(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pys	   <genexpr>   s    (   t   sumR   t   values(   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   get_total_size   s    c           s6   |  j  |   t   f d   |  j j   D  } | S(   s   
        Returns the size of the most recent `generation` generations of
        the cache. (1 is the current, 2 is the current and one before).
        c         3  s*   |  ]  } | j    k r | j   Vq d  S(   N(   R
   R   (   R)   R*   (   R&   (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pys	   <genexpr>   s    (   R
   R+   R   R,   (   R   t   generationsR   (    (   R&   si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   get_current_size   s    %c         C  sa   t  j j d k	 r< d t  j j t  j j t  j j |  _ n! t t  j j d d d  |  _ d S(   st   
        Updates the cache object to make use of settings that might be provided
        by the game-maker.
        i   i   i   N(	   t   renpyt   configt   image_cache_sizeR   t   screen_widtht   screen_heightR!   t   intt   image_cache_size_mb(   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   init   s    *c         C  sT   |  j  j   s d  S|  j  t |  _ |  j j   Wd  QX|  j  j   |  j   d  S(   N(   R$   t   isAliveR   t   FalseR   t   notifyt   joint   clear(   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   quit   s    
	c         C  sO   |  j  j   g  |  _ i  |  _ i  |  _ t |  _ |  j j   |  j  j	   d  S(   N(
   R   t   acquireR   R   R   R   R   R'   R<   t   release(   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR<      s    				c         C  s   |  j  3 |  j d 7_ g  |  _ t |  _ |  j j   Wd  QXt j j	 r t j
 j j d  t j j   \ } } t j
 j j d | |  n  d  S(   Ni   s   ----s   %s %d(   R   R
   R   R   R   R'   R<   R0   R1   t   debug_image_cachet   displayt   ic_logt   writet   exportst   get_filename_line(   R   t   filenamet   line(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   tick   s    
		c         C  s   g  |  _  d  S(   N(   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   end_tick   s    c      
   C  s  | r t  } n  t j j } t | t  sG t d t |  d   n  | j ss | j	   } t j
 j j |  | S|  j j | d   } | d  k	 r&|  j | _ | r| j d  k	 r| r d  S| rt j
 j j | j | j  } | j | j | j d   | S| j Sn  | j d  k r&d  } q&n  | d  k ry` | |  j k rT|  j | } n= | st j j d |   | j	   } Wd  QXn | j	   } Wn
   n X| j   \ }	 }
 | rt | j    } | d }	 | d }
 n d d |	 |
 f } |  j  t | | |  } | |  j | <t j
 j j | j  t j j r| rst j
 j  j! d | j" d |  j#   |  j$  qt j
 j  j! d	 | j"  n  Wd  QXn  |  j | _ | r| j d  k r)| j } | j d d | j | j f k r| j j% | j  } t j
 j j |  n  t j
 j& j' |  | _ n  | s|| rpt j
 j j | j | j  } | j | j | j d   q| j } qd  } n	 | j } t j j( s| j d  k	 rt j
 j& j | j  n  d  | _ n  | j d  k r| j d  k r|  j  |  j) |  Wd  QXn  | S(
   Ns'   Expected an image of some sort, but gott   .i   s   While loading %r:i   i    s   Added %r (%.02f%%)g      Y@s   Total Miss %r(*   R   R0   R1   t   optimize_texture_boundst
   isinstancet	   ImageBaset	   Exceptiont   strR   t   loadRA   t   rendert   mutated_surfacet   getR   R
   R   t   RenderR   R   t   blitR	   R   R   t   gamet   ExceptionInfoR   t   tuplet   get_bounding_rectR   R   R@   RB   RC   R   R-   R!   t
   subsurfacet   drawt   load_texturet   cache_surfacest   kill(   R   t   imaget   predictR   RQ   t   optimize_boundsR   t   ceR   t   wt   hR	   t   texsurf(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRS      s    		


0%	!		
c         C  sa   | j  d  k	 r( t j j j | j   n  |  j | j =t j j	 r] t j j
 j d | j  n  d  S(   Ns
   Removed %r(   R   R   R0   RA   R[   RR   R   R   R1   R@   RB   RC   (   R   Rb   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR^   U  s
    c         C  s   |  j    |  j k r t Sxb t |  j j   d d   D]B } | j |  j k rT t S|  j |  |  j    |  j k r8 Pq8 q8 Wt S(   s   
        Cleans out the cache, if it's gotten too large. Returns True
        if the cache is smaller than the size limit, or False if it's
        bigger and we don't want to continue preloading.
        t   keyc         S  s   |  j  S(   N(   R
   (   t   a(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   <lambda>n  s    (	   R-   R!   R   t   sortedR   t
   itervaluesR
   R9   R^   (   R   Rb   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   cleanout`  s    %c         C  s   |  j  | d t d t d S(   si   
        Preloads `im` into the cache, and loads the corresponding texture
        into the GPU.
        R`   R   N(   RS   R   (   R   t   im(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   preload_texture~  s    c         C  s   |  j  | d t d S(   sn   
        Gets `im` as a texture. Used when prediction is being used to load
        the actual image.
        R   N(   RS   R   (   R   Rl   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   get_texture  s    c         C  s   t  | t  s d  S|  j w | |  j k r0 d  S|  j j |  |  j j | d   } | ry | j ry |  j	 | _	 t
 } n |  j j |  t } Wd  QX| s |  j  |  j j   Wd  QXn  | r t j j r t j j j d |  n  d  S(   Ns   Kept %r(   RL   RM   R   R'   t   addR   RS   R   R   R
   R   R   t   appendR9   R   R:   R0   R1   R@   RA   RB   RC   (   R   Rl   Rb   t   in_cache(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   preload_image  s"    
	
c         C  s!   |  j   |  j  j   Wd QXd S(   s|   
        Called at the start of prediction, to ensure the thread runs
        at least once to clean out the cache.
        N(   R   R:   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   start_prediction  s    
c         C  sE   x> |  j  r@ |  j j   |  j j   |  j j   |  j   q Wd  S(   N(   R   R   R>   t   waitR?   t   preload_thread_pass(   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR#     s
    c         C  s  x |  j  r |  j r |  j W |  j   sq t j j rd x* |  j  D] } t j j j	 d |  qA Wn  g  |  _  Pn  Wd  QXyS |  j  j
 d  } | |  j k r y |  j |  Wq |  j j |  q Xn  Wq q Xq W|  j  |  j   Wd  QX|  j rt j j rt t j j  } xJ |  j j   D]9 } | | k rL| j |  q*|  j | } |  j | =q*Wx} | D]r } | |  j k rqnn  |  j  rPn  y0 | j   } | |  j | <t j j j |  Wqn|  j j |  qnXqnWn  d  S(   Ns   Overfull %ri    (   R   R   R   Rk   R0   R1   R@   RA   RB   RC   t   popR    Rm   Ro   RV   t   less_memoryR   t   storet   _cache_pin_setR   t   keyst   removeRP   R[   R\   (   R   R*   R_   t   worksetR   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRu     sJ    
	

	c         C  st   t  j j s d  St j   |  j k } |  j j d t j   | | f  x& t	 |  j  d k ro |  j j
   qJ Wd  S(   Ni    id   (   R0   R1   t	   developerR   t   current_threadR$   R(   t   insertR
   t   lenRv   (   R   RF   t   preload(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   add_load_log  s    "(   R   R   R   R-   R/   R7   R=   R<   RH   RI   R9   RS   R^   Rk   Rm   Rn   Rr   Rs   R#   Ru   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   N   s$   	3							z									
	Bc           C  s   t  j j j   t j   d S(   s   
    Frees some memory.
    N(   R0   RA   R[   t   free_memoryR   R<   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    RM   c           B  se   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z RS(   sf   
    This is the base class for all of the various kinds of images that
    we can possibly have.
    i   c         C  s   | d k  r t  |  _ n  d  S(   Ni   (   R   R   (   R   t   version(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   after_upgrade#  s    c         O  sm   | j  d d   |  _ | j  d t  |  _ | j d d  t t |   j |   t	 |   j
 f | |  _ d  S(   Nt   rleR   t   styleR_   (   Rv   R   R   R   R   t
   setdefaultt   superRM   R   t   typeR   t   identity(   R   t   argst
   properties(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   '  s
    c         C  s   t  |  j  S(   N(   t   hashR   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   __hash__1  s    c         C  s#   t  | t  s t S|  j | j k S(   N(   RL   RM   R9   R   (   R   t   other(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   __eq__4  s    c         C  s1   d d j  g  |  j D] } t |  ^ q  d S(   Nt   <t    t   >(   R;   R   t   repr(   R   R*   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   __repr__;  s    c         C  s   t  d   d S(   s   
        This function is called by the image cache code to cause this
        image to be loaded. It's expected that children of this class
        would override this.
        s   load method not implemented.N(   RN   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP   >  s    c         C  s   t  j |  d t S(   NRQ   (   R   RS   R   (   R   Rc   Rd   t   stt   at(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRQ   G  s    c         C  s   t  j j j |   d  S(   N(   R0   RA   R`   R_   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   predict_oneJ  s    c         C  s   g  S(   so   
        Returns a list of files that will be accessed when this image
        operation is performed.
        (    (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   predict_filesM  s    (   R   R   t   __doc__t   __version__R   R   R   R   R   RP   RQ   R   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRM     s   		
							t   Imagec           B  s>   e  Z d  Z d   Z d   Z d   Z e d  Z d   Z RS(   s<   
    This image manipulator loads an image from a file.
    c         K  s&   t  t |   j | |  | |  _ d S(   sS   
        @param filename: The filename that the image will be loaded from.
        N(   R   R   R   RF   (   R   RF   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   [  s    c         C  s3   t  |  j  d k  r  d |  j Sd |  j d Sd  S(   Ni   u   Image %ru   Image …%si(   R   RF   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   __unicode__c  s    c         C  s   t  j j |  j  S(   N(   R0   t   loadert   get_hashRF   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   i  s    c         C  s   t  j |  j  ye | rF t j j j t j j |  j  |  j  } n* t j j j	 t j j |  j  |  j  } | SWnV t
 k
 r } t j j r t j j |  j  } | d  k r |  n  | j   S  n Xd  S(   N(   R   R   RF   R0   RA   t   pgrendert   load_image_unscaledR   RP   t
   load_imageRN   R1   t   missing_image_callbackR   (   R   t   unscaledR   t   eRl   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP   l  s    -*	
c         C  sg   t  j j |  j  r |  j g St  j j rY t  j j |  j  } | d  k	 rY | j   Sn  |  j g Sd  S(   N(   R0   R   t   loadableRF   R1   R   R   R   (   R   Rl   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    
(	   R   R   R   R   R   R   R9   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   V  s   			t   Datac           B  s)   e  Z d  Z d   Z d   Z d   Z RS(   sx  
    :doc: im_im

    This image manipulator loads an image from binary data.

    `data`
        A string of bytes, giving the compressed image data in a standard
        file format.

    `filename`
        A "filename" associated with the image. This is used to provide a
        hint to Ren'Py about the format of `data`. (It's not actually
        loaded from disk.)
    c         K  s2   t  t |   j | | |  | |  _ | |  _ d  S(   N(   R   R   R   t   dataRF   (   R   R   RF   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    	c         C  s   d |  j  S(   Nu   im.Data(%r)(   RF   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    c         C  s+   t  j |  j  } t j j j | |  j  S(   N(   t   iot   BytesIOR   R0   RA   R   R   RF   (   R   t   f(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP     s    (   R   R   R   R   R   RP   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s   		t   ZipFileImagec           B  s&   e  Z d  d  Z d   Z d   Z RS(   i    c         K  s5   t  t |   j | | | |  | |  _ | |  _ d  S(   N(   R   R   R   t   zipfilenameRF   (   R   R   RF   t   mtimeR   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    	c         C  s   yc t  j |  j d  } | j |  j  } t j |  } t j j	 j
 | |  j  } | j   | SWn t j j	 j d t  SXd  S(   Nt   ri   (   i   i   (   t   zipfilet   ZipFileR   t   readRF   t	   cStringIOt   StringIOR0   RA   R   R   t   closet   surfaceR   (   R   t   zfR   t   sioR   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP     s    
c         C  s   g  S(   N(    (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    (   R   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s   	t	   Compositec           B  s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s  
    :undocumented:

    This image manipulator composites multiple images together to
    form a single image.

    The `size` should be a (width, height) tuple giving the size
    of the composed image.

    The remaining positional arguments are interpreted as groups of
    two. The first argument in a group should be an (x, y) tuple,
    while the second should be an image manipulator. The image
    produced by the image manipulator is composited at the location
    given by the tuple.

    ::

        image girl clothed happy = im.Composite(
            (300, 600),
            (0, 0), "girl_body.png",
            (0, 0), "girl_clothes.png",
            (100, 100), "girl_happy.png"
            )

    c         O  s   t  t |   j | | |  t |  d d k rA t d   n  | |  _ | d d  d  |  _ g  | d d  d  D] } t |  ^ qt |  _ d  S(   Ni   i    s.   Composite requires an odd number of arguments.i   (	   R   R   R   R   RN   R   t	   positionsR_   t   images(   R   R   R   R   R*   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    	c         C  s.   d } x! |  j  D] } | | j   7} q W| S(   Ni    (   R   R   (   R   R   R*   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    c         C  s   |  j  r |  j  } n t j |  j d  j   } t j j j | t	  } x< t
 |  j |  j  D]% \ } } | j t j |  |  q_ W| S(   Ni    (   R   R   RS   R   R   R0   RA   R   R   R   t   zipR   RU   (   R   R   R   t   posRl   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP     s    	"c         C  s1   g  } x$ |  j  D] } | j | j    q W| S(   N(   R   t   extendR   (   R   R   R*   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    (   R   R   R   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s
   			t   Scalec           B  s5   e  Z d  Z e d  Z d   Z d   Z d   Z RS(   sB  
    :undocumented:

    An image manipulator that scales `im` (an image manipulator) to
    `width` and `height`.

    If `bilinear` is true, then bilinear interpolation is used for
    the scaling. Otherwise, nearest neighbor interpolation is used.

    ::

        image logo scale = im.Scale("logo.png", 100, 150)
    c         K  sb   t  |  } t t |   j | | | | |  | |  _  t |  |  _ t |  |  _ | |  _ d  S(   N(   R_   R   R   R   R5   R   R   t   bilinear(   R   Rl   R   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    "	c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   $  s    c         C  s   t  j |  j  } |  j rp z; t j j j j   t j j	 j
 | |  j |  j f  } Wd  t j j j j   XnR z; t j j j j   t j j j | |  j |  j f  } Wd  t j j j j   X| S(   N(   R   RS   R_   R   R0   RA   RQ   t	   blit_lockR>   t   scalet   smoothscaleR   R   R?   R   t   transform_scale(   R   t   childR   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP   '  s    	((c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   :  s    (   R   R   R   R   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s
   
		t   FactorScalec           B  s8   e  Z d  Z d e d  Z d   Z d   Z d   Z RS(   s  
    :doc: im_im

    An image manipulator that scales `im` (a second image manipulator)
    to `width` times its original `width`, and `height` times its
    original height. If `height` is omitted, it defaults to `width`.

    If `bilinear` is true, then bilinear interpolation is used for
    the scaling. Otherwise, nearest neighbor interpolation is used.

    ::

        image logo doubled = im.FactorScale("logo.png", 1.5)
    c         K  sk   | d  k r | } n  t |  } t t |   j | | | | |  | |  _ | |  _ | |  _ | |  _ d  S(   N(   R   R_   R   R   R   R   R   R   (   R   Rl   R   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   N  s    	"			c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   [  s    c         C  s   t  j |  j  } | j   \ } } t | |  j  } t | |  j  } |  j r z5 t j	 j
 j j   t j	 j j | | | f  } Wd  t j	 j
 j j   XnL z5 t j	 j
 j j   t j	 j j | | | f  } Wd  t j	 j
 j j   X| S(   N(   R   RS   R_   R   R5   R   R   R   R0   RA   RQ   R   R>   R   R   R?   R   R   (   R   R   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP   ^  s    	""c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   v  s    N(	   R   R   R   R   R   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   >  s
   		t   Flipc           B  s8   e  Z d  Z e e d  Z d   Z d   Z d   Z RS(   s  
    :doc: im_im

    An image manipulator that flips `im` (an image manipulator)
    vertically or horizontally.  `vertical` and `horizontal` control
    the directions in which the image is flipped.

    ::

        image eileen flip = im.Flip("eileen_happy.png", vertical=True)
    c         K  se   | p	 | s t  d   n  t |  } t t |   j | | | |  | |  _ | |  _ | |  _ d  S(   NsD   im.Flip must be called with a true value for horizontal or vertical.(   RN   R_   R   R   R   t
   horizontalt   vertical(   R   Rl   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    		c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    c         C  se   t  j |  j  } z8 t j j j j   t j j j	 | |  j
 |  j  } Wd  t j j j j   X| S(   N(   R   RS   R_   R0   RA   RQ   R   R>   R   t   flipR   R   R?   (   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP     s    %c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    (   R   R   R   R9   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   z  s
   		t   Rotozoomc           B  s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   sg   
    This is an image manipulator that is a smooth rotation and zoom of another image manipulator.
    c         K  sJ   t  |  } t t |   j | | | |  | |  _  | |  _ | |  _ d S(   s  
        @param im: The image to be rotozoomed.

        @param angle: The number of degrees counterclockwise the image is
        to be rotated.

        @param zoom: The zoom factor. Numbers that are greater than 1.0
        lead to the image becoming larger.
        N(   R_   R   R   R   t   anglet   zoom(   R   Rl   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s
    		c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    c         C  se   t  j |  j  } z8 t j j j j   t j j j	 | |  j
 |  j  } Wd  t j j j j   X| S(   N(   R   RS   R_   R0   RA   RQ   R   R>   R   t   rotozoomR   R   R?   (   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP     s    %c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    (   R   R   R   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s
   			t   Cropc           B  s;   e  Z d  Z d d d d  Z d   Z d   Z d   Z RS(   s   
    :doc: im_im
    :args: (im, rect)

    An image manipulator that crops `rect`, a (x, y, width, height) tuple,
    out of `im`, an image manipulator.

    ::

        image logo crop = im.Crop("logo.png", (0, 0, 100, 307))
    c         K  s   t  |  } | d  k r- | \ } } } } n  t t |   j | | | | | |  | |  _  | |  _ | |  _ | |  _ | |  _ d  S(   N(	   R_   R   R   R   R   t   xt   yRc   Rd   (   R   Rl   R   R   Rc   Rd   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    %				c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    c         C  s1   t  j |  j  j |  j |  j |  j |  j f  S(   N(   R   RS   R_   RZ   R   R   Rc   Rd   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP     s    c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    N(   R   R   R   R   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s
   		c         C  s   t  j |  | f d  } | d k r g  } xJ t d d  D]9 } | d } | j t t | | |  d |    q: Wd j |  } | t  |  | f <n  | S(   s   
    Returns a 256 character linear ramp, where the first character has
    the value start and the last character has the value end. Such a
    ramp can be used as a map argument of im.Map.
    i    i   g     o@g      ?t    N(   t
   ramp_cacheRS   R   t   rangeRp   t   chrR5   R;   (   R&   t   endR   t   charsR*   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   ramp  s    
-i    i   t   Mapc           B  sA   e  Z d  Z e e e e e d  Z d   Z d   Z d   Z RS(   s   
    This adjusts the colors of the image that is its child. It takes
    as arguments 4 256 character strings. If a pixel channel has a
    value of 192, then the value of the 192nd character in the string
    is used for the mapped pixel component.
    c         K  sn   t  |  } t t |   j | | | | | | |  | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   N(	   R_   R   R   R   t   rmapt   gmapt   bmapt   amapt   force_alpha(   R   Rl   R   R   R   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    (					c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   *  s    c         C  sb   t  j |  j  } t j j j | j   t  } t j j	 j
 | | |  j |  j |  j |  j  | S(   N(   R   RS   R_   R0   RA   R   R   R   R   t   modulet   mapR   R   R   R   (   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP   -  s
    c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   8  s    (	   R   R   R   R   R9   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s   			t   Twocolorc           B  s5   e  Z d  Z e d  Z d   Z d   Z d   Z RS(   sp  
    This takes as arguments two colors, white and black. The image is
    mapped such that pixels in white have the white color, pixels in
    black have the black color, and shades of gray are linearly
    interpolated inbetween.  The alpha channel is mapped linearly
    between 0 and the alpha found in the white color, the black
    color's alpha is ignored.
    c         K  sz   t  j j |  } t  j j |  } t |  } t t |   j | | | | |  | |  _ | |  _ | |  _ | |  _	 d  S(   N(
   R0   t   easyt   colorR_   R   R   R   t   whitet   blackR   (   R   Rl   R   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   F  s    "			c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   U  s    c         C  sV   t  j |  j  } t j j j | j   t  } t j j	 j
 | | |  j |  j  | S(   N(   R   RS   R_   R0   RA   R   R   R   R   R   t   twomapR   R   (   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP   X  s
    c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   c  s    (   R   R   R   R9   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   <  s
   		t   Recolorc           B  sA   e  Z d  Z d d d d e d  Z d   Z d   Z d   Z RS(   s   
    This adjusts the colors of the image that is its child. It takes as an
    argument 4 numbers between 0 and 255, and maps each channel of the image
    linearly between 0 and the supplied color.
    i   c         K  s~   t  |  } t t |   j | | | | | | |  | |  _  | d |  _ | d |  _ | d |  _ | d |  _ | |  _ d  S(   Ni   (	   R_   R   R   R   t   rmult   gmult   bmult   amulR   (   R   Rl   R   R   R   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   n  s    (	c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   }  s    c         C  sb   t  j |  j  } t j j j | j   t  } t j j	 j
 | | |  j |  j |  j |  j  | S(   N(   R   RS   R_   R0   RA   R   R   R   R   R   t   linmapR   R   R   R   (   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP     s
    c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    (   R   R   R   R9   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   g  s   			t   Blurc           B  s5   e  Z d  Z d d  Z d   Z d   Z d   Z RS(   sF  
    :doc: im_im

    An image manipulator that blurs the image manipulator `im` using
    an elliptical kernel described by `xrad` and optionally `yrad`.

    If `yrad` is None, it will take the value of `xrad` resulting in
    a circular kernel being used.

    ::

        image logo blurred = im.Blur("logo.png", 1.5)
    c         K  s\   t  |  } t t |   j | | | |  | |  _  | |  _ | d  k rO | n | |  _ d  S(   N(   R_   R   R   R   t   rxR   t   ry(   R   Rl   t   xradt   yradR   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s
    		c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    c         C  sw   t  j |  j  } t j j j | j   t  } t j j j | j   t  } t j j	 j
 | | | |  j |  j  | S(   N(   R   RS   R_   R0   RA   R   R   R   R   R   t   blurR   R   (   R   R   t   wsR   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP     s
    %c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    N(   R   R   R   R   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s
   
		t   MatrixColorc           B  s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s  
    :doc: im_matrixcolor

    An image operator that uses `matrix` to linearly transform the
    image manipulator `im`.

    `Matrix` should be a list, tuple, or :func:`im.matrix` that is 20
    or 25 elements long. If the object has 25 elements, then elements
    past the 20th are ignored.

    When the four components of the source color are R, G, B, and A,
    which range from 0.0 to 1.0; the four components of the transformed
    color are R', G', B', and A', with the same range; and the elements
    of the matrix are named::

        [ a, b, c, d, e,
          f, g, h, i, j,
          k, l, m, n, o,
          p, q, r, s, t ]

    the transformed colors can be computed with the formula::

        R' = (a * R) + (b * G) + (c * B) + (d * A) + e
        G' = (f * R) + (g * G) + (h * B) + (i * A) + j
        B' = (k * R) + (l * G) + (m * B) + (n * A) + o
        A' = (p * R) + (q * G) + (r * B) + (s * A) + t

    The components of the transformed color are clamped to the
    range [0.0, 1.0].
    c         K  s   t  |  } t |  d k rI t |  d k rI t d t |    n  t |  } t t |   j | | |  | |  _  | |  _ d  S(   Ni   i   s?   ColorMatrix expects a 20 or 25 element matrix, got %d elements.(   R_   R   RN   RX   R   R   R   t   matrix(   R   Rl   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    $	c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    c         C  sP   t  j |  j  } t j j j | j   t  } t j j	 j
 | | |  j  | S(   N(   R   RS   R_   R0   RA   R   R   R   R   R   t   colormatrixR   (   R   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP     s    c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    (   R   R   R   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s
   			
R   c           B  s  e  Z d  Z d   Z d   Z d   Z d   Z d   Z e Z d   Z	 d   Z
 d   Z d	   Z d
   Z e d    Z e d d   Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z RS(   s  
    :doc: im_matrixcolor

    Constructs an im.matrix object from `matrix`. im.matrix objects
    support The operations supported are matrix multiplication, scalar
    multiplication, element-wise addition, and element-wise
    subtraction. These operations are invoked using the standard
    mathematical operators (\*, \*, +, and -, respectively). If two
    im.matrix objects are multiplied, matrix multiplication is
    performed, otherwise scalar multiplication is used.

    `matrix` is a 20 or 25 element list or tuple. If it is 20 elements
    long, it is padded with (0, 0, 0, 0, 1) to make a 5x5 matrix,
    suitable for multiplication.
    c         G  s   t  |  d k r% t | d  } n  t  |  d k rD | d } n  t  |  d k ro t d t  |    n  t j |  |  S(   Ni   i    i   i   s4   Matrix expects to be given 20 or 25 entries, not %d.(   i    i    i    i    i   (   R   RX   RN   t   __new__(   t   clsR   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   	  s    c         C  s   t  | t  s t |  } n  t  | t  sU t  | t j j  rF t St |  } n  d g d } x t d d  D]n } xe t d d  D]T } xK t d d  D]: } | | | d c | | | d | | | d 7<q Wq Wqr Wt |  S(   Ni    i   i   (   RL   R   R0   R   t   Colort   NotImplementedR   (   R   Rg   t   bt   resultR   R   R*   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   mul  s    @c         C  s-   t  |  } t g  |  D] } | | ^ q  S(   N(   t   floatR   (   R   R   R*   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt
   scalar_mul*  s    c         C  s#  | 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 f S(   Ni    i   i   i   i   i   i   i   i   i	   i
   i   i   i   i   i   i   i   i   i   (    (   R   t   o(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt
   vector_mul.  s
    GGGGc         C  s~   t  | t t f  rB t |  } t g  |  D] } | | ^ q+  St |  } t g  t |  |  D] \ } } | | ^ qa  S(   N(   RL   R5   R   R   R   (   R   R   R*   t   j(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   __add__6  s
    !c         C  s   |  | d S(   Ni(    (   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   __sub__@  s    c         C  s   |  d | S(   Ni(    (   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   __rsub__C  s    c         C  s2   t  | t t f  r" |  j |  S|  j |  |  S(   N(   RL   R5   R   R   R   (   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   __mul__F  s    c         C  s2   t  | t t f  r" |  j |  S|  j | |   S(   N(   RL   R5   R   R   R   (   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   __rmul__L  s    c         C  s   d |  S(   Ns   im.matrix(%f, %f, %f, %f, %f.
          %f, %f, %f, %f, %f,
          %f, %f, %f, %f, %f,
          %f, %f, %f, %f, %f,
          %f, %f, %f, %f, %f)(    (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   R  s    c           C  sC   t  d d d d d d d d d d d d d d d d d d d d  S(   s   
        :doc: im_matrixcolor
        :name: im.matrix.identity

        Returns an identity matrix, one that does not change color or
        alpha.
        i   i    (   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   Z  s    
gz6?g,C?g]m{?c           s   | \ } } }   f d   } t  | | d  | | d  | | d  d d | | d  | | d  | | d  d d | | d  | | d  | | d  d d d d d d d  S(   s  
        :doc: im_matrixcolor
        :name: im.matrix.saturation

        Returns an im.matrix that alters the saturation of an
        image. The alpha channel is untouched.

        `level`
            The amount of saturation in the resulting image. 1.0 is
            the unaltered image, while 0.0 is grayscale.

        `desat`
            This is a 3-element tuple that controls how much of the
            red, green, and blue channels will be placed into all
            three channels of a fully desaturated image. The default
            is based on the constants used for the luminance channel
            of an NTSC television signal. Since the human eye is
            mostly sensitive to green, more of the green channel is
            kept then the other two channels.
        c           s   |  | |    S(   N(    (   Rg   R   (   t   level(    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   I  s    i   i    (   R   (   R	  t   desatR   t   gR   R
  (    (   R	  si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt
   saturationi  s    -**c           C  s   t  j d  S(   s   
        :doc: im_matrixcolor
        :name: im.matrix.desaturate

        Returns an im.matrix that desaturates the image (makes it
        grayscale). This is equivalent to calling
        im.matrix.saturation(0).
        g        (   R   R  (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt
   desaturate  s    c         C  sC   t  |  d d d d d | d d d d d | d d d d d d d  S(   s  
        :doc: im_matrixcolor
        :name: im.matrix.tint

        Returns an im.matrix that tints an image, without changing
        the alpha channel. `r`, `g`, and `b` should be numbers between
        0 and 1, and control what fraction of the given channel is
        placed into the final image. (For example, if `r` is .5, and
        the value of the red channel is 100, the transformed color
        will have a red value of 50.)
        i    i   (   R   (   R   R  R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   tint  s    c           C  sC   t  d d d d d d d d d d d d d d d d d d d d  S(   s   
        :doc: im_matrixcolor
        :name: im.matrix.invert

        Returns an im.matrix that inverts the red, green, and blue
        channels of the image without changing the alpha channel.
        ii    i   (   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   invert  s    
c         C  sC   t  d d d d |  d d d d |  d d d d |  d d d d d  S(   sM  
        :doc: im_matrixcolor
        :name: im.matrix.brightness

        Returns an im.matrix that alters the brightness of an image.

        `b`
            The amount of change in image brightness. This should be
            a number between -1 and 1, with -1 the darkest possible
            image and 1 the brightest.
        i   i    (   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt
   brightness  s    c         C  sC   t  d d d d d d d d d d d d d d d d d d |  d  S(   s   
        :doc: im_matrixcolor
        :name: im.matrix.opacity

        Returns an im.matrix that alters the opacity of an image. An
        `o` of 0.0 is fully transparent, while 1.0 is fully opaque.
        i   i    (   R   (   R  (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   opacity  s    
c         C  s-   t  j d  t  j |  |  |   t  j d  S(   s"  
        :doc: im_matrixcolor
        :name: im.matrix.contrast

        Returns an im.matrix that alters the contrast of an image. `c` should
        be greater than 0.0, with values between 0.0 and 1.0 decreasing contrast, and
        values greater than 1.0 increasing contrast.
        g      g      ?(   R   R  R  (   t   c(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   contrast  s    c         C  s@  |  t  j d }  t  j |   } t  j |   } d } d } d } t | | 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(
   s   
        :doc: im_matrixcolor
        :name: im.matrix.hue

        Returns an im.matrix that rotates the hue by `h` degrees, while
        preserving luminosity.
        i   g$C?gzG?g;On?i   i    gM?gQ?g&1ҿ(   t   matht   pit   cost   sinR   (   Rd   t   cosValt   sinValt   lumRt   lumGt   lumB(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   hue  s    
KEJc   
      C  s   t  j j |   \ } } } } t  j j |  \ } } } }	 | d :} | d :} | d :} | d :} | d :} | d :} t | | d d d | d | | d d | d d | | d | d d d d d  S(   s  
        :doc: im_matrixcolor
        :name: im.matrix.colorize

        Returns an im.matrix that colorizes a black and white image.
        `black_color` and `white_color` are Ren'Py style colors, so
        they may be specified as strings or tuples of (0-255) color
        values. ::

            # This makes black colors red, and white colors blue.
            image logo colored = im.MatrixColor(
                "bwlogo.png",
                im.matrix.colorize("#f00", "#00f"))

        g     o@i    i   (   R0   R   R   R   (
   t   black_colort   white_colort   r0t   g0t   b0t   _a0t   r1t   g1t   b1t   _a1(    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   colorize  s    





(   gz6?g,C?g]m{?(   R   R   R   R   R   R   R  R  t   __radd__R  R  R  R  R   t   staticmethodR   R  R  R  R  R  R  R  R  R)  (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s.   										 gz6?g,C?g]m{?c         K  s   t  |  t j d |  |  S(   s   
    :doc: im_im
    :args: (im, **properties)

    An image manipulator that creates a desaturated version of the image
    manipulator `im`.
    g        (   R   R   R  (   Rl   R  R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt	   Grayscale#  s    	g      ?gGz?gRQ?c         K  s;   t  |  t j d |  t j | d | d | d  |  S(   s   
    :doc: im_im
    :args: (im, **properties)

    An image manipulator that creates a sepia-toned version of the image
    manipulator `im`.
    g        i    i   i   (   R   R   R  R  (   Rl   R  R  R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   Sepia/  s    	c         C  s4   t  j j |  \ } } } } t |  | | | |  S(   sx   
    This recolors the supplied image, mapping colors such that black is
    black and white is the supplied color.
    (   R0   R   R   R   (   Rl   R   R   R  R   Rg   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   ;  s    c      	   K  s)   t  |  d d d t d |  d t | S(   s  
    Returns an alpha-mapped version of the image. Alpha is the maximum
    alpha that this image can have, a number between 0.0 (fully
    transparent) and 1.0 (opaque).

    If an image already has an alpha channel, values in that alpha
    channel are reduced as appropriate.
    i   R   (   R   R5   R   (   R_   t   alphaR   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   AlphaF  s    
t   Tilec           B  s5   e  Z d  Z d d  Z d   Z d   Z d   Z RS(   s  
    :doc: im_im

    An image manipulator that tiles the image manipulator `im`, until
    it is `size`.

    `size`
        If not None, a (width, height) tuple. If None, this defaults to
        (:var:`config.screen_width`, :var:`config.screen_height`).
    c         K  s>   t  |  } t t |   j | | |  | |  _  | |  _ d  S(   N(   R_   R   R0  R   R   (   R   Rl   R   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   _  s    	c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   g  s    c   
      C  s   |  j  } | d  k r0 t j j t j j f } n  t j |  j  } t j	 j
 j | t  } | \ } } | j   \ } } xM t d | |  D]9 } x0 t d | |  D] }	 | j | |	 | f  q Wq W| S(   Ni    (   R   R   R0   R1   R3   R4   R   RS   R_   RA   R   R   R   R   R   RU   (
   R   R   R   R   R   R   t   swt   shR   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP   j  s    	c         C  s   |  j  j   S(   N(   R_   R   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR   ~  s    N(   R   R   R   R   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR0  S  s
   
		t	   AlphaMaskc           B  s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s  
    :doc: im_im

    An image manipulator that takes two image manipulators, `base` and
    `mask`, as arguments. It replaces the alpha channel of `base` with
    the red channel of `mask`.

    This is used to provide an image's alpha channel in a second
    image, like having one jpeg for color data, and a second one
    for alpha. In some cases, two jpegs can be smaller than a
    single png file.

    Note that this takes different arguments from :func:`AlphaMask`,
    which uses the mask's alpha channel.
    c         K  s>   t  t |   j | | |  t |  |  _ t |  |  _ d  S(   N(   R   R3  R   R_   t   baset   mask(   R   R4  R5  R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    c         C  s   |  j  j   |  j j   S(   N(   R4  R   R_   (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    c         C  s}   t  j |  j  } t  j |  j  } | j   | j   k rK t d   n  t j j j	 |  } t j j
 j | | t  | S(   Ns)   AlphaMask surfaces must be the same size.(   R   RS   R4  R5  R   RN   R0   RA   R   t   copy_surfaceR   t   alpha_mungeR   (   R   t   basesurft   masksurfR   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyRP     s    c         C  s   |  j  j   |  j j   S(   N(   R4  R   R5  (   R   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    (   R   R   R   R   R   RP   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR3    s
   			c         K  s   t  |  t  r |  St  |  t  r/ t |  |  St  |  t j j j  rg |  j   t |  j	 d | | St  |  t
  r g  } x( |  D]  } | j d  | j |  q Wt d |  S| r |  St  |  t j j j  r t d   n t d   d S(   s   
    :doc: im_image
    :name: Image
    :args: (filename, **properties)

    Loads an image from a file. `filename` is a
    string giving the name of the file.

    `filename` should be a JPEG or PNG file with an appropriate
    extension.
    t   loosei    s1   Expected an image, but got a general displayable.s(   Could not construct image from argument.N(   i    i    (   RL   RM   t
   basestringR   R0   RA   R_   t   ImageReferencet   find_targetR   RX   Rp   R   R   t   coret   DisplayableRN   (   t   argR:  R   t   paramsR*   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR_     s$    
c         C  s   t  j t |   d t S(   s   
    :name: renpy.load_image
    :doc: udd_utility

    Loads the image manipulator `im` using the image cache, and returns a render.
    RQ   (   R   RS   R_   R   (   Rl   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyR     s    c         C  s   t  j t |    S(   s   
    :name: renpy.load_surface
    :doc: udd_utility

    Loads the image manipulator `im` using the image cache, and returns a pygame Surface.
    (   R   RS   R_   (   Rl   (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   load_surface  s    c           C  s   t  d  t   a d  S(   Ns   Resetting cache.(   t   printR   R   (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   reset_module  s    
(1   t
   __future__R    t   renpy.displayR0   R  R   R   R   R
   R   t   objectR   R   R   R   RA   R>  R?  RM   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   RX   R   R,  R-  R   R/  R0  R3  R9   R_   R   RB  RD  (    (    (    si   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\im.pyt   <module>   sT   ( 			;;F3<,*'	)+(+> ,!		/,3		