a
    ¦ˆcË  ã                   @   s`   d dl mZmZmZ d dlmZ d dlmZmZm	Z	m
Z
 eddd�ZeeƒG dd„ deƒƒZd	S )
é    )ÚArrayÚHasStrictTraitsÚprovides)ÚIImage)Úarray_to_imageÚimage_to_bitmapÚbitmap_to_iconÚresize_image)NN)é   é   Zuint8)ÚshapeZdtypec                       sD   e Zd ZdZeƒ Zddd„Zddd„Zddd„Z‡ fd	d
„Z	‡  Z
S )Ú
ArrayImagez0 An IImage stored in an RGB(A) numpy array.
    Nc                 C   s    t | jƒ}|durt||ƒ}|S )a‰   Creates a toolkit-specific image for this array.

        Parameters
        ----------
        size : (int, int) or None
            The desired size as a width, height tuple, or None if wanting
            default image size.

        Returns
        -------
        image : toolkit image
            The toolkit image corresponding to the image and the specified
            size.
        N)r   Údatar	   )ÚselfÚsizeÚimage© r   úU/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/array_image.pyÚcreate_image$   s    

zArrayImage.create_imagec                 C   s   t |  |¡ƒS )a’   Creates a toolkit-specific bitmap image for this array.

        Parameters
        ----------
        size : (int, int) or None
            The desired size as a width, height tuple, or None if wanting
            default image size.

        Returns
        -------
        image : toolkit bitmap
            The toolkit bitmap corresponding to the image and the specified
            size.
        )r   r   ©r   r   r   r   r   Úcreate_bitmap8   s    zArrayImage.create_bitmapc                 C   s   t |  |¡ƒS )a‘   Creates a toolkit-specific icon for this array.

        Parameters
        ----------
        size : (int, int) or None
            The desired size as a width, height tuple, or None if wanting
            default icon size.

        Returns
        -------
        image : toolkit icon
            The toolkit image corresponding to the image and the specified
            size as an icon.
        )r   r   r   r   r   r   Úcreate_iconI   s    zArrayImage.create_iconc                    s   t ƒ jf d|i|¤Ž d S )Nr   )ÚsuperÚ__init__)r   r   Ztraits©Ú	__class__r   r   r   ^   s    zArrayImage.__init__)N)N)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
ImageArrayr   r   r   r   r   Ú__classcell__r   r   r   r   r      s   


r   N)Z
traits.apir   r   r   Zpyface.i_imager   Zpyface.util.image_helpersr   r   r   r	   r    r   r   r   r   r   Ú<module>   s
   