File: //home/arjun/projects/env/lib/python3.10/site-packages/cairocffi/__pycache__/pixbuf.cpython-310.pyc
o
*weL � @ s d Z ddlZddlmZ ddlmZ ddlmZ ddlmZm Z m
Z
mZ ddlm
Z d gZeed
d�Zeedd
�Zeedd�Zzeedd�ZW n eyR dZY nw e�� G dd� de�Zdd� ZG dd� de�Zd!dd�Zd!dd �Zdd� Zdd� Zdd � ZdS )"z�
cairocffi.pixbuf
~~~~~~~~~~~~~~~~
Loading various image formats with GDK-PixBuf
:copyright: Copyright 2013-2019 by Simon Sapin
:license: BSD, see LICENSE for details.
� N)�array)�partial)�BytesIO� )�Context�ImageSurface� constants�dlopen)�
ffi_pixbuf�decode_to_image_surface)zgdk_pixbuf-2.0zlibgdk_pixbuf-2.0-0)zlibgdk_pixbuf-2.0.so.0zlibgdk_pixbuf-2.0.0.dylibzlibgdk_pixbuf-2.0-0.dll)zgobject-2.0zlibgobject-2.0-0)zlibgobject-2.0.so.0zlibgobject-2.0.dylibzlibgobject-2.0-0.dll)zglib-2.0z
libglib-2.0-0)zlibglib-2.0.so.0zlibglib-2.0.dylibzlibglib-2.0-0.dll)zgdk-3z
libgdk-3-0)z
libgdk-3.so.0zlibgdk-3.0.dylibzlibgdk-3-0.dllc @ s e Zd ZdZdS )�ImageLoadingErrorz`PixBuf returned an error when loading an image.
The image data is probably corrupted.
N)�__name__�
__module__�__qualname__�__doc__� r r �I/home/arjun/projects/env/lib/python3.10/site-packages/cairocffi/pixbuf.pyr * s r c C sh | d } t |�| tjkksJ �| tjkr2| jtjkr'dt�| j��dd� }nd}t�| � t|��dS )zZConvert a ``GError**`` to a Python :exception:`ImageLoadingError`,
and raise it.
r zPixbuf error: �utf8�replacezPixbuf errorN) �bool�ffi�NULL�message�string�decode�glib�g_error_freer )�error�return_valuer r r r �handle_g_error2 s
�
�r c @ s e Zd ZdZdd� Zdd� ZdS )�Pixbufz2Wrap a ``GdkPixbuf`` pointer and simulate methods.c C s t �|� t�|t j�| _d S )N)�gobject�g_object_refr �gc�g_object_unref�_pointer)�self�pointerr r r �__init__E s
zPixbuf.__init__c C s t td| �}t|| j�S )N�gdk_pixbuf_)�getattr�
gdk_pixbufr r% )r&