Java Code Examples for sun.awt.SunHints#VALUE_INTERPOLATION_NEAREST_NEIGHBOR

The following examples show how to use sun.awt.SunHints#VALUE_INTERPOLATION_NEAREST_NEIGHBOR . 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: SunGraphics2D.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 2
Source File: SunGraphics2D.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 3
Source File: SunGraphics2D.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the preferences for the rendering algorithms.
 * @param hintCategory The category of hint to be set. The strings
 * are defined in the RenderingHints class.
 * @return The preferences for rendering algorithms. The strings
 * are defined in the RenderingHints class.
 * @see RenderingHints
 */
public Object getRenderingHint(Key hintKey) {
    if (hints != null) {
        return hints.get(hintKey);
    }
    if (!(hintKey instanceof SunHints.Key)) {
        return null;
    }
    int keyindex = ((SunHints.Key)hintKey).getIndex();
    switch (keyindex) {
    case SunHints.INTKEY_RENDERING:
        return SunHints.Value.get(SunHints.INTKEY_RENDERING,
                                  renderHint);
    case SunHints.INTKEY_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_ANTIALIASING,
                                  antialiasHint);
    case SunHints.INTKEY_TEXT_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING,
                                  textAntialiasHint);
    case SunHints.INTKEY_FRACTIONALMETRICS:
        return SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
                                  fractionalMetricsHint);
    case SunHints.INTKEY_AATEXT_LCD_CONTRAST:
        return new Integer(lcdTextContrast);
    case SunHints.INTKEY_INTERPOLATION:
        switch (interpolationHint) {
        case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
            return SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
        case SunHints.INTVAL_INTERPOLATION_BILINEAR:
            return SunHints.VALUE_INTERPOLATION_BILINEAR;
        case SunHints.INTVAL_INTERPOLATION_BICUBIC:
            return SunHints.VALUE_INTERPOLATION_BICUBIC;
        }
        return null;
    case SunHints.INTKEY_STROKE_CONTROL:
        return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
                                  strokeHint);
    }
    return null;
}
 
Example 4
Source File: SunGraphics2D.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the preferences for the rendering algorithms.
 * @param hintCategory The category of hint to be set. The strings
 * are defined in the RenderingHints class.
 * @return The preferences for rendering algorithms. The strings
 * are defined in the RenderingHints class.
 * @see RenderingHints
 */
public Object getRenderingHint(Key hintKey) {
    if (hints != null) {
        return hints.get(hintKey);
    }
    if (!(hintKey instanceof SunHints.Key)) {
        return null;
    }
    int keyindex = ((SunHints.Key)hintKey).getIndex();
    switch (keyindex) {
    case SunHints.INTKEY_RENDERING:
        return SunHints.Value.get(SunHints.INTKEY_RENDERING,
                                  renderHint);
    case SunHints.INTKEY_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_ANTIALIASING,
                                  antialiasHint);
    case SunHints.INTKEY_TEXT_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING,
                                  textAntialiasHint);
    case SunHints.INTKEY_FRACTIONALMETRICS:
        return SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
                                  fractionalMetricsHint);
    case SunHints.INTKEY_AATEXT_LCD_CONTRAST:
        return new Integer(lcdTextContrast);
    case SunHints.INTKEY_INTERPOLATION:
        switch (interpolationHint) {
        case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
            return SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
        case SunHints.INTVAL_INTERPOLATION_BILINEAR:
            return SunHints.VALUE_INTERPOLATION_BILINEAR;
        case SunHints.INTVAL_INTERPOLATION_BICUBIC:
            return SunHints.VALUE_INTERPOLATION_BICUBIC;
        }
        return null;
    case SunHints.INTKEY_STROKE_CONTROL:
        return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
                                  strokeHint);
    }
    return null;
}
 
Example 5
Source File: SunGraphics2D.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 6
Source File: SunGraphics2D.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: SunGraphics2D.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 8
Source File: SunGraphics2D.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 9
Source File: SunGraphics2D.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 10
Source File: SunGraphics2D.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 11
Source File: SunGraphics2D.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 12
Source File: SunGraphics2D.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the preferences for the rendering algorithms.
 * @param hintCategory The category of hint to be set. The strings
 * are defined in the RenderingHints class.
 * @return The preferences for rendering algorithms. The strings
 * are defined in the RenderingHints class.
 * @see RenderingHints
 */
