private static int getFilterType ( RenderingHints pHints ) { if ( pHints == null ) { return FILTER_UNDEFINED ; } if ( pHints . containsKey ( KEY_RESAMPLE_INTERPOLATION ) ) { Object value = pHints . get ( KEY_RESAMPLE_INTERPOLATION ) ; // NOTE: Workaround for a bug in RenderingHints constructor (Bug id# 5084832) if ( ! KEY_RESAMPLE_INTERPOLATION . isCompatibleValue ( value ) ) { throw new IllegalArgumentException ( value + " incompatible with key " + KEY_RESAMPLE_INTERPOLATION ) ; } return value != null ? ( ( Value ) value ) . getFilterType ( ) : FILTER_UNDEFINED ; } else if ( RenderingHints . VALUE_INTERPOLATION_NEAREST_NEIGHBOR . equals ( pHints . get ( RenderingHints . KEY_INTERPOLATION ) ) || ( ! pHints . containsKey ( RenderingHints . KEY_INTERPOLATION ) && ( RenderingHints . VALUE_RENDER_SPEED . equals ( pHints . get ( RenderingHints . KEY_RENDERING ) ) || RenderingHints . VALUE_COLOR_RENDER_SPEED . equals ( pHints . get ( RenderingHints . KEY_COLOR_RENDERING ) ) ) ) ) { // Nearest neighbour, or prioritize speed return FILTER_POINT ; } else if ( RenderingHints . VALUE_INTERPOLATION_BILINEAR . equals ( pHints . get ( RenderingHints . KEY_INTERPOLATION ) ) ) { // Triangle equals bi-linear interpolation return FILTER_TRIANGLE ; } else if ( RenderingHints . VALUE_INTERPOLATION_BICUBIC . equals ( pHints . get ( RenderingHints . KEY_INTERPOLATION ) ) ) { return FILTER_QUADRATIC ; // No idea if this is correct..? } else if ( RenderingHints . VALUE_RENDER_QUALITY . equals ( pHints . get ( RenderingHints . KEY_RENDERING ) ) || RenderingHints . VALUE_COLOR_RENDER_QUALITY . equals ( pHints . get ( RenderingHints . KEY_COLOR_RENDERING ) ) ) { // Prioritize quality return FILTER_MITCHELL ; } // NOTE: Other hints are ignored return FILTER_UNDEFINED ; }
Gets the filter type specified by the given hints .