<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>How can I load png files with Allegro?</title>
		<link>http://www.allegro.cc/forums/view/596428</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Mon, 26 May 2008 01:04:16 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello. What should I do to load png?<br />I have allegro 4.2.2(last stable version) and I downloaded libpng,and zlib.<br />I link to alleg.lib, loadpng.lib, zdll.lib. But if I only write after initialize allegro BITMAP *png = load_png(&quot;name.png&quot;,NULL);<br />The Compiler (msvc2008 c++ express) said he cant find:<br />Verweis auf nicht aufgelöstes externes Symbol &quot;_png_error&quot; in Funktion &quot;_read_data&quot;.<br />Verweis auf nicht aufgelöstes externes Symbol &quot;_png_get_io_ptr&quot; in Funktion &quot;_read_data&quot;.<br />and so on... Had I link some false?<br />I hope someone can help me.</p><p>Greetz,<br />Tibo
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tibor Fober)</author>
		<pubDate>Wed, 21 May 2008 19:11:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Link with this: <tt>alleg.lib loadpng.lib &lt;zlib&gt; &lt;libpng&gt;</tt> (where zlib/libpng are the correct names; I don&#39;t know what they are, since I don&#39;t use LoadPNG with MSVC).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Erin Maus)</author>
		<pubDate>Wed, 21 May 2008 23:58:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>my problem is... i havent got a data named loadpng.lib only have zdll.lib and libpng.lib.... where do i get support for MSVC... i only find linux and unix support... <br />If i download loadpng from here:<br /><a href="http://tjaden.strangesoft.net/loadpng/">http://tjaden.strangesoft.net/loadpng/</a><br />ldpng15.zip (90.8k) <br />there are only some make files examples and headers but no library....<br />please help me guys.</p><p>Best Regards,<br />Tibo
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tibor Fober)</author>
		<pubDate>Thu, 22 May 2008 00:27:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>For MSVC, try and directly add the LoadPNG files (all the C source files and header files) to your project and see what happens (linking with libpng and zlib, too).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Erin Maus)</author>
		<pubDate>Thu, 22 May 2008 00:50:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Here see the code:</p><p>#include &lt;WinAllegro.h&gt;<br />#include &quot;loadpng.h&quot;<br />#include &lt;png.h&gt;<br />#include &lt;zlib.h&gt;</p><p>int main(int argc, char **argv) <br />{    <br />	allegro_init();<br />	install_keyboard();<br />	set_color_depth(32);<br />	set_gfx_mode(GFX_AUTODETECT_WINDOWED,640,480,0,0);<br />	<br />    <br />	<br />	BITMAP *bmp;<br />	register_png_file_type();<br />	</p><p>    return 0;<br />} END_OF_MAIN()</p><p>and I link to alleg.lib, zdll.lib, and libpng.lib</p><p>here is the error message only for register_png_file_type()</p><p>1&gt;main.obj : error LNK2001: Nicht aufgelöstes externes Symbol &quot;_register_png_file_type&quot;.<br />1&gt;C:\Users\Tibo\pngtest\pngtest\Debug\pngtest.exe : fatal error LNK1120: 1 nicht aufgelöste externe Verweise.</p><p>nicht aufgelöste externe verweise = unresolved extern symbol... so he cant find the function... but if i write the function in msvc he find the function...</p><p>ah and I found out that register_png_file() is only declared not defined... where is the definition of register_png_file() usually?</p><p>Tibo
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tibor Fober)</author>
		<pubDate>Thu, 22 May 2008 14:53:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>regpng.c
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Thu, 22 May 2008 16:33:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>and if i include regpng.c he said:<br />Verweis auf nicht aufgelöstes externes Symbol &quot;_load_png&quot; in Funktion &quot;_register_png_file_type&quot;.<br />Verweis auf nicht aufgelöstes externes Symbol &quot;_save_png&quot; in Funktion &quot;_register_png_file_type&quot;.<br />Verweis auf nicht aufgelöstes externes Symbol &quot;_load_memory_png&quot; in Funktion &quot;&quot;void * __cdecl load_datafile_png(struct PACKFILE *,long)&quot; (?load_datafile_png@@YAPAXPAUPACKFILE@@J@Z)&quot;.</p><p>I dont know... do loadpng really work?....
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tibor Fober)</author>
		<pubDate>Thu, 22 May 2008 18:05:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are you sure that all the loadpng files are being compiled? It sounds like the .o files haven&#39;t been made or they are not being linked against.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 22 May 2008 18:20:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>whats a .o file? I found a libpng-bcc.lib data and i linked to it.. but my compiler said this data is damaged or not valid...<br />I downloaded libpng from here<br /><a href="http://gnuwin32.sourceforge.net/packages/libpng.htm">http://gnuwin32.sourceforge.net/packages/libpng.htm</a><br />i downloaded the complete package without sources...</p><p>Tibo
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tibor Fober)</author>
		<pubDate>Thu, 22 May 2008 19:13:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A .o file is code that has been compiled but not linked.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 22 May 2008 20:10:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>does nobody know the problem?<br />Nobody use loadpng with MSVC?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tibor Fober)</author>
		<pubDate>Thu, 22 May 2008 20:39:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I made a wrapper that used gd to load images, at the moment its licensed under gpl, but I am in the process of getting the next release together and moving it to either lgpl or the gd licence so it can be used more easily in peoples projects.</p><p>It has project files for msvc 2005 and not so great instructions for v6, it allows you to also load gif and jpegs. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p><a href="http://www.timorg.net/gdalleg/">http://www.timorg.net/gdalleg/</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Timorg)</author>
		<pubDate>Thu, 22 May 2008 21:15:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I downloaded libpng from here<br /><a href="http://gnuwin32.sourceforge.net/packages/libpng.htm">http://gnuwin32.sourceforge.net/packages/libpng.htm</a>
