Files
PINRemoteImage/docs/html/Classes/PINAnimatedImage.html
2016-04-08 14:39:08 -07:00

817 lines
19 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PINAnimatedImage Class Reference</title>
<link rel="stylesheet" href="../css/style.css">
<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
<meta name="generator" content="appledoc 2.2.1 (build 1333)">
</head>
<body class="appledoc">
<header>
<div class="container" class="hide-in-xcode">
<h1 id="library-title">
<a href="../index.html">PINRemoteImage </a>
</h1>
<p id="developer-home">
<a href="../index.html">Pinterest</a>
</p>
</div>
</header>
<aside>
<div class="container">
<nav>
<ul id="header-buttons" role="toolbar">
<li><a href="../index.html">Index</a></li>
<li><a href="../hierarchy.html">Hierarchy</a></li>
<li id="on-this-page" role="navigation">
<label>
On This Page
<div class="chevron">
<div class="chevy chevron-left"></div>
<div class="chevy chevron-right"></div>
</div>
<select id="jump-to">
<option value="top">Jump To&#133;</option>
<option value="overview">Overview</option>
<option value="tasks">Tasks</option>
<optgroup label="Properties">
<option value="//api/name/animatedImageReady">animatedImageReady</option>
<option value="//api/name/coverImage">coverImage</option>
<option value="//api/name/coverImageReady">coverImageReady</option>
<option value="//api/name/fileReady">fileReady</option>
<option value="//api/name/frameCount">frameCount</option>
<option value="//api/name/frameInterval">frameInterval</option>
<option value="//api/name/infoCompletion">infoCompletion</option>
<option value="//api/name/loopCount">loopCount</option>
<option value="//api/name/playbackReady">playbackReady</option>
<option value="//api/name/status">status</option>
<option value="//api/name/totalDuration">totalDuration</option>
</optgroup>
<optgroup label="Instance Methods">
<option value="//api/name/clearAnimatedImageCache">- clearAnimatedImageCache</option>
<option value="//api/name/durationAtIndex:">- durationAtIndex:</option>
<option value="//api/name/imageAtIndex:">- imageAtIndex:</option>
</optgroup>
</select>
</label>
</li>
</ul>
</nav>
</div>
</aside>
<article>
<div id="overview_contents" class="container">
<div id="content">
<main role="main">
<h1 class="title">PINAnimatedImage Class Reference</h1>
<div class="section section-specification"><table cellspacing="0"><tbody>
<tr>
<th>Inherits from</th>
<td>NSObject</td>
</tr><tr>
<th>Declared in</th>
<td>PINAnimatedImage.h</td>
</tr>
</tbody></table></div>
<div class="section section-overview">
<a title="Overview" name="overview"></a>
<h2 class="subtitle subtitle-overview">Overview</h2>
<p>PINAnimatedImage is a class which decodes GIFs to memory mapped files on disk. Like PINRemoteImageManager,
it will only decode a GIF one time, regardless of the number of the number of PINAnimatedImages created with
the same NSData.</p>
<p>PINAnimatedImage&rsquo;s are also decoded chunks at a time, writing each chunk to a separate file. This allows callback
and playback to start before the GIF is completely decoded. If a frame is requested beyond what has been processed,
nil will be returned. Because a fileReady is called on each chunk completion, you can pause playback if you hit a nil
frame until you receive another fileReady call.</p>
<p>Internally, PINAnimatedImage attempts to keep only the files it needs open the last file associated with the requested
frame and the one after (to prime).</p>
<p>It&rsquo;s important to note that until infoCompletion is called, it is unsafe to access many of the methods on PINAnimatedImage.</p>
</div>
<div class="section section-tasks">
<a title="Tasks" name="tasks"></a>
<div class="task-list">
<div class="section-method">
<a name="//api/name/infoCompletion" title="infoCompletion"></a>
<h3 class="method-title"><code><a href="#//api/name/infoCompletion">&nbsp;&nbsp;infoCompletion</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>A block to be called on when GIF info has been processed. Status will == PINAnimatedImageStatusInfoProcessed</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, strong, readwrite) PINAnimatedImageInfoReady infoCompletion</code></div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/fileReady" title="fileReady"></a>
<h3 class="method-title"><code><a href="#//api/name/fileReady">&nbsp;&nbsp;fileReady</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>A block to be called whenever a new file is done being processed. You can start (or resume) playback when you
get this callback, though it&rsquo;s possible for playback to catch up to the decoding and you&rsquo;ll need to pause.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, strong, readwrite) dispatch_block_t fileReady</code></div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/animatedImageReady" title="animatedImageReady"></a>
<h3 class="method-title"><code><a href="#//api/name/animatedImageReady">&nbsp;&nbsp;animatedImageReady</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>A block to be called when the animated image is fully decoded and written to disk.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, strong, readwrite) dispatch_block_t animatedImageReady</code></div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/status" title="status"></a>
<h3 class="method-title"><code><a href="#//api/name/status">&nbsp;&nbsp;status</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>The current status of the animated image.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, assign, readwrite) PINAnimatedImageStatus status</code></div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/coverImageReady" title="coverImageReady"></a>
<h3 class="method-title"><code><a href="#//api/name/coverImageReady">&nbsp;&nbsp;coverImageReady</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>A helper function which references status to check if the coverImage is ready.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly) BOOL coverImageReady</code></div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/playbackReady" title="playbackReady"></a>
<h3 class="method-title"><code><a href="#//api/name/playbackReady">&nbsp;&nbsp;playbackReady</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>A helper function which references status to check if playback is ready.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly) BOOL playbackReady</code></div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/coverImage" title="coverImage"></a>
<h3 class="method-title"><code><a href="#//api/name/coverImage">&nbsp;&nbsp;coverImage</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>The first frame / cover image of the animated image.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly) PINImage *coverImage</code></div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<div class="warning"><p><strong>Warning:</strong> Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined. You can check coverImageReady too.</p></div>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/totalDuration" title="totalDuration"></a>
<h3 class="method-title"><code><a href="#//api/name/totalDuration">&nbsp;&nbsp;totalDuration</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>The total duration of one loop of playback.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly) CFTimeInterval totalDuration</code></div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<div class="warning"><p><strong>Warning:</strong> Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined.</p></div>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/frameInterval" title="frameInterval"></a>
<h3 class="method-title"><code><a href="#//api/name/frameInterval">&nbsp;&nbsp;frameInterval</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>The number of frames to play per second * display refresh rate (defined as 60 which appears to be true on iOS). You probably want to
set this value on a displayLink.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly) NSUInteger frameInterval</code></div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<div class="warning"><p><strong>Warning:</strong> Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined.</p></div>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/loopCount" title="loopCount"></a>
<h3 class="method-title"><code><a href="#//api/name/loopCount">&nbsp;&nbsp;loopCount</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>The number of times to loop the animated image. Returns 0 if looping should occur infinitely.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly) size_t loopCount</code></div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<div class="warning"><p><strong>Warning:</strong> Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined.</p></div>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/frameCount" title="frameCount"></a>
<h3 class="method-title"><code><a href="#//api/name/frameCount">&nbsp;&nbsp;frameCount</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>The total number of frames in the animated image.</p>
</div>
<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly) size_t frameCount</code></div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<div class="warning"><p><strong>Warning:</strong> Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined.</p></div>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/imageAtIndex:" title="imageAtIndex:"></a>
<h3 class="method-title"><code><a href="#//api/name/imageAtIndex:">&ndash;&nbsp;imageAtIndex:</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>The image at the frame index passed in.</p>
</div>
<div class="method-subsection method-declaration"><code>- (CGImageRef)imageAtIndex:(NSUInteger)<em>index</em></code></div>
<div class="method-subsection arguments-section parameters">
<h4 class="method-subtitle parameter-title">Parameters</h4>
<table class="argument-def parameter-def">
<tr>
<th scope="row" class="argument-name"><code>index</code></th>
<td><p>The index of the frame to retrieve.</p></td>
</tr>
</table>
</div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<div class="warning"><p><strong>Warning:</strong> Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined.</p></div>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/durationAtIndex:" title="durationAtIndex:"></a>
<h3 class="method-title"><code><a href="#//api/name/durationAtIndex:">&ndash;&nbsp;durationAtIndex:</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>The duration of the frame of the passed in index.</p>
</div>
<div class="method-subsection method-declaration"><code>- (CFTimeInterval)durationAtIndex:(NSUInteger)<em>index</em></code></div>
<div class="method-subsection arguments-section parameters">
<h4 class="method-subtitle parameter-title">Parameters</h4>
<table class="argument-def parameter-def">
<tr>
<th scope="row" class="argument-name"><code>index</code></th>
<td><p>The index of the frame to retrieve the duration it should be shown for.</p></td>
</tr>
</table>
</div>
<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<div class="warning"><p><strong>Warning:</strong> Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined.</p></div>
</div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div><div class="section-method">
<a name="//api/name/clearAnimatedImageCache" title="clearAnimatedImageCache"></a>
<h3 class="method-title"><code><a href="#//api/name/clearAnimatedImageCache">&ndash;&nbsp;clearAnimatedImageCache</a></code>
</h3>
<div class="method-info">
<div class="pointy-thing"></div>
<div class="method-info-container">
<div class="method-subsection brief-description">
<p>Clears out the strong references to any memory maps that are being held.</p>
</div>
<div class="method-subsection method-declaration"><code>- (void)clearAnimatedImageCache</code></div>
<div class="method-subsection declared-in-section">
<h4 class="method-subtitle">Declared In</h4>
<p><code class="declared-in-ref">PINAnimatedImage.h</code></p>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<footer>
<div class="footer-copyright">
<p class="copyright">Copyright &copy; 2016 Pinterest. All rights reserved. Updated: 2016-04-08</p>
<p class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.2.1 (build 1333)</a>.</p>
</div>
</footer>
</div>
</div>
</article>
<script src="../js/script.js"></script>
</body>
</html>