@Override public void draw(Canvas canvas, Point origin, Matrix matrix, Filter filter) { Point adjustedStart = xy.offset(-origin.x, -origin.y); Point adjustedEnd = end.offset(-origin.x, -origin.y); if (this.paintBack != null) { int color = this.paintBack.getColor(); if (filter != Filter.NONE) { this.paintBack.setColor(GraphicUtils.filterColor(color, filter)); } canvas.drawTextRotated(text, (int) (adjustedStart.x), (int) (adjustedStart.y), (int) (adjustedEnd.x), (int) (adjustedEnd.y), this.paintBack); if (filter != Filter.NONE) { this.paintBack.setColor(color); } } int color = this.paintFront.getColor(); if (filter != Filter.NONE) { this.paintFront.setColor(GraphicUtils.filterColor(color, filter)); } canvas.drawTextRotated(text, (int) (adjustedStart.x), (int) (adjustedStart.y), (int) (adjustedEnd.x), (int) (adjustedEnd.y), this.paintFront); if (filter != Filter.NONE) { this.paintFront.setColor(color); } }
void fill(int color) { if (GraphicUtils.getAlpha(color) > 0) { this.canvas.fillColor(color); } }
AwtResourceBitmap(InputStream inputStream, float scaleFactor, int width, int height, int percent) throws IOException { super(inputStream); float[] newSize = GraphicUtils.imageSize(getWidth(), getHeight(), scaleFactor, width, height, percent); scaleTo((int) newSize[0], (int) newSize[1]); }
int colorF = this.paintFront.getColor(); if (filter != Filter.NONE) { this.paintFront.setColor(GraphicUtils.filterColor(colorF, filter)); int colorB = this.paintBack.getColor(); if (filter != Filter.NONE) { this.paintBack.setColor(GraphicUtils.filterColor(colorB, filter)); int color = this.paintBack.getColor(); if (filter != Filter.NONE) { this.paintBack.setColor(GraphicUtils.filterColor(color, filter)); this.paintFront.setColor(GraphicUtils.filterColor(color, filter));
public static BufferedImage getResourceBitmap(InputStream inputStream, String name, float scaleFactor, float defaultSize, int width, int height, int percent) throws IOException { try { URI uri = SVGCache.getSVGUniverse().loadSVG(inputStream, name); SVGDiagram diagram = SVGCache.getSVGUniverse().getDiagram(uri); double scale = scaleFactor / Math.sqrt((diagram.getHeight() * diagram.getWidth()) / defaultSize); float[] bmpSize = GraphicUtils.imageSize(diagram.getWidth(), diagram.getHeight(), (float) scale, width, height, percent); SVGIcon icon = new SVGIcon(); icon.setAntiAlias(true); icon.setAutosize(SVGIcon.AUTOSIZE_STRETCH); icon.setPreferredSize(new Dimension((int) bmpSize[0], (int) bmpSize[1])); icon.setSvgURI(uri); BufferedImage bufferedImage = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); icon.paintIcon(null, bufferedImage.createGraphics(), 0, 0); return bufferedImage; } catch (Exception e) { throw new IOException(e); } }
void fill(int color) { if (GraphicUtils.getAlpha(color) > 0) { this.canvas.fillColor(color); } }
int color = this.backLayout.getPaint().getColor(); if (filter != Filter.NONE) { this.backLayout.getPaint().setColor(GraphicUtils.filterColor(color, filter)); this.frontLayout.getPaint().setColor(GraphicUtils.filterColor(color, filter)); int color = this.paintBack.getColor(); if (filter != Filter.NONE) { this.paintBack.setColor(GraphicUtils.filterColor(color, filter)); this.paintFront.setColor(GraphicUtils.filterColor(color, filter));
throw new IOException("BitmapFactory failed to decodeStream"); float[] newSize = GraphicUtils.imageSize(bitmap.getWidth(), bitmap.getHeight(), scaleFactor, width, height, percent); if ((int) newSize[0] != bitmap.getWidth() || (int) newSize[1] != bitmap.getHeight()) bitmap = Bitmap.createScaledBitmap(bitmap, (int) newSize[0], (int) newSize[1], true);
@Override public void draw(Canvas canvas, Point origin, Matrix matrix, Filter filter) { Point adjustedStart = xy.offset(-origin.x, -origin.y); Point adjustedEnd = end.offset(-origin.x, -origin.y); if (this.paintBack != null) { int color = this.paintBack.getColor(); if (filter != Filter.NONE) { this.paintBack.setColor(GraphicUtils.filterColor(color, filter)); } canvas.drawTextRotated(text, (int) (adjustedStart.x), (int) (adjustedStart.y), (int) (adjustedEnd.x), (int) (adjustedEnd.y), this.paintBack); if (filter != Filter.NONE) { this.paintBack.setColor(color); } } int color = this.paintFront.getColor(); if (filter != Filter.NONE) { this.paintFront.setColor(GraphicUtils.filterColor(color, filter)); } canvas.drawTextRotated(text, (int) (adjustedStart.x), (int) (adjustedStart.y), (int) (adjustedEnd.x), (int) (adjustedEnd.y), this.paintFront); if (filter != Filter.NONE) { this.paintFront.setColor(color); } }
public static android.graphics.Bitmap getResourceBitmap(InputStream inputStream, float scaleFactor, float defaultSize, int width, int height, int percent) throws IOException { try { // not in any cache, so need to render svg SVG svg = SVG.getFromInputStream(inputStream); Picture picture = svg.renderToPicture(); double scale = scaleFactor / Math.sqrt((picture.getHeight() * picture.getWidth()) / defaultSize); float[] bmpSize = GraphicUtils.imageSize(picture.getWidth(), picture.getHeight(), (float) scale, width, height, percent); android.graphics.Bitmap bitmap = android.graphics.Bitmap.createBitmap((int) Math.ceil(bmpSize[0]), (int) Math.ceil(bmpSize[1]), AndroidGraphicFactory.TRANSPARENT_BITMAP); Canvas canvas = new Canvas(bitmap); canvas.drawPicture(picture, new RectF(0, 0, bmpSize[0], bmpSize[1])); return bitmap; } catch (Exception e) { throw new IOException(e); } }
int colorF = this.paintFront.getColor(); if (filter != Filter.NONE) { this.paintFront.setColor(GraphicUtils.filterColor(colorF, filter)); int colorB = this.paintBack.getColor(); if (filter != Filter.NONE) { this.paintBack.setColor(GraphicUtils.filterColor(colorB, filter)); int color = this.paintBack.getColor(); if (filter != Filter.NONE) { this.paintBack.setColor(GraphicUtils.filterColor(color, filter)); this.paintFront.setColor(GraphicUtils.filterColor(color, filter));