</p></div></div><p>
These are probably not for MSVC.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Milan Mimica)</author>
		<pubDate>Fri, 23 May 2008 01:26:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are you planning to use the win32 API in your program?
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;WinAllegro.h&gt;</span>
<span class="p">#include "loadpng.h"</span>
<span class="p">#include &lt;png.h&gt;</span>
<span class="p">#include &lt;zlib.h&gt;</span>
</pre></div></div><p>

If you want to use the win32 API with Allegro you need to include winalleg.h after allegro.h , which I don&#39;t see there and you&#39;ve also misspelled &#39;winalleg.h&#39; as WinAllegro.h.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
and if i include regpng.c he said:
</p></div></div><p>
So you&#39;ve added all of loadpng&#39;s source files to your project right?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 23 May 2008 11:59:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;d make WinAllegro.h on my self... without WinAllegro allegro doesnt work with MSVC. Allegro havent got much support for windows... thats very bad. I&#39;m not a windows fan but the IDE is very good...</p><p>Yes i added all loadpng sources. regpng savepng and so on...</p><p>To Milan Mimica:<br />So there arent any loadpng libpng files for MSVC?...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tibor Fober)</author>
		<pubDate>Fri, 23 May 2008 18:11:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I&#39;d make WinAllegro.h on my self... without WinAllegro allegro doesnt work with MSVC. Allegro havent got much support for windows... thats very bad. I&#39;m not a windows fan but the IDE is very good...
</p></div></div><p>

Hehe, that made my day. <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><p>Anyway, why make it yourself? Can&#39;t you read? </p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include "WinAllegro.h" // WRONG! Even if you make it yourself...</span>
<span class="p">#include &lt;winalleg.h&gt; // Correct.</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Vanneto)</author>
		<pubDate>Fri, 23 May 2008 18:17:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
So there arent any loadpng libpng files for MSVC?
</p></div></div><p>

Compile them yourself. A C programmer should be used to compile things.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Milan Mimica)</author>
		<pubDate>Fri, 23 May 2008 18:28:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Allegro havent got much support for windows...
