273 * Returns a boolean that indicates if the cached object is 274 * no longer needed and should be removed from the cache. 275 */ 276 public boolean flush(boolean deaccelerated); 277 } 278 279 /** 280 * Called when image's acceleration priority is changed. 281 * <p> 282 * The default implementation will visit all of the value objects 283 * in the cacheMap when the priority gets set to 0.0 and flush them 284 * if they implement the FlushableCacheData interface. 285 */ 286 public void setAccelerationPriority(float priority) { 287 if (priority == 0.0f) { 288 flush(true); 289 } 290 } 291 292 /** 293 * Returns a scale factor of the image. This is utility method, which 294 * fetches information from the SurfaceData of the image. 295 * 296 * @see SurfaceData#getDefaultScale 297 */ 298 public static int getImageScale(final Image img) { 299 if (!(img instanceof VolatileImage)) { 300 return 1; 301 } 302 final SurfaceManager sm = getManager(img); 303 return sm.getPrimarySurfaceData().getDefaultScale(); 304 } 305 } | 273 * Returns a boolean that indicates if the cached object is 274 * no longer needed and should be removed from the cache. 275 */ 276 public boolean flush(boolean deaccelerated); 277 } 278 279 /** 280 * Called when image's acceleration priority is changed. 281 * <p> 282 * The default implementation will visit all of the value objects 283 * in the cacheMap when the priority gets set to 0.0 and flush them 284 * if they implement the FlushableCacheData interface. 285 */ 286 public void setAccelerationPriority(float priority) { 287 if (priority == 0.0f) { 288 flush(true); 289 } 290 } 291 292 /** 293 * Returns a horizontal scale factor of the image. This is utility method, 294 * which fetches information from the SurfaceData of the image. 295 * 296 * @see SurfaceData#getDefaultScaleX 297 */ 298 public static double getImageScaleX(final Image img) { 299 if (!(img instanceof VolatileImage)) { 300 return 1; 301 } 302 final SurfaceManager sm = getManager(img); 303 return sm.getPrimarySurfaceData().getDefaultScaleX(); 304 } 305 306 /** 307 * Returns a vertical scale factor of the image. This is utility method, 308 * which fetches information from the SurfaceData of the image. 309 * 310 * @see SurfaceData#getDefaultScaleY 311 */ 312 public static double getImageScaleY(final Image img) { 313 if (!(img instanceof VolatileImage)) { 314 return 1; 315 } 316 final SurfaceManager sm = getManager(img); 317 return sm.getPrimarySurfaceData().getDefaultScaleY(); 318 } 319 } |