1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
silica-viewer/Dependencies/PSDWriter/Documentation/Classes/PSDWriter.html

724 lines
22 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
<title>PSDWriter Class Reference</title>
<meta id="xcode-display" name="xcode-display" content="render"/>
<meta name="viewport" content="width=550" />
<link rel="stylesheet" type="text/css" href="../css/styles.css" media="all" />
<link rel="stylesheet" type="text/css" media="print" href="../css/stylesPrint.css" />
<meta name="generator" content="appledoc 2.0.5 (build 759)" />
</head>
<body>
<header id="top_header">
<div id="library" class="hideInXcode">
<h1><a id="libraryTitle" href="../index.html">PSDWriter Documentation </a></h1>
<a id="developerHome" href="../index.html">Foundry376</a>
</div>
<div id="title" role="banner">
<h1 class="hideInXcode">PSDWriter Class Reference</h1>
</div>
<ul id="headerButtons" role="toolbar">
<li id="toc_button">
<button aria-label="Show Table of Contents" role="checkbox" class="open" id="table_of_contents"><span class="disclosure"></span>Table of Contents</button>
</li>
<li id="jumpto_button" role="navigation">
<select id="jumpTo">
<option value="top">Jump To&#133;</option>
<option value="tasks">Tasks</option>
<option value="properties">Properties</option>
<option value="//api/name/documentSize">&nbsp;&nbsp;&nbsp;&nbsp;documentSize</option>
<option value="//api/name/flattenedData">&nbsp;&nbsp;&nbsp;&nbsp;flattenedData</option>
<option value="//api/name/layerChannelCount">&nbsp;&nbsp;&nbsp;&nbsp;layerChannelCount</option>
<option value="//api/name/layers">&nbsp;&nbsp;&nbsp;&nbsp;layers</option>
<option value="//api/name/shouldFlipLayerData">&nbsp;&nbsp;&nbsp;&nbsp;shouldFlipLayerData</option>
<option value="//api/name/shouldUnpremultiplyLayerData">&nbsp;&nbsp;&nbsp;&nbsp;shouldUnpremultiplyLayerData</option>
<option value="instance_methods">Instance Methods</option>
<option value="//api/name/addLayerWithCGImage:andName:andOpacity:andOffset:">&nbsp;&nbsp;&nbsp;&nbsp;- addLayerWithCGImage:andName:andOpacity:andOffset:</option>
<option value="//api/name/initWithDocumentSize:">&nbsp;&nbsp;&nbsp;&nbsp;- initWithDocumentSize:</option>
</select>
</li>
</ul>
</header>
<nav id="tocContainer" class="isShowingTOC">
<ul id="toc" role="tree">
<li role="treeitem" id="task_treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#tasks">Tasks</a></span><ul>
</ul></li>
<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#properties">Properties</a></span><ul>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/documentSize">documentSize</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/flattenedData">flattenedData</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/layerChannelCount">layerChannelCount</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/layers">layers</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/shouldFlipLayerData">shouldFlipLayerData</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/shouldUnpremultiplyLayerData">shouldUnpremultiplyLayerData</a></span></li>
</ul></li>
<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#instance_methods">Instance Methods</a></span><ul>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/addLayerWithCGImage:andName:andOpacity:andOffset:">addLayerWithCGImage:andName:andOpacity:andOffset:</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithDocumentSize:">initWithDocumentSize:</a></span></li>
</ul></li>
</ul>
</nav>
<article>
<div id="contents" class="isShowingTOC" role="main">
<a title="PSDWriter Class Reference" name="top"></a>
<div class="main-navigation navigation-top">
<ul>
<li><a href="../index.html">Index</a></li>
<li><a href="../hierarchy.html">Hierarchy</a></li>
</ul>
</div>
<div id="header">
<div class="section-header">
<h1 class="title title-header">PSDWriter Class Reference</h1>
</div>
</div>
<div id="container">
<div class="section section-specification"><table cellspacing="0"><tbody>
<tr>
<td class="specification-title">Inherits from</td>
<td class="specification-value">NSObject</td>
</tr><tr>
<td class="specification-title">Declared in</td>
<td class="specification-value">PSDWriter.h<br />PSDWriter.m</td>
</tr>
</tbody></table></div>
<div class="section section-tasks">
<a title="Tasks" name="tasks"></a>
<h2 class="subtitle subtitle-tasks">Tasks</h2>
<ul class="task-list">
<li>
<span class="tooltip">
<code><a href="#//api/name/layers">&nbsp;&nbsp;layers</a></code>
<span class="tooltip"><p>The <a href="../Classes/PSDLayer.html">PSDLayer</a> objects with layer data, names, etc&hellip; Note that when you call
<a href="#//api/name/createPSDData">createPSDData</a>, this array is slowly emptied &ndash; the <a href="PSDWriter.html">PSDWriter</a> removes the individual <a href="#//api/name/layers">layers</a>
from memory as it builds the PSD file.</p></span>
</span>
<span class="task-item-suffix">property</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/documentSize">&nbsp;&nbsp;documentSize</a></code>
<span class="tooltip"><p>The size of the PSD you&rsquo;re exporting.</p></span>
</span>
<span class="task-item-suffix">property</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/layerChannelCount">&nbsp;&nbsp;layerChannelCount</a></code>
<span class="tooltip"><p>The number of channels in each layer. Defaults to 4, unless <a href="#//api/name/layers">layers</a>
are not transparent. At the moment, this setting applies to all <a href="#//api/name/layers">layers</a>.</p></span>
</span>
<span class="task-item-suffix">property</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/flattenedData">&nbsp;&nbsp;flattenedData</a></code>
<span class="tooltip"><p>Optional. The RGBA data for a flattened &ldquo;preview&rdquo; of the PSD.</p></span>
</span>
<span class="task-item-suffix">property</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/shouldFlipLayerData">&nbsp;&nbsp;shouldFlipLayerData</a></code>
<span class="tooltip"><p>Allows you to automatically vertically flip the image data when it&rsquo;s being
written to PSD. This is important if the source images are coming from OpenGL or
another drawing system with an inverted coordinate system.</p></span>
</span>
<span class="task-item-suffix">property</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/shouldUnpremultiplyLayerData">&nbsp;&nbsp;shouldUnpremultiplyLayerData</a></code>
<span class="tooltip"><p>Allows you to automatically unpremultiply the image data. Premultiplication is
a process by which the R,G, and B values are multiplied by the alpha. Setting this
to YES will cause RGB to be divided by A. You&rsquo;ll know you need to do this if the
image comes out darker than you expect.</p></span>
</span>
<span class="task-item-suffix">property</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/initWithDocumentSize:">&ndash;&nbsp;initWithDocumentSize:</a></code>
<span class="tooltip"><p>Initializes a new <a href="PSDWriter.html">PSDWriter</a> for creating a PSD document with the specified size.</p></span>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/addLayerWithCGImage:andName:andOpacity:andOffset:">&ndash;&nbsp;addLayerWithCGImage:andName:andOpacity:andOffset:</a></code>
<span class="tooltip"><p>Adds a new layer to the PSD image with the provided properties.</p></span>
</span>
</li>
</ul>
</div>
<div class="section section-methods">
<a title="Properties" name="properties"></a>
<h2 class="subtitle subtitle-methods">Properties</h2>
<div class="section-method">
<a name="//api/name/documentSize" title="documentSize"></a>
<h3 class="subsubtitle method-title">documentSize</h3>
<div class="method-subsection brief-description">
<p>The size of the PSD you&rsquo;re exporting.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, assign) CGSize documentSize</code></div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<p>The size of the PSD you&rsquo;re exporting.</p>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<code class="declared-in-ref">PSDWriter.h</code><br />
</div>
</div>
<div class="section-method">
<a name="//api/name/flattenedData" title="flattenedData"></a>
<h3 class="subsubtitle method-title">flattenedData</h3>
<div class="method-subsection brief-description">
<p>Optional. The RGBA data for a flattened &ldquo;preview&rdquo; of the PSD.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, retain) NSData *flattenedData</code></div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<p>Optional. The RGBA data for a flattened &ldquo;preview&rdquo; of the PSD.</p>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<code class="declared-in-ref">PSDWriter.h</code><br />
</div>
</div>
<div class="section-method">
<a name="//api/name/layerChannelCount" title="layerChannelCount"></a>
<h3 class="subsubtitle method-title">layerChannelCount</h3>
<div class="method-subsection brief-description">
<p>The number of channels in each layer. Defaults to 4, unless <a href="#//api/name/layers">layers</a>
are not transparent. At the moment, this setting applies to all <a href="#//api/name/layers">layers</a>.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, assign) int layerChannelCount</code></div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<p>The number of channels in each layer. Defaults to 4, unless <a href="#//api/name/layers">layers</a>
are not transparent. At the moment, this setting applies to all <a href="#//api/name/layers">layers</a>.</p>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<code class="declared-in-ref">PSDWriter.h</code><br />
</div>
</div>
<div class="section-method">
<a name="//api/name/layers" title="layers"></a>
<h3 class="subsubtitle method-title">layers</h3>
<div class="method-subsection brief-description">
<p>The <a href="../Classes/PSDLayer.html">PSDLayer</a> objects with layer data, names, etc&hellip; Note that when you call
<a href="#//api/name/createPSDData">createPSDData</a>, this array is slowly emptied &ndash; the <a href="PSDWriter.html">PSDWriter</a> removes the individual <a href="#//api/name/layers">layers</a>
from memory as it builds the PSD file.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, retain) NSMutableArray *layers</code></div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<p>The <a href="../Classes/PSDLayer.html">PSDLayer</a> objects with layer data, names, etc&hellip; Note that when you call
<a href="#//api/name/createPSDData">createPSDData</a>, this array is slowly emptied &ndash; the <a href="PSDWriter.html">PSDWriter</a> removes the individual <a href="#//api/name/layers">layers</a>
from memory as it builds the PSD file.</p>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<code class="declared-in-ref">PSDWriter.h</code><br />
</div>
</div>
<div class="section-method">
<a name="//api/name/shouldFlipLayerData" title="shouldFlipLayerData"></a>
<h3 class="subsubtitle method-title">shouldFlipLayerData</h3>
<div class="method-subsection brief-description">
<p>Allows you to automatically vertically flip the image data when it&rsquo;s being
written to PSD. This is important if the source images are coming from OpenGL or
another drawing system with an inverted coordinate system.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, assign) BOOL shouldFlipLayerData</code></div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<p>Allows you to automatically vertically flip the image data when it&rsquo;s being
written to PSD. This is important if the source images are coming from OpenGL or
another drawing system with an inverted coordinate system.</p>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<code class="declared-in-ref">PSDWriter.h</code><br />
</div>
</div>
<div class="section-method">
<a name="//api/name/shouldUnpremultiplyLayerData" title="shouldUnpremultiplyLayerData"></a>
<h3 class="subsubtitle method-title">shouldUnpremultiplyLayerData</h3>
<div class="method-subsection brief-description">
<p>Allows you to automatically unpremultiply the image data. Premultiplication is
a process by which the R,G, and B values are multiplied by the alpha. Setting this
to YES will cause RGB to be divided by A. You&rsquo;ll know you need to do this if the
image comes out darker than you expect.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, assign) BOOL shouldUnpremultiplyLayerData</code></div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<p>Allows you to automatically unpremultiply the image data. Premultiplication is
a process by which the R,G, and B values are multiplied by the alpha. Setting this
to YES will cause RGB to be divided by A. You&rsquo;ll know you need to do this if the
image comes out darker than you expect.</p>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<code class="declared-in-ref">PSDWriter.h</code><br />
</div>
</div>
</div>
<div class="section section-methods">
<a title="Instance Methods" name="instance_methods"></a>
<h2 class="subtitle subtitle-methods">Instance Methods</h2>
<div class="section-method">
<a name="//api/name/addLayerWithCGImage:andName:andOpacity:andOffset:" title="addLayerWithCGImage:andName:andOpacity:andOffset:"></a>
<h3 class="subsubtitle method-title">addLayerWithCGImage:andName:andOpacity:andOffset:</h3>
<div class="method-subsection brief-description">
<p>Adds a new layer to the PSD image with the provided properties.</p>
</div>
<div class="method-subsection method-declaration"><code>- (void)addLayerWithCGImage:(CGImageRef)<em>image</em> andName:(NSString *)<em>name</em> andOpacity:(float)<em>opacity</em> andOffset:(CGPoint)<em>offset</em></code></div>
<div class="method-subsection arguments-section parameters">
<h4 class="method-subtitle parameter-title">Parameters</h4>
<dl class="argument-def parameter-def">
<dt><em>image</em></dt>
<dd><p>The image to be added. Does not need to be the same size as the document, but it cannot be larger.</p></dd>
</dl>
<dl class="argument-def parameter-def">
<dt><em>name</em></dt>
<dd><p>The name you&rsquo;d like to give the layer.</p></dd>
</dl>
<dl class="argument-def parameter-def">
<dt><em>opacity</em></dt>
<dd><p>The opacity of the layer, from [0-1]</p></dd>
</dl>
<dl class="argument-def parameter-def">
<dt><em>offset</em></dt>
<dd><p>The offset of the layer within the document. Use this to position <a href="#//api/name/layers">layers</a> within the PSD.</p></dd>
</dl>
</div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<p>Adds a new layer to the PSD image with the provided properties.</p>
<p>If you are using NSImages and not CGImages, use the following code to convert to CGImageRefs:</p>
<pre><code>NSImage* yourImage;
CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)[yourImage TIFFRepresentation], NULL);
CGImageRef imageRef = CGImageSourceCreateImageAtIndex(source, 0, NULL);
</code></pre>
<p>If you prefer, you can setup PSDLayers by yourself
and put them in the <a href="PSDWriter.html">PSDWriter</a>.<a href="#//api/name/layers">layers</a> array, but this method automatically creates the <a href="#//api/name/flattenedData">flattenedData</a>,
an image that is a flattened preview of the layered PSD. If you populate the layer objects yourself,
you need to provide the flattened image data yourself.</p>
<p>Note: Having <a href="#//api/name/layers">layers</a> partially off the edge of the canvas is not currently supported.</p>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<code class="declared-in-ref">PSDWriter.h</code><br />
</div>
</div>
<div class="section-method">
<a name="//api/name/initWithDocumentSize:" title="initWithDocumentSize:"></a>
<h3 class="subsubtitle method-title">initWithDocumentSize:</h3>
<div class="method-subsection brief-description">
<p>Initializes a new <a href="PSDWriter.html">PSDWriter</a> for creating a PSD document with the specified size.</p>
</div>
<div class="method-subsection method-declaration"><code>- (id)initWithDocumentSize:(CGSize)<em>s</em></code></div>
<div class="method-subsection arguments-section parameters">
<h4 class="method-subtitle parameter-title">Parameters</h4>
<dl class="argument-def parameter-def">
<dt><em>s</em></dt>
<dd><p>The document size</p></dd>
</dl>
</div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<p>Initializes a new <a href="PSDWriter.html">PSDWriter</a> for creating a PSD document with the specified size.</p>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<code class="declared-in-ref">PSDWriter.h</code><br />
</div>
</div>
</div>
</div>
<div class="main-navigation navigation-bottom">
<ul>
<li><a href="../index.html">Index</a></li>
<li><a href="../hierarchy.html">Hierarchy</a></li>
</ul>
</div>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2012 Foundry376. All rights reserved. (Last updated: 2012-03-08)</span><br />
<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.0.5 (build 759)</a>.</span></p>
</div>
</div>
</div>
</article>
<script type="text/javascript">
function jumpToChange()
{
window.location.hash = this.options[this.selectedIndex].value;
}
function toggleTOC()
{
var contents = document.getElementById('contents');
var tocContainer = document.getElementById('tocContainer');
if (this.getAttribute('class') == 'open')
{
this.setAttribute('class', '');
contents.setAttribute('class', '');
tocContainer.setAttribute('class', '');
window.name = "hideTOC";
}
else
{
this.setAttribute('class', 'open');
contents.setAttribute('class', 'isShowingTOC');
tocContainer.setAttribute('class', 'isShowingTOC');
window.name = "";
}
return false;
}
function toggleTOCEntryChildren(e)
{
e.stopPropagation();
var currentClass = this.getAttribute('class');
if (currentClass == 'children') {
this.setAttribute('class', 'children open');
}
else if (currentClass == 'children open') {
this.setAttribute('class', 'children');
}
return false;
}
function tocEntryClick(e)
{
e.stopPropagation();
return true;
}
function init()
{
var selectElement = document.getElementById('jumpTo');
selectElement.addEventListener('change', jumpToChange, false);
var tocButton = document.getElementById('table_of_contents');
tocButton.addEventListener('click', toggleTOC, false);
var taskTreeItem = document.getElementById('task_treeitem');
if (taskTreeItem.getElementsByTagName('li').length > 0)
{
taskTreeItem.setAttribute('class', 'children');
taskTreeItem.firstChild.setAttribute('class', 'disclosure');
}
var tocList = document.getElementById('toc');
var tocEntries = tocList.getElementsByTagName('li');
for (var i = 0; i < tocEntries.length; i++) {
tocEntries[i].addEventListener('click', toggleTOCEntryChildren, false);
}
var tocLinks = tocList.getElementsByTagName('a');
for (var i = 0; i < tocLinks.length; i++) {
tocLinks[i].addEventListener('click', tocEntryClick, false);
}
if (window.name == "hideTOC") {
toggleTOC.call(tocButton);
}
}
window.onload = init;
</script>
</body>
</html>