</p></div></div><p>
That&#39;s really not true. Check the manual.</p><p>From <a href="http://www.allegro.cc/manual/platform-specifics/windows-specifics/">Allegro manual - Windows Specifics</a>
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
A Windows program that uses the Allegro library is only required to include one or more header files from the include/allegro tree, or allegro.h; <i>however, if it also needs to directly call non portable Win32 API functions, it must include the Windows-specific header file winalleg.h after the Allegro headers, and before any Win32 API header file.</i> By default winalleg.h includes the main Win32 C API header file windows.h. If instead you want to use the C++ interface to the Win32 API (a.k.a. the Microsoft Foundation Classes), define the preprocessor symbol ALLEGRO_AND_MFC before including any Allegro header so that afxwin.h will be included. Note that, in this latter case, the Allegro debugging macros ASSERT() and TRACE() are renamed AL_ASSERT() and AL_TRACE() respectively.
</p></div></div><p>

So if you want to use the Win32 API , include allegro.h and then winalleg.h.
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;allegro.h&gt;</span>
<span class="p">#include &lt;winalleg.h&gt;</span>
</pre></div></div><p>

As far as the unresolved external symbol errors you&#39;ve been getting , I think it&#39;s from linking in the wrong order. You need to have linked against zlib and libpng for any png functions to work and for &#39;register_png_file_type&#39; to work you should need to link against allegro and the loadpng object files.</p><p>So I&#39;m guessing that the correct order to link in is : zlib , libpng , and then allegro.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 23 May 2008 23:59:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>what should i compile? the regpng loadpng savepng sources?<br />WTF? Without my code allegro doesnt work... and I dont use Winapi:<br />See whats written in my code:<br />#ifdef _MSC_VER<br />    #pragma warning(push)<br />    #pragma warning(disable: 312)<br />    #include &quot;allegro.h&quot;<br />    #pragma warning(pop)<br />#else<br />    #include &quot;allegro.h&quot;<br />#endif</p><p>And winalleg including doesnt work right. I tried everything but without this code allegro doesnt work by me.</p><p>Hey guys... its working now.... thank you soo much for help. I dont know what was my fault but after i installed all allegro and libpng zlib again it works fine.<br />Thanks</p><p>Greetz,<br />Tibo
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tibor Fober)</author>
		<pubDate>Sat, 24 May 2008 00:13:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>So that&#39;s the only code in your &quot;WinAllegro.h&quot; file?<br />Did you have to do that because using <i>#include &lt;allegro.h&gt;</i> in your main.c file didn&#39;t work? (Notice that it should be <i>#include <b>&lt;</b>allegro.h<b>&gt;</b></i> and not <i>#include &quot;allegro.h&quot;</i>). You had me confused because you called your preprocessor defines file WinAllegro.h and I&#39;d never heard of it before.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
what should i compile? the regpng loadpng savepng sources?
</p></div></div><p>
Yes , along with the other source files in your project and then link them all together.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 24 May 2008 00:27:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ya without the WinAllegro.h allegro doesnt work^^ I only have to include loadpng.h<br />If I include the others error message appear^^ so thanks for your help Edgar and the others. It&#39;s working fine now.</p><p>Edit: Omfg sry next problem. Why does transparency doesnt work?<br />I only can use alpha blending on pngs? or is there a special method to do png transparent.</p><p>Greetz,<br />Tibo
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tibor Fober)</author>
		<pubDate>Sun, 25 May 2008 15:28:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Without my code allegro doesnt work...<br />[...]<br />ya without the WinAllegro.h allegro doesnt work
