Class AbstractCSSCanvas

java.lang.Object
io.sf.carte.doc.style.css.om.AbstractCSSCanvas
All Implemented Interfaces:
CSSCanvas

public abstract class AbstractCSSCanvas extends Object implements CSSCanvas
Abstract base class useful for CSSCanvas implementations.
  • Constructor Details

    • AbstractCSSCanvas

      protected AbstractCSSCanvas(CSSDocument doc)
      Construct a canvas to display the given document.
      Parameters:
      doc - the document to display.
  • Method Details

    • getDocument

      public CSSDocument getDocument()
      Description copied from interface: CSSCanvas
      Gets the document to which this canvas applies.
      Specified by:
      getDocument in interface CSSCanvas
      Returns:
      the document.
    • setDocument

      protected void setDocument(CSSDocument doc)
    • getFeatureValue

      public CSSTypedValue getFeatureValue(String feature)
      Description copied from interface: CSSCanvas
      Provide the value of the requested media feature.
      Specified by:
      getFeatureValue in interface CSSCanvas
      Parameters:
      feature - the media feature.
      Returns:
      the value of the requested media feature, or null if the feature is not known or not supported.
    • matchesFeature

      public boolean matchesFeature(String feature, CSSTypedValue value)
      Description copied from interface: CSSCanvas
      Does this canvas support the given media feature?
      Specified by:
      matchesFeature in interface CSSCanvas
      Parameters:
      feature - the media feature name.
      value - the optional feature value to be tested against.
      Returns:
      true if the feature (with the given value, if any) is supported, false otherwise.
    • getColorIndex

      protected float getColorIndex()
      Get the number of entries in the color lookup table of the device.
      Returns:
      the number of entries in the color lookup table of the device, or 0 if the device does not use a color lookup table.
    • isGridDevice

      protected boolean isGridDevice()
      Is this device a grid device?
      Returns:
      true if a grid device, false if bitmap.
    • getMonoBitsPerPixel

      protected int getMonoBitsPerPixel()
      Get the number of bits per pixel in a monochrome frame buffer.
      Returns:
      the number of bits per pixel in a monochrome frame buffer, or 0 if the device is not a monochrome device.
    • getOrientation

      protected String getOrientation()
      The orientation.
      Returns:
      the orientation (portrait or landscape).
    • getOverflowBlock

      protected abstract String getOverflowBlock()
      Describes the behavior of the device when content overflows the initial containing block in the block axis
      Returns:
      the overflow-block feature.
    • getOverflowInline

      protected abstract String getOverflowInline()
      Describes the behavior of the device when content overflows the initial containing block in the inline axis.
      Returns:
      the overflow-inline feature.
    • getPointerAccuracy

      protected String getPointerAccuracy()
      The pointing device quality.
      Returns:
      the pointer feature
    • getPrefersColorScheme

      protected String getPrefersColorScheme()
      The desire for light or dark color schemes.
      Returns:
      the prefers-color-scheme feature
    • getPrefersReducedMotion

      protected String getPrefersReducedMotion()
      The desire for less motion on the page.
      Returns:
      the prefers-reduced-motion feature
    • getResolution

      protected float getResolution()
      Get the device resolution.
      Returns:
      the device resolution, in dpi.
    • getScanType

      protected String getScanType()
      The display scan type.
      Returns:
      the scan feature.
    • getUpdateFrequency

      protected String getUpdateFrequency()
      The display update frequency.
      Returns:
      the update feature.
    • supportsGamut

      protected boolean supportsGamut(String gamut)
      Check whether a color gamut is supported.
      Parameters:
      gamut - the color-gamut to check, like srgb, p3 or rec2020.
      Returns:
      true if the gamut is supported.