# PNG in Sprite

**URL:** <https://discourse.libsdl.org/t/png-in-sprite/3095>\
**Category:** SDL Development\
**Created:** [September 3, 2000, 5:56pm UTC](https://discourse.libsdl.org/t/png-in-sprite/3095 "2000-09-03T17:56:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephane\_Magnenat](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@Stephane\_Magnenat](https://discourse.libsdl.org/u/Stephane_Magnenat)\
**Post date:** [September 3, 2000, 5:56pm UTC](https://discourse.libsdl.org/t/png-in-sprite/3095/1 "2000-09-03T17:56:20Z")

</div>

Hello,

I’m trying to create an avanced sprite format.  
I plan using libPNG & SDL\_image for storing multiple PNG images in a single  
file, which will have the following format :

[number of frame]  
[center offset info for frame 1]  
[animation info for frame 1]  
[png data for frame 1]  
.  
.  
.  
[center offset info for frame n]  
[animation info for frame n]  
[png data for frame n]

So I checked in SDL\_image and I found that SDL\_RWFromFP can’t be allocated  
from a DLL.  
Unfortunatly I though using a thing like this to load a frame :

FILE \*rfp;  
…  
fread(rfp,…) // offset infos  
fread(rfp,…) // animation infos  
SDL\_RWops rwops=SDL\_RWFromFP(rfp,false)  
// don’t know the value of false for autoclose, is it 0 ?  
IMG\_LoadTyped\_RW(rwops,0,“PNG”);

Is it correct ?  
Will it work ?  
This will be part of the Ylib, a high-level C++ library on top of SDL I will  
release under LGPL as soon as it becomes a bit cleaner (if anyone is  
interested, he can email me, or check at [http://ysagoon.com/ylib.html](http://ysagoon.com/ylib.html))  
Thanks a lot,

Stephane