public Object getRenderingHint(Key hintKey) {
    if (hints != null) {
        return hints.get(hintKey);
    }
    if (!(hintKey instanceof SunHints.Key)) {
        return null;
    }
    int keyindex = ((SunHints.Key)hintKey).getIndex();
    switch (keyindex) {
    case SunHints.INTKEY_RENDERING:
        return SunHints.Value.get(SunHints.INTKEY_RENDERING,
                                  renderHint);
    case SunHints.INTKEY_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_ANTIALIASING,
                                  antialiasHint);
    case SunHints.INTKEY_TEXT_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING,
                                  textAntialiasHint);
    case SunHints.INTKEY_FRACTIONALMETRICS:
        return SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
                                  fractionalMetricsHint);
    case SunHints.INTKEY_AATEXT_LCD_CONTRAST:
        return new Integer(lcdTextContrast);
    case SunHints.INTKEY_INTERPOLATION:
        switch (interpolationHint) {
        case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
            return SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
        case SunHints.INTVAL_INTERPOLATION_BILINEAR:
            return SunHints.VALUE_INTERPOLATION_BILINEAR;
        case SunHints.INTVAL_INTERPOLATION_BICUBIC:
            return SunHints.VALUE_INTERPOLATION_BICUBIC;
        }
        return null;
    case SunHints.INTKEY_STROKE_CONTROL:
        return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
                                  strokeHint);
    case SunHints.INTKEY_RESOLUTION_VARIANT:
        return SunHints.Value.get(SunHints.INTKEY_RESOLUTION_VARIANT,
                                  resolutionVariantHint);
    }
    return null;
}
 
Example 13
Source File: SunGraphics2D.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the preferences for the rendering algorithms.
 * @param hintKey The category of hint to be set. The strings
 * are defined in the RenderingHints class.
 * @return The preferences for rendering algorithms. The strings
 * are defined in the RenderingHints class.
 * @see RenderingHints
 */
public Object getRenderingHint(Key hintKey) {
    if (hints != null) {
        return hints.get(hintKey);
    }
    if (!(hintKey instanceof SunHints.Key)) {
        return null;
    }
    int keyindex = ((SunHints.Key)hintKey).getIndex();
    switch (keyindex) {
    case SunHints.INTKEY_RENDERING:
        return SunHints.Value.get(SunHints.INTKEY_RENDERING,
                                  renderHint);
    case SunHints.INTKEY_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_ANTIALIASING,
                                  antialiasHint);
    case SunHints.INTKEY_TEXT_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING,
                                  textAntialiasHint);
    case SunHints.INTKEY_FRACTIONALMETRICS:
        return SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
                                  fractionalMetricsHint);
    case SunHints.INTKEY_AATEXT_LCD_CONTRAST:
        return lcdTextContrast;
    case SunHints.INTKEY_INTERPOLATION:
        switch (interpolationHint) {
        case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
            return SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
        case SunHints.INTVAL_INTERPOLATION_BILINEAR:
            return SunHints.VALUE_INTERPOLATION_BILINEAR;
        case SunHints.INTVAL_INTERPOLATION_BICUBIC:
            return SunHints.VALUE_INTERPOLATION_BICUBIC;
        }
        return null;
    case SunHints.INTKEY_STROKE_CONTROL:
        return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
                                  strokeHint);
    case SunHints.INTKEY_RESOLUTION_VARIANT:
        return SunHints.Value.get(SunHints.INTKEY_RESOLUTION_VARIANT,
                                  resolutionVariantHint);
    }
    return null;
}
 