</p></div></div><p>
This is blatently not true. Post whatever error message you get and we&#39;ll tell you how to fix it, or point you in the right direction.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Why does transparency doesnt work?
</p></div></div><p>
Clarify &quot;doesn&#39;t work&quot;.<br />However, I&#39;m going to make a guess and tell you you&#39;re either not using magic pink (max red and blue, no green) for a true or high colour image, or not using colour 0 for an 8-bit palette image as your mask colour.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sun, 25 May 2008 17:21:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I'm dumb! brother I have 2 gfx in my project folder both are the same images only the format isnt the same. One is .bmp and the other is .png if I draw them both using draw_sprite the bmp is transparent but the png isnt transparent....<br />So its not my fault...</p><p>Here is the error code without WinAllegro.h and with allegro.h</p><p>1&gt;d:\lib\allegro v4.2.2\include\allegro\internal\alconfig.h(397) : warning C4312: &#39;Typumwandlung&#39;: Konvertierung von &#39;unsigned int&#39; in größeren Typ &#39;unsigned char *&#39;<br />1&gt;d:\lib\allegro v4.2.2\include\allegro\internal\alconfig.h(404) : warning C4312: &#39;Typumwandlung&#39;: Konvertierung von &#39;unsigned int&#39; in größeren Typ &#39;unsigned char *&#39;<br />1&gt;d:\lib\allegro v4.2.2\include\allegro\inline\draw.inl(421) : warning C4312: &#39;Typumwandlung&#39;: Konvertierung von &#39;unsigned int&#39; in größeren Typ &#39;unsigned char *&#39;<br />1&gt;d:\lib\allegro v4.2.2\include\allegro\inline\draw.inl(435) : warning C4312: &#39;Typumwandlung&#39;: Konvertierung von &#39;unsigned int&#39; in größeren Typ &#39;unsigned char *&#39;<br />1&gt;d:\lib\allegro v4.2.2\include\allegro\inline\draw.inl(446) : warning C4312: &#39;Typumwandlung&#39;: Konvertierung von &#39;unsigned int&#39; in größeren Typ &#39;unsigned short *&#39;<br />1&gt;d:\lib\allegro v4.2.2\include\allegro\inline\draw.inl(460) : warning C4312: &#39;Typumwandlung&#39;: Konvertierung von &#39;unsigned int&#39; in größeren Typ &#39;unsigned short *&#39;<br />1&gt;d:\lib\allegro v4.2.2\include\allegro\inline\draw.inl(471) : warning C4312: &#39;Typumwandlung&#39;: Konvertierung von &#39;unsigned int&#39; in größeren Typ &#39;unsigned short *&#39;<br />1&gt;d:\lib\allegro v4.2.2\include\allegro\inline\draw.inl(485) : warning C4312: &#39;Typumwandlung&#39;: Konvertierung von &#39;unsigned int&#39; in größeren Typ &#39;unsigned short *&#39;<br />1&gt;d:\lib\allegro v4.2.2\include\allegro\inline\draw.inl(521) : warning C4312: &#39;Typumwandlung&#39;: Konvertierung von &#39;unsigned int&#39; in größeren Typ &#39;unsigned int *&#39;<br />1&gt;d:\lib\allegro v4.2.2\include\allegro\inline\draw.inl(535) : warning C4312: &#39;Typumwandlung&#39;: Konvertierung von &#39;unsigned int&#39; in größeren Typ &#39;unsigned int *&#39;</p><p>have fun^^. </p><p>Konvertierung von &#39;unsigned int&#39; in größeren Typ &#39;unsigned int * =<br />Convert from unsigned int in bigger type unsigned int*.</p><p>Thanks for help.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tibor Fober)</author>
		<pubDate>Sun, 25 May 2008 18:46:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Those are warnings, not errors, and can be disabled by unselecting the &quot;Detect 64-bit compatibility problems&quot; in the settings.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Sun, 25 May 2008 20:08:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
One is .bmp and the other is .png if I draw them both using draw_sprite the bmp is transparent but the png isnt transparent....<br />So its not my fault...
</p></div></div><p>
One way or the other, it is your fault, because both are Allegro BITMAPs after they&#39;ve been loaded. At that time, the on-disk format is no longer relevant.<br />Attach both images so we can have a look at them.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Here is the error code
</p></div></div><p>
I see no errors, just warnings.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sun, 25 May 2008 23:13:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>oh it is working now... dont know my fault but thanks guys^^</p><p>See you,<br />Tibo
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tibor Fober)</author>
		<pubDate>Mon, 26 May 2008 01:04:16 +0000</pubDate>
	</item>
</rss>
