
    Dh7                        d dl Z d dlZd dlmZmZmZmZmZmZ  e j                  e	      Z
ej                  r5 ej                         d        Z ej                  dej                        Zn+ ej                   d      d        Z ej                  de      ZeeedZ edd	      rej                  r5 ej                         d
        Z ej                  dej$                        Zn+ ej                   d      d        Z ej                  de      Zeed<   ej                  r5 ej                         d        Z ej                  dej(                        Zn+ ej                   d      d        Z ej                  de      Zeed<   ej                  r5 ej                         d        Z ej                  dej,                        Zn+ ej                   d      d        Z ej                  de      Zeed<   ej                  r5 ej                         d        Z ej                  dej0                        Zn+ ej                   d      d        Z ej                  de      Zeed<    edd      rqej                  r5 ej                         d        Z ej                  dej4                        Zn+ ej                   d      d        Z ej                  de      Zeed<    G d d e      Zd gZy)!    N)ffigobject_lib	_to_bytesError	type_nameat_least_libvipsc                     t        j                  |        t        j                  |       }t	        j
                  |      }t	        j                  d|      } |||       y NzVipsProgress*r   g_object_refpyvipsImager   from_handlecastvipointerhandleimagecallbackprogresss         p/var/www/fastuser/data/www/generator.snapmosaic.io/flask_app/venv/lib/python3.12/site-packages/pyvips/gobject.py_marshal_image_progressr      F      $R ??6*88OW5!    	GCallbackzvoid(VipsImage*, void*, void*)c                     t        j                  |        t        j                  |       }t	        j
                  |      }t	        j                  d|      } |||       y r
   r   r   s         r   r   r      r   r   )preevalevalposteval   	   c                 h    t        j                  ||      }t        j                  |      } ||      S Nr   bufferr   gobjectr   lengthr   bufr   s         r   _marshal_readr+   *   *    **Wf-Cv.HC= r   z/gint64(VipsSourceCustom*, void*, gint64, void*)c                 h    t        j                  ||      }t        j                  |      } ||      S r$   r%   r'   s         r   r+   r+   1   r,   r   readc                 >    t        j                  |      } |||      S r$   r   r   r(   offsetwhencer   r   s        r   _marshal_seekr4   :       v.HFF++r   z-gint64(VipsSourceCustom*, gint64, int, void*)c                 >    t        j                  |      } |||      S r$   r0   r1   s        r   r4   r4   A   r5   r   seekc                 h    t        j                  ||      }t        j                  |      } ||      S r$   r%   r'   s         r   _marshal_writer9   I   r,   r   z/gint64(VipsTargetCustom*, void*, gint64, void*)c                 h    t        j                  ||      }t        j                  |      } ||      S r$   r%   r'   s         r   r9   r9   P   r,   r   writec                 <    t        j                  |      } |        y r$   r0   r(   r   r   s      r   _marshal_finishr>   Y       v.HJr   zvoid(VipsTargetCustom*, void*)c                 <    t        j                  |      } |        y r$   r0   r=   s      r   r>   r>   _   r?   r   finish   c                 :    t        j                  |      } |       S r$   r0   r=   s      r   _marshal_endrD   h       v.H:r   zint(VipsTargetCustom*, void*)c                 :    t        j                  |      } |       S r$   r0   r=   s      r   rD   rD   n   rE   r   endc                   0    e Zd ZdZdZd Zed        Zd Zy)GObjectzManage GObject lifetime.

    )_handlesr   c                 d    g | _         t        j                  |t        j                        | _        y)zWrap around a pointer.

        Wraps a GObject instance around an underlying pointer. When the
        instance is garbage-collected, the underlying object is unreferenced.

        N)rJ   r   gcr   g_object_unrefr   )selfr   s     r   __init__zGObject.__init__|   s%      vvg{'A'ABr   c                     t        j                  | t        j                        }|t        j                  k(  rt	        dt        |              |S )a  Make a new GObject pointer from a gtype.

        This is useful for subclasses which need to control the construction
        process.

        You can pass the result pointer to the Python constructor for the
        object you are building. You will need to call VipsObject.build() to
        finish construction.

        Returns:
            A pointer to a new GObject.

        Raises:
            :class:`.Error`

        zcan't create )r   g_object_newr   NULLr   r   )gtyper   s     r   new_pointer_from_gtypezGObject.new_pointer_from_gtype   sC    & **5#((;chh-	%(8'9:;;r   c                 x   |t         vrt        d| d      t        j                  d| j                        }t        j
                  |      }| j                  j                  |       | j                  j                  |       t        j                  |t        |      t         |   |t        j                  d       y)a|  Connect to a signal on this object.

        The callback will be triggered every time this signal is issued on this
        instance. It will be passed the image ('self' here), and a single
        `void *` pointer from libvips.

        The value of the pointer, if any, depends on the signal -- for
        example, ::eval passes a pointer to a `VipsProgress` struct.

        zunsupported signal ""z	GObject *r   N)_marshalersr   r   r   r   
new_handlerJ   appendr   g_signal_connect_datar   rR   )rN   namer   gor   s        r   signal_connectzGObject.signal_connect   s     {".tfA677XXk4<<0)
 	V$X&))"io*5d*;*0#((A	?r   N)	__name__
__module____qualname____doc__	__slots__rO   staticmethodrT   r]    r   r   rI   rI   v   s-     (IC"  0?r   rI   )loggingr   r   r   r   r   r   r   	getLoggerr^   loggerAPI_mode
def_externr   r   _marshal_image_progress_cbr   rW   r+   _marshal_read_cbr4   _marshal_seek_cbr9   _marshal_write_cbr>   _marshal_finish_cbrD   _marshal_end_cbobjectrI   __all__rd   r   r   <module>rr      sI      
		8	$ 
??S^^" " 	kAAB  S\\23" 4" 	56  *&* Aq			! 
	! $388K1J1JK	G	H	! 
I	! $388K?*K			, 
	, CHH[+";";< 	 
E	F	, 
G	, $388K?*K			! 
	! %CHH[+2L2LM	G	H	! 
I	! %CHH[.A,K			 
	 &SXXk;3N3NO	6	7	 
8	 &SXXk?C.KAr			 
	 ##((;0H0HI	5	6	 
7	 ##((;=(KJ?f J?Z +r   