OwlCyberSecurity - MANAGER
Edit File: image.cpython-38.pyc
U ��]d� � @ s� d Z ddlmZ ddlmZ ddlZddlZddlmZ ddl Z ddlZddl mZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlT dd lmZmZm Z m!Z!m"Z"m#Z# e�$e%�Z&ej'ej'ej(ej)ej*ej+ej,ej-ej.ej/ej0ej1ej2ej3ej4ej5ej6ej7d �Z8e9e8�Z:d*dd �Z;d+dd�Z<dd� Z=G dd� dej>ej?�Z@G dd� de@�ZAG dd� deA�ZBG dd� deA�ZCG dd� de@�ZDG dd� de@�ZEd,dd�ZFd-d!d"�ZGd#d$� ZHd.d(d)�ZIdS )/zR The image module supports basic image loading, rescaling and display operations. � )�BytesIO)�ceilN)�Path)�rcParams)�FigureCanvasBase)�*)�Affine2D�BboxBase�Bbox� BboxTransform�IdentityTransform�TransformedBbox)�none�nearest�bilinearZbicubicZspline16Zspline36ZhanningZhammingZhermiteZkaiserZquadricZcatromZgaussianZbesselZmitchellZsincZlanczosZblackman� �?c C sP t | �dkr"tjdtjd�ddfS g }g }| D ]x}|�||�\}}}} |dk r.||9 }||9 }|�||||�� prdf� |�t||g||jd ||jd gg�� q.t |�dkr�tjdtjd�ddfS t� |�} tj t| j�t| j �dftjd�}|D ]>\}}}}t� �|| j || j �} tj||| tjd|d � q�|| j| | j| fS ) aD Composite a number of RGBA images into one. The images are composited in the order in which they appear in the `images` list. Parameters ---------- images : list of Images Each must have a `make_image` method. For each image, `can_composite` should return `True`, though this is not enforced by this function. Each image must have a purely affine transformation with no shear. renderer : RendererBase instance magnification : float The additional magnification to apply for the renderer in use. Returns ------- tuple : image, offset_x, offset_y Returns the tuple: - image: A numpy array of the same type as the input images. - offset_x, offset_y: The offset of the image (left, bottom) in the output figure. r )r r � ��dtypeNr � r F)�resample�alpha)�len�np�empty�uint8� make_image�append� get_alphar �shape�union�zeros�int�height�widthr � translate�x0�y0�_imager �NEAREST) Zimages�renderer� magnification�partsZbboxes�image�data�x�y�trans�bbox�outputr � r4 �2/usr/lib/python3/dist-packages/matplotlib/image.py�composite_images; s6 &� � �r6 c s� t dd� |D ��}|dk r|n��� }|s.|sD|D ]}|��� q2n\g � ��� �� ���fdd�}|D ]2}t|t�r�|�� r�� �|� qf|� |��� qf|� dS )a Draw a sorted list of artists, compositing images into a single image where possible. For internal matplotlib use only: It is here to reduce duplication between `Figure.draw` and `Axes.draw`, but otherwise should not be generally useful. c s s | ]}t |t�V qd S �N)� isinstance� _ImageBase��.0r/ r4 r4 r5 � <genexpr> s z0_draw_list_compositing_images.<locals>.<genexpr>Nc s� t � �dkr� d ��� nnt � �dkr�t� ���\} }}| jdkr���� }|��j� |���� � �� |t �|�t �|�| � |�� � d d �= d S )Nr r ) r �drawr6 �size�new_gcZset_clip_rectangler2 Z set_clip_pathZ get_clip_path� draw_imager �round�restore)r. �l�b�gc�Zimage_groupZmag�parentr* r4 r5 �flush_images� s z3_draw_list_compositing_images.<locals>.flush_images)�anyZoption_image_nocompositer= �get_image_magnificationr8 r9 � can_compositer )r* rG ZartistsZsuppress_compositeZ has_imagesZ not_composite�arH r4 rF r5 �_draw_list_compositing_imagesu s � rM c C sz t j| jd | jd df| jd�}| |dd�dd�dd�f<