void scale(float scaleFactor, float pivotDistanceX, float pivotDistanceY) { if (scaleFactor != 1) { final Point center = this.dimension.getCenter(); float pivotX = (float) (pivotDistanceX + center.x); float pivotY = (float) (pivotDistanceY + center.y); this.matrix.scale(scaleFactor, scaleFactor, pivotX, pivotY); } }
private void drawParentTileBitmap(Canvas canvas, Point point, Tile tile) { Tile cachedParentTile = getCachedParentTile(tile, 4); if (cachedParentTile != null) { Bitmap bitmap = this.tileCache.getImmediately(createJob(cachedParentTile)); if (bitmap != null) { int tileSize = this.displayModel.getTileSize(); long translateX = tile.getShiftX(cachedParentTile) * tileSize; long translateY = tile.getShiftY(cachedParentTile) * tileSize; byte zoomLevelDiff = (byte) (tile.zoomLevel - cachedParentTile.zoomLevel); float scaleFactor = (float) Math.pow(2, zoomLevelDiff); int x = (int) Math.round(point.x); int y = (int) Math.round(point.y); this.matrix.reset(); this.matrix.translate(x - translateX, y - translateY); this.matrix.scale(scaleFactor, scaleFactor); canvas.setClip(x, y, this.displayModel.getTileSize(), this.displayModel.getTileSize()); canvas.drawBitmap(bitmap, this.matrix, this.displayModel.getFilter()); canvas.resetClip(); bitmap.decrementRefCount(); } } }
void scale(float scaleFactor, float pivotDistanceX, float pivotDistanceY) { if (scaleFactor != 1) { final Point center = this.dimension.getCenter(); float pivotX = (float) (pivotDistanceX + center.x); float pivotY = (float) (pivotDistanceY + center.y); this.matrix.scale(scaleFactor, scaleFactor, pivotX, pivotY); } }
private void drawParentTileBitmap(Canvas canvas, Point point, Tile tile) { Tile cachedParentTile = getCachedParentTile(tile, 4); if (cachedParentTile != null) { Bitmap bitmap = this.tileCache.getImmediately(createJob(cachedParentTile)); if (bitmap != null) { int tileSize = this.displayModel.getTileSize(); long translateX = tile.getShiftX(cachedParentTile) * tileSize; long translateY = tile.getShiftY(cachedParentTile) * tileSize; byte zoomLevelDiff = (byte) (tile.zoomLevel - cachedParentTile.zoomLevel); float scaleFactor = (float) Math.pow(2, zoomLevelDiff); int x = (int) Math.round(point.x); int y = (int) Math.round(point.y); this.matrix.reset(); this.matrix.translate(x - translateX, y - translateY); this.matrix.scale(scaleFactor, scaleFactor); canvas.setClip(x, y, this.displayModel.getTileSize(), this.displayModel.getTileSize()); canvas.drawBitmap(bitmap, this.matrix, this.displayModel.getFilter()); canvas.resetClip(); bitmap.decrementRefCount(); } } }