Java Code Examples for sun.java2d.pipe.Region#getScaledRegion()
The following examples show how to use
sun.java2d.pipe.Region#getScaledRegion() .
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: WComponentPeer.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Applies the shape to the native component window. * @since 1.7 */ @Override public void applyShape(Region shape) { if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) { shapeLog.finer("*** INFO: Setting shape: PEER: " + this + "; TARGET: " + target + "; SHAPE: " + shape); } if (shape != null) { AffineTransform tx = winGraphicsConfig.getDefaultTransform(); double scaleX = tx.getScaleX(); double scaleY = tx.getScaleY(); if (scaleX != 1 || scaleY != 1) { shape = shape.getScaledRegion(scaleX, scaleY); } setRectangularShape(shape.getLoX(), shape.getLoY(), shape.getHiX(), shape.getHiY(), (shape.isRectangular() ? null : shape)); } else { setRectangularShape(0, 0, 0, 0, null); } }
Example 2
Source File: SunGraphics2D.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 3
Source File: SunGraphics2D.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 4
Source File: SunGraphics2D.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 5
Source File: SunGraphics2D.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 6
Source File: SunGraphics2D.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 7
Source File: SunGraphics2D.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 8
Source File: SunGraphics2D.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 9
Source File: SunGraphics2D.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 10
Source File: SunGraphics2D.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 11
Source File: SunGraphics2D.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 12
Source File: SunGraphics2D.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 13
Source File: SunGraphics2D.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 14
Source File: SunGraphics2D.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); x = constrainX = (int) transform.getTranslateX(); y = constrainY = (int) transform.getTranslateY(); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }
Example 15
Source File: XComponentPeer.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Applies the shape to the X-window. * @since 1.7 */ public void applyShape(Region shape) { if (XlibUtil.isShapingSupported()) { if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) { shapeLog.finer( "*** INFO: Setting shape: PEER: " + this + "; WINDOW: " + getWindow() + "; TARGET: " + target + "; SHAPE: " + shape); } XToolkit.awtLock(); try { if (shape != null) { int scale = getScale(); if (scale != 1) { shape = shape.getScaledRegion(scale, scale); } XlibWrapper.SetRectangularShape( XToolkit.getDisplay(), getWindow(), shape.getLoX(), shape.getLoY(), shape.getHiX(), shape.getHiY(), (shape.isRectangular() ? null : shape) ); } else { XlibWrapper.SetRectangularShape( XToolkit.getDisplay(), getWindow(), 0, 0, 0, 0, null ); } } finally { XToolkit.awtUnlock(); } } else { if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) { shapeLog.finer("*** WARNING: Shaping is NOT supported!"); } } }
Example 16
Source File: SunGraphics2D.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * Constrain rendering for lightweight objects. */ public void constrain(int x, int y, int w, int h, Region region) { if ((x | y) != 0) { translate(x, y); } if (transformState > TRANSFORM_TRANSLATESCALE) { clipRect(0, 0, w, h); return; } // changes parameters according to the current scale and translate. final double scaleX = transform.getScaleX(); final double scaleY = transform.getScaleY(); // [tav] rounding down affects aligning by insets in WWindowPeer.getGraphics x = constrainX = (int)Math.floor(transform.getTranslateX()); y = constrainY = (int)Math.floor(transform.getTranslateY()); w = Region.dimAdd(x, Region.clipScale(w, scaleX)); h = Region.dimAdd(y, Region.clipScale(h, scaleY)); Region c = constrainClip; if (c == null) { c = Region.getInstanceXYXY(x, y, w, h); } else { c = c.getIntersectionXYXY(x, y, w, h); } if (region != null) { region = region.getScaledRegion(scaleX, scaleY); region = region.getTranslatedRegion(x, y); c = c.getIntersection(region); } if (c == constrainClip) { // Common case to ignore return; } constrainClip = c; if (!devClip.isInsideQuickCheck(c)) { devClip = devClip.getIntersection(c); validateCompClip(); } }