)Ej% XddlmZddlmZdZerddlmZGddZ dddZdS)) annotations)ImageF)Callablec2eZdZdZd dZdd Zdd Zdd Zd S)Iteratora- This class implements an iterator object that can be used to loop over an image sequence. You can use the ``[]`` operator to access elements by index. This operator will raise an :py:exc:`IndexError` if you try to access a nonexistent frame. :param im: An image object. im Image.ImagereturnNonect|dsd}t|||_t|jdd|_dS)Nseekzim must have seek method _min_framer)hasattrAttributeErrorr getattrposition)selfr msgs CC:\PYTHON\MyICR_Suite\python\Lib\site-packages\PIL/ImageSequence.py__init__zIterator.__init__&sGr6"" &,C %% %q99 ixintc |j||jS#t$r}d}t||d}~wwxYw)Nend of sequence)r rEOFError IndexError)rrers r __getitem__zIterator.__getitem__-sT ) GLL   7N ) ) )#CS//q ( )s # A?Ac|SN)rs r__iter__zIterator.__iter__5s rc |j|j|xjdz c_|jS#t$r}d}t ||d}~wwxYw)Nrr)r rrr StopIteration)rrrs r__next__zIterator.__next__8sh , GLL ' ' ' MMQ MM7N , , ,#C$$! + ,s58 AAAN)r r r r )rrr r )r r)r r )__name__ __module__ __qualname____doc__rr r$r'r#rrrrsn  ::::)))),,,,,,rrNr Image.Image | list[Image.Image]func+Callable[[Image.Image], Image.Image] | Noner list[Image.Image]ct|ts|g}g}|D]G}|}|dt|Dz }||Hrfd|Dn|S)a Applies a given function to all frames in an image or a list of images. The frames are returned as a list of separate images. :param im: An image, or a list of images. :param func: The function to apply to all of the image frames. :returns: A list of images. c6g|]}|Sr#)copy).0im_frames r zall_frames..Us EEEH EEErc&g|] }|Sr#r#)r3r r-s rr5zall_frames..Xs! # # #DDHH # # #r) isinstancelisttellrr)r r-ims imSequencecurrents ` r all_framesr=Bs b$  T C!! //## EE0D0DEEEE    '+ 4 # # # #s # # # #4rr")r r,r-r.r r/) __future__rr TYPE_CHECKINGcollections.abcrrr=r#rrrBs"#""""" )((((((%,%,%,%,%,%,%,%,T9=5555555r