public static class ContrastResult.OverlappingArea extends Object
This class encapsulates the information about a specific background element that intersects
with a text element, along with the calculated contrast ratio between them. It is used as
part of a ContrastResult to provide detailed information about all backgrounds
that contribute to the overall contrast of a text element.
The contrast ratio is calculated according to WCAG 2.1 guidelines and ranges from 1:1 (no contrast) to 21:1 (maximum contrast between black and white).
| Constructor and Description |
|---|
OverlappingArea(BackgroundColorInfo backgroundRenderInfo,
double contrastRatio)
Constructs a new ContrastResultEntry with the specified background information and contrast ratio.
|
| Modifier and Type | Method and Description |
|---|---|
BackgroundColorInfo |
getBackgroundRenderInfo()
Gets the background render information for this contrast entry.
|
double |
getContrastRatio()
Gets the contrast ratio between the text and this background element.
|
double |
getOverlapRatio()
Gets the percentage of the text area that overlaps with this background element.
|
void |
setOverlapRatio(double overlappingAreaInPercentage)
Sets the percentage of the text area that overlaps with this background element.
|
public OverlappingArea(BackgroundColorInfo backgroundRenderInfo, double contrastRatio)
backgroundRenderInfo - the background element that was analyzed for contrastcontrastRatio - the calculated contrast ratio between the text and this background,
according to WCAG 2.1 guidelines (ranges from 1.0 to 21.0)public BackgroundColorInfo getBackgroundRenderInfo()
The background information includes the color and geometric path of the background element that was compared against the text.
public double getContrastRatio()
The contrast ratio is calculated according to WCAG 2.1 guidelines:
*1.0 indicates no contrast (identical colors) *21.0 is the maximum contrast (black and white)
public double getOverlapRatio()
public void setOverlapRatio(double overlappingAreaInPercentage)
overlappingAreaInPercentage - the overlapping area in percentage.Copyright © 1998–2026 Apryse Group NV. All rights reserved.