Class RadianceCommonCortex
java.lang.Object
org.pushingpixels.radiance.common.api.RadianceCommonCortex
Provides the public API surface for working with platform-consistent fonts,
text rendering and offscreen bitmap rendering.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static RadianceCommonCortex.Platform
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clearDesktopHints
(Graphics2D g2, Font font) static BufferedImage
createThumbnail
(double scale, BufferedImage image, int requestedThumbWidth) Creates a thumbnail of the specified width.private static Map
static void
drawImageWithScale
(Graphics g, double scaleFactor, Image img, int x, int y) static void
drawImageWithScale
(Graphics g, double scaleFactor, Image img, int x, int y, int width, int height, int offsetX, int offsetY) static BufferedImage
getBlankScaledImage
(double scale, int width, int height) Gets a scaled, high-DPI aware image of specified dimensions.static BufferedImage
getBlankUnscaledImage
(int width, int height) Gets an unscaled, high-DPI aware image of specified dimensions.static FontPolicy
Returns the default platform-specific font policy.static FontPolicy
getScaledFontPolicy
(float scaleFactor) Returns scaled platform-specific font policy.static double
getScaleFactor
(Component component) static void
installDesktopHints
(Graphics2D g2, Font font) private static boolean
static void
paintAtScale1x
(Graphics2D g, int x, int y, int width, int height, RadianceCommonCortex.PainterScale1X painterScale1X)
-
Field Details
-
PROP_DESKTOPHINTS
- See Also:
-
platform
-
desktopHintsCache
-
-
Constructor Details
-
RadianceCommonCortex
private RadianceCommonCortex()
-
-
Method Details
-
getPlatform
-
getDefaultFontPolicy
Returns the default platform-specific font policy.- Returns:
- Default platform-specific font policy.
-
getScaledFontPolicy
Returns scaled platform-specific font policy.- Parameters:
scaleFactor
- Scale factor. Should be positive.- Returns:
- Scaled platform-specific font policy.
-
createThumbnail
public static BufferedImage createThumbnail(double scale, BufferedImage image, int requestedThumbWidth) Creates a thumbnail of the specified width.- Parameters:
image
- The original image.requestedThumbWidth
- The width of the resulting thumbnail.- Returns:
- Thumbnail of the specified width.
-
installDesktopHints
-
clearDesktopHints
-
desktopHints
-
isPrinting
-
getScaleFactor
-
getBlankScaledImage
Gets a scaled, high-DPI aware image of specified dimensions.Use
drawImageWithScale(Graphics, double, Image, int, int)
ordrawImageWithScale(Graphics, double, Image, int, int, int, int, int, int)
to draw the image obtained with this method. Note that applying an extension ofRadianceAbstractFilter
is a "safe" operation as far as preserving the scale-aware configuration. If you are using a customBufferedImageOp
that is not aRadianceAbstractFilter
, the resulting image will be a regularBufferedImage
that will not be drawn correctly using one of thedrawImageWithScale
methods above. In such a case, usegetScaleFactor(Component)
to divide the image width and height for the purposes of drawing.- Parameters:
width
- Width of the target imageheight
- Width of the target image- Returns:
- A scaled, high-DPI aware image of specified dimensions.
-
getBlankUnscaledImage
Gets an unscaled, high-DPI aware image of specified dimensions.- Parameters:
width
- Width of the target imageheight
- Width of the target image- Returns:
- An unscaled, high-DPI aware image of specified dimensions.
-
drawImageWithScale
-
drawImageWithScale
-
paintAtScale1x
public static void paintAtScale1x(Graphics2D g, int x, int y, int width, int height, RadianceCommonCortex.PainterScale1X painterScale1X)
-