Example 14
Source File: SunGraphics2D.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
RenderingHints makeHints(Map<?,?> hints) {
    RenderingHints model = new RenderingHints(null);
    if (hints != null) {
        model.putAll(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;
}
 
Example 15
Source File: SunGraphics2D.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
RenderingHints makeHints(Map<?,?> hints) {
    RenderingHints model = new RenderingHints(null);
    if (hints != null) {
        model.putAll(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;
}
 
Example 16
Source File: SunGraphics2D.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the preferences for the rendering algorithms.
 * @param hintCategory The category of hint to be set. The strings
 * are defined in the RenderingHints class.
 * @return The preferences for rendering algorithms. The strings
 * are defined in the RenderingHints class.
 * @see RenderingHints
 */
public Object getRenderingHint(Key hintKey) {
    if (hints != null) {
        return hints.get(hintKey);
    }
    if (!(hintKey instanceof SunHints.Key)) {
        return null;
    }
    int keyindex = ((SunHints.Key)hintKey).getIndex();
    switch (keyindex) {
    case SunHints.INTKEY_RENDERING:
        return SunHints.Value.get(SunHints.INTKEY_RENDERING,
                                  renderHint);
    case SunHints.INTKEY_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_ANTIALIASING,
                                  antialiasHint);
    case SunHints.INTKEY_TEXT_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING,
                                  textAntialiasHint);
    case SunHints.INTKEY_FRACTIONALMETRICS:
        return SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
                                  fractionalMetricsHint);
    case SunHints.INTKEY_AATEXT_LCD_CONTRAST:
        return new Integer(lcdTextContrast);
    case SunHints.INTKEY_INTERPOLATION:
        switch (interpolationHint) {
        case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
            return SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
        case SunHints.INTVAL_INTERPOLATION_BILINEAR:
            return SunHints.VALUE_INTERPOLATION_BILINEAR;
        case SunHints.INTVAL_INTERPOLATION_BICUBIC:
            return SunHints.VALUE_INTERPOLATION_BICUBIC;
        }
        return null;
    case SunHints.INTKEY_STROKE_CONTROL:
        return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
                                  strokeHint);
    case SunHints.INTKEY_RESOLUTION_VARIANT:
        return SunHints.Value.get(SunHints.INTKEY_RESOLUTION_VARIANT,
                                  resolutionVariantHint);
    }
    return null;
}
 
Example 17
Source File: SunGraphics2D.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the preferences for the rendering algorithms.
 * @param hintCategory The category of hint to be set. The strings
 * are defined in the RenderingHints class.
 * @return The preferences for rendering algorithms. The strings
 * are defined in the RenderingHints class.
 * @see RenderingHints
 */
public Object getRenderingHint(Key hintKey) {
    if (hints != null) {
        return hints.get(hintKey);
    }
    if (!(hintKey instanceof SunHints.Key)) {
        return null;
    }
    int keyindex = ((SunHints.Key)hintKey).getIndex();
    switch (keyindex) {
    case SunHints.INTKEY_RENDERING:
        return SunHints.Value.get(SunHints.INTKEY_RENDERING,
                                  renderHint);
    case SunHints.INTKEY_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_ANTIALIASING,
                                  antialiasHint);
    case SunHints.INTKEY_TEXT_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING,
                                  textAntialiasHint);
    case SunHints.INTKEY_FRACTIONALMETRICS:
        return SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
                                  fractionalMetricsHint);
    case SunHints.INTKEY_AATEXT_LCD_CONTRAST:
        return new Integer(lcdTextContrast);
    case SunHints.INTKEY_INTERPOLATION:
        switch (interpolationHint) {
        case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
            return SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
        case SunHints.INTVAL_INTERPOLATION_BILINEAR:
            return SunHints.VALUE_INTERPOLATION_BILINEAR;
        case SunHints.INTVAL_INTERPOLATION_BICUBIC:
            return SunHints.VALUE_INTERPOLATION_BICUBIC;
        }
        return null;
    case SunHints.INTKEY_STROKE_CONTROL:
        return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
                                  strokeHint);
    case SunHints.INTKEY_RESOLUTION_VARIANT:
        return SunHints.Value.get(SunHints.INTKEY_RESOLUTION_VARIANT,
                                  resolutionVariantHint);
    }
    return null;
}
 
Example 18
Source File: SunGraphics2D.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the preferences for the rendering algorithms.
 * @param hintCategory The category of hint to be set. The strings
 * are defined in the RenderingHints class.
 * @return The preferences for rendering algorithms. The strings
 * are defined in the RenderingHints class.
 * @see RenderingHints
 */
public Object getRenderingHint(Key hintKey) {
    if (hints != null) {
        return hints.get(hintKey);
    }
    if (!(hintKey instanceof SunHints.Key)) {
        return null;
    }
    int keyindex = ((SunHints.Key)hintKey).getIndex();
    switch (keyindex) {
    case SunHints.INTKEY_RENDERING:
        return SunHints.Value.get(SunHints.INTKEY_RENDERING,
                                  renderHint);
    case SunHints.INTKEY_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_ANTIALIASING,
                                  antialiasHint);
    case SunHints.INTKEY_TEXT_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING,
                                  textAntialiasHint);
    case SunHints.INTKEY_FRACTIONALMETRICS:
        return SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
                                  fractionalMetricsHint);
    case SunHints.INTKEY_AATEXT_LCD_CONTRAST:
        return new Integer(lcdTextContrast);
    case SunHints.INTKEY_INTERPOLATION:
        switch (interpolationHint) {
        case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
            return SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
        case SunHints.INTVAL_INTERPOLATION_BILINEAR:
            return SunHints.VALUE_INTERPOLATION_BILINEAR;
        case SunHints.INTVAL_INTERPOLATION_BICUBIC:
            return SunHints.VALUE_INTERPOLATION_BICUBIC;
        }
        return null;
    case SunHints.INTKEY_STROKE_CONTROL:
        return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
                                  strokeHint);
    case SunHints.INTKEY_RESOLUTION_VARIANT:
        return SunHints.Value.get(SunHints.INTKEY_RESOLUTION_VARIANT,
                                  resolutionVariantHint);
    }
    return null;
}
 
