sun.awt.SunHints Java Examples
The following examples show how to use
sun.awt.SunHints.
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: AAShapePipe.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) { final boolean adjust = (bs != null && sg.strokeHint != SunHints.INTVAL_STROKE_PURE); final boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED); final TileState ts = TILE_STATE_PROVIDER.acquire(); try { final int[] abox = ts.abox; final AATileGenerator aatg = RDR_ENGINE.getAATileGenerator(s, sg.transform, sg.getCompClip(), bs, thin, adjust, abox); if (aatg != null) { renderTiles(sg, s, aatg, abox, ts); } } finally { TILE_STATE_PROVIDER.release(ts); } }
Example #2
Source File: LoopPipe.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static ShapeSpanIterator getStrokeSpans(SunGraphics2D sg2d, Shape s) { ShapeSpanIterator sr = new ShapeSpanIterator(false); try { sr.setOutputArea(sg2d.getCompClip()); sr.setRule(PathIterator.WIND_NON_ZERO); BasicStroke bs = (BasicStroke) sg2d.stroke; boolean thin = (sg2d.strokeState <= SunGraphics2D.STROKE_THINDASHED); boolean normalize = (sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE); RenderEngine.strokeTo(s, sg2d.transform, bs, thin, normalize, false, sr); } catch (Throwable t) { sr.dispose(); sr = null; throw new InternalError("Unable to Stroke shape ("+ t.getMessage()+")", t); } return sr; }
Example #3
Source File: GlyphListLoopPipe.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl, int aaHint) { switch (aaHint) { case SunHints.INTVAL_TEXT_ANTIALIAS_OFF: sg2d.loops.drawGlyphListLoop. DrawGlyphList(sg2d, sg2d.surfaceData, gl); return; case SunHints.INTVAL_TEXT_ANTIALIAS_ON: sg2d.loops.drawGlyphListAALoop. DrawGlyphListAA(sg2d, sg2d.surfaceData, gl); return; case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB: case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB: sg2d.loops.drawGlyphListLCDLoop. DrawGlyphListLCD(sg2d,sg2d.surfaceData, gl); return; } }
Example #4
Source File: AAShapePipe.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) { boolean adjust = (bs != null && sg.strokeHint != SunHints.INTVAL_STROKE_PURE); boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED); Region clip = sg.getCompClip(); int abox[] = new int[4]; AATileGenerator aatg = renderengine.getAATileGenerator(s, sg.transform, clip, bs, thin, adjust, abox); if (aatg == null) { // Nothing to render return; } renderTiles(sg, s, aatg, abox); }
Example #5
Source File: AAShapePipe.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) { final boolean adjust = (bs != null && sg.strokeHint != SunHints.INTVAL_STROKE_PURE); final boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED); final TileState ts = TILE_STATE_PROVIDER.acquire(); try { final int[] abox = ts.abox; final AATileGenerator aatg = RDR_ENGINE.getAATileGenerator(s, sg.transform, sg.getCompClip(), bs, thin, adjust, abox); if (aatg != null) { renderTiles(sg, s, aatg, abox, ts); } } finally { TILE_STATE_PROVIDER.release(ts); } }
Example #6
Source File: GlyphListLoopPipe.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl, int aaHint) { switch (aaHint) { case SunHints.INTVAL_TEXT_ANTIALIAS_OFF: sg2d.loops.drawGlyphListLoop. DrawGlyphList(sg2d, sg2d.surfaceData, gl); return; case SunHints.INTVAL_TEXT_ANTIALIAS_ON: sg2d.loops.drawGlyphListAALoop. DrawGlyphListAA(sg2d, sg2d.surfaceData, gl); return; case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB: case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB: sg2d.loops.drawGlyphListLCDLoop. DrawGlyphListLCD(sg2d,sg2d.surfaceData, gl); return; } }
Example #7
Source File: AAShapePipe.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) { boolean adjust = (bs != null && sg.strokeHint != SunHints.INTVAL_STROKE_PURE); boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED); Region clip = sg.getCompClip(); int abox[] = new int[4]; AATileGenerator aatg = renderengine.getAATileGenerator(s, sg.transform, clip, bs, thin, adjust, abox); if (aatg == null) { // Nothing to render return; } renderTiles(sg, s, aatg, abox); }
Example #8
Source File: AAShapePipe.java From Bytecoder with Apache License 2.0 | 6 votes |
public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) { final boolean adjust = (bs != null && sg.strokeHint != SunHints.INTVAL_STROKE_PURE); final boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED); final TileState ts = TILE_STATE_PROVIDER.acquire(); try { final int[] abox = ts.abox; final AATileGenerator aatg = RDR_ENGINE.getAATileGenerator(s, sg.transform, sg.getCompClip(), bs, thin, adjust, abox); if (aatg != null) { renderTiles(sg, s, aatg, abox, ts); } } finally { TILE_STATE_PROVIDER.release(ts); } }
Example #9
Source File: AAShapePipe.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) { final boolean adjust = (bs != null && sg.strokeHint != SunHints.INTVAL_STROKE_PURE); final boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED); final TileState ts = tileStateProvider.acquire(); try { final int[] abox = ts.abox; final AATileGenerator aatg = renderengine.getAATileGenerator(s, sg.transform, sg.getCompClip(), bs, thin, adjust, abox); if (aatg != null) { renderTiles(sg, s, aatg, abox, ts); } } finally { tileStateProvider.release(ts); } }
Example #10
Source File: X11TextRenderer.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void drawGlyphVector(SunGraphics2D sg2d, GlyphVector g, float x, float y) { FontRenderContext frc = g.getFontRenderContext(); FontInfo info = sg2d.getGVFontInfo(g.getFont(), frc); switch (info.aaHint) { case SunHints.INTVAL_TEXT_ANTIALIAS_OFF: super.drawGlyphVector(sg2d, g, x, y); return; case SunHints.INTVAL_TEXT_ANTIALIAS_ON: sg2d.surfaceData.aaTextRenderer.drawGlyphVector(sg2d, g, x, y); return; case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB: case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB: sg2d.surfaceData.lcdTextRenderer.drawGlyphVector(sg2d, g, x, y); return; default: } }
Example #11
Source File: X11TextRenderer.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void drawGlyphVector(SunGraphics2D sg2d, GlyphVector g, float x, float y) { FontRenderContext frc = g.getFontRenderContext(); FontInfo info = sg2d.getGVFontInfo(g.getFont(), frc); switch (info.aaHint) { case SunHints.INTVAL_TEXT_ANTIALIAS_OFF: super.drawGlyphVector(sg2d, g, x, y); return; case SunHints.INTVAL_TEXT_ANTIALIAS_ON: SurfaceData.aaTextRenderer.drawGlyphVector(sg2d, g, x, y); return; case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB: case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB: SurfaceData.lcdTextRenderer.drawGlyphVector(sg2d, g, x, y); return; default: } }
Example #12
Source File: AAShapePipe.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) { boolean adjust = (bs != null && sg.strokeHint != SunHints.INTVAL_STROKE_PURE); boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED); Region clip = sg.getCompClip(); int abox[] = new int[4]; AATileGenerator aatg = renderengine.getAATileGenerator(s, sg.transform, clip, bs, thin, adjust, abox); if (aatg == null) { // Nothing to render return; } renderTiles(sg, s, aatg, abox); }
Example #13
Source File: X11TextRenderer.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void drawGlyphVector(SunGraphics2D sg2d, GlyphVector g, float x, float y) { FontRenderContext frc = g.getFontRenderContext(); FontInfo info = sg2d.getGVFontInfo(g.getFont(), frc); switch (info.aaHint) { case SunHints.INTVAL_TEXT_ANTIALIAS_OFF: super.drawGlyphVector(sg2d, g, x, y); return; case SunHints.INTVAL_TEXT_ANTIALIAS_ON: sg2d.surfaceData.aaTextRenderer.drawGlyphVector(sg2d, g, x, y); return; case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB: case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB: sg2d.surfaceData.lcdTextRenderer.drawGlyphVector(sg2d, g, x, y); return; default: } }
Example #14
Source File: SunGraphics2D.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Sets the preferences for the rendering algorithms. * Hint categories include controls for rendering quality and * overall time/quality trade-off in the rendering process. * @param hints The rendering hints to be set * @see RenderingHints */ public void setRenderingHints(Map<?,?> hints) { this.hints = null; renderHint = SunHints.INTVAL_RENDER_DEFAULT; antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF; textAntialiasHint = SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT; fractionalMetricsHint = SunHints.INTVAL_FRACTIONALMETRICS_OFF; lcdTextContrast = lcdTextContrastDefaultValue; interpolationHint = -1; interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR; boolean customHintPresent = false; Iterator<?> iter = hints.keySet().iterator(); while (iter.hasNext()) { Object key = iter.next(); if (key == SunHints.KEY_RENDERING || key == SunHints.KEY_ANTIALIASING || key == SunHints.KEY_TEXT_ANTIALIASING || key == SunHints.KEY_FRACTIONALMETRICS || key == SunHints.KEY_TEXT_ANTIALIAS_LCD_CONTRAST || key == SunHints.KEY_STROKE_CONTROL || key == SunHints.KEY_INTERPOLATION) { setRenderingHint((Key) key, hints.get(key)); } else { customHintPresent = true; } } if (customHintPresent) { this.hints = makeHints(hints); } invalidatePipe(); }
Example #15
Source File: OutlineTextRenderer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void drawGlyphVector(SunGraphics2D g2d, GlyphVector gv, float x, float y) { Shape s = gv.getOutline(x, y); int prevaaHint = - 1; FontRenderContext frc = gv.getFontRenderContext(); boolean aa = frc.isAntiAliased(); /* aa will be true if any AA mode has been specified. * ie for LCD and 'gasp' modes too. * We will check if 'gasp' has resolved AA to be "OFF", and * in all other cases (ie AA ON and all LCD modes) use AA outlines. */ if (aa) { if (g2d.getGVFontInfo(gv.getFont(), frc).aaHint == SunHints.INTVAL_TEXT_ANTIALIAS_OFF) { aa = false; } } if (aa && g2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) { prevaaHint = g2d.antialiasHint; g2d.antialiasHint = SunHints.INTVAL_ANTIALIAS_ON; g2d.validatePipe(); } else if (!aa && g2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_OFF) { prevaaHint = g2d.antialiasHint; g2d.antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF; g2d.validatePipe(); } g2d.fill(s); if (prevaaHint != -1) { g2d.antialiasHint = prevaaHint; g2d.validatePipe(); } }
Example #16
Source File: PixelToParallelogramConverter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void fillRectangle(SunGraphics2D sg2d, double rx, double ry, double rw, double rh) { double px, py; double dx1, dy1, dx2, dy2; AffineTransform txform = sg2d.transform; dx1 = txform.getScaleX(); dy1 = txform.getShearY(); dx2 = txform.getShearX(); dy2 = txform.getScaleY(); px = rx * dx1 + ry * dx2 + txform.getTranslateX(); py = rx * dy1 + ry * dy2 + txform.getTranslateY(); dx1 *= rw; dy1 *= rw; dx2 *= rh; dy2 *= rh; if (adjustfill && sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM && sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE) { double newx = normalize(px); double newy = normalize(py); dx1 = normalize(px + dx1) - newx; dy1 = normalize(py + dy1) - newy; dx2 = normalize(px + dx2) - newx; dy2 = normalize(py + dy2) - newy; px = newx; py = newy; } outrenderer.fillParallelogram(sg2d, rx, ry, rx+rw, ry+rh, px, py, dx1, dy1, dx2, dy2); }
Example #17
Source File: SunGraphics2D.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void setFont(Font font) { /* replacing the reference equality test font != this.font with * !font.equals(this.font) did not yield any measurable difference * in testing, but there may be yet to be identified cases where it * is beneficial. */ if (font != null && font!=this.font/*!font.equals(this.font)*/) { /* In the GASP AA case the textpipe depends on the glyph size * as determined by graphics and font transforms as well as the * font size, and information in the font. But we may invalidate * the pipe only to find that it made no difference. * Deferring pipe invalidation to checkFontInfo won't work because * when called we may already be rendering to the wrong pipe. * So, if the font is transformed, or the graphics has more than * a simple scale, we'll take that as enough of a hint to * revalidate everything. But if they aren't we will * use the font's point size to query the gasp table and see if * what it says matches what's currently being used, in which * case there's no need to invalidate the textpipe. * This should be sufficient for all typical uses cases. */ if (textAntialiasHint == SunHints.INTVAL_TEXT_ANTIALIAS_GASP && textpipe != invalidpipe && (transformState > TRANSFORM_ANY_TRANSLATE || font.isTransformed() || fontInfo == null || // Precaution, if true shouldn't get here (fontInfo.aaHint == SunHints.INTVAL_TEXT_ANTIALIAS_ON) != FontUtilities.getFont2D(font). useAAForPtSize(font.getSize()))) { textpipe = invalidpipe; } this.font = font; this.fontMetrics = null; this.validFontInfo = false; } }
Example #18
Source File: SunGraphics2D.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Adds a number of preferences for the rendering algorithms. * Hint categories include controls for rendering quality and * overall time/quality trade-off in the rendering process. * @param hints The rendering hints to be set * @see RenderingHints */ public void addRenderingHints(Map<?,?> hints) { boolean customHintPresent = false; Iterator<?> iter = hints.keySet().iterator(); while (iter.hasNext()) { Object key = iter.next(); if (key == SunHints.KEY_RENDERING || key == SunHints.KEY_ANTIALIASING || key == SunHints.KEY_TEXT_ANTIALIASING || key == SunHints.KEY_FRACTIONALMETRICS || key == SunHints.KEY_TEXT_ANTIALIAS_LCD_CONTRAST || key == SunHints.KEY_STROKE_CONTROL || key == SunHints.KEY_INTERPOLATION) { setRenderingHint((Key) key, hints.get(key)); } else { customHintPresent = true; } } if (customHintPresent) { if (this.hints == null) { this.hints = makeHints(hints); } else { this.hints.putAll(hints); } } }
Example #19
Source File: OutlineTextRenderer.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void drawGlyphVector(SunGraphics2D g2d, GlyphVector gv, float x, float y) { Shape s = gv.getOutline(x, y); int prevaaHint = - 1; FontRenderContext frc = gv.getFontRenderContext(); boolean aa = frc.isAntiAliased(); /* aa will be true if any AA mode has been specified. * ie for LCD and 'gasp' modes too. * We will check if 'gasp' has resolved AA to be "OFF", and * in all other cases (ie AA ON and all LCD modes) use AA outlines. */ if (aa) { if (g2d.getGVFontInfo(gv.getFont(), frc).aaHint == SunHints.INTVAL_TEXT_ANTIALIAS_OFF) { aa = false; } } if (aa && g2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) { prevaaHint = g2d.antialiasHint; g2d.antialiasHint = SunHints.INTVAL_ANTIALIAS_ON; g2d.validatePipe(); } else if (!aa && g2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_OFF) { prevaaHint = g2d.antialiasHint; g2d.antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF; g2d.validatePipe(); } g2d.fill(s); if (prevaaHint != -1) { g2d.antialiasHint = prevaaHint; g2d.validatePipe(); } }
Example #20
Source File: SunGraphics2D.java From Bytecoder with Apache License 2.0 | 5 votes |
public void setFont(Font font) { /* replacing the reference equality test font != this.font with * !font.equals(this.font) did not yield any measurable difference * in testing, but there may be yet to be identified cases where it * is beneficial. */ if (font != null && font!=this.font/*!font.equals(this.font)*/) { /* In the GASP AA case the textpipe depends on the glyph size * as determined by graphics and font transforms as well as the * font size, and information in the font. But we may invalidate * the pipe only to find that it made no difference. * Deferring pipe invalidation to checkFontInfo won't work because * when called we may already be rendering to the wrong pipe. * So, if the font is transformed, or the graphics has more than * a simple scale, we'll take that as enough of a hint to * revalidate everything. But if they aren't we will * use the font's point size to query the gasp table and see if * what it says matches what's currently being used, in which * case there's no need to invalidate the textpipe. * This should be sufficient for all typical uses cases. */ if (textAntialiasHint == SunHints.INTVAL_TEXT_ANTIALIAS_GASP && textpipe != invalidpipe && (transformState > TRANSFORM_ANY_TRANSLATE || font.isTransformed() || fontInfo == null || // Precaution, if true shouldn't get here (fontInfo.aaHint == SunHints.INTVAL_TEXT_ANTIALIAS_ON) != FontUtilities.getFont2D(font). useAAForPtSize(font.getSize()))) { textpipe = invalidpipe; } this.font = font; this.fontMetrics = null; this.validFontInfo = false; } }
Example #21
Source File: FontConfigManager.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static Object getFontConfigAAHint(String fcFamily) { if (FontUtilities.isWindows) { return null; } else { int hint = getFontConfigAASettings(getFCLocaleStr(), fcFamily); if (hint < 0) { return null; } else { return SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING, hint); } } }
Example #22
Source File: FontConfigManager.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public static Object getFontConfigAAHint(String fcFamily) { if (FontUtilities.isWindows) { return null; } else { int hint = getFontConfigAASettings(getFCLocaleStr(), fcFamily); if (hint < 0) { return null; } else { return SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING, hint); } } }
Example #23
Source File: SunGraphics2D.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Adds a number of preferences for the rendering algorithms. * Hint categories include controls for rendering quality and * overall time/quality trade-off in the rendering process. * @param hints The rendering hints to be set * @see RenderingHints */ public void addRenderingHints(Map<?,?> hints) { boolean customHintPresent = false; Iterator<?> iter = hints.keySet().iterator(); while (iter.hasNext()) { Object key = iter.next(); if (key == SunHints.KEY_RENDERING || key == SunHints.KEY_ANTIALIASING || key == SunHints.KEY_TEXT_ANTIALIASING || key == SunHints.KEY_FRACTIONALMETRICS || key == SunHints.KEY_TEXT_ANTIALIAS_LCD_CONTRAST || key == SunHints.KEY_STROKE_CONTROL || key == SunHints.KEY_INTERPOLATION) { setRenderingHint((Key) key, hints.get(key)); } else { customHintPresent = true; } } if (customHintPresent) { if (this.hints == null) { this.hints = makeHints(hints); } else { this.hints.putAll(hints); } } }
Example #24
Source File: SunGraphics2D.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void setFont(Font font) { /* replacing the reference equality test font != this.font with * !font.equals(this.font) did not yield any measurable difference * in testing, but there may be yet to be identified cases where it * is beneficial. */ if (font != null && font!=this.font/*!font.equals(this.font)*/) { /* In the GASP AA case the textpipe depends on the glyph size * as determined by graphics and font transforms as well as the * font size, and information in the font. But we may invalidate * the pipe only to find that it made no difference. * Deferring pipe invalidation to checkFontInfo won't work because * when called we may already be rendering to the wrong pipe. * So, if the font is transformed, or the graphics has more than * a simple scale, we'll take that as enough of a hint to * revalidate everything. But if they aren't we will * use the font's point size to query the gasp table and see if * what it says matches what's currently being used, in which * case there's no need to invalidate the textpipe. * This should be sufficient for all typical uses cases. */ if (textAntialiasHint == SunHints.INTVAL_TEXT_ANTIALIAS_GASP && textpipe != invalidpipe && (transformState > TRANSFORM_ANY_TRANSLATE || font.isTransformed() || fontInfo == null || // Precaution, if true shouldn't get here (fontInfo.aaHint == SunHints.INTVAL_TEXT_ANTIALIAS_ON) != FontUtilities.getFont2D(font). useAAForPtSize(font.getSize()))) { textpipe = invalidpipe; } this.font = font; this.fontMetrics = null; this.validFontInfo = false; } }
Example #25
Source File: OutlineTextRenderer.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void drawString(SunGraphics2D g2d, String str, double x, double y) { if ("".equals(str)) { return; // TextLayout constructor throws IAE on "". } TextLayout tl = new TextLayout(str, g2d.getFont(), g2d.getFontRenderContext()); Shape s = tl.getOutline(AffineTransform.getTranslateInstance(x, y)); int textAAHint = g2d.getFontInfo().aaHint; int prevaaHint = - 1; if (textAAHint != SunHints.INTVAL_TEXT_ANTIALIAS_OFF && g2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) { prevaaHint = g2d.antialiasHint; g2d.antialiasHint = SunHints.INTVAL_ANTIALIAS_ON; g2d.validatePipe(); } else if (textAAHint == SunHints.INTVAL_TEXT_ANTIALIAS_OFF && g2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_OFF) { prevaaHint = g2d.antialiasHint; g2d.antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF; g2d.validatePipe(); } g2d.fill(s); if (prevaaHint != -1) { g2d.antialiasHint = prevaaHint; g2d.validatePipe(); } }
Example #26
Source File: SunGraphics2D.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public SunGraphics2D(SurfaceData sd, Color fg, Color bg, Font f) { surfaceData = sd; foregroundColor = fg; backgroundColor = bg; transform = new AffineTransform(); stroke = defaultStroke; composite = defaultComposite; paint = foregroundColor; imageComp = CompositeType.SrcOverNoEa; renderHint = SunHints.INTVAL_RENDER_DEFAULT; antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF; textAntialiasHint = SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT; fractionalMetricsHint = SunHints.INTVAL_FRACTIONALMETRICS_OFF; lcdTextContrast = lcdTextContrastDefaultValue; interpolationHint = -1; strokeHint = SunHints.INTVAL_STROKE_DEFAULT; resolutionVariantHint = SunHints.INTVAL_RESOLUTION_VARIANT_DEFAULT; interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR; validateColor(); devScale = sd.getDefaultScale(); if (devScale != 1) { transform.setToScale(devScale, devScale); invalidateTransform(); } font = f; if (font == null) { font = defaultFont; } setDevClip(sd.getBounds()); invalidatePipe(); }
Example #27
Source File: PixelToParallelogramConverter.java From hottub with GNU General Public License v2.0 | 5 votes |
public void fillRectangle(SunGraphics2D sg2d, double rx, double ry, double rw, double rh) { double px, py; double dx1, dy1, dx2, dy2; AffineTransform txform = sg2d.transform; dx1 = txform.getScaleX(); dy1 = txform.getShearY(); dx2 = txform.getShearX(); dy2 = txform.getScaleY(); px = rx * dx1 + ry * dx2 + txform.getTranslateX(); py = rx * dy1 + ry * dy2 + txform.getTranslateY(); dx1 *= rw; dy1 *= rw; dx2 *= rh; dy2 *= rh; if (adjustfill && sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM && sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE) { double newx = normalize(px); double newy = normalize(py); dx1 = normalize(px + dx1) - newx; dy1 = normalize(py + dy1) - newy; dx2 = normalize(px + dx2) - newx; dy2 = normalize(py + dy2) - newy; px = newx; py = newy; } outrenderer.fillParallelogram(sg2d, rx, ry, rx+rw, ry+rh, px, py, dx1, dy1, dx2, dy2); }
Example #28
Source File: PixelToParallelogramConverter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void fillRectangle(SunGraphics2D sg2d, double rx, double ry, double rw, double rh) { double px, py; double dx1, dy1, dx2, dy2; AffineTransform txform = sg2d.transform; dx1 = txform.getScaleX(); dy1 = txform.getShearY(); dx2 = txform.getShearX(); dy2 = txform.getScaleY(); px = rx * dx1 + ry * dx2 + txform.getTranslateX(); py = rx * dy1 + ry * dy2 + txform.getTranslateY(); dx1 *= rw; dy1 *= rw; dx2 *= rh; dy2 *= rh; if (adjustfill && sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM && sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE) { double newx = normalize(px); double newy = normalize(py); dx1 = normalize(px + dx1) - newx; dy1 = normalize(py + dy1) - newy; dx2 = normalize(px + dx2) - newx; dy2 = normalize(py + dy2) - newy; px = newx; py = newy; } outrenderer.fillParallelogram(sg2d, rx, ry, rx+rw, ry+rh, px, py, dx1, dy1, dx2, dy2); }
Example #29
Source File: OutlineTextRenderer.java From hottub with GNU General Public License v2.0 | 5 votes |
public void drawGlyphVector(SunGraphics2D g2d, GlyphVector gv, float x, float y) { Shape s = gv.getOutline(x, y); int prevaaHint = - 1; FontRenderContext frc = gv.getFontRenderContext(); boolean aa = frc.isAntiAliased(); /* aa will be true if any AA mode has been specified. * ie for LCD and 'gasp' modes too. * We will check if 'gasp' has resolved AA to be "OFF", and * in all other cases (ie AA ON and all LCD modes) use AA outlines. */ if (aa) { if (g2d.getGVFontInfo(gv.getFont(), frc).aaHint == SunHints.INTVAL_TEXT_ANTIALIAS_OFF) { aa = false; } } if (aa && g2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) { prevaaHint = g2d.antialiasHint; g2d.antialiasHint = SunHints.INTVAL_ANTIALIAS_ON; g2d.validatePipe(); } else if (!aa && g2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_OFF) { prevaaHint = g2d.antialiasHint; g2d.antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF; g2d.validatePipe(); } g2d.fill(s); if (prevaaHint != -1) { g2d.antialiasHint = prevaaHint; g2d.validatePipe(); } }
Example #30
Source File: SunGraphics2D.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
RenderingHints makeHints(Map hints) { RenderingHints model = new RenderingHints(hints); model.put(SunHints.KEY_RENDERING, SunHints.Value.get(SunHints.INTKEY_RENDERING, renderHint)); model.put(SunHints.KEY_ANTIALIASING, SunHints.Value.get(SunHints.INTKEY_ANTIALIASING, antialiasHint)); model.put(SunHints.KEY_TEXT_ANTIALIASING, SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING, textAntialiasHint)); model.put(SunHints.KEY_FRACTIONALMETRICS, SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS, fractionalMetricsHint)); model.put(SunHints.KEY_TEXT_ANTIALIAS_LCD_CONTRAST, Integer.valueOf(lcdTextContrast)); Object value; switch (interpolationHint) { case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR: value = SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR; break; case SunHints.INTVAL_INTERPOLATION_BILINEAR: value = SunHints.VALUE_INTERPOLATION_BILINEAR; break; case SunHints.INTVAL_INTERPOLATION_BICUBIC: value = SunHints.VALUE_INTERPOLATION_BICUBIC; break; default: value = null; break; } if (value != null) { model.put(SunHints.KEY_INTERPOLATION, value); } model.put(SunHints.KEY_STROKE_CONTROL, SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL, strokeHint)); return model; }