List of usage examples for android.graphics RectF intersects
public static boolean intersects(RectF a, RectF b)
From source file:org.uoyabause.android.PadButton.java
public boolean intersects(RectF r) { return RectF.intersects(rect, r); }
From source file:com.zenithed.core.widget.scaledimageview.ScaledImageView.java
/** * Loads the optimum tiles for display at the current scale and translate, so the screen can be filled with tiles * that are at least as high resolution as the screen. Frees up bitmaps that are now off the screen. * @param load Whether to load the new tiles needed. Use false while scrolling/panning for performance. *//*from ww w. j av a 2s .com*/ private void refreshRequiredTiles(boolean load) { final int sampleSize = Math.min(mFullImageSampleSize, calculateInSampleSize((int) (mScale * mContentWidth), (int) (mScale * mContentHeight))); final RectF vVisRect = new RectF(0, 0, getWidth(), getHeight()); final RectF sVisRect = viewToSourceRect(vVisRect); // Load tiles of the correct sample size that are on screen. Discard tiles off screen, and those that are higher // resolution than required, or lower res than required but not the base layer, so the base layer is always present. final SparseArray<List<Tile>> tileMap = mTileMap; final int SIZE = mTileMap.size(); List<Tile> tileList = null; for (int i = 0; i < SIZE; i++) { tileList = tileMap.valueAt(i); for (Tile tile : tileList) { if (tile.sampleSize < sampleSize || (tile.sampleSize > sampleSize && tile.sampleSize != mFullImageSampleSize)) { tile.visible = false; if (tile.bitmap != null) { tile.bitmap.recycle(); tile.bitmap = null; } } if (tile.sampleSize == sampleSize) { if (RectF.intersects(sVisRect, convertRect(tile.sRect))) { tile.visible = true; if (!tile.loading && tile.bitmap == null && load) { BitmapTileTask task = new BitmapTileTask(this, mBitmapRegionDecoder, tile); task.execute(); mTasks.add(task); } } else if (tile.sampleSize != mFullImageSampleSize) { tile.visible = false; if (tile.bitmap != null) { tile.bitmap.recycle(); tile.bitmap = null; } } } else if (tile.sampleSize == mFullImageSampleSize) { tile.visible = true; } } } }
From source file:xiaofan.llongimageview.view.SubsamplingScaleImageView.java
/** * Loads the optimum tiles for display at the current scale and translate, so the screen can be filled with tiles * that are at least as high resolution as the screen. Frees up bitmaps that are now off the screen. * @param load Whether to load the new tiles needed. Use false while scrolling/panning for performance. *///from w ww. j a va 2 s.co m private void refreshRequiredTiles(boolean load) { int sampleSize = Math.min(fullImageSampleSize, calculateInSampleSize()); RectF vVisRect = new RectF(0, 0, getWidth(), getHeight()); RectF sVisRect = viewToSourceRect(vVisRect); // Load tiles of the correct sample size that are on screen. Discard tiles off screen, and those that are higher // resolution than required, or lower res than required but not the base layer, so the base layer is always present. for (Map.Entry<Integer, List<Tile>> tileMapEntry : tileMap.entrySet()) { for (Tile tile : tileMapEntry.getValue()) { if (tile.sampleSize < sampleSize || (tile.sampleSize > sampleSize && tile.sampleSize != fullImageSampleSize)) { tile.visible = false; if (tile.bitmap != null) { tile.bitmap.recycle(); tile.bitmap = null; } } if (tile.sampleSize == sampleSize) { if (RectF.intersects(sVisRect, convertRect(tile.sRect))) { tile.visible = true; if (!tile.loading && tile.bitmap == null && load) { BitmapTileTask task = new BitmapTileTask(this, decoder, decoderLock, tile); task.execute(); } } else if (tile.sampleSize != fullImageSampleSize) { tile.visible = false; if (tile.bitmap != null) { tile.bitmap.recycle(); tile.bitmap = null; } } } else if (tile.sampleSize == fullImageSampleSize) { tile.visible = true; } } } }
From source file:com.bizcom.vc.widget.cus.SubsamplingScaleImageView.java
/** * Loads the optimum tiles for display at the current scale and translate, * so the screen can be filled with tiles that are at least as high * resolution as the screen. Frees up bitmaps that are now off the screen. * //from w w w . j a v a 2 s .c o m * @param load * Whether to load the new tiles needed. Use false while * scrolling/panning for performance. */ private void refreshRequiredTiles(boolean load) { int sampleSize = Math.min(fullImageSampleSize, calculateInSampleSize()); RectF vVisRect = new RectF(0, 0, getWidth(), getHeight()); RectF sVisRect = viewToSourceRect(vVisRect); // Load tiles of the correct sample size that are on screen. Discard // tiles off screen, and those that are higher // resolution than required, or lower res than required but not the base // layer, so the base layer is always present. for (Map.Entry<Integer, List<Tile>> tileMapEntry : tileMap.entrySet()) { for (Tile tile : tileMapEntry.getValue()) { if (tile.sampleSize < sampleSize || (tile.sampleSize > sampleSize && tile.sampleSize != fullImageSampleSize)) { tile.visible = false; if (tile.bitmap != null) { tile.bitmap.recycle(); tile.bitmap = null; } } if (tile.sampleSize == sampleSize) { if (RectF.intersects(sVisRect, convertRect(tile.sRect))) { tile.visible = true; if (!tile.loading && tile.bitmap == null && load) { BitmapTileTask task = new BitmapTileTask(this, decoder, decoderLock, tile); task.execute(); } } else if (tile.sampleSize != fullImageSampleSize) { tile.visible = false; if (tile.bitmap != null) { tile.bitmap.recycle(); tile.bitmap = null; } } } else if (tile.sampleSize == fullImageSampleSize) { tile.visible = true; } } } }