B .^-@slddlmZmZmZddlmZmZmZ m Z ddZ GdddejZ e e je e ee jddgd S) )Image ImageFile ImagePalette)i8i16lei32leo8cCs t|dkot|dddkS)N)ii)leni16)prefixr6/tmp/pip-install-mwhup7aw/Pillow/PIL/FliImagePlugin.py_acceptsrc@s`eZdZdZdZdZddZddZedd Z ed d Z d d Z ddZ ddZ ddZdS) FliImageFileZFLIzAutodesk FLI/FLC AnimationFcCs|jd}t|dd}|dkrHt|dddkrH|dd d ksPtd t|dd |_d |_t|d dt|ddf|_t|dd}|dkr|dd}||jd<ddt dD}|jd}d|_ t|dddkr|j t||_ |jd}t|dddkrv|jd}t|dddkrT| |dn"t|dddkrv| |ddd|D}t dd||_d|_|j|_|j|_|ddS) Nr r )ii)sznot an FLI/FLC fileP iiFdurationcSsg|]}|||fqSrr).0arrr Csz&FliImageFile._open..ii rcSs*g|]"\}}}t|t|t|qSr)r)rrgbrrrr!VsZRGB)fpreadr SyntaxError_FliImageFile__framecountmode_sizei32inforange_FliImageFile__offset_paletterrawjoinpalette_FliImageFile__frame_FliImageFile__fptell_FliImageFile__rewindseek)selfsmagicrr7rrr_open)s> "       zFliImageFile._openc Csd}xtt|jdD]}|jd}|t|d}t|d}|dkrRd}|j|d}xftdt|dD]R}t|||>}t||d|>}t||d|>} ||| f||<|d7}qtWqWdS)Nrr$rr"r)r2r r*r+rr ) r=r7shiftier>nr%r&r'rrrr4_s  zFliImageFile._palettecCs|jS)N)r-)r=rrrn_framesqszFliImageFile.n_framescCs |jdkS)Nr)r-)r=rrr is_animateduszFliImageFile.is_animatedcCsN||sdS||jkr"|dx&t|jd|dD]}||q8WdS)Nrr)Z _seek_checkr8_seekr2)r=framefrrrr<ys    zFliImageFile.seekcCs|dkr$d|_|j|jd|_n|||jdkrFtd|||_|j|_|j|j|jd}|svt t |}||_ dd|j |jdfg|_ |j|7_dS) Nrr)rrzcannot seek to frame %dr Zfli)rr)r8r9r<r;r3load ValueErrorr*r+EOFErrorr0ZdecodermaxblocksizeZtile)r=rHr>Z framesizerrrrGs"  zFliImageFile._seekcCs|jS)N)r8)r=rrrr:szFliImageFile.tellcCsBz4y|j|jkr|jWntk r0YnXWdd|_XdS)N)r9r*closeAttributeError)r=rrr _close__fps   zFliImageFile._close__fpN)__name__ __module__ __qualname__formatformat_descriptionZ!_close_exclusive_fp_after_loadingr@r4propertyrErFr<rGr:rPrrrrr#s6   rz.fliz.flcN)rrr_binaryrrr rr0rrrZ register_openrTZregister_extensionsrrrrs