Class ContrastRatioChecker


  • public class ContrastRatioChecker
    extends Object
    • Constructor Detail

      • ContrastRatioChecker

        public ContrastRatioChecker()
    • Method Detail

      • checkSemanticTree

        public void checkSemanticTree​(ITree tree,
                                      String pdfName)
        Traverses the document semantic tree and updates contrast ratio parameter of it's nodes. Uses pdf document associated with the tree to determine contrast ratio by rendering it's pages.
        Parameters:
        tree - tree with nodes to update with calculated contrast ratio
        pdfName - String path to the pdf document associated with given tree
      • checkDocument

        public void checkDocument​(IDocument document,
                                  String pdfName)
      • getContrastRatio

        public double getContrastRatio​(double first,
                                       double second)
        Determines contrast ratio of two color based on their relative luminance. The resulting contrast ratio ranges from 1.0 to 21.0
        Parameters:
        first - relative luminance of the first color
        second - relative luminance of the first color
        Returns:
        contrast ratio of the given colors