David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 1 | <!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 Morrissey | 3b0a9d1 | 2017-12-03 09:13:27 +0000 | [diff] [blame] | 5 | <!-- Generated by javadoc --> |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 6 | <title>SkiaPooledImageRegionDecoder (library 3.9.0 API)</title> |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 7 | <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) { |
| 14 | parent.document.title="SkiaPooledImageRegionDecoder (library 3.9.0 API)"; |
| 15 | } |
| 16 | } |
| 17 | catch(err) { |
| 18 | } |
| 19 | //--> |
| 20 | var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":9}; |
| 21 | var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| 22 | var altColor = "altColor"; |
| 23 | var rowColor = "rowColor"; |
| 24 | var tableTab = "tableTab"; |
| 25 | var 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/SkiaImageRegionDecoder.html" title="class in com.davemorrissey.labs.subscaleview.decoder"><span class="typeNameLink">Prev Class</span></a></li> |
| 51 | <li>Next Class</li> |
| 52 | </ul> |
| 53 | <ul class="navList"> |
| 54 | <li><a href="../../../../../index.html?com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html" target="_top">Frames</a></li> |
| 55 | <li><a href="SkiaPooledImageRegionDecoder.html" target="_top">No Frames</a></li> |
| 56 | </ul> |
| 57 | <ul class="navList" id="allclasses_navbar_top"> |
| 58 | <li><a href="../../../../../allclasses-noframe.html">All 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: </li> |
| 75 | <li>Nested | </li> |
| 76 | <li>Field | </li> |
| 77 | <li><a href="#constructor.summary">Constr</a> | </li> |
| 78 | <li><a href="#method.summary">Method</a></li> |
| 79 | </ul> |
| 80 | <ul class="subNavList"> |
| 81 | <li>Detail: </li> |
| 82 | <li>Field | </li> |
| 83 | <li><a href="#constructor.detail">Constr</a> | </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="Class SkiaPooledImageRegionDecoder" class="title">Class SkiaPooledImageRegionDecoder</h2> |
| 95 | </div> |
| 96 | <div class="contentContainer"> |
| 97 | <ul class="inheritance"> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 98 | <li><a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 99 | <li> |
| 100 | <ul class="inheritance"> |
| 101 | <li>com.davemorrissey.labs.subscaleview.decoder.SkiaPooledImageRegionDecoder</li> |
| 102 | </ul> |
| 103 | </li> |
| 104 | </ul> |
| 105 | <div class="description"> |
| 106 | <ul class="blockList"> |
| 107 | <li class="blockList"> |
| 108 | <dl> |
| 109 | <dt>All Implemented Interfaces:</dt> |
| 110 | <dd><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html" title="interface in com.davemorrissey.labs.subscaleview.decoder">ImageRegionDecoder</a></dd> |
| 111 | </dl> |
| 112 | <hr> |
| 113 | <br> |
| 114 | <pre>public class <span class="typeNameLabel">SkiaPooledImageRegionDecoder</span> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 115 | extends <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 116 | implements <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html" title="interface in com.davemorrissey.labs.subscaleview.decoder">ImageRegionDecoder</a></pre> |
| 117 | <div class="block"><p> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 118 | An implementation of <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html" title="interface in com.davemorrissey.labs.subscaleview.decoder"><code>ImageRegionDecoder</code></a> using a pool of <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>s, |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 119 | to provide true parallel loading of tiles. This is only effective if parallel loading has been |
| 120 | enabled in the view by calling <a href="../../../../../com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html#setExecutor-java.util.concurrent.Executor-"><code>SubsamplingScaleImageView.setExecutor(Executor)</code></a> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 121 | with a multi-threaded <a href="https://developer.android.com/reference/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent"><code>Executor</code></a> instance. |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 122 | </p><p> |
| 123 | One decoder is initialised when the class is initialised. This is enough to decode base layer tiles. |
| 124 | Additional decoders are initialised when a subregion of the image is first requested, which indicates |
| 125 | interaction with the view. Creation of additional encoders stops when <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#allowAdditionalDecoder-int-long-"><code>allowAdditionalDecoder(int, long)</code></a> |
| 126 | returns false. The default implementation takes into account the file size, number of CPU cores, |
| 127 | low memory status and a hard limit of 4. Extend this class to customise this. |
| 128 | </p><p> |
| 129 | <b>WARNING:</b> This class is highly experimental and not proven to be stable on a wide range of |
| 130 | devices. You are advised to test it thoroughly on all available devices, and code your app to use |
| 131 | <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaImageRegionDecoder.html" title="class in com.davemorrissey.labs.subscaleview.decoder"><code>SkiaImageRegionDecoder</code></a> on old or low powered devices you could not test. |
| 132 | </p></div> |
| 133 | </li> |
| 134 | </ul> |
| 135 | </div> |
| 136 | <div class="summary"> |
| 137 | <ul class="blockList"> |
| 138 | <li class="blockList"> |
| 139 | <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| 140 | <ul class="blockList"> |
| 141 | <li class="blockList"><a name="constructor.summary"> |
| 142 | <!-- --> |
| 143 | </a> |
| 144 | <h3>Constructor Summary</h3> |
| 145 | <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| 146 | <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| 147 | <tr> |
| 148 | <th class="colOne" scope="col">Constructor and Description</th> |
| 149 | </tr> |
| 150 | <tr class="altColor"> |
| 151 | <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#SkiaPooledImageRegionDecoder--">SkiaPooledImageRegionDecoder</a></span>()</code> </td> |
| 152 | </tr> |
| 153 | <tr class="rowColor"> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 154 | <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#SkiaPooledImageRegionDecoder-android.graphics.Bitmap.Config-">SkiaPooledImageRegionDecoder</a></span>(<a href="https://developer.android.com/reference/android/graphics/Bitmap.Config.html?is-external=true" title="class or interface in android.graphics">Bitmap.Config</a> bitmapConfig)</code> </td> |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 155 | </tr> |
| 156 | </table> |
| 157 | </li> |
| 158 | </ul> |
| 159 | <!-- ========== METHOD SUMMARY =========== --> |
| 160 | <ul class="blockList"> |
| 161 | <li class="blockList"><a name="method.summary"> |
| 162 | <!-- --> |
| 163 | </a> |
| 164 | <h3>Method Summary</h3> |
| 165 | <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| 166 | <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| 167 | <tr> |
| 168 | <th class="colFirst" scope="col">Modifier and Type</th> |
| 169 | <th class="colLast" scope="col">Method and Description</th> |
| 170 | </tr> |
| 171 | <tr id="i0" class="altColor"> |
| 172 | <td class="colFirst"><code>protected boolean</code></td> |
| 173 | <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#allowAdditionalDecoder-int-long-">allowAdditionalDecoder</a></span>(int numberOfDecoders, |
| 174 | long fileLength)</code> |
| 175 | <div class="block">Called before creating a new decoder.</div> |
| 176 | </td> |
| 177 | </tr> |
| 178 | <tr id="i1" class="rowColor"> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 179 | <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> |
| 180 | <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.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> sRect, |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 181 | int sampleSize)</code> |
| 182 | <div class="block">Acquire a read lock to prevent decoding overlapping with recycling, then check the pool still |
| 183 | exists and acquire a decoder to load the requested region.</div> |
| 184 | </td> |
| 185 | </tr> |
| 186 | <tr id="i2" class="altColor"> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 187 | <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> |
| 188 | <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.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> context, |
| 189 | <a href="https://developer.android.com/reference/android/net/Uri.html?is-external=true" title="class or interface in android.net">Uri</a> uri)</code> |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 190 | <div class="block">Initialises the decoder pool.</div> |
| 191 | </td> |
| 192 | </tr> |
| 193 | <tr id="i3" class="rowColor"> |
| 194 | <td class="colFirst"><code>boolean</code></td> |
| 195 | <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#isReady--">isReady</a></span>()</code> |
| 196 | <div class="block">Holding a read lock to avoid returning true while the pool is being recycled, this returns |
| 197 | true if the pool has at least one decoder available.</div> |
| 198 | </td> |
| 199 | </tr> |
| 200 | <tr id="i4" class="altColor"> |
| 201 | <td class="colFirst"><code>void</code></td> |
| 202 | <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#recycle--">recycle</a></span>()</code> |
| 203 | <div class="block">Wait until all read locks held by <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#decodeRegion-android.graphics.Rect-int-"><code>decodeRegion(Rect, int)</code></a> are released, then recycle |
| 204 | and destroy the pool.</div> |
| 205 | </td> |
| 206 | </tr> |
| 207 | <tr id="i5" class="rowColor"> |
| 208 | <td class="colFirst"><code>static void</code></td> |
| 209 | <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#setDebug-boolean-">setDebug</a></span>(boolean debug)</code> |
| 210 | <div class="block">Controls logging of debug messages.</div> |
| 211 | </td> |
| 212 | </tr> |
| 213 | </table> |
| 214 | <ul class="blockList"> |
| 215 | <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| 216 | <!-- --> |
| 217 | </a> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 218 | <h3>Methods inherited from class java.lang.<a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| 219 | <code><a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 220 | </ul> |
| 221 | </li> |
| 222 | </ul> |
| 223 | </li> |
| 224 | </ul> |
| 225 | </div> |
| 226 | <div class="details"> |
| 227 | <ul class="blockList"> |
| 228 | <li class="blockList"> |
| 229 | <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| 230 | <ul class="blockList"> |
| 231 | <li class="blockList"><a name="constructor.detail"> |
| 232 | <!-- --> |
| 233 | </a> |
| 234 | <h3>Constructor Detail</h3> |
| 235 | <a name="SkiaPooledImageRegionDecoder--"> |
| 236 | <!-- --> |
| 237 | </a> |
| 238 | <ul class="blockList"> |
| 239 | <li class="blockList"> |
| 240 | <h4>SkiaPooledImageRegionDecoder</h4> |
| 241 | <pre>public SkiaPooledImageRegionDecoder()</pre> |
| 242 | </li> |
| 243 | </ul> |
| 244 | <a name="SkiaPooledImageRegionDecoder-android.graphics.Bitmap.Config-"> |
| 245 | <!-- --> |
| 246 | </a> |
| 247 | <ul class="blockListLast"> |
| 248 | <li class="blockList"> |
| 249 | <h4>SkiaPooledImageRegionDecoder</h4> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 250 | <pre>public SkiaPooledImageRegionDecoder(<a href="https://developer.android.com/reference/android/graphics/Bitmap.Config.html?is-external=true" title="class or interface in android.graphics">Bitmap.Config</a> bitmapConfig)</pre> |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 251 | </li> |
| 252 | </ul> |
| 253 | </li> |
| 254 | </ul> |
| 255 | <!-- ============ METHOD DETAIL ========== --> |
| 256 | <ul class="blockList"> |
| 257 | <li class="blockList"><a name="method.detail"> |
| 258 | <!-- --> |
| 259 | </a> |
| 260 | <h3>Method Detail</h3> |
| 261 | <a name="setDebug-boolean-"> |
| 262 | <!-- --> |
| 263 | </a> |
| 264 | <ul class="blockList"> |
| 265 | <li class="blockList"> |
| 266 | <h4>setDebug</h4> |
| 267 | <pre>public static void setDebug(boolean debug)</pre> |
| 268 | <div class="block">Controls logging of debug messages. All instances are affected.</div> |
| 269 | <dl> |
| 270 | <dt><span class="paramLabel">Parameters:</span></dt> |
| 271 | <dd><code>debug</code> - true to enable debug logging, false to disable.</dd> |
| 272 | </dl> |
| 273 | </li> |
| 274 | </ul> |
| 275 | <a name="init-android.content.Context-android.net.Uri-"> |
| 276 | <!-- --> |
| 277 | </a> |
| 278 | <ul class="blockList"> |
| 279 | <li class="blockList"> |
| 280 | <h4>init</h4> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 281 | <pre>public <a href="https://developer.android.com/reference/android/graphics/Point.html?is-external=true" title="class or interface in android.graphics">Point</a> init(<a href="https://developer.android.com/reference/android/content/Context.html?is-external=true" title="class or interface in android.content">Context</a> context, |
| 282 | <a href="https://developer.android.com/reference/android/net/Uri.html?is-external=true" title="class or interface in android.net">Uri</a> uri) |
| 283 | 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 Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 284 | <div class="block">Initialises the decoder pool. This method creates one decoder on the current thread and uses |
| 285 | it to decode the bounds, then spawns an independent thread to populate the pool with an |
| 286 | additional three decoders. The thread will abort if <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#recycle--"><code>recycle()</code></a> is called.</div> |
| 287 | <dl> |
| 288 | <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| 289 | <dd><code><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html#init-android.content.Context-android.net.Uri-">init</a></code> in interface <code><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html" title="interface in com.davemorrissey.labs.subscaleview.decoder">ImageRegionDecoder</a></code></dd> |
| 290 | <dt><span class="paramLabel">Parameters:</span></dt> |
| 291 | <dd><code>context</code> - Application context. A reference may be held, but must be cleared on recycle.</dd> |
| 292 | <dd><code>uri</code> - URI of the image.</dd> |
| 293 | <dt><span class="returnLabel">Returns:</span></dt> |
| 294 | <dd>Dimensions of the image.</dd> |
| 295 | <dt><span class="throwsLabel">Throws:</span></dt> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 296 | <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 Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 297 | </dl> |
| 298 | </li> |
| 299 | </ul> |
| 300 | <a name="decodeRegion-android.graphics.Rect-int-"> |
| 301 | <!-- --> |
| 302 | </a> |
| 303 | <ul class="blockList"> |
| 304 | <li class="blockList"> |
| 305 | <h4>decodeRegion</h4> |
David Morrissey | fed3d78 | 2017-12-04 08:03:42 +0000 | [diff] [blame] | 306 | <pre>public <a href="https://developer.android.com/reference/android/graphics/Bitmap.html?is-external=true" title="class or interface in android.graphics">Bitmap</a> decodeRegion(<a href="https://developer.android.com/reference/android/graphics/Rect.html?is-external=true" title="class or interface in android.graphics">Rect</a> sRect, |
| 307 | int sampleSize)</pre> |
David Morrissey | 585af6a | 2017-12-02 08:47:05 +0000 | [diff] [blame] | 308 | <div class="block">Acquire a read lock to prevent decoding overlapping with recycling, then check the pool still |
| 309 | exists and acquire a decoder to load the requested region. There is no check whether the pool |
| 310 | currently has decoders, because it's guaranteed to have one decoder after <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#init-android.content.Context-android.net.Uri-"><code>init(Context, Uri)</code></a> |
| 311 | is called and be null once <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#recycle--"><code>recycle()</code></a> is called. In practice the view can't call this |
| 312 | method until after <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#init-android.content.Context-android.net.Uri-"><code>init(Context, Uri)</code></a>, so there will be no blocking on an empty pool.</div> |
| 313 | <dl> |
| 314 | <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| 315 | <dd><code><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html#decodeRegion-android.graphics.Rect-int-">decodeRegion</a></code> in interface <code><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html" title="interface in com.davemorrissey.labs.subscaleview.decoder">ImageRegionDecoder</a></code></dd> |
| 316 | <dt><span class="paramLabel">Parameters:</span></dt> |
| 317 | <dd><code>sRect</code> - Source image rectangle to decode.</dd> |
| 318 | <dd><code>sampleSize</code> - Sample size.</dd> |
| 319 | <dt><span class="returnLabel">Returns:</span></dt> |
| 320 | <dd>The decoded region. It is safe to return null if decoding fails.</dd> |
| 321 | </dl> |
| 322 | </li> |
| 323 | </ul> |
| 324 | <a name="isReady--"> |
| 325 | <!-- --> |
| 326 | </a> |
| 327 | <ul class="blockList"> |
| 328 | <li class="blockList"> |
| 329 | <h4>isReady</h4> |
| 330 | <pre>public boolean isReady()</pre> |
| 331 | <div class="block">Holding a read lock to avoid returning true while the pool is being recycled, this returns |
| 332 | true if the pool has at least one decoder available.</div> |
| 333 | <dl> |
| 334 | <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| 335 | <dd><code><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html#isReady--">isReady</a></code> in interface <code><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html" title="interface in com.davemorrissey.labs.subscaleview.decoder">ImageRegionDecoder</a></code></dd> |
| 336 | <dt><span class="returnLabel">Returns:</span></dt> |
| 337 | <dd>true if the decoder is ready to be used.</dd> |
| 338 | </dl> |
| 339 | </li> |
| 340 | </ul> |
| 341 | <a name="recycle--"> |
| 342 | <!-- --> |
| 343 | </a> |
| 344 | <ul class="blockList"> |
| 345 | <li class="blockList"> |
| 346 | <h4>recycle</h4> |
| 347 | <pre>public void recycle()</pre> |
| 348 | <div class="block">Wait until all read locks held by <a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html#decodeRegion-android.graphics.Rect-int-"><code>decodeRegion(Rect, int)</code></a> are released, then recycle |
| 349 | and destroy the pool. Elsewhere, when a read lock is acquired, we must check the pool is not null.</div> |
| 350 | <dl> |
| 351 | <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| 352 | <dd><code><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html#recycle--">recycle</a></code> in interface <code><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html" title="interface in com.davemorrissey.labs.subscaleview.decoder">ImageRegionDecoder</a></code></dd> |
| 353 | </dl> |
| 354 | </li> |
| 355 | </ul> |
| 356 | <a name="allowAdditionalDecoder-int-long-"> |
| 357 | <!-- --> |
| 358 | </a> |
| 359 | <ul class="blockListLast"> |
| 360 | <li class="blockList"> |
| 361 | <h4>allowAdditionalDecoder</h4> |
| 362 | <pre>protected boolean allowAdditionalDecoder(int numberOfDecoders, |
| 363 | long fileLength)</pre> |
| 364 | <div class="block">Called before creating a new decoder. Based on number of CPU cores, available memory, and the |
| 365 | size of the image file, determines whether another decoder can be created. Subclasses can |
| 366 | override and customise this.</div> |
| 367 | <dl> |
| 368 | <dt><span class="paramLabel">Parameters:</span></dt> |
| 369 | <dd><code>numberOfDecoders</code> - the number of decoders that have been created so far</dd> |
| 370 | <dd><code>fileLength</code> - the size of the image file in bytes. Creating another decoder will use approximately this much native memory.</dd> |
| 371 | <dt><span class="returnLabel">Returns:</span></dt> |
| 372 | <dd>true if another decoder can be created.</dd> |
| 373 | </dl> |
| 374 | </li> |
| 375 | </ul> |
| 376 | </li> |
| 377 | </ul> |
| 378 | </li> |
| 379 | </ul> |
| 380 | </div> |
| 381 | </div> |
| 382 | <!-- ========= END OF CLASS DATA ========= --> |
| 383 | <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| 384 | <div class="bottomNav"><a name="navbar.bottom"> |
| 385 | <!-- --> |
| 386 | </a> |
| 387 | <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| 388 | <a name="navbar.bottom.firstrow"> |
| 389 | <!-- --> |
| 390 | </a> |
| 391 | <ul class="navList" title="Navigation"> |
| 392 | <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| 393 | <li><a href="package-summary.html">Package</a></li> |
| 394 | <li class="navBarCell1Rev">Class</li> |
| 395 | <li><a href="package-tree.html">Tree</a></li> |
| 396 | <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| 397 | <li><a href="../../../../../index-all.html">Index</a></li> |
| 398 | <li><a href="../../../../../help-doc.html">Help</a></li> |
| 399 | </ul> |
| 400 | </div> |
| 401 | <div class="subNav"> |
| 402 | <ul class="navList"> |
| 403 | <li><a href="../../../../../com/davemorrissey/labs/subscaleview/decoder/SkiaImageRegionDecoder.html" title="class in com.davemorrissey.labs.subscaleview.decoder"><span class="typeNameLink">Prev Class</span></a></li> |
| 404 | <li>Next Class</li> |
| 405 | </ul> |
| 406 | <ul class="navList"> |
| 407 | <li><a href="../../../../../index.html?com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html" target="_top">Frames</a></li> |
| 408 | <li><a href="SkiaPooledImageRegionDecoder.html" target="_top">No Frames</a></li> |
| 409 | </ul> |
| 410 | <ul class="navList" id="allclasses_navbar_bottom"> |
| 411 | <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| 412 | </ul> |
| 413 | <div> |
| 414 | <script type="text/javascript"><!-- |
| 415 | allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| 416 | if(window==top) { |
| 417 | allClassesLink.style.display = "block"; |
| 418 | } |
| 419 | else { |
| 420 | allClassesLink.style.display = "none"; |
| 421 | } |
| 422 | //--> |
| 423 | </script> |
| 424 | </div> |
| 425 | <div> |
| 426 | <ul class="subNavList"> |
| 427 | <li>Summary: </li> |
| 428 | <li>Nested | </li> |
| 429 | <li>Field | </li> |
| 430 | <li><a href="#constructor.summary">Constr</a> | </li> |
| 431 | <li><a href="#method.summary">Method</a></li> |
| 432 | </ul> |
| 433 | <ul class="subNavList"> |
| 434 | <li>Detail: </li> |
| 435 | <li>Field | </li> |
| 436 | <li><a href="#constructor.detail">Constr</a> | </li> |
| 437 | <li><a href="#method.detail">Method</a></li> |
| 438 | </ul> |
| 439 | </div> |
| 440 | <a name="skip.navbar.bottom"> |
| 441 | <!-- --> |
| 442 | </a></div> |
| 443 | <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| 444 | </body> |
| 445 | </html> |