<?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>Codec &#187; combine</title>
	<atom:link href="http://www.trembl.org/codec/tag/combine/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.trembl.org/codec</link>
	<description>A Personal Polylogic Code/Decode &#039;Zettelkasten&#039;</description>
	<lastBuildDate>Thu, 02 Feb 2012 03:38:01 +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>Combining Images with UIImage &amp; CGContext &#8211; (Offscreen drawing)</title>
		<link>http://www.trembl.org/codec/334/</link>
		<comments>http://www.trembl.org/codec/334/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 09:25:49 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[add]]></category>
		<category><![CDATA[combine]]></category>
		<category><![CDATA[context]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[layer]]></category>
		<category><![CDATA[lockFocus]]></category>
		<category><![CDATA[NSImage]]></category>
		<category><![CDATA[offscreen]]></category>
		<category><![CDATA[Quartz]]></category>
		<category><![CDATA[UIImage]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=334</guid>
		<description><![CDATA[In Cocoa NSImage has a lockFocus method, that allows to draw images offscreen and combine them into one. &#91;img lockFocus&#93;; //... &#91;img unlockFocus&#93;; On the iPhone, UIImage lacks the lockFocus methods, instead the following: // Create new offscreen context with desired size UIGraphicsBeginImageContext&#40;CGSizeMake&#40;64.0f, 64.0f&#41;&#41;; &#160; // draw img at 0,0 in the context &#91;img drawAtPoint:CGPointZero&#93;; [...]]]></description>
			<content:encoded><![CDATA[<p>In Cocoa NSImage has a lockFocus method, that allows to draw images offscreen and combine them into one.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span>img lockFocus<span style="color: #002200;">&#93;</span>;
<span style="color: #11740a; font-style: italic;">//...</span>
<span style="color: #002200;">&#91;</span>img unlockFocus<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>On the iPhone, UIImage lacks the lockFocus methods, instead the following:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Create new offscreen context with desired size</span>
UIGraphicsBeginImageContext<span style="color: #002200;">&#40;</span>CGSizeMake<span style="color: #002200;">&#40;</span>64.0f, 64.0f<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// draw img at 0,0 in the context</span>
<span style="color: #002200;">&#91;</span>img drawAtPoint<span style="color: #002200;">:</span>CGPointZero<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// draw another at 0,0 in the context, maybe with an alpha value</span>
<span style="color: #002200;">&#91;</span>another drawAtPoint<span style="color: #002200;">:</span>CGPointZero<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// ... and other operations</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// assign context to UIImage</span>
UIImage <span style="color: #002200;">*</span>outputImg <span style="color: #002200;">=</span> UIGraphicsGetImageFromCurrentImageContext<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// end context</span>
UIGraphicsEndImageContext<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/334/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concatenating Strings @&#8221;string1&#8243; @&#8221;string2&#8243; @&#8221;stringN&#8221;</title>
		<link>http://www.trembl.org/codec/73/</link>
		<comments>http://www.trembl.org/codec/73/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 06:44:27 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[add]]></category>
		<category><![CDATA[combine]]></category>
		<category><![CDATA[concatenate]]></category>
		<category><![CDATA[directive]]></category>
		<category><![CDATA[NSString]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=73</guid>
		<description><![CDATA[That&#8217;s basically it. No more [@"string1" stringByAppendingString:@"string2"]; or [NSString stringWithFormat:@"string1%@", @"string1"]; just @"string1" @"string2" @"stringN" -> @"string1string2stringN" The Objective-C 2.0 Programming Language.pdf, p131]]></description>
			<content:encoded><![CDATA[<p>That&#8217;s basically it.</p>
<p>No more<br />
<code>[@"string1" stringByAppendingString:@"string2"];</code></p>
<p>or<br />
<code>[NSString stringWithFormat:@"string1%@", @"string1"];</code></p>
<p>just<br />
<code>@"string1" @"string2" @"stringN"</code> -> <code>@"string1string2stringN"</code></p>
<p><em><a href="http://developer.apple.com/documentation/cocoa/conceptual/objectiveC/objc.pdf">The Objective-C 2.0 Programming Language.pdf</a>, p131</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/73/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

