this.paintStroke.setBitmapShaderShift(topLeftPoint); this.paintFill.setBitmapShaderShift(topLeftPoint);
@Override public synchronized void renderWay(RenderCallback renderCallback, final RenderContext renderContext, PolylineContainer way) { if (!bitmapCreated) { try { shaderBitmap = createBitmap(relativePathPrefix, src); } catch (IOException ioException) { // no-op } bitmapCreated = true; } Paint strokePaint = getStrokePaint(renderContext.rendererJob.tile.zoomLevel); if (shaderBitmap != null) { strokePaint.setBitmapShader(shaderBitmap); strokePaint.setBitmapShaderShift(way.getUpperLeft().getOrigin()); } Float dyScale = this.dyScaled.get(renderContext.rendererJob.tile.zoomLevel); if (dyScale == null) { dyScale = this.dy; } renderCallback.renderWay(renderContext, strokePaint, dyScale, this.level, way); }
this.paintStroke.setBitmapShaderShift(topLeftPoint);
@Override public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) { if (this.latLong == null || (this.paintStroke == null && this.paintFill == null)) { return; } double latitude = this.latLong.latitude; double longitude = this.latLong.longitude; long mapSize = MercatorProjection.getMapSize(zoomLevel, displayModel.getTileSize()); int pixelX = (int) (MercatorProjection.longitudeToPixelX(longitude, mapSize) - topLeftPoint.x); int pixelY = (int) (MercatorProjection.latitudeToPixelY(latitude, mapSize) - topLeftPoint.y); int radiusInPixel = getRadiusInPixels(latitude, zoomLevel); Rectangle canvasRectangle = new Rectangle(0, 0, canvas.getWidth(), canvas.getHeight()); if (!canvasRectangle.intersectsCircle(pixelX, pixelY, radiusInPixel)) { return; } if (this.paintStroke != null) { if (this.keepAligned) { this.paintStroke.setBitmapShaderShift(topLeftPoint); } canvas.drawCircle(pixelX, pixelY, radiusInPixel, this.paintStroke); } if (this.paintFill != null) { if (this.keepAligned) { this.paintFill.setBitmapShaderShift(topLeftPoint); } canvas.drawCircle(pixelX, pixelY, radiusInPixel, this.paintFill); } }
@Override public void renderWay(RenderCallback renderCallback, final RenderContext renderContext, PolylineContainer way) { synchronized (this) { // this needs to be synchronized as we potentially set a shift in the shader and // the shift is particular to the tile when rendered in multi-thread mode Paint fillPaint = getFillPaint(); if (shaderBitmap == null && !bitmapInvalid) { try { shaderBitmap = createBitmap(relativePathPrefix, src); if (shaderBitmap != null) { fillPaint.setBitmapShader(shaderBitmap); shaderBitmap.decrementRefCount(); } } catch (IOException ioException) { bitmapInvalid = true; } } fillPaint.setBitmapShaderShift(way.getUpperLeft().getOrigin()); renderCallback.renderArea(renderContext, fillPaint, getStrokePaint(renderContext.rendererJob.tile.zoomLevel), this.level, way); } }
@Override public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) { if (this.latLongs.isEmpty() || this.paintStroke == null) { return; } if (this.boundingBox != null && !this.boundingBox.intersects(boundingBox)) { return; } Iterator<LatLong> iterator = this.latLongs.iterator(); if (!iterator.hasNext()) { return; } LatLong latLong = iterator.next(); long mapSize = MercatorProjection.getMapSize(zoomLevel, displayModel.getTileSize()); float x = (float) (MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize) - topLeftPoint.x); float y = (float) (MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize) - topLeftPoint.y); Path path = this.graphicFactory.createPath(); path.moveTo(x, y); while (iterator.hasNext()) { latLong = iterator.next(); x = (float) (MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize) - topLeftPoint.x); y = (float) (MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize) - topLeftPoint.y); path.lineTo(x, y); } if (this.keepAligned) { this.paintStroke.setBitmapShaderShift(topLeftPoint); } canvas.drawPath(path, this.paintStroke); }
this.paintStroke.setBitmapShaderShift(topLeftPoint); this.paintFill.setBitmapShaderShift(topLeftPoint);
@Override public synchronized void renderWay(RenderCallback renderCallback, final RenderContext renderContext, PolylineContainer way) { if (!bitmapCreated) { try { shaderBitmap = createBitmap(relativePathPrefix, src); } catch (IOException ioException) { // no-op } bitmapCreated = true; } Paint strokePaint = getStrokePaint(renderContext.rendererJob.tile.zoomLevel); if (shaderBitmap != null) { strokePaint.setBitmapShader(shaderBitmap); strokePaint.setBitmapShaderShift(way.getUpperLeft().getOrigin()); } Float dyScale = this.dyScaled.get(renderContext.rendererJob.tile.zoomLevel); if (dyScale == null) { dyScale = this.dy; } renderCallback.renderWay(renderContext, strokePaint, dyScale, this.level, way); }
@Override public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) { if (this.latLong == null || (this.paintStroke == null && this.paintFill == null)) { return; } double latitude = this.latLong.latitude; double longitude = this.latLong.longitude; long mapSize = MercatorProjection.getMapSize(zoomLevel, displayModel.getTileSize()); int pixelX = (int) (MercatorProjection.longitudeToPixelX(longitude, mapSize) - topLeftPoint.x); int pixelY = (int) (MercatorProjection.latitudeToPixelY(latitude, mapSize) - topLeftPoint.y); int radiusInPixel = getRadiusInPixels(latitude, zoomLevel); Rectangle canvasRectangle = new Rectangle(0, 0, canvas.getWidth(), canvas.getHeight()); if (!canvasRectangle.intersectsCircle(pixelX, pixelY, radiusInPixel)) { return; } if (this.paintStroke != null) { if (this.keepAligned) { this.paintStroke.setBitmapShaderShift(topLeftPoint); } canvas.drawCircle(pixelX, pixelY, radiusInPixel, this.paintStroke); } if (this.paintFill != null) { if (this.keepAligned) { this.paintFill.setBitmapShaderShift(topLeftPoint); } canvas.drawCircle(pixelX, pixelY, radiusInPixel, this.paintFill); } }
@Override public void renderWay(RenderCallback renderCallback, final RenderContext renderContext, PolylineContainer way) { synchronized (this) { // this needs to be synchronized as we potentially set a shift in the shader and // the shift is particular to the tile when rendered in multi-thread mode Paint fillPaint = getFillPaint(); if (shaderBitmap == null && !bitmapInvalid) { try { shaderBitmap = createBitmap(relativePathPrefix, src); if (shaderBitmap != null) { fillPaint.setBitmapShader(shaderBitmap); shaderBitmap.decrementRefCount(); } } catch (IOException ioException) { bitmapInvalid = true; } } fillPaint.setBitmapShaderShift(way.getUpperLeft().getOrigin()); renderCallback.renderArea(renderContext, fillPaint, getStrokePaint(renderContext.rendererJob.tile.zoomLevel), this.level, way); } }