private Paint createTextPaint(Color color, float strokeWidth, Style style) { Paint paint = this.graphicFactory.createPaint(); paint.setColor(color); paint.setStrokeWidth(strokeWidth * this.scale); paint.setStyle(style); paint.setTypeface(FontFamily.DEFAULT, FontStyle.BOLD); paint.setTextSize(12 * this.scale); return paint; }
private Paint createScaleBarPaint(Color color, float strokeWidth, Style style) { Paint paint = this.graphicFactory.createPaint(); paint.setColor(color); paint.setStrokeWidth(strokeWidth * this.scale); paint.setStyle(style); paint.setStrokeCap(Cap.SQUARE); return paint; }
private static Paint createTextFront(GraphicFactory graphicFactory, DisplayModel displayModel) { Paint paint = graphicFactory.createPaint(); paint.setColor(Color.BLUE); paint.setTypeface(FontFamily.DEFAULT, FontStyle.BOLD); paint.setTextSize(12 * displayModel.getScaleFactor()); return paint; }
@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); } }
public MapScaleBar(IMapViewPosition mapViewPosition, MapViewDimension mapViewDimension, DisplayModel displayModel, GraphicFactory graphicFactory, int width, int height) { this.mapViewPosition = mapViewPosition; this.mapViewDimension = mapViewDimension; this.displayModel = displayModel; this.graphicFactory = graphicFactory; this.mapScaleBitmap = graphicFactory.createBitmap(width, height); this.scaleBarPosition = DEFAULT_SCALE_BAR_POSITION; this.mapScaleCanvas = graphicFactory.createCanvas(); this.mapScaleCanvas.setBitmap(this.mapScaleBitmap); this.distanceUnitAdapter = MetricUnitAdapter.INSTANCE; this.visible = true; this.redrawNeeded = true; }
@Override public void scaleStrokeWidth(float scaleFactor, byte zoomLevel) { if (this.scaleRadius) { this.renderRadiusScaled.put(zoomLevel, this.radius * scaleFactor); if (this.stroke != null) { Paint paint = graphicFactory.createPaint(stroke); paint.setStrokeWidth(this.strokeWidth * scaleFactor); strokes.put(zoomLevel, paint); } } }
/** * Free all resources */ public void destroy() { this.mapScaleBitmap.decrementRefCount(); this.mapScaleCanvas.destroy(); }
public CanvasRasterer(GraphicFactory graphicFactory) { this.canvas = graphicFactory.createCanvas(); this.path = graphicFactory.createPath(); this.symbolMatrix = graphicFactory.createMatrix(); }
Bitmap create() { if (dimension.width > 0 && dimension.height > 0) { Bitmap bitmap = factory.createBitmap(dimension.width, dimension.height, isTransparent); bitmap.setBackgroundColor(color); return bitmap; } return null; } }
@Override public void destroy() { if (this.bitmap != null) { this.bitmap.decrementRefCount(); } }
void centerFrameBufferToMapView(Dimension mapViewDimension) { float dx = (this.dimension.width - mapViewDimension.width) / -2f; float dy = (this.dimension.height - mapViewDimension.height) / -2f; this.matrix.translate(dx, dy); }
public LabelLayer(GraphicFactory graphicFactory, LabelStore labelStore) { this.labelStore = labelStore; this.matrix = graphicFactory.createMatrix(); this.lastLabelStoreVersion = -1; }
private void drawCircleContainer(ShapePaintContainer shapePaintContainer) { CircleContainer circleContainer = (CircleContainer) shapePaintContainer.shapeContainer; Point point = circleContainer.point; this.canvas.drawCircle((int) point.x, (int) point.y, (int) circleContainer.radius, shapePaintContainer.paint); }
private static Paint createTextBack(GraphicFactory graphicFactory, DisplayModel displayModel) { Paint paint = graphicFactory.createPaint(); paint.setColor(Color.WHITE); paint.setTypeface(FontFamily.DEFAULT, FontStyle.BOLD); paint.setTextSize(12 * displayModel.getScaleFactor()); paint.setStrokeWidth(4 * displayModel.getScaleFactor()); paint.setStyle(Style.STROKE); return paint; }
private static Paint createLineBack(GraphicFactory graphicFactory, DisplayModel displayModel) { Paint paint = graphicFactory.createPaint(); paint.setColor(Color.WHITE); paint.setStrokeWidth(4 * displayModel.getScaleFactor()); paint.setStyle(Style.STROKE); return paint; }
private static Paint createPaintFront(GraphicFactory graphicFactory, DisplayModel displayModel) { Paint paint = graphicFactory.createPaint(); paint.setColor(Color.RED); paint.setTypeface(FontFamily.DEFAULT, FontStyle.BOLD); paint.setTextSize(12 * displayModel.getScaleFactor()); return paint; }
@Override public synchronized void onDestroy() { if (this.bitmap != null) { this.bitmap.decrementRefCount(); } }
private static Paint createPaintBack(GraphicFactory graphicFactory, DisplayModel displayModel) { Paint paint = graphicFactory.createPaint(); paint.setColor(Color.WHITE); paint.setTypeface(FontFamily.DEFAULT, FontStyle.BOLD); paint.setTextSize(12 * displayModel.getScaleFactor()); paint.setStrokeWidth(2 * displayModel.getScaleFactor()); paint.setStyle(Style.STROKE); return paint; }
private void destroyBitmap() { if (bitmap != null) { bitmap.decrementRefCount(); bitmap = null; } }