<?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>Notes of a Developer &#187; Texture</title>
	<atom:link href="http://www.developers-life.com/tag/texture/feed" rel="self" type="application/rss+xml" />
	<link>http://www.developers-life.com</link>
	<description>Develop on Objective-C, UIKit, C, OpenGL for  iPhone, iPad, Mac OS X</description>
	<lastBuildDate>Fri, 03 Feb 2012 11:49:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Resize and Mask an Image</title>
		<link>http://www.developers-life.com/resize-and-mask-an-image.html</link>
		<comments>http://www.developers-life.com/resize-and-mask-an-image.html#comments</comments>
		<pubDate>Sat, 26 Dec 2009 19:37:12 +0000</pubDate>
		<dc:creator>Vladimir Boychentsov</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[Texture]]></category>
		<category><![CDATA[UIKit]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[Кодинг]]></category>

		<guid isPermaLink="false">http://www.developers-life.com/?p=698</guid>
		<description><![CDATA[Make image with a mask! Source: 123456789101112131415161718192021222324252627282930313233343536373839404142- &#40;UIImage*&#41; maskImage:&#40;UIImage *&#41;image &#160;&#123; &#160; &#160; &#160; &#160; &#160; &#160;CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB&#40;&#41;; &#160; &#160; &#160; &#160; &#160; &#160;UIImage *maskImage = &#91;UIImage imageNamed:@&#34;mask.png&#34;&#93;; &#160; &#160; &#160;CGImageRef maskImageRef = &#91;maskImage CGImage&#93;; &#160; &#160; &#160; &#160; &#160; &#160;// create a bitmap graphics context the size of the image &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Make image with a mask!</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/2id4pPmoCwQ&#038;hl=en_US&#038;fs=1&#038;rel=0&#038;color1=0x3a3a3a&#038;color2=0x999999"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2id4pPmoCwQ&#038;hl=en_US&#038;fs=1&#038;rel=0&#038;color1=0x3a3a3a&#038;color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
 </p>
<p>Source:</p>
<div class="codecolorer-container objc geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:810px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UIImage<span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> maskImage<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIImage <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>image &nbsp;<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;CGColorSpaceRef colorSpace <span style="color: #002200;">=</span> CGColorSpaceCreateDeviceRGB<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;UIImage <span style="color: #002200;">*</span>maskImage <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;mask.png&quot;</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp;CGImageRef maskImageRef <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>maskImage CGImage<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #11740a; font-style: italic;">// create a bitmap graphics context the size of the image</span><br />
&nbsp; &nbsp; &nbsp;CGContextRef mainViewContentContext <span style="color: #002200;">=</span> CGBitmapContextCreate <span style="color: #002200;">&#40;</span><span style="color: #a61390;">NULL</span>, maskImage.size.width, maskImage.size.height, <span style="color: #2400d9;">8</span>, <span style="color: #2400d9;">0</span>, colorSpace, kCGImageAlphaPremultipliedLast<span style="color: #002200;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>mainViewContentContext<span style="color: #002200;">==</span><span style="color: #a61390;">NULL</span><span style="color: #002200;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #a61390;">return</span> <span style="color: #a61390;">NULL</span>;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;CGFloat ratio <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;ratio <span style="color: #002200;">=</span> maskImage.size.width<span style="color: #002200;">/</span> image.size.width;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span>ratio <span style="color: #002200;">*</span> image.size.height &lt; maskImage.size.height<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ratio <span style="color: #002200;">=</span> maskImage.size.height<span style="color: #002200;">/</span> image.size.height;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #002200;">&#125;</span> <br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;CGRect rect1 &nbsp;<span style="color: #002200;">=</span> <span style="color: #002200;">&#123;</span><span style="color: #002200;">&#123;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">0</span><span style="color: #002200;">&#125;</span>, <span style="color: #002200;">&#123;</span>maskImage.size.width, maskImage.size.height<span style="color: #002200;">&#125;</span><span style="color: #002200;">&#125;</span>;<br />
&nbsp; &nbsp; &nbsp;CGRect rect2 &nbsp;<span style="color: #002200;">=</span> <span style="color: #002200;">&#123;</span><span style="color: #002200;">&#123;</span><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>image.size.width<span style="color: #002200;">*</span>ratio<span style="color: #002200;">&#41;</span><span style="color: #002200;">-</span>maskImage.size.width<span style="color: #002200;">&#41;</span><span style="color: #002200;">/</span><span style="color: #2400d9;">2</span> , <span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>image.size.height<span style="color: #002200;">*</span>ratio<span style="color: #002200;">&#41;</span><span style="color: #002200;">-</span>maskImage.size.height<span style="color: #002200;">&#41;</span><span style="color: #002200;">/</span><span style="color: #2400d9;">2</span><span style="color: #002200;">&#125;</span>, <span style="color: #002200;">&#123;</span>image.size.width<span style="color: #002200;">*</span>ratio, image.size.height<span style="color: #002200;">*</span>ratio<span style="color: #002200;">&#125;</span><span style="color: #002200;">&#125;</span>;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;CGContextClipToMask<span style="color: #002200;">&#40;</span>mainViewContentContext, rect1, maskImageRef<span style="color: #002200;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;CGContextDrawImage<span style="color: #002200;">&#40;</span>mainViewContentContext, rect2, image.CGImage<span style="color: #002200;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #11740a; font-style: italic;">// Create CGImageRef of the main view bitmap content, and then</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #11740a; font-style: italic;">// release that bitmap context</span><br />
&nbsp; &nbsp; &nbsp;CGImageRef newImage <span style="color: #002200;">=</span> CGBitmapContextCreateImage<span style="color: #002200;">&#40;</span>mainViewContentContext<span style="color: #002200;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;CGContextRelease<span style="color: #002200;">&#40;</span>mainViewContentContext<span style="color: #002200;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;UIImage <span style="color: #002200;">*</span>theImage <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageWithCGImage<span style="color: #002200;">:</span>newImage<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;CGImageRelease<span style="color: #002200;">&#40;</span>newImage<span style="color: #002200;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #11740a; font-style: italic;">// return the image</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #a61390;">return</span> theImage;<br />
<span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p></p>
<p><a href="http://depositfiles.com/files/yitpbu87l" style="color:red;">Download Sources of Project</a> </p>
<p><span id="more-698"></span><br />
</p>
<p>Mask:<br />
<img alt="" src="http://gyazo.com/c0be2fb7a12947575d31ecd0fc0ad8da.png" class="alignnone" width="150" height="200" /><br />
<br />
Default image:<br />
<img alt="" src="http://gyazo.com/1d5cfffd9bd81ff423b8dbeb463379f9.png" class="alignnone" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.developers-life.com/resize-and-mask-an-image.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PVRTexture &amp; Texture2D</title>
		<link>http://www.developers-life.com/pvrtexture-vs-other-texture.html</link>
		<comments>http://www.developers-life.com/pvrtexture-vs-other-texture.html#comments</comments>
		<pubDate>Wed, 29 Jul 2009 21:12:44 +0000</pubDate>
		<dc:creator>Vladimir Boychentsov</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Macros]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Texture]]></category>

		<guid isPermaLink="false">http://www.developers-life.com/?p=506</guid>
		<description><![CDATA[Hi guys! Расскажу о приимуществах и недостатках о разных видах текстурирования. Начну с текстурирования не PVR, более простое. Простота заключается в следуещих удобствах: - Возможность использовать любое расширения картинки с неодинаковой высотой и шириной (желательно до 1024&#215;1024). - Можно использовать картинки TGA, PNG, JPG, etc. - Один из значительных плюсов является простота размещения. Создается bound [...]]]></description>
			<content:encoded><![CDATA[<p>Hi guys!</p>
<p>Расскажу о приимуществах и недостатках о разных видах текстурирования.</p>
<p>Начну с текстурирования не PVR, более простое. Простота заключается в следуещих удобствах:<br />
- Возможность использовать любое расширения картинки с неодинаковой высотой и шириной (желательно до 1024&#215;1024).<br />
- Можно использовать картинки TGA, PNG, JPG, etc.<br />
- Один из значительных плюсов является простота размещения. Создается bound в который всталяется картинка.<br />
- Использование картинок с прозрачностью.</p>
<p>Примеры текстурирования приведены ниже</p>
<p><a href="http://www.developers-life.com/wp-content/uploads/2009/07/picture-12.png"><img class="alignnone size-medium wp-image-508" title="picture-12" src="http://www.developers-life.com/wp-content/uploads/2009/07/picture-12-164x300.png" alt="" width="164" height="300" /></a> <a href="http://www.developers-life.com/wp-content/uploads/2009/07/picture-2.png"><img class="alignnone size-medium wp-image-509" title="picture-2" src="http://www.developers-life.com/wp-content/uploads/2009/07/picture-2-162x300.png" alt="" width="162" height="300" /></a><br />
<span id="more-506"></span><br />
Пример исходного кода <a title="OpenGL Texture2D iPhone" href="http://depositfiles.com/files/2ac172y9u">OpenGL Texture2D</a></p>
<p>Минусы заключаются в том, что загружается долго, если текстур много и памяти много занимает.</p>
<p>Рассказывать про PVR не буду подробно, т.к. можно посмотреть пример apple <a title="PVRTextureLoader iPhone" href="http://depositfiles.com/ru/files/dq3n9f0be">PVRTextureLoader</a> (где он находится на сайте apple не помню, поэтому выложил на deposit).  Скажу вкратце, что с текстурированием такого типа работает в N раз быстрее. Порекомендую писать sh скрипты для преобразования рисунков.</p>
<p>Пример:</p>
<div class="codecolorer-container bash geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:810px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
<span style="color: #007800;">TEXTURE_TOOL</span>=<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>Platforms<span style="color: #000000; font-weight: bold;">/</span>iPhoneOS.platform<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>texturetool<br />
<br />
<span style="color: #007800;">$TEXTURE_TOOL</span> <span style="color: #660033;">-m</span> <span style="color: #660033;">-e</span> PVRTC &nbsp;<span style="color: #660033;">--bits-per-pixel-2</span> <span style="color: #660033;">-o</span> <span style="color: #ff0000;">&quot;$1.pvr&quot;</span> <span style="color: #660033;">-f</span> PVR <span style="color: #007800;">$1</span></div></td></tr></tbody></table></div>
<p>Пример вызова:<br />
./Script.sh fire.png</p>
<p>И еще один нюанс! PVR только квадратное расширение: 64&#215;64, 128&#215;128, etc.</p>
<p><a href="http://www.developers-life.com/wp-content/uploads/2009/07/picture-3.png"><img class="alignnone size-medium wp-image-510" title="picture-3" src="http://www.developers-life.com/wp-content/uploads/2009/07/picture-3-158x300.png" alt="" width="158" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.developers-life.com/pvrtexture-vs-other-texture.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL and gif &#8211; gifPlayer for iPhone</title>
		<link>http://www.developers-life.com/opengl-and-gif-gifplayer-for-iphone.html</link>
		<comments>http://www.developers-life.com/opengl-and-gif-gifplayer-for-iphone.html#comments</comments>
		<pubDate>Mon, 27 Jul 2009 11:44:43 +0000</pubDate>
		<dc:creator>Vladimir Boychentsov</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[GIF]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Texture]]></category>

		<guid isPermaLink="false">http://www.developers-life.com/?p=498</guid>
		<description><![CDATA[It&#8217;s really easy! If you have this source code :) OpenGL GIF Player iPhone P.S.: I&#8217;ve returned!]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s really easy! If you have this source code :)</p>
<p><a style="text-decoration: none;" href="http://www.developers-life.com/wp-content/uploads/2009/07/picture-11.png"><img class="size-full wp-image-499 alignnone" title="picture-11" src="http://www.developers-life.com/wp-content/uploads/2009/07/picture-11.png" alt="" width="307" height="581" /> </a> <a href="http://www.developers-life.com/wp-content/uploads/2009/07/38351245449941a6a12277.gif"><img class="size-medium wp-image-501 alignnone" title="38351245449941a6a12277" src="http://www.developers-life.com/wp-content/uploads/2009/07/38351245449941a6a12277.gif" alt="" width="100" height="100" /></a></p>
<p><a href="http://www.developers-life.com/wp-content/plugins/download_counter/redirect.php?id=7" target="_blank"><img class="alignleft" src="http://www.developers-life.com/wp-content/plugins/download_counter/redirect.php?pid=7" border="0" alt="OpenGL GIF Player iPhone" />OpenGL GIF Player iPhone</a></p>
<p>P.S.: I&#8217;ve returned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.developers-life.com/opengl-and-gif-gifplayer-for-iphone.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

