<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>richardjdare.com &#187; objective c</title>
	<atom:link href="http://richardjdare.com/blog/tag/objectivec/feed/" rel="self" type="application/rss+xml" />
	<link>http://richardjdare.com</link>
	<description>Games, Ideas, Imagination</description>
	<lastBuildDate>Thu, 06 Apr 2023 12:02:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.38</generator>
	<item>
		<title>Programming Toxin &#8211; Part One</title>
		<link>http://richardjdare.com/blog/2012/10/programming-toxin-part-one/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=programming-toxin-part-one</link>
		<comments>http://richardjdare.com/blog/2012/10/programming-toxin-part-one/#comments</comments>
		<pubDate>Fri, 19 Oct 2012 12:56:43 +0000</pubDate>
		<dc:creator><![CDATA[Richard Dare]]></dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[Toxin]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective c]]></category>

		<guid isPermaLink="false">http://richardjdare.com/blog/?p=243</guid>
		<description><![CDATA[Over the next few posts I want to write a bit about how my first iPhone game, Toxin, is being developed. Although I&#8217;ve been programming.]]></description>
				<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-244" style="border: 0px;" title="Toxin" src="http://richardjdare.com/blog/wp-content/uploads/2012/10/toxin-screen1.jpg" alt="" width="500" height="249" /></p>
<p>Over the next few posts I want to write a bit about how my first iPhone game, Toxin, is being developed. Although I&#8217;ve been programming for a long time, this is my first ever project in the Apple ecosystem; I hadn&#8217;t even used a Mac before starting this game.</p>
<p>Toxin is written in C++ inside a thin layer of Objective C. I did this for a number of reasons. Firstly I am much more familiar with C++. Secondly, as the most common game development language I knew I would have better luck finding additional libraries and answers to any development problems if I worked in it.</p>
<p>It also meant I could reuse some of my own code. Toxin actually contains code used in my first game, <a href="http://richardjdare.com/blog/games/">Starblaster</a> (2003). Some of it goes back to DirectX stuff I did in the late 90&#8217;s. I always liked having a sense of continuity in my work, a feeling that all my games are connected.</p>
<p>The Objective C layer handles iOS specific stuff like getting the app started up, passing touch information to the game logic, and setting up threads for Toxin&#8217;s concurrent level loading. The sound library I use, <a href="http://www.cocos2d-iphone.org/wiki/doku.php/cocosdenshion:faq" target="_blank">CocosDenshion</a> is also in Objective C. I wouldn&#8217;t rule out doing a whole project in Objective C. I&#8217;ve enjoyed learning it and I&#8217;ve used it to create several utilities already, including the Toxin Level Editor, which I will probably write about soon. I would, however, want to spend some time comparing the performance of the Objective C Container libraries with the STL beforehand.</p>
<h3>Engine? What Engine?</h3>
<p>Now, some of my friends believe that the main reason Toxin has taken me so long is because I didn&#8217;t use one of the popular 2d engines out there like <a href="http://www.cocos2d-iphone.org/" target="_blank">Cocos2d</a> and instead wrote all my own graphics code. They don&#8217;t believe me when I tell them that large engines are unnecessary for small games (though I would never stop anyone from using them) and that I could rewrite my entire graphics system in about 2 weeks.</p>
<div id="#whatsinbox" style="margin: 10px; padding: 8px; background-color: #ebebeb; height: 155px;">
<h4>What&#8217;s in Toxin</h4>
<ul>
<li style="float: left; width: 220px;">Batched sprite drawing</li>
<li style="float: left; width: 220px;">Resource management</li>
<li style="float: left; width: 220px;">Messaging system</li>
<li style="float: left; width: 220px;">2d particle system</li>
<li style="float: left; width: 220px;">JSON file loading</li>
<li style="float: left; width: 220px;">Zip file loading</li>
<li style="float: left; width: 220px;">Chipmunk physics</li>
<li style="float: left; width: 220px;">Oriented bounding box collision</li>
<li style="float: left; width: 220px;">Keyframe interpolation system</li>
<li style="float: left; width: 220px;">Concurrent level loading</li>
</ul>
</div>
<p>&nbsp;</p>
<p>My &#8220;engine&#8221; if you could call it that, is a basic set of classes for things like sprite drawing, line drawing, loading textures, and drawing basic primitive shapes. All sprite and line drawing is batched using vertex buffers for maximum speed. The classes are loosely related; I just add something when I need it, not worrying about architecture or anything. The whole thing is about 7000 lines of code, and that includes some significant utility classes I wrote, such as my keyframe interpolation system. I use this all over the place to animate transitions, colour blends and movements of all kinds. I wrote interpolators for many different data types and I&#8217;m sure I could reduce the lines of code by making them into template classes.</p>
<p>I used this graphics system to build Toxin&#8217;s particle engine which I based on John van der Burg&#8217;s Gamasutra article, <em><a href="http://www.gamasutra.com/view/feature/3157/building_an_advanced_particle_.php" target="_blank">Building an advanced Particle System.</a></em> The particles use some simple physics to bounce them off the inside of the elliptical playfield.</p>
<p>At one point, the game had elliptical gravity: When a particle hit the ellipse, gravity would activate for that particle and it would &#8220;fall&#8221; into the ellipse, over 360 degrees. It was a cool effect but it didn&#8217;t look like anything you would expect to happen, so I replaced it with simple bouncing which is much more satisfying to watch.</p>
<p>Some of the enemies in Toxin use the <a href="http://chipmunk-physics.net/" target="_blank">Chipmunk physics engine</a>. One of the things I&#8217;m proud of in this game is how you can easily mix and match different types of objects. Some use Chipmunk, others use simple bounding box and oriented-bounding box collision.</p>
<p>Game structure is accounted for by a basic game state manager with simple transitions and there&#8217;s a resource managment system that lets me load and unload graphics whenever I need to.</p>
<p>After reading <a href="http://www.mcshaffry.com/mrmike/">Mike McShaffry&#8217;s</a> <a href="http://www.amazon.co.uk/Game-Coding-Complete-Mike-McShaffry/dp/1133776574/ref=dp_ob_title_bk">Game Coding Complete</a> I wrote a messaging system which allows different parts of my game to easily communicate with each other with a minimal amount of dependency. I use this messaging system for spawning enemies, creating explosions, and playing sound effects.</p>
<p>Next time I&#8217;ll write something about how Toxin levels work, and I&#8217;ll describe my first native Mac program, the Toxin Level Editor. Please let me know if you have any questions or if you want more information about any of the things in this post.</p>
]]></content:encoded>
			<wfw:commentRss>http://richardjdare.com/blog/2012/10/programming-toxin-part-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Toxin for iPhone and iPod Touch</title>
		<link>http://richardjdare.com/blog/2012/10/toxin-for-iphone-and-ipod-touch/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=toxin-for-iphone-and-ipod-touch</link>
		<comments>http://richardjdare.com/blog/2012/10/toxin-for-iphone-and-ipod-touch/#comments</comments>
		<pubDate>Sat, 13 Oct 2012 17:24:39 +0000</pubDate>
		<dc:creator><![CDATA[Richard Dare]]></dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Toxin]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://richardjdare.com/blog/?p=85</guid>
		<description><![CDATA[Its time to introduce my forthcoming game, Toxin! It&#8217;s my first game since 2003, and has been in development for erm, *too long*. I can&#8217;t.]]></description>
				<content:encoded><![CDATA[<p><!-- br {display:none;} --><img class="aligncenter size-full wp-image-232" style="border: 0px;" title="Toxin" src="http://richardjdare.com/blog/wp-content/uploads/2012/10/toxin1.jpg" alt="Toxin Screenshot" width="480" height="320" /><br />
Its time to introduce my forthcoming game, Toxin! It&#8217;s my first game since 2003, and has been in development for erm, *too long*. I can&#8217;t give a release date yet; every day I sit down and say, &#8220;this week I&#8217;m going to finish it&#8221;, but most of the code and artwork is complete. There are some cosmetic changes I want to make, so please bear in mind that these screenshots might not reflect the finished product.</p>
<p><img class="aligncenter size-full wp-image-236" style="border: 0px;" title="Toxin Screenshot 2" src="http://richardjdare.com/blog/wp-content/uploads/2012/10/toxin2.jpg" alt="" width="480" height="320" /></p>
<p>Toxin is an abstract puzzle/shooter for the iPhone and iPod Touch, running on iOS3.0 and above. The basic gameplay is simple. You control a ship that rotates around the edge of an elliptical playfield, shooting inwards. If anything touches the edge you lose energy. Lose too much energy and you die.</p>
<p>Inside the ellipse are 99 levels of swarming biological foes, multiplying toxic cells, physics puzzles and colourful particle effects.</p>
<p><img class="size-full wp-image-89 alignright" title="Microbes - Vision Software 1991" src="http://richardjdare.com/blog/wp-content/uploads/2011/11/microbes.jpg" alt="Microbes - Vision Software 1991" width="250" height="197" /></p>
<p>Toxin was inspired by a number of different games including Geometry Wars, Tempest, Space Invaders and Ebonstar, but the biggest influence was Microbes, released by Vision Software in 1991. I really enjoyed this back in the day, and like many innovative Amiga titles it seems to have disappeared from the consensual history of video games. You can play it with UAE, but I dont think the emulation is perfect.</p>
<p>I also tried to add some simple puzzle concepts to give the game more depth but without affecting the pace too much. The design process involved me sitting down with a coffee every night after work, staring at my sketchpad and thinking, &#8220;now what can I do inside an ellipse?&#8221;</p>
<p>&nbsp;</p>
<div class="row" style="text-align: center; margin-bottom: 4px;"><img class="size-full wp-image-95" style="margin-right: 8px;" title="Tempest - Atari 1981" src="http://richardjdare.com/blog/wp-content/uploads/2011/11/tempest.jpg" alt="Tempest - Atari 1981" /><img class="size-full wp-image-96" title="Vortex - Visionary Design 1988" src="http://richardjdare.com/blog/wp-content/uploads/2011/11/vortex.jpg" alt="Vortex - 1988 Visionary Design" /></div>
<div class="row" style="text-align: center;"><img class="wp-image-112 size-full" style="margin-right: 8px;" title="Ebonstar - MicroIllusions 1988" src="http://www.richardjdare.com/blog/wp-content/uploads/2011/11/ebonstar.jpg" alt="Ebonstar - 1988 MicroIllusions" /><img class="size-full wp-image-113" title="E-Motion - 1990 US Gold" src="http://richardjdare.com/blog/wp-content/uploads/2011/11/e-motion.jpg" alt="E-Motion - US Gold 1990" /></div>
<div class="row" style="text-align: center;"><em><span style="color: #808080;">Direct and indirect influences.Clockwise from left: Tempest, Vortex, E-motion, Ebonstar</span></em></div>
<p>Once this game is done, I am thinking about writing a Toxin &#8220;Remix&#8221; called Antigen. It will have the same ship-in-an-ellipse structure but the core game will be more puzzle based and slower paced as well as having different artwork. I think the idea of a game remix could work well at low pricepoints, a little like the way remix CDs used to accompany singles.</p>
<p>Soon I&#8217;ll write a little on how the artwork was done, and how it went through a long, painful process of development. I am also looking into producing a gameplay video, so stay tuned&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://richardjdare.com/blog/2012/10/toxin-for-iphone-and-ipod-touch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the size of a PNG without loading it</title>
		<link>http://richardjdare.com/blog/2010/10/getting-the-size-of-a-png-without-loading-it/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-the-size-of-a-png-without-loading-it</link>
		<comments>http://richardjdare.com/blog/2010/10/getting-the-size-of-a-png-without-loading-it/#comments</comments>
		<pubDate>Sat, 09 Oct 2010 13:37:21 +0000</pubDate>
		<dc:creator><![CDATA[Richard Dare]]></dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[png]]></category>

		<guid isPermaLink="false">http://richardjdare.com/blog/?p=33</guid>
		<description><![CDATA[My current iPhone game (more info coming soon, I promise!) has a resource system that allows me to load texture maps when I need them.]]></description>
				<content:encoded><![CDATA[<p>My current iPhone game (more info coming soon, I promise!) has a resource system that allows me to load texture maps when I need them and unload them when I don’t. This helps makes the game very memory efficient, but it had one annoying flaw. At program startup I had to load and unload several textures to get size information I needed to set up other game structures. To avoid this wasteful operation I started looking at ways to extract information from a png without loading the whole thing.</p>
<p>This <a href="http://stackoverflow.com/questions/1551300/get-size-of-image-without-loading-in-to-memory">StackOverflow discussion</a> was useful, along with this <a href="http://www.w3.org/TR/PNG/">guide to the png format</a> from the W3C, but unfortunately, Apple threw a spanner in the works.</p>
<p>If you’ve been programming the iPhone for a while you’ll know that by default, Xcode premultiplies the alpha channel of PNG files before adding them to the application bundle. It also adds its own undocumented data chunk to the beginning of the file, breaking PNG guidelines which state that the IHDR chunk should always be at the beginning.</p>
<p>This Objective C function will return the size of an image for both standard and Apple PNGs. It scans through the file looking for the IHDR chunk, making no assumptions about its position. It should be easy enough to convert to other members of the C family.</p>
<div style="margin-top:32px;">
<style>
.wp_syntax{overflow-y:auto;max-height:400px};
</style>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#include &lt;stdio.h&gt;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">//----------------------------------------------------------------------------</span>
<span style="color: #11740a; font-style: italic;">// GetPNGSize() - gets PNG Dimensions without loading any data</span>
<span style="color: #11740a; font-style: italic;">//----------------------------------------------------------------------------</span>
<span style="color: #a61390;">BOOL</span> GetPNGSize<span style="color: #002200;">&#40;</span><span style="color: #a61390;">const</span> <span style="color: #a61390;">char</span> <span style="color: #002200;">*</span>fileName,CGSize <span style="color: #002200;">*</span>pngSize<span style="color: #002200;">&#41;</span>
<span style="color: #002200;">&#123;</span>
    <span style="color: #11740a; font-style: italic;">// PNG Signature</span>
    <span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">char</span> png_signature<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">8</span><span style="color: #002200;">&#93;</span> <span style="color: #002200;">=</span> <span style="color: #002200;">&#123;</span><span style="color: #2400d9;">137</span>, <span style="color: #2400d9;">80</span>, <span style="color: #2400d9;">78</span>, <span style="color: #2400d9;">71</span>, <span style="color: #2400d9;">13</span>, <span style="color: #2400d9;">10</span>, <span style="color: #2400d9;">26</span>, <span style="color: #2400d9;">10</span><span style="color: #002200;">&#125;</span>;
    <span style="color: #11740a; font-style: italic;">// IHDR chunk identifier</span>
    <span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">char</span> ihdr_signature<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">4</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">=</span><span style="color: #002200;">&#123;</span><span style="color: #bf1d1a;">'I'</span>,<span style="color: #bf1d1a;">'H'</span>,<span style="color: #bf1d1a;">'D'</span>,<span style="color: #bf1d1a;">'R'</span><span style="color: #002200;">&#125;</span>;
&nbsp;
    <span style="color: #a61390;">FILE</span> <span style="color: #002200;">*</span>fp;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> <span style="color: #002200;">&#40;</span>fp <span style="color: #002200;">=</span> <span style="color: #a61390;">fopen</span><span style="color: #002200;">&#40;</span>fileName,<span style="color: #bf1d1a;">&quot;rb&quot;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">==</span> <span style="color: #a61390;">NULL</span> <span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        <span style="color: #a61390;">return</span> <span style="color: #a61390;">NO</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #11740a; font-style: italic;">// load png signature and check it</span>
    <span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">char</span> sigBuf<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">8</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">fread</span><span style="color: #002200;">&#40;</span>sigBuf, <span style="color: #2400d9;">1</span>, <span style="color: #2400d9;">8</span>, fp<span style="color: #002200;">&#41;</span>;
&nbsp;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">memcmp</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&amp;</span>sigBuf<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>, <span style="color: #002200;">&amp;</span>png_signature<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>, <span style="color: #2400d9;">8</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        <span style="color: #a61390;">fclose</span><span style="color: #002200;">&#40;</span>fp<span style="color: #002200;">&#41;</span>;
        <span style="color: #a61390;">return</span> <span style="color: #a61390;">NO</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #11740a; font-style: italic;">// examine chunks until we find IHDR</span>
    <span style="color: #a61390;">BOOL</span> done <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
    <span style="color: #a61390;">while</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>done <span style="color: #002200;">&amp;&amp;</span> <span style="color: #002200;">!</span><span style="color: #a61390;">feof</span><span style="color: #002200;">&#40;</span>fp<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        <span style="color: #11740a; font-style: italic;">// get chunk length and type</span>
        <span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">char</span> chunkInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">8</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #a61390;">fread</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&amp;</span>chunkInfo, <span style="color: #2400d9;">1</span>, <span style="color: #2400d9;">8</span>, fp<span style="color: #002200;">&#41;</span>;
&nbsp;
        <span style="color: #a61390;">long</span> length <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>chunkInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span> &lt;&lt; <span style="color: #2400d9;">24</span><span style="color: #002200;">&#41;</span> | <span style="color: #002200;">&#40;</span>chunkInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">1</span><span style="color: #002200;">&#93;</span> &lt;&lt; <span style="color: #2400d9;">16</span><span style="color: #002200;">&#41;</span> | <span style="color: #002200;">&#40;</span>chunkInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">2</span><span style="color: #002200;">&#93;</span> &lt;&lt; <span style="color: #2400d9;">8</span><span style="color: #002200;">&#41;</span> | chunkInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">3</span><span style="color: #002200;">&#93;</span>;
&nbsp;
        <span style="color: #11740a; font-style: italic;">// is this the IHDR?</span>
        <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span><span style="color: #a61390;">memcmp</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&amp;</span>chunkInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">4</span><span style="color: #002200;">&#93;</span>, <span style="color: #002200;">&amp;</span>ihdr_signature<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>, <span style="color: #2400d9;">4</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>
        <span style="color: #002200;">&#123;</span>
            <span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">char</span> sizeInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">8</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #a61390;">fread</span><span style="color: #002200;">&#40;</span>sizeInfo,<span style="color: #2400d9;">1</span>,<span style="color: #2400d9;">8</span>,fp<span style="color: #002200;">&#41;</span>;
&nbsp;
            pngSize<span style="color: #002200;">-</span>&gt;width <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>sizeInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span> &lt;&lt; <span style="color: #2400d9;">24</span><span style="color: #002200;">&#41;</span> | <span style="color: #002200;">&#40;</span>sizeInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">1</span><span style="color: #002200;">&#93;</span> &lt;&lt; <span style="color: #2400d9;">16</span><span style="color: #002200;">&#41;</span> | <span style="color: #002200;">&#40;</span>sizeInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">2</span><span style="color: #002200;">&#93;</span> &lt;&lt; <span style="color: #2400d9;">8</span><span style="color: #002200;">&#41;</span> | sizeInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">3</span><span style="color: #002200;">&#93;</span>; 
            pngSize<span style="color: #002200;">-</span>&gt;height<span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>sizeInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">4</span><span style="color: #002200;">&#93;</span> &lt;&lt; <span style="color: #2400d9;">24</span><span style="color: #002200;">&#41;</span> | <span style="color: #002200;">&#40;</span>sizeInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">5</span><span style="color: #002200;">&#93;</span> &lt;&lt; <span style="color: #2400d9;">16</span><span style="color: #002200;">&#41;</span> | <span style="color: #002200;">&#40;</span>sizeInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">6</span><span style="color: #002200;">&#93;</span> &lt;&lt; <span style="color: #2400d9;">8</span><span style="color: #002200;">&#41;</span> | sizeInfo<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">7</span><span style="color: #002200;">&#93;</span>;
            done <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
        <span style="color: #002200;">&#125;</span>
        <span style="color: #a61390;">else</span> 
        <span style="color: #002200;">&#123;</span>
            <span style="color: #11740a; font-style: italic;">// skip over the data and checksum and go to next chunk</span>
            <span style="color: #a61390;">fseek</span><span style="color: #002200;">&#40;</span>fp, length<span style="color: #002200;">+</span><span style="color: #2400d9;">4</span> , <span style="color: #a61390;">SEEK_CUR</span><span style="color: #002200;">&#41;</span>;
        <span style="color: #002200;">&#125;</span>
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">fclose</span><span style="color: #002200;">&#40;</span>fp<span style="color: #002200;">&#41;</span>;
    <span style="color: #a61390;">return</span> done;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://richardjdare.com/blog/2010/10/getting-the-size-of-a-png-without-loading-it/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
