public synchronized void adjustMatrix(float diffX, float diffY, float scaleFactor, Dimension mapViewDimension, float pivotDistanceX, float pivotDistanceY) { if (this.dimension == null) { return; } this.matrix.reset(); centerFrameBufferToMapView(mapViewDimension); if (pivotDistanceX == 0 && pivotDistanceY == 0) { // only translate the matrix if we are not zooming around a pivot, // the translation happens only once the zoom is finished. this.matrix.translate(diffX, diffY); } scale(scaleFactor, pivotDistanceX, pivotDistanceY); }
public void adjustMatrix(float diffX, float diffY, float scaleFactor, Dimension mapViewDimension, float pivotDistanceX, float pivotDistanceY) { synchronized (this.matrix) { if (this.dimension == null) { return; } this.matrix.reset(); centerFrameBufferToMapView(mapViewDimension); if (pivotDistanceX == 0 && pivotDistanceY == 0) { // only translate the matrix if we are not zooming around a pivot, // the translation happens only once the zoom is finished. this.matrix.translate(diffX, diffY); } scale(scaleFactor, pivotDistanceX, pivotDistanceY); } }
@Override public void draw(Canvas canvas, Point origin, Matrix matrix, Filter filter) { matrix.reset(); // We cast to int for pixel perfect positioning matrix.translate((int) (this.xy.x - origin.x + boundary.left), (int) (this.xy.y - origin.y + boundary.top)); if (theta != 0 && alignCenter) { matrix.rotate(theta, (float) -boundary.left, (float) -boundary.top); } else { matrix.rotate(theta); } canvas.drawBitmap(this.symbol, matrix, filter); } }
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(); } } }
public synchronized void adjustMatrix(float diffX, float diffY, float scaleFactor, Dimension mapViewDimension, float pivotDistanceX, float pivotDistanceY) { if (this.dimension == null) { return; } this.matrix.reset(); centerFrameBufferToMapView(mapViewDimension); if (pivotDistanceX == 0 && pivotDistanceY == 0) { // only translate the matrix if we are not zooming around a pivot, // the translation happens only once the zoom is finished. this.matrix.translate(diffX, diffY); } scale(scaleFactor, pivotDistanceX, pivotDistanceY); }
public void adjustMatrix(float diffX, float diffY, float scaleFactor, Dimension mapViewDimension, float pivotDistanceX, float pivotDistanceY) { synchronized (this.matrix) { if (this.dimension == null) { return; } this.matrix.reset(); centerFrameBufferToMapView(mapViewDimension); if (pivotDistanceX == 0 && pivotDistanceY == 0) { // only translate the matrix if we are not zooming around a pivot, // the translation happens only once the zoom is finished. this.matrix.translate(diffX, diffY); } scale(scaleFactor, pivotDistanceX, pivotDistanceY); } }
@Override public void draw(Canvas canvas, Point origin, Matrix matrix, Filter filter) { matrix.reset(); // We cast to int for pixel perfect positioning matrix.translate((int) (this.xy.x - origin.x + boundary.left), (int) (this.xy.y - origin.y + boundary.top)); if (theta != 0 && alignCenter) { matrix.rotate(theta, (float) -boundary.left, (float) -boundary.top); } else { matrix.rotate(theta); } canvas.drawBitmap(this.symbol, matrix, filter); } }
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(); } } }