
    Dh	                         d dl Z d dlZd dlmZmZmZmZ  e j                  e      Z G d dej                        Z
dgZy)    N)ffivips_libError	_to_bytesc                   R     e Zd ZdZ fdZed        Zed        Zed        Z xZ	S )TargetzAn output connection.

    c                 ,    t         t        |   |       y )N)superr   __init__)selfpointer	__class__s     p/var/www/fastuser/data/www/generator.snapmosaic.io/flask_app/venv/lib/python3.12/site-packages/pyvips/vtarget.pyr   zTarget.__init__   s    fd$W-    c                     t        j                  |       }|t        j                  k(  rt	        d|        t        |      S )aV  Make a new target to write to a file descriptor (a small
        integer).

        Make a new target that is attached to the descriptor. For example::

            target = pyvips.Target.new_to_descriptor(1)

        Makes a descriptor attached to stdout.

        You can pass this target to (for example) :meth:`write_to_target`.

        z+can't create output target from descriptor )r   vips_target_new_to_descriptorr   NULLr   r   )
descriptorr   s     r   new_to_descriptorzTarget.new_to_descriptor   sF    & 88DchhE%,( ) ) gr   c                     t        j                  t        |             }|t        j                  k(  rt        d|        t        |      S )a  Make a new target to write to a file.

        Make a new target that will write to the named file. For example::

            target = pyvips.Target.new_to_file("myfile.jpg")

        You can pass this target to (for example) :meth:`write_to_target`.

        z)can't create output target from filename )r   vips_target_new_to_filer   r   r   r   r   )filenamer   s     r   new_to_filezTarget.new_to_file,   sB     229X3FGchhCH:NOOgr   c                  |    t        j                         } | t        j                  k(  rt	        d      t        |       S )an  Make a new target to write to an area of memory.

        Make a new target that will write to memory. For example::

            target = pyvips.Target.new_to_memory()

        You can pass this target to (for example) :meth:`write_to_target`.

        After writing to the target, fetch the bytes from the target object
        with `target.get("blob")`.

        z&can't create output target from memory)r   vips_target_new_to_memoryr   r   r   r   )r   s    r   new_to_memoryzTarget.new_to_memory@   s4    " 446chh@AAgr   )
__name__
__module____qualname____doc__r   staticmethodr   r   r   __classcell__)r   s   @r   r   r   	   sI    .  2  &  r   r   )loggingpyvipsr   r   r   r   	getLoggerr   logger
Connectionr   __all__ r   r   <module>r*      sA      2 2			8	$LV L^ *r   