blob: 74c783ea658ca7c0e0fbf34915bdeda95fdc1f78 [file] [log] [blame]
David Morrisseyd94cb882017-11-16 14:55:41 +00001<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!-- NewPage -->
3<html lang="en">
4<head>
David Morrissey3b0a9d12017-12-03 09:13:27 +00005<!-- Generated by javadoc -->
David Morrisseydea2a392017-12-02 08:46:32 +00006<title>ImageRegionDecoder (library 3.9.0 API)</title>
David Morrisseyd94cb882017-11-16 14:55:41 +00007<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
8<script type="text/javascript" src="../../../../../script.js"></script>
9</head>
10<body>
11<script type="text/javascript"><!--
12 try {
13 if (location.href.indexOf('is-external=true') == -1) {
David Morrisseydea2a392017-12-02 08:46:32 +000014 parent.document.title="ImageRegionDecoder (library 3.9.0 API)";
David Morrisseyd94cb882017-11-16 14:55:41 +000015 }
16 }
17 catch(err) {
18 }
19//-->
20var methods = {"i0":6,"i1":6,"i2":6,"i3":6};
21var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
22var altColor = "altColor";
23var rowColor = "rowColor";
24var tableTab = "tableTab";
25var activeTableTab = "activeTableTab";
26</script>
27<noscript>
28<div>JavaScript is disabled on your browser.</div>
29</noscript>
30<!-- ========= START OF TOP NAVBAR ======= -->
31<div class="topNav"><a name="navbar.top">
32<!-- -->
33</a>
34<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
35<a name="navbar.top.firstrow">
36<!-- -->
37</a>
38<ul class="navList" title="Navigation">
39<li><a href="../../../../../overview-summary.html">Overview</a></li>
40<li><a href="package-summary.html">Package</a></li>
41<li class="navBarCell1Rev">Class</li>
42<li><a href="package-tree.html">Tree</a></li>
43<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
44<li><a href="../../../../../index-all.html">Index</a></li>
45<li><a href="../../../../../help-doc.html">Help</a></li>
46</ul>
47</div>
48<div class="subNav">
49<ul class="navList">
50<li><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageDecoder.html" title="interface in com.davemorrissey.labs.subscaleview.decoder"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
51<li><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaImageDecoder.html" title="class in com.davemorrissey.labs.subscaleview.decoder"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
52</ul>
53<ul class="navList">
54<li><a href="../../../../../index.html?com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html" target="_top">Frames</a></li>
55<li><a href="ImageRegionDecoder.html" target="_top">No&nbsp;Frames</a></li>
56</ul>
57<ul class="navList" id="allclasses_navbar_top">
58<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
59</ul>
60<div>
61<script type="text/javascript"><!--
62 allClassesLink = document.getElementById("allclasses_navbar_top");
63 if(window==top) {
64 allClassesLink.style.display = "block";
65 }
66 else {
67 allClassesLink.style.display = "none";
68 }
69 //-->
70</script>
71</div>
72<div>
73<ul class="subNavList">
74<li>Summary:&nbsp;</li>
75<li>Nested&nbsp;|&nbsp;</li>
76<li>Field&nbsp;|&nbsp;</li>
77<li>Constr&nbsp;|&nbsp;</li>
78<li><a href="#method.summary">Method</a></li>
79</ul>
80<ul class="subNavList">
81<li>Detail:&nbsp;</li>
82<li>Field&nbsp;|&nbsp;</li>
83<li>Constr&nbsp;|&nbsp;</li>
84<li><a href="#method.detail">Method</a></li>
85</ul>
86</div>
87<a name="skip.navbar.top">
88<!-- -->
89</a></div>
90<!-- ========= END OF TOP NAVBAR ========= -->
91<!-- ======== START OF CLASS DATA ======== -->
92<div class="header">
93<div class="subTitle">com.davemorrissey.labs.subscaleview.decoder</div>
94<h2 title="Interface ImageRegionDecoder" class="title">Interface ImageRegionDecoder</h2>
95</div>
96<div class="contentContainer">
97<div class="description">
98<ul class="blockList">
99<li class="blockList">
100<dl>
101<dt>All Known Implementing Classes:</dt>
David Morrisseydea2a392017-12-02 08:46:32 +0000102<dd><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaImageRegionDecoder.html" title="class in com.davemorrissey.labs.subscaleview.decoder">SkiaImageRegionDecoder</a>, <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html" title="class in com.davemorrissey.labs.subscaleview.decoder">SkiaPooledImageRegionDecoder</a></dd>
David Morrisseyd94cb882017-11-16 14:55:41 +0000103</dl>
104<hr>
105<br>
106<pre>public interface <span class="typeNameLabel">ImageRegionDecoder</span></pre>
David Morrisseyfed3d782017-12-04 08:03:42 +0000107<div class="block">Interface for image decoding classes, allowing the default <a href="https://developer.android.com/reference/android/graphics/BitmapRegionDecoder.html?is-external=true" title="class or interface in android.graphics"><code>BitmapRegionDecoder</code></a>
David Morrisseyd94cb882017-11-16 14:55:41 +0000108 based on the Skia library to be replaced with a custom class.</div>
109</li>
110</ul>
111</div>
112<div class="summary">
113<ul class="blockList">
114<li class="blockList">
115<!-- ========== METHOD SUMMARY =========== -->
116<ul class="blockList">
117<li class="blockList"><a name="method.summary">
118<!-- -->
119</a>
120<h3>Method Summary</h3>
121<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
122<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
123<tr>
124<th class="colFirst" scope="col">Modifier and Type</th>
125<th class="colLast" scope="col">Method and Description</th>
126</tr>
127<tr id="i0" class="altColor">
David Morrisseyfed3d782017-12-04 08:03:42 +0000128<td class="colFirst"><code><a href="https://developer.android.com/reference/android/graphics/Bitmap.html?is-external=true" title="class or interface in android.graphics">Bitmap</a></code></td>
129<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html#decodeRegion-android.graphics.Rect-int-">decodeRegion</a></span>(<a href="https://developer.android.com/reference/android/graphics/Rect.html?is-external=true" title="class or interface in android.graphics">Rect</a>&nbsp;sRect,
David Morrisseyd94cb882017-11-16 14:55:41 +0000130 int&nbsp;sampleSize)</code>
David Morrisseyc2d55e02017-12-03 09:43:51 +0000131<div class="block">
132 Decode a region of the image with the given sample size.</div>
David Morrisseyd94cb882017-11-16 14:55:41 +0000133</td>
134</tr>
135<tr id="i1" class="rowColor">
David Morrisseyfed3d782017-12-04 08:03:42 +0000136<td class="colFirst"><code><a href="https://developer.android.com/reference/android/graphics/Point.html?is-external=true" title="class or interface in android.graphics">Point</a></code></td>
137<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html#init-android.content.Context-android.net.Uri-">init</a></span>(<a href="https://developer.android.com/reference/android/content/Context.html?is-external=true" title="class or interface in android.content">Context</a>&nbsp;context,
138 <a href="https://developer.android.com/reference/android/net/Uri.html?is-external=true" title="class or interface in android.net">Uri</a>&nbsp;uri)</code>
David Morrisseyd94cb882017-11-16 14:55:41 +0000139<div class="block">Initialise the decoder.</div>
140</td>
141</tr>
142<tr id="i2" class="altColor">
143<td class="colFirst"><code>boolean</code></td>
144<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html#isReady--">isReady</a></span>()</code>
145<div class="block">Status check.</div>
146</td>
147</tr>
148<tr id="i3" class="rowColor">
149<td class="colFirst"><code>void</code></td>
150<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html#recycle--">recycle</a></span>()</code>
151<div class="block">This method will be called when the decoder is no longer required.</div>
152</td>
153</tr>
154</table>
155</li>
156</ul>
157</li>
158</ul>
159</div>
160<div class="details">
161<ul class="blockList">
162<li class="blockList">
163<!-- ============ METHOD DETAIL ========== -->
164<ul class="blockList">
165<li class="blockList"><a name="method.detail">
166<!-- -->
167</a>
168<h3>Method Detail</h3>
169<a name="init-android.content.Context-android.net.Uri-">
170<!-- -->
171</a>
172<ul class="blockList">
173<li class="blockList">
174<h4>init</h4>
David Morrisseyfed3d782017-12-04 08:03:42 +0000175<pre><a href="https://developer.android.com/reference/android/graphics/Point.html?is-external=true" title="class or interface in android.graphics">Point</a>&nbsp;init(<a href="https://developer.android.com/reference/android/content/Context.html?is-external=true" title="class or interface in android.content">Context</a>&nbsp;context,
176 <a href="https://developer.android.com/reference/android/net/Uri.html?is-external=true" title="class or interface in android.net">Uri</a>&nbsp;uri)
177 throws <a href="https://developer.android.com/reference/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></pre>
David Morrisseyc2d55e02017-12-03 09:43:51 +0000178<div class="block">Initialise the decoder. When possible, perform initial setup work once in this method. The
179 dimensions of the image must be returned. The URI can be in one of the following formats:
180 <br>
181 File: <code>file:///scard/picture.jpg</code>
182 <br>
183 Asset: <code>file:///android_asset/picture.png</code>
184 <br>
185 Resource: <code>android.resource://com.example.app/drawable/picture</code></div>
David Morrisseyd94cb882017-11-16 14:55:41 +0000186<dl>
187<dt><span class="paramLabel">Parameters:</span></dt>
188<dd><code>context</code> - Application context. A reference may be held, but must be cleared on recycle.</dd>
189<dd><code>uri</code> - URI of the image.</dd>
190<dt><span class="returnLabel">Returns:</span></dt>
191<dd>Dimensions of the image.</dd>
192<dt><span class="throwsLabel">Throws:</span></dt>
David Morrisseyfed3d782017-12-04 08:03:42 +0000193<dd><code><a href="https://developer.android.com/reference/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></code> - if initialisation fails.</dd>
David Morrisseyd94cb882017-11-16 14:55:41 +0000194</dl>
195</li>
196</ul>
197<a name="decodeRegion-android.graphics.Rect-int-">
198<!-- -->
199</a>
200<ul class="blockList">
201<li class="blockList">
202<h4>decodeRegion</h4>
David Morrisseyfed3d782017-12-04 08:03:42 +0000203<pre><a href="https://developer.android.com/reference/android/graphics/Bitmap.html?is-external=true" title="class or interface in android.graphics">Bitmap</a>&nbsp;decodeRegion(<a href="https://developer.android.com/reference/android/graphics/Rect.html?is-external=true" title="class or interface in android.graphics">Rect</a>&nbsp;sRect,
204 int&nbsp;sampleSize)</pre>
David Morrisseyc2d55e02017-12-03 09:43:51 +0000205<div class="block"><p>
206 Decode a region of the image with the given sample size. This method is called off the UI
207 thread so it can safely load the image on the current thread. It is called from
David Morrisseyfed3d782017-12-04 08:03:42 +0000208 <a href="https://developer.android.com/reference/android/os/AsyncTask.html?is-external=true" title="class or interface in android.os"><code>AsyncTask</code></a>s running in an executor that may have multiple threads, so
David Morrisseyc2d55e02017-12-03 09:43:51 +0000209 implementations must be thread safe. Adding <code>synchronized</code> to the method signature
210 is the simplest way to achieve this, but bear in mind the <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html#recycle--"><code>recycle()</code></a> method can be
211 called concurrently.
212 </p><p>
213 See <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaImageRegionDecoder.html" title="class in com.davemorrissey.labs.subscaleview.decoder"><code>SkiaImageRegionDecoder</code></a> and <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html" title="class in com.davemorrissey.labs.subscaleview.decoder"><code>SkiaPooledImageRegionDecoder</code></a> for examples of
214 internal locking and synchronization.
215 </p></div>
David Morrisseyd94cb882017-11-16 14:55:41 +0000216<dl>
217<dt><span class="paramLabel">Parameters:</span></dt>
218<dd><code>sRect</code> - Source image rectangle to decode.</dd>
219<dd><code>sampleSize</code> - Sample size.</dd>
220<dt><span class="returnLabel">Returns:</span></dt>
221<dd>The decoded region. It is safe to return null if decoding fails.</dd>
222</dl>
223</li>
224</ul>
225<a name="isReady--">
226<!-- -->
227</a>
228<ul class="blockList">
229<li class="blockList">
230<h4>isReady</h4>
231<pre>boolean&nbsp;isReady()</pre>
232<div class="block">Status check. Should return false before initialisation and after recycle.</div>
233<dl>
234<dt><span class="returnLabel">Returns:</span></dt>
235<dd>true if the decoder is ready to be used.</dd>
236</dl>
237</li>
238</ul>
239<a name="recycle--">
240<!-- -->
241</a>
242<ul class="blockListLast">
243<li class="blockList">
244<h4>recycle</h4>
245<pre>void&nbsp;recycle()</pre>
246<div class="block">This method will be called when the decoder is no longer required. It should clean up any resources still in use.</div>
247</li>
248</ul>
249</li>
250</ul>
251</li>
252</ul>
253</div>
254</div>
255<!-- ========= END OF CLASS DATA ========= -->
256<!-- ======= START OF BOTTOM NAVBAR ====== -->
257<div class="bottomNav"><a name="navbar.bottom">
258<!-- -->
259</a>
260<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
261<a name="navbar.bottom.firstrow">
262<!-- -->
263</a>
264<ul class="navList" title="Navigation">
265<li><a href="../../../../../overview-summary.html">Overview</a></li>
266<li><a href="package-summary.html">Package</a></li>
267<li class="navBarCell1Rev">Class</li>
268<li><a href="package-tree.html">Tree</a></li>
269<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
270<li><a href="../../../../../index-all.html">Index</a></li>
271<li><a href="../../../../../help-doc.html">Help</a></li>
272</ul>
273</div>
274<div class="subNav">
275<ul class="navList">
276<li><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageDecoder.html" title="interface in com.davemorrissey.labs.subscaleview.decoder"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
277<li><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaImageDecoder.html" title="class in com.davemorrissey.labs.subscaleview.decoder"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
278</ul>
279<ul class="navList">
280<li><a href="../../../../../index.html?com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html" target="_top">Frames</a></li>
281<li><a href="ImageRegionDecoder.html" target="_top">No&nbsp;Frames</a></li>
282</ul>
283<ul class="navList" id="allclasses_navbar_bottom">
284<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
285</ul>
286<div>
287<script type="text/javascript"><!--
288 allClassesLink = document.getElementById("allclasses_navbar_bottom");
289 if(window==top) {
290 allClassesLink.style.display = "block";
291 }
292 else {
293 allClassesLink.style.display = "none";
294 }
295 //-->
296</script>
297</div>
298<div>
299<ul class="subNavList">
300<li>Summary:&nbsp;</li>
301<li>Nested&nbsp;|&nbsp;</li>
302<li>Field&nbsp;|&nbsp;</li>
303<li>Constr&nbsp;|&nbsp;</li>
304<li><a href="#method.summary">Method</a></li>
305</ul>
306<ul class="subNavList">
307<li>Detail:&nbsp;</li>
308<li>Field&nbsp;|&nbsp;</li>
309<li>Constr&nbsp;|&nbsp;</li>
310<li><a href="#method.detail">Method</a></li>
311</ul>
312</div>
313<a name="skip.navbar.bottom">
314<!-- -->
315</a></div>
316<!-- ======== END OF BOTTOM NAVBAR ======= -->
317</body>
318</html>