- All Known Implementing Classes:
AbstractCSSCanvas
public interface CSSCanvas
CSS canvas interface.
-
Method Summary
Modifier and TypeMethodDescriptionfloat
Get the cap-height of the first available font, in typographic points.Gets the document to which this canvas applies.getFeatureValue
(String feature) Provide the value of the requested media feature.Gets the style database for this canvas.Gets the viewport of this canvas.boolean
isActivePseudoClass
(CSSElement element, String pseudoclassName) Is the provided pseudo-class active in this canvas?boolean
matchesFeature
(String featureName, ExtendedCSSPrimitiveValue value) Does this canvas support the given media feature?void
Reload any possible style state/caching that this canvas may have.int
stringWidth
(String text, CSSComputedProperties style) Gives the width, in typographic points, for showing the given text with the given style.
-
Method Details
-
getStyleDatabase
StyleDatabase getStyleDatabase()Gets the style database for this canvas.- Returns:
- the StyleDatabase.
-
isActivePseudoClass
Is the provided pseudo-class active in this canvas?- Parameters:
element
- the element to which the pseudo-class applies.pseudoclassName
- the pseudo-class name.- Returns:
true
id the pseudo-class is active,false
otherwise.
-
getFeatureValue
Provide the value of the requested media feature.- 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
Does this canvas support the given media feature?- Parameters:
featureName
- 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.
-
reloadStyleState
void reloadStyleState()Reload any possible style state/caching that this canvas may have. -
getViewport
Viewport getViewport()Gets the viewport of this canvas.- Returns:
- the viewport, or null if this canvas does not have a viewport.
-
stringWidth
Gives the width, in typographic points, for showing the given text with the given style.- Parameters:
text
- the text to measure.style
- the style that applies.- Returns:
- the advance width for showing the text with the given font.
-
getCapHeight
Get the cap-height of the first available font, in typographic points.If the cap-height is not available, the font's ascent must be used.
- Parameters:
style
- the style that applies.- Returns:
- the cap-height of the first available font.
-
getDocument
CSSDocument getDocument()Gets the document to which this canvas applies.- Returns:
- the document.
-