List of usage examples for java.awt.geom AffineTransform TYPE_IDENTITY
int TYPE_IDENTITY
To view the source code for java.awt.geom AffineTransform TYPE_IDENTITY.
Click Source Link
From source file:ExtendedGeneralPath.java
/** * Delegates to the enclosed <code>GeneralPath</code>. *///ww w . j a v a 2s. co m public void transform(AffineTransform at) { if (at.getType() != AffineTransform.TYPE_IDENTITY) throw new IllegalArgumentException("ExtendedGeneralPaths can not be transformed"); }
From source file:org.eclipse.birt.chart.device.svg.SVGGraphics2D.java
protected Element createGeneralPath(Shape path) { Element elem = createShape(path); if (transforms.getType() != AffineTransform.TYPE_IDENTITY) { double[] matrix = new double[6]; transforms.getMatrix(matrix);/*ww w . j ava 2 s . c o m*/ elem.setAttribute("transform", "matrix(" + toString(matrix, ',') + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return elem; }
From source file:org.eclipse.birt.chart.device.svg.SVGGraphics2D.java
protected Element createText(String text) { // #232718 to support bidi boolean bRtl = false; if (text.length() > 0) { int iEnd = text.length(); if (chPDF == text.charAt(text.length() - 1)) { iEnd--;//from w ww . j av a2 s . c o m } if (chRLE == text.charAt(0)) { bRtl = true; text = text.substring(1, iEnd); } } Element elem = dom.createElement("text"); //$NON-NLS-1$ elem.appendChild(dom.createTextNode(text)); switch (getFont().getStyle()) { case Font.BOLD: elem.setAttribute("font-weight", "bold"); //$NON-NLS-1$ //$NON-NLS-2$ break; case Font.ITALIC: elem.setAttribute("font-style", "italic"); //$NON-NLS-1$ //$NON-NLS-2$ break; case (Font.BOLD + Font.ITALIC): elem.setAttribute("font-style", "italic"); //$NON-NLS-1$ //$NON-NLS-2$ elem.setAttribute("font-weight", "bold"); //$NON-NLS-1$ //$NON-NLS-2$ break; } String textDecorator = null; Map<TextAttribute, ?> attributes = getFont().getAttributes(); if (attributes.get(TextAttribute.UNDERLINE) == TextAttribute.UNDERLINE_ON) { textDecorator = "underline"; //$NON-NLS-1$ } if (attributes.get(TextAttribute.STRIKETHROUGH) == TextAttribute.STRIKETHROUGH_ON) { if (textDecorator == null) textDecorator = "line-through"; //$NON-NLS-1$ else textDecorator += ",line-through"; //$NON-NLS-1$ } if (textDecorator != null) elem.setAttribute("text-decoration", textDecorator); //$NON-NLS-1$ // for now just preserve space for text elements Bug 182159 elem.setAttribute("xml:space", "preserve"); //$NON-NLS-1$ //$NON-NLS-2$ elem.setAttribute("stroke", "none"); //$NON-NLS-1$ //$NON-NLS-2$ // Here we still use Font.getName() as font-family for SVG instead of // Font.getFaimly(), since if current code is running on linux and there // isn't a valid font family to fit the font setting in chart model, // the call of Font.getFamily() will get a default 'Dialog' font family, // it will caused that the svg in client system can't correct display // mulitple-characters text(Chinese, Jpanese and so on). // We just need to set the original font family setting of chart model // into svg document, if the font family is valid in client system // and can support current text character, it will correct display. elem.setAttribute("font-family", getFont().getName()); //$NON-NLS-1$ elem.setAttribute("font-size", Integer.toString(getFont().getSize())); //$NON-NLS-1$ String style = getRenderingStyle(RenderingHints.KEY_TEXT_ANTIALIASING); if (color != null) { String alpha = alphaToString(color); if (alpha != null) style += "fill-opacity:" + alpha + ";"; //$NON-NLS-1$ //$NON-NLS-2$ style += "fill:" + serializeToString(color) + ";"; //$NON-NLS-1$ //$NON-NLS-2$ } if (bRtl) { style += sStyleBidi; } elem.setAttribute("style", style); //$NON-NLS-1$ if (transforms.getType() != AffineTransform.TYPE_IDENTITY) { double[] matrix = new double[6]; transforms.getMatrix(matrix); elem.setAttribute("transform", "matrix(" + toString(matrix, ',') + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return elem; }
From source file:org.eclipse.birt.chart.device.svg.SVGGraphics2D.java
protected String getRenderingStyle(Object key) { Object value = renderingHints.get(key); if (key.equals(RenderingHints.KEY_TEXT_ANTIALIASING)) { if (value.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)) { // Adobe SVG viewer 3 bug. Rotated text with optimizelegibility // disappears. Replace // with optimizespeed for rotated text. if (transforms.getType() != AffineTransform.TYPE_IDENTITY) return "text-rendering:optimizeSpeed;";//$NON-NLS-1$ else/*w ww . j a va 2 s. c o m*/ return "text-rendering:optimizeLegibility;";//$NON-NLS-1$ } else // SVG always turns on antialias return ""; //$NON-NLS-1$ } return "";//$NON-NLS-1$ }
From source file:org.eclipse.birt.chart.device.svg.SVGGraphics2D.java
protected Element createElement(String id) { Element elem = dom.createElement(id); if (this.primitiveId != null) elem.setAttribute("id", primitiveId); //$NON-NLS-1$ if (transforms.getType() != AffineTransform.TYPE_IDENTITY) { double[] matrix = new double[6]; transforms.getMatrix(matrix);/*from w w w. j a v a 2 s .c o m*/ elem.setAttribute("transform", "matrix(" + toString(matrix, ',') + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return elem; }