java.lang.Object
org.miaixz.bus.extra.image.RenderHintsBuilder
- All Implemented Interfaces:
Serializable,org.miaixz.bus.core.Builder<RenderingHints>
public class RenderHintsBuilder
extends Object
implements org.miaixz.bus.core.Builder<RenderingHints>
A builder for defining and managing a collection of keys and their associated values for rendering hints. It provides
configuration for:
RenderingHints.KEY_ANTIALIASINGRenderingHints.KEY_TEXT_ANTIALIASINGRenderingHints.KEY_COLOR_RENDERINGRenderingHints.KEY_DITHERINGRenderingHints.KEY_FRACTIONALMETRICSRenderingHints.KEY_INTERPOLATIONRenderingHints.KEY_ALPHA_INTERPOLATIONRenderingHints.KEY_RENDERINGRenderingHints.KEY_STROKE_CONTROLRenderingHints.KEY_TEXT_LCD_CONTRAST
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAlpha compositing adjustment.static enumAnti-aliasing options.static enumColor rendering methods.static enumDithering options.static enumFont metrics options.static enumInterpolation methods.static enumRendering techniques.static enumStroke normalization control.static enumText anti-aliasing options. -
Method Summary
Modifier and TypeMethodDescriptionbuild()static RenderHintsBuilderof()Creates aRenderingHintsbuilder.setAlphaInterpolation(RenderHintsBuilder.AlphaInterpolation alphaInterpolation) Sets the alpha compositing adjustment.setAntialiasing(RenderHintsBuilder.Antialias antialias) Sets whether to use anti-aliasing.setColorRendering(RenderHintsBuilder.ColorRender colorRender) Sets the rendering method for color rendering.Sets how to handle dithering.setFractionalMetrics(RenderHintsBuilder.FractionalMetrics fractionalMetrics) Sets the font metrics.setInterpolation(RenderHintsBuilder.Interpolation interpolation) Sets how interpolation is performed.Sets the rendering technique, balancing speed and quality.setStrokeControl(RenderHintsBuilder.StrokeControl strokeControl) Sets the stroke normalization control.setTextAntialias(RenderHintsBuilder.TextAntialias textAntialias) Sets whether to use anti-aliasing for text rendering.setTextLCDContrast(Integer textLCDContrast) Sets the LCD text contrast rendering.
-
Method Details
-
of
Creates aRenderingHintsbuilder.- Returns:
- A
RenderingHintsBuilder.
-
setAntialiasing
Sets whether to use anti-aliasing.- Parameters:
antialias- The anti-aliasing option. Ifnull, this option is removed.- Returns:
- this
-
setTextAntialias
Sets whether to use anti-aliasing for text rendering.- Parameters:
textAntialias- The text anti-aliasing option. Ifnull, this option is removed.- Returns:
- this
-
setColorRendering
Sets the rendering method for color rendering.- Parameters:
colorRender- The color rendering method. Ifnull, this option is removed.- Returns:
- this
-
setDithering
Sets how to handle dithering. Dithering is the process of synthesizing a wider range of colors from a limited set by coloring adjacent pixels to create the illusion of a new color.- Parameters:
dither- How to handle dithering. Ifnull, this option is removed.- Returns:
- this
-
setFractionalMetrics
public RenderHintsBuilder setFractionalMetrics(RenderHintsBuilder.FractionalMetrics fractionalMetrics) Sets the font metrics.- Parameters:
fractionalMetrics- The font metrics option. Ifnull, this option is removed.- Returns:
- this
-
setInterpolation
Sets how interpolation is performed. When transforming a source image, the transformed pixels rarely align perfectly with the target pixel positions. In such cases, the color value of each transformed pixel must be determined from the surrounding pixels. Interpolation is the process of achieving this.- Parameters:
interpolation- The interpolation method. Ifnull, this option is removed.- Returns:
- this
-
setAlphaInterpolation
public RenderHintsBuilder setAlphaInterpolation(RenderHintsBuilder.AlphaInterpolation alphaInterpolation) Sets the alpha compositing adjustment.- Parameters:
alphaInterpolation- The alpha compositing adjustment. Ifnull, this option is removed.- Returns:
- this
-
setRendering
Sets the rendering technique, balancing speed and quality.- Parameters:
render- The rendering technique. Ifnull, this option is removed.- Returns:
- this
-
setStrokeControl
Sets the stroke normalization control.- Parameters:
strokeControl- The stroke normalization control. Ifnull, this option is removed.- Returns:
- this
-
setTextLCDContrast
Sets the LCD text contrast rendering. A positive integer between 100 and 250. Typically, the useful range is 140-180.- Parameters:
textLCDContrast- The LCD text contrast rendering, a positive integer between 100 and 250.- Returns:
- this
-
build
- Specified by:
buildin interfaceorg.miaixz.bus.core.Builder<RenderingHints>
-