+
    ÂHàj�  ã                  ó  € R t ^ RIHt RR0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.
)ÚannotationsÚioÚstructN)ÚIntEnum)ÚBytesIO)ÚImageÚ	ImageFiles   FTEXc                  ó   € ] tR t^Ct^ t^tRtR# )ÚFormat© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__ÚDXT1ÚUNCOMPRESSEDÚ__static_attributes__r   ó    Ú•/home/ubuntu/.hermes/installs/5f0a1ff4045d044e/environments/88679baa1dc64374a0cd943b62eeefb9/venv/lib/python3.14/site-packages/PIL/FtexImagePlugin.pyr
   r
   C   s   † Ø€DØ„Lr   r
   c                  ó6   € ] tR t^Ht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__L   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^8w  d   RV 2p\        V4      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  d7   RV n        \        P                  ! R^ ^ .V P                  O5^ R
4      .V n        MdV\        P                   8X  d7   RV n        \        P                  ! R^ ^ .V P                  O5^ 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<2iz'Unsupported number of texture formats: ÚRGBAÚbcnÚRGBÚrawz$Invalid texture compression format: )é   )ÚfpÚ_acceptÚreadÚSyntaxErrorr   ÚunpackÚ_sizeÚ
ValueErrorÚseekr
   r   Ú_moder   Ú_TileÚsizeÚtiler   ÚreprÚcloser   )ÚselfÚmsgÚmipmap_countÚformat_countr   ÚwhereÚmipmap_sizeÚdatas   &       r   Ú_openÚFtexImageFile._openL   s¶  € Ø�w‰wÒ"Ð"Ð"Ü�t—w‘w—|‘| A“×'Ò'Ø$ˆCÜ˜cÓ"Ð"Ü�Š�d˜DŸG™GŸL™L¨›OÔ,Ü—]’] 5¨$¯'©'¯,©,°q«/Ó:ˆŒ
Ü%+§]¢]°5¸$¿'¹'¿,¹,Àq»/Ó%JÑ"ˆð ˜1ÔØ;¸L¸>ÐJˆCÜ˜S“/Ð!äŸš e¨T¯W©W¯\©\¸!«_Ó=‰ˆØ�‰�‰�UÔÜŸš t¨T¯W©W¯\©\¸!«_Ó=‰ˆà�w‰w�|‰|˜KÓ(ˆà”V—[‘[Ô ØˆDŒJÜ"Ÿš¨°°AÐ0B¸¿	¹	Ñ0BÀAÀtÓLÐMˆD�IØ”v×*Ñ*Ô*ØˆDŒJÜ"Ÿš¨°°AÐ0B¸¿	¹	Ñ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   n   s   € ÷ ñ ˜Sð  Tñ r   c                	ó   € R # ©Nr   )r3   r=   s   &&r   Ú	load_seekÚFtexImageFile.load_seekn   s   € Ùr   )r-   r*   r%   r0   N)	r   r   r   r   r   Úformat_descriptionr:   rA   r   r   r   r   r   r   H   s   † Ø€FØ8Ðõ  ÷Dñ r   r   c               ó    € V ^8„  d   QhRRRR/# )r   ÚprefixÚbytesr   Úboolr   )r   s   "r   r   r   r   s   € ÷ $ñ $�Eð $˜dñ $r   c                ó,   € V P                  \        4      # r@   )Ú
startswithÚMAGIC)rE   s   &r   r&   r&   r   s   € Ø×ÑœUÓ#Ð#r   z.ftcz.ftu)Ú__doc__Ú
__future__r   Ú__lazy_modules__r   Úenumr   r   r   Ú r   r   rJ   r
   r   r&   Úregister_openr   Úregister_extensionsr   r   r   Ú<module>rR      s…   ðñ3õj #à˜(Ð#Ð ã Ý Ý ç à€ôˆWô ô
'�I×'Ñ'ô 'õT$ð × Ò �M×(Ñ(¨-¸Ô AØ × Ò ˜-×.Ñ.°¸Ð0@Ö Ar   