+
    JV-jò  ã                  ó  € R t ^ RIHt ^ RIt^ RIHt ^ RIHt ^RIH	t	H
t
 Rt ! R R]4      t ! R	 R
]
P                  4      tR R lt]	P                  ! ]P                   ]]4       ]	P"                  ! ]P                   RR.4       R# )a  
A Pillow loader for .ftc and .ftu files (FTEX)
Jerome Leclanche <jerome@leclan.ch>

The contents of this file are hereby released in the public domain (CC0)
Full text of the CC0 license:
  https://creativecommons.org/publicdomain/zero/1.0/

Independence War 2: Edge Of Chaos - Texture File Format - 16 October 2001

The textures used for 3D objects in Independence War 2: Edge Of Chaos are in a
packed custom format called FTEX. This file format uses file extensions FTC
and FTU.
* FTC files are compressed textures (using standard texture compression).
* FTU files are not compressed.
Texture File Format
The FTC and FTU texture files both use the same format. This
has the following structure:
{header}
{format_directory}
{data}
Where:
{header} = {
    u32:magic,
    u32:version,
    u32:width,
    u32:height,
    u32:mipmap_count,
    u32:format_count
}

* The "magic" number is "FTEX".
* "width" and "height" are the dimensions of the texture.
* "mipmap_count" is the number of mipmaps in the texture.
* "format_count" is the number of texture formats (different versions of the
same texture) in this file.

{format_directory} = format_count * { u32:format, u32:where }

The format value is 0 for DXT1 compressed textures and 1 for 24-bit RGB
uncompressed textures.
The texture data for a format starts at the position "where" in the file.

Each set of texture data in the file has the following structure:
{data} = format_count * { u32:mipmap_size, mipmap_size * { u8 } }
* "mipmap_size" is the number of bytes in that mip level. For compressed
textures this is the size of the texture data compressed with DXT1. For 24 bit
uncompressed textures, this is 3 * width * height. Following this are the image
bytes for that mipmap level.

Note: All data is stored in little-Endian (Intel) byte order.
)ÚannotationsN)ÚIntEnum)ÚBytesIO)ÚImageÚ	ImageFiles   FTEXc                  ó   € ] tR t^At^ t^tRtR# )ÚFormat© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__ÚDXT1ÚUNCOMPRESSEDÚ__static_attributes__r	   ó    Úd/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/PIL/FtexImagePlugin.pyr   r   A   s   † Ø€DØ„Lr   r   c                  ó6   € ] tR t^FtRtRtR R ltR R ltRtR# )	ÚFtexImageFileÚFTEXzTexture File Format (IW2:EOC)c               ó   € V ^8„  d   QhRR/# )é   ÚreturnÚNoner	   )Úformats   "r   Ú__annotate__ÚFtexImageFile.__annotate__J   s   € ÷  ñ  �tñ  r   c                	óÂ  € V P                   f   Q h\        V P                   P                  ^4      4      '       g   Rp\        V4      h\        P
                  ! RV P                   P                  ^4      4       \        P
                  ! RV P                   P                  ^4      4      V n        \        P
                  ! RV P                   P                  ^4      4      w  r#V^8X  g   Q h\        P
                  ! RV P                   P                  ^4      4      w  rEV P                   P                  V4       \        P
                  ! RV P                   P                  ^4      4      w  pV P                   P                  V4      pV\        P                  8X  d9   RV n
        \        P                  ! RR	V P                  ,           ^ R
4      .V n        MfV\        P                  8X  d9   RV n
        \        P                  ! RR	V P                  ,           ^ R4      .V n        MR\!        V4       2p\#        V4      hV P                   P%                  4        \'        V4      V n         R # )Nznot an FTEX filez<iz<2iÚRGBAÚbcnÚRGBÚrawz$Invalid texture compression format: )é    r"   )é   )ÚfpÚ_acceptÚreadÚSyntaxErrorÚstructÚunpackÚ_sizeÚseekr   r   Ú_moder   Ú_TileÚsizeÚtiler   ÚreprÚ
ValueErrorÚcloser   )ÚselfÚmsgÚmipmap_countÚformat_countr   ÚwhereÚmipmap_sizeÚdatas   &       r   Ú_openÚFtexImageFile._openJ   sœ  € Ø�w‰wÒ"Ð"Ð"Ü�t—w‘w—|‘| A“×'Ò'Ø$ˆCÜ˜cÓ"Ð"Ü�Š�d˜DŸG™GŸL™L¨›OÔ,Ü—]’] 5¨$¯'©'¯,©,°q«/Ó:ˆŒ
Ü%+§]¢]°5¸$¿'¹'¿,¹,Àq»/Ó%JÑ"ˆð ˜qÔ Ð Ð äŸš e¨T¯W©W¯\©\¸!«_Ó=‰ˆØ�‰�‰�UÔÜŸš t¨T¯W©W¯\©\¸!«_Ó=‰ˆà�w‰w�|‰|˜KÓ(ˆà”V—[‘[Ô ØˆDŒJÜ"Ÿš¨°¸¿¹Õ0BÀAÀtÓLÐMˆD�IØ”v×*Ñ*Ô*ØˆDŒJÜ"Ÿš¨°¸¿¹Õ0BÀAÀuÓMÐNˆD�Ià8¼¸f»¸ÐGˆCÜ˜S“/Ð!à�‰�‰ŒÜ˜$“-ˆŽr   c               ó    € V ^8„  d   QhRRRR/# )r   ÚposÚintr   r   r	   )r   s   "r   r   r   j   s   € ÷ ñ ˜Sð  Tñ r   c                	ó   € R # ©Nr	   )r3   r=   s   &&r   Ú	load_seekÚFtexImageFile.load_seekj   s   € Ùr   )r,   r*   r$   r/   N)	r
   r   r   r   r   Úformat_descriptionr:   rA   r   r	   r   r   r   r   F   s   † Ø€FØ8Ðõ ÷@ñ r   r   c               ó    € V ^8„  d   QhRRRR/# )r   ÚprefixÚbytesr   Úboolr	   )r   s   "r   r   r   n   s   € ÷ $ñ $�Eð $˜dñ $r   c                ó,   € V P                  \        4      # r@   )Ú
startswithÚMAGIC)rE   s   &r   r%   r%   n   s   € Ø×ÑœUÓ#Ð#r   z.ftcz.ftu)Ú__doc__Ú
__future__r   r(   Úenumr   Úior   Ú r   r   rJ   r   r   r%   Úregister_openr   Úregister_extensionsr	   r   r   Ú<module>rR      sz   ðñ3õj #ã Ý Ý ç à€ôˆWô ô
%�I×'Ñ'ô %õP$ð × Ò �M×(Ñ(¨-¸Ô AØ × Ò ˜-×.Ñ.°¸Ð0@Ö Ar   