Example 19
Source File: SunGraphics2D.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the preferences for the rendering algorithms.
 * @param hintCategory The category of hint to be set. The strings
 * are defined in the RenderingHints class.
 * @return The preferences for rendering algorithms. The strings
 * are defined in the RenderingHints class.
 * @see RenderingHints
 */
public Object getRenderingHint(Key hintKey) {
    if (hints != null) {
        return hints.get(hintKey);
    }
    if (!(hintKey instanceof SunHints.Key)) {
        return null;
    }
    int keyindex = ((SunHints.Key)hintKey).getIndex();
    switch (keyindex) {
    case SunHints.INTKEY_RENDERING:
        return SunHints.Value.get(SunHints.INTKEY_RENDERING,
                                  renderHint);
    case SunHints.INTKEY_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_ANTIALIASING,
                                  antialiasHint);
    case SunHints.INTKEY_TEXT_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING,
                                  textAntialiasHint);
    case SunHints.INTKEY_FRACTIONALMETRICS:
        return SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
                                  fractionalMetricsHint);
    case SunHints.INTKEY_AATEXT_LCD_CONTRAST:
        return new Integer(lcdTextContrast);
    case SunHints.INTKEY_INTERPOLATION:
        switch (interpolationHint) {
        case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
            return SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
        case SunHints.INTVAL_INTERPOLATION_BILINEAR:
            return SunHints.VALUE_INTERPOLATION_BILINEAR;
        case SunHints.INTVAL_INTERPOLATION_BICUBIC:
            return SunHints.VALUE_INTERPOLATION_BICUBIC;
        }
        return null;
    case SunHints.INTKEY_STROKE_CONTROL:
        return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
                                  strokeHint);
    case SunHints.INTKEY_RESOLUTION_VARIANT:
        return SunHints.Value.get(SunHints.INTKEY_RESOLUTION_VARIANT,
                                  resolutionVariantHint);
    }
    return null;
}
 
Example 20
Source File: SunGraphics2D.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the preferences for the rendering algorithms.
 * @param hintCategory The category of hint to be set. The strings
 * are defined in the RenderingHints class.
 * @return The preferences for rendering algorithms. The strings
 * are defined in the RenderingHints class.
 * @see RenderingHints
 */
public Object getRenderingHint(Key hintKey) {
    if (hints != null) {
        return hints.get(hintKey);
    }
    if (!(hintKey instanceof SunHints.Key)) {
        return null;
    }
    int keyindex = ((SunHints.Key)hintKey).getIndex();
    switch (keyindex) {
    case SunHints.INTKEY_RENDERING:
        return SunHints.Value.get(SunHints.INTKEY_RENDERING,
                                  renderHint);
    case SunHints.INTKEY_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_ANTIALIASING,
                                  antialiasHint);
    case SunHints.INTKEY_TEXT_ANTIALIASING:
        return SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING,
                                  textAntialiasHint);
    case SunHints.INTKEY_FRACTIONALMETRICS:
        return SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
                                  fractionalMetricsHint);
    case SunHints.INTKEY_AATEXT_LCD_CONTRAST:
        return new Integer(lcdTextContrast);
    case SunHints.INTKEY_INTERPOLATION:
        switch (interpolationHint) {
        case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
            return SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
        case SunHints.INTVAL_INTERPOLATION_BILINEAR:
            return SunHints.VALUE_INTERPOLATION_BILINEAR;
        case SunHints.INTVAL_INTERPOLATION_BICUBIC:
            return SunHints.VALUE_INTERPOLATION_BICUBIC;
        }
        return null;
    case SunHints.INTKEY_STROKE_CONTROL:
        return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
                                  strokeHint);
    case SunHints.INTKEY_RESOLUTION_VARIANT:
        return SunHints.Value.get(SunHints.INTKEY_RESOLUTION_VARIANT,
                                  resolutionVariantHint);
    }
    return null;
}