Java Code Examples for java.awt.geom.AffineTransform#TYPE_GENERAL_ROTATION
The following examples show how to use
java.awt.geom.AffineTransform#TYPE_GENERAL_ROTATION .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WPathGraphics.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override protected void deviceFillRect(int x, int y, int width, int height, Color color) { /* * Transform to device coordinates */ AffineTransform deviceTransform = getTransform(); /* check if rotated or sheared */ int transformType = deviceTransform.getType(); boolean usePath = ((transformType & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); if (usePath) { fill(new Rectangle2D.Float(x, y, width, height)); return; } Point2D.Float tlc_pos = new Point2D.Float(x, y); deviceTransform.transform(tlc_pos, tlc_pos); Point2D.Float brc_pos = new Point2D.Float(x+width, y+height); deviceTransform.transform(brc_pos, brc_pos); float deviceWidth = (float) (brc_pos.getX() - tlc_pos.getX()); float deviceHeight = (float)(brc_pos.getY() - tlc_pos.getY()); WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); wPrinterJob.fillRect((float)tlc_pos.getX(), (float)tlc_pos.getY(), deviceWidth, deviceHeight, color); }
Example 2
Source File: WPathGraphics.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override protected void deviceFillRect(int x, int y, int width, int height, Color color) { /* * Transform to device coordinates */ AffineTransform deviceTransform = getTransform(); /* check if rotated or sheared */ int transformType = deviceTransform.getType(); boolean usePath = ((transformType & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); if (usePath) { fill(new Rectangle2D.Float(x, y, width, height)); return; } Point2D.Float tlc_pos = new Point2D.Float(x, y); deviceTransform.transform(tlc_pos, tlc_pos); Point2D.Float brc_pos = new Point2D.Float(x+width, y+height); deviceTransform.transform(brc_pos, brc_pos); float deviceWidth = (float) (brc_pos.getX() - tlc_pos.getX()); float deviceHeight = (float)(brc_pos.getY() - tlc_pos.getY()); WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); wPrinterJob.fillRect((float)tlc_pos.getX(), (float)tlc_pos.getY(), deviceWidth, deviceHeight, color); }
Example 3
Source File: ProxyGraphics2D.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Return true if drawing <code>img</code> will * invoke a Java2D bug (#4258675). The bug in question * occurs when a draw image call with a background color * parameter tries to render a sheared * or rotated image. The portions of the bounding * rectangle not covered by the sheared image * are incorrectly drawn with the background color. */ private boolean needToCopyBgColorImage(Image img) { boolean needToCopy; AffineTransform transform = getTransform(); return (transform.getType() & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0; }
Example 4
Source File: ProxyGraphics2D.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Return true if drawing {@code img} will * invoke a Java2D bug (#4258675). The bug in question * occurs when a draw image call with a background color * parameter tries to render a sheared * or rotated image. The portions of the bounding * rectangle not covered by the sheared image * are incorrectly drawn with the background color. */ private boolean needToCopyBgColorImage(Image img) { boolean needToCopy; AffineTransform transform = getTransform(); return (transform.getType() & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0; }
Example 5
Source File: WPathGraphics.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override protected void deviceFillRect(int x, int y, int width, int height, Color color) { /* * Transform to device coordinates */ AffineTransform deviceTransform = getTransform(); /* check if rotated or sheared */ int transformType = deviceTransform.getType(); boolean usePath = ((transformType & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); if (usePath) { fill(new Rectangle2D.Float(x, y, width, height)); return; } Point2D.Float tlc_pos = new Point2D.Float(x, y); deviceTransform.transform(tlc_pos, tlc_pos); Point2D.Float brc_pos = new Point2D.Float(x+width, y+height); deviceTransform.transform(brc_pos, brc_pos); float deviceWidth = (float) (brc_pos.getX() - tlc_pos.getX()); float deviceHeight = (float)(brc_pos.getY() - tlc_pos.getY()); WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); wPrinterJob.fillRect((float)tlc_pos.getX(), (float)tlc_pos.getY(), deviceWidth, deviceHeight, color); }
Example 6
Source File: WPathGraphics.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
protected void deviceFillRect(int x, int y, int width, int height, Color color) { /* * Transform to device coordinates */ AffineTransform deviceTransform = getTransform(); /* check if rotated or sheared */ int transformType = deviceTransform.getType(); boolean usePath = ((transformType & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); if (usePath) { fill(new Rectangle2D.Float(x, y, width, height)); return; } Point2D.Float tlc_pos = new Point2D.Float(x, y); deviceTransform.transform(tlc_pos, tlc_pos); Point2D.Float brc_pos = new Point2D.Float(x+width, y+height); deviceTransform.transform(brc_pos, brc_pos); float deviceWidth = (float) (brc_pos.getX() - tlc_pos.getX()); float deviceHeight = (float)(brc_pos.getY() - tlc_pos.getY()); WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); wPrinterJob.fillRect((float)tlc_pos.getX(), (float)tlc_pos.getY(), deviceWidth, deviceHeight, color); }
Example 7
Source File: ProxyGraphics2D.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Return true if drawing <code>img</code> will * invoke a Java2D bug (#4258675). The bug in question * occurs when a draw image call with a background color * parameter tries to render a sheared * or rotated image. The portions of the bounding * rectangle not covered by the sheared image * are incorrectly drawn with the background color. */ private boolean needToCopyBgColorImage(Image img) { boolean needToCopy; AffineTransform transform = getTransform(); return (transform.getType() & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0; }
Example 8
Source File: ProxyGraphics2D.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Return true if drawing <code>img</code> will * invoke a Java2D bug (#4258675). The bug in question * occurs when a draw image call with a background color * parameter tries to render a sheared * or rotated image. The portions of the bounding * rectangle not covered by the sheared image * are incorrectly drawn with the background color. */ private boolean needToCopyBgColorImage(Image img) { boolean needToCopy; AffineTransform transform = getTransform(); return (transform.getType() & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0; }
Example 9
Source File: WPathGraphics.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override protected void deviceFillRect(int x, int y, int width, int height, Color color) { /* * Transform to device coordinates */ AffineTransform deviceTransform = getTransform(); /* check if rotated or sheared */ int transformType = deviceTransform.getType(); boolean usePath = ((transformType & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); if (usePath) { fill(new Rectangle2D.Float(x, y, width, height)); return; } Point2D.Float tlc_pos = new Point2D.Float(x, y); deviceTransform.transform(tlc_pos, tlc_pos); Point2D.Float brc_pos = new Point2D.Float(x+width, y+height); deviceTransform.transform(brc_pos, brc_pos); float deviceWidth = (float) (brc_pos.getX() - tlc_pos.getX()); float deviceHeight = (float)(brc_pos.getY() - tlc_pos.getY()); WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); wPrinterJob.fillRect((float)tlc_pos.getX(), (float)tlc_pos.getY(), deviceWidth, deviceHeight, color); }
Example 10
Source File: WPathGraphics.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override protected void deviceFillRect(int x, int y, int width, int height, Color color) { /* * Transform to device coordinates */ AffineTransform deviceTransform = getTransform(); /* check if rotated or sheared */ int transformType = deviceTransform.getType(); boolean usePath = ((transformType & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); if (usePath) { fill(new Rectangle2D.Float(x, y, width, height)); return; } Point2D.Float tlc_pos = new Point2D.Float(x, y); deviceTransform.transform(tlc_pos, tlc_pos); Point2D.Float brc_pos = new Point2D.Float(x+width, y+height); deviceTransform.transform(brc_pos, brc_pos); float deviceWidth = (float) (brc_pos.getX() - tlc_pos.getX()); float deviceHeight = (float)(brc_pos.getY() - tlc_pos.getY()); WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); wPrinterJob.fillRect((float)tlc_pos.getX(), (float)tlc_pos.getY(), deviceWidth, deviceHeight, color); }
Example 11
Source File: ProxyGraphics2D.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Return true if drawing <code>img</code> will * invoke a Java2D bug (#4258675). The bug in question * occurs when a draw image call with a background color * parameter tries to render a sheared * or rotated image. The portions of the bounding * rectangle not covered by the sheared image * are incorrectly drawn with the background color. */ private boolean needToCopyBgColorImage(Image img) { boolean needToCopy; AffineTransform transform = getTransform(); return (transform.getType() & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0; }
Example 12
Source File: ProxyGraphics2D.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Return true if drawing <code>img</code> will * invoke a Java2D bug (#4258675). The bug in question * occurs when a draw image call with a background color * parameter tries to render a sheared * or rotated image. The portions of the bounding * rectangle not covered by the sheared image * are incorrectly drawn with the background color. */ private boolean needToCopyBgColorImage(Image img) { boolean needToCopy; AffineTransform transform = getTransform(); return (transform.getType() & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0; }
Example 13
Source File: WPathGraphics.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override protected void deviceFillRect(int x, int y, int width, int height, Color color) { /* * Transform to device coordinates */ AffineTransform deviceTransform = getTransform(); /* check if rotated or sheared */ int transformType = deviceTransform.getType(); boolean usePath = ((transformType & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); if (usePath) { fill(new Rectangle2D.Float(x, y, width, height)); return; } Point2D.Float tlc_pos = new Point2D.Float(x, y); deviceTransform.transform(tlc_pos, tlc_pos); Point2D.Float brc_pos = new Point2D.Float(x+width, y+height); deviceTransform.transform(brc_pos, brc_pos); float deviceWidth = (float) (brc_pos.getX() - tlc_pos.getX()); float deviceHeight = (float)(brc_pos.getY() - tlc_pos.getY()); WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); wPrinterJob.fillRect((float)tlc_pos.getX(), (float)tlc_pos.getY(), deviceWidth, deviceHeight, color); }
Example 14
Source File: XRUtils.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static boolean isTransformQuadrantRotated(AffineTransform tr) { return ((tr.getType() & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) == 0); }
Example 15
Source File: WPathGraphics.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Draw the bounding rectangle using transformed coordinates. */ @Override protected void deviceFrameRect(int x, int y, int width, int height, Color color) { AffineTransform deviceTransform = getTransform(); /* check if rotated or sheared */ int transformType = deviceTransform.getType(); boolean usePath = ((transformType & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); if (usePath) { draw(new Rectangle2D.Float(x, y, width, height)); return; } Stroke stroke = getStroke(); if (stroke instanceof BasicStroke) { BasicStroke lineStroke = (BasicStroke) stroke; int endCap = lineStroke.getEndCap(); int lineJoin = lineStroke.getLineJoin(); /* check for default style and try to optimize it by * calling the frameRect native function instead of using paths. */ if ((endCap == BasicStroke.CAP_SQUARE) && (lineJoin == BasicStroke.JOIN_MITER) && (lineStroke.getMiterLimit() ==10.0f)) { float lineWidth = lineStroke.getLineWidth(); Point2D.Float penSize = new Point2D.Float(lineWidth, lineWidth); deviceTransform.deltaTransform(penSize, penSize); float deviceLineWidth = Math.min(Math.abs(penSize.x), Math.abs(penSize.y)); /* transform upper left coordinate */ Point2D.Float ul_pos = new Point2D.Float(x, y); deviceTransform.transform(ul_pos, ul_pos); /* transform lower right coordinate */ Point2D.Float lr_pos = new Point2D.Float(x + width, y + height); deviceTransform.transform(lr_pos, lr_pos); float w = (float) (lr_pos.getX() - ul_pos.getX()); float h = (float)(lr_pos.getY() - ul_pos.getY()); WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); /* use selectStylePen, if supported */ if (wPrinterJob.selectStylePen(endCap, lineJoin, deviceLineWidth, color) == true) { wPrinterJob.frameRect((float)ul_pos.getX(), (float)ul_pos.getY(), w, h); } /* not supported, must be a Win 9x */ else { double lowerRes = Math.min(wPrinterJob.getXRes(), wPrinterJob.getYRes()); if ((deviceLineWidth/lowerRes) < MAX_THINLINE_INCHES) { /* use the default pen styles for thin pens. */ wPrinterJob.selectPen(deviceLineWidth, color); wPrinterJob.frameRect((float)ul_pos.getX(), (float)ul_pos.getY(), w, h); } else { draw(new Rectangle2D.Float(x, y, width, height)); } } } else { draw(new Rectangle2D.Float(x, y, width, height)); } } }
Example 16
Source File: XRUtils.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static boolean isTransformQuadrantRotated(AffineTransform tr) { return ((tr.getType() & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) == 0); }
Example 17
Source File: WPathGraphics.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Draw the bounding rectangle using transformed coordinates. */ protected void deviceFrameRect(int x, int y, int width, int height, Color color) { AffineTransform deviceTransform = getTransform(); /* check if rotated or sheared */ int transformType = deviceTransform.getType(); boolean usePath = ((transformType & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); if (usePath) { draw(new Rectangle2D.Float(x, y, width, height)); return; } Stroke stroke = getStroke(); if (stroke instanceof BasicStroke) { BasicStroke lineStroke = (BasicStroke) stroke; int endCap = lineStroke.getEndCap(); int lineJoin = lineStroke.getLineJoin(); /* check for default style and try to optimize it by * calling the frameRect native function instead of using paths. */ if ((endCap == BasicStroke.CAP_SQUARE) && (lineJoin == BasicStroke.JOIN_MITER) && (lineStroke.getMiterLimit() ==10.0f)) { float lineWidth = lineStroke.getLineWidth(); Point2D.Float penSize = new Point2D.Float(lineWidth, lineWidth); deviceTransform.deltaTransform(penSize, penSize); float deviceLineWidth = Math.min(Math.abs(penSize.x), Math.abs(penSize.y)); /* transform upper left coordinate */ Point2D.Float ul_pos = new Point2D.Float(x, y); deviceTransform.transform(ul_pos, ul_pos); /* transform lower right coordinate */ Point2D.Float lr_pos = new Point2D.Float(x + width, y + height); deviceTransform.transform(lr_pos, lr_pos); float w = (float) (lr_pos.getX() - ul_pos.getX()); float h = (float)(lr_pos.getY() - ul_pos.getY()); WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); /* use selectStylePen, if supported */ if (wPrinterJob.selectStylePen(endCap, lineJoin, deviceLineWidth, color) == true) { wPrinterJob.frameRect((float)ul_pos.getX(), (float)ul_pos.getY(), w, h); } /* not supported, must be a Win 9x */ else { double lowerRes = Math.min(wPrinterJob.getXRes(), wPrinterJob.getYRes()); if ((deviceLineWidth/lowerRes) < MAX_THINLINE_INCHES) { /* use the default pen styles for thin pens. */ wPrinterJob.selectPen(deviceLineWidth, color); wPrinterJob.frameRect((float)ul_pos.getX(), (float)ul_pos.getY(), w, h); } else { draw(new Rectangle2D.Float(x, y, width, height)); } } } else { draw(new Rectangle2D.Float(x, y, width, height)); } } }
Example 18
Source File: WPathGraphics.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Draw the bounding rectangle using transformed coordinates. */ protected void deviceFrameRect(int x, int y, int width, int height, Color color) { AffineTransform deviceTransform = getTransform(); /* check if rotated or sheared */ int transformType = deviceTransform.getType(); boolean usePath = ((transformType & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); if (usePath) { draw(new Rectangle2D.Float(x, y, width, height)); return; } Stroke stroke = getStroke(); if (stroke instanceof BasicStroke) { BasicStroke lineStroke = (BasicStroke) stroke; int endCap = lineStroke.getEndCap(); int lineJoin = lineStroke.getLineJoin(); /* check for default style and try to optimize it by * calling the frameRect native function instead of using paths. */ if ((endCap == BasicStroke.CAP_SQUARE) && (lineJoin == BasicStroke.JOIN_MITER) && (lineStroke.getMiterLimit() ==10.0f)) { float lineWidth = lineStroke.getLineWidth(); Point2D.Float penSize = new Point2D.Float(lineWidth, lineWidth); deviceTransform.deltaTransform(penSize, penSize); float deviceLineWidth = Math.min(Math.abs(penSize.x), Math.abs(penSize.y)); /* transform upper left coordinate */ Point2D.Float ul_pos = new Point2D.Float(x, y); deviceTransform.transform(ul_pos, ul_pos); /* transform lower right coordinate */ Point2D.Float lr_pos = new Point2D.Float(x + width, y + height); deviceTransform.transform(lr_pos, lr_pos); float w = (float) (lr_pos.getX() - ul_pos.getX()); float h = (float)(lr_pos.getY() - ul_pos.getY()); WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); /* use selectStylePen, if supported */ if (wPrinterJob.selectStylePen(endCap, lineJoin, deviceLineWidth, color) == true) { wPrinterJob.frameRect((float)ul_pos.getX(), (float)ul_pos.getY(), w, h); } /* not supported, must be a Win 9x */ else { double lowerRes = Math.min(wPrinterJob.getXRes(), wPrinterJob.getYRes()); if ((deviceLineWidth/lowerRes) < MAX_THINLINE_INCHES) { /* use the default pen styles for thin pens. */ wPrinterJob.selectPen(deviceLineWidth, color); wPrinterJob.frameRect((float)ul_pos.getX(), (float)ul_pos.getY(), w, h); } else { draw(new Rectangle2D.Float(x, y, width, height)); } } } else { draw(new Rectangle2D.Float(x, y, width, height)); } } }
Example 19
Source File: XRUtils.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public static boolean isTransformQuadrantRotated(AffineTransform tr) { return ((tr.getType() & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) == 0); }
Example 20
Source File: WPathGraphics.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * Draw the bounding rectangle using transformed coordinates. */ @Override protected void deviceFrameRect(int x, int y, int width, int height, Color color) { AffineTransform deviceTransform = getTransform(); /* check if rotated or sheared */ int transformType = deviceTransform.getType(); boolean usePath = ((transformType & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); if (usePath) { draw(new Rectangle2D.Float(x, y, width, height)); return; } Stroke stroke = getStroke(); if (stroke instanceof BasicStroke) { BasicStroke lineStroke = (BasicStroke) stroke; int endCap = lineStroke.getEndCap(); int lineJoin = lineStroke.getLineJoin(); /* check for default style and try to optimize it by * calling the frameRect native function instead of using paths. */ if ((endCap == BasicStroke.CAP_SQUARE) && (lineJoin == BasicStroke.JOIN_MITER) && (lineStroke.getMiterLimit() ==10.0f)) { float lineWidth = lineStroke.getLineWidth(); Point2D.Float penSize = new Point2D.Float(lineWidth, lineWidth); deviceTransform.deltaTransform(penSize, penSize); float deviceLineWidth = Math.min(Math.abs(penSize.x), Math.abs(penSize.y)); /* transform upper left coordinate */ Point2D.Float ul_pos = new Point2D.Float(x, y); deviceTransform.transform(ul_pos, ul_pos); /* transform lower right coordinate */ Point2D.Float lr_pos = new Point2D.Float(x + width, y + height); deviceTransform.transform(lr_pos, lr_pos); float w = (float) (lr_pos.getX() - ul_pos.getX()); float h = (float)(lr_pos.getY() - ul_pos.getY()); WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob(); /* use selectStylePen, if supported */ if (wPrinterJob.selectStylePen(endCap, lineJoin, deviceLineWidth, color) == true) { wPrinterJob.frameRect((float)ul_pos.getX(), (float)ul_pos.getY(), w, h); } /* not supported, must be a Win 9x */ else { double lowerRes = Math.min(wPrinterJob.getXRes(), wPrinterJob.getYRes()); if ((deviceLineWidth/lowerRes) < MAX_THINLINE_INCHES) { /* use the default pen styles for thin pens. */ wPrinterJob.selectPen(deviceLineWidth, color); wPrinterJob.frameRect((float)ul_pos.getX(), (float)ul_pos.getY(), w, h); } else { draw(new Rectangle2D.Float(x, y, width, height)); } } } else { draw(new Rectangle2D.Float(x, y, width, height)); } } }