Interface NTxRendererContext
- All Superinterfaces:
net.thevpc.nuts.log.NLogger, NTxResolutionContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final StringHost paints on-canvas search highlights (screen viewer); absent in PDF/HTML/image exports so they never appear there.Fields inherited from interface net.thevpc.nuts.log.NLogger
NULL, STDERR, STDOUT, STDTRACE -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanapplyContourColor(boolean force) voidbooleanapplyForeground(boolean force) booleanapplyGridColor(boolean force) booleanapplyLineColor(boolean force) booleanbounds(NTxRendererContext ctx) default NTxGraphicsclippedGraphics(Shape shape) Returns a disposable copy of the current graphics whose clip is intersected withshape; seeclippedGraphics(NTxBounds2D).default NTxGraphicsclippedGraphics(NTxBounds2D bounds) Returns a disposable copy of the current graphics whose clip is intersected withbounds.net.thevpc.nuts.util.NOptional<Color> net.thevpc.nuts.util.NOptional<net.thevpc.nuts.elem.NElement> computePropertyValue(String s, String... synonyms) voiddryMode()get3D()getCapability(String name) net.thevpc.nuts.util.NOptional<Paint> getColorProperty(String propName) intintintgetFont()doublegetForegroundColor(boolean force) getLineColor(boolean force) intgetRows()intnet.thevpc.nuts.elem.NElementnet.thevpc.nuts.util.NOptional<NTxPoint2D> graphics()booleanhasCapability(String name) voidhighlightNutsText(String lang, String rawText, net.thevpc.nuts.text.NText parsedText, NTxTextRendererBuilder result) booleanbooleanisCapability(String name) booleanisDebug()booleanbooleanisDry()booleanbooleanbooleanbooleanbooleandefault booleanWhether the page being rendered is currently shown to the user.booleanisPrint()booleanbooleanmapDim(double w, double h) default NtxAnimationTimerRegisters a page-owned periodic animation tick for the current node; seeNtxPageLifecycle.newTimer(Object, long, Runnable).default doubleSeconds elapsed since the page being rendered became visible;0while the page is hidden or when the host does not track page visibility (static PDF/image/HTML renders).default net.thevpc.nuts.util.NOptional<NtxPageLifecycle> Live lifecycle of the page currently being rendered, when the hosting renderer knows about page visibility (typically the screen renderer).longvoidvoidpopNode()net.thevpc.nuts.util.NOptional<NTxShadow> voidrender()voidrenderDetachedNode(NTxNode childNode, NTxBounds2D relativeBounds) voidrenderDetachedNode(net.thevpc.nuts.elem.NElement childNode, NTxBounds2D relativeBounds) voidrepaint()default voidrequestAnimationFrame(boolean wantsAnimation) Convenience for animated components: requests one animation frame only when the component itself wants to animate (wantsAnimation), the host is actually animating (isAnimate()) and the page is currently showing (isPageShowing()).default voidRequests one more animation frame from the hosting view (no-op when there is none).booleanbooleanresolveLineColor(boolean force) resolveNode(NTxNode node) ///////resolveNode(NTxNode node, NTxBounds2D parentBounds) selfBounds2D(NTxDouble2 selfSize, NTxDouble2 minSize) sizeRef()default NTxSizeRequirementswithBuilderContext(NTxNodeBuilderContext builderContext) withDefaultStyles(NTxProperties defaultStyles) withElement(net.thevpc.nuts.elem.NElement element) withGraphics(NTxGraphics graphics) default voidwithinClip(Shape shape, Consumer<NTxRendererContext> body) Same aswithinClip(NTxBounds2D, Consumer)but clips to an arbitrary shape.default voidwithinClip(NTxBounds2D bounds, Consumer<NTxRendererContext> body) Runsbodywith a renderer context whose graphics is clipped tobounds, then restores (disposes) the clip.withParentBounds(NTxBounds2D bounds2) withRealBounds3D(NTxBounds3D realBounds3D) withRealGlobalBounds3D(NTxBounds3D realGlobalBounds3D) booleanMethods inherited from interface net.thevpc.nuts.log.NLogger
logMethods inherited from interface NTxResolutionContext
copy, def, document, documentFactory, doWithChild, doWithChild, doWithElement, doWithSibling, doWithSibling, element, engine, evalExpression, findNodeByProperty, getFunction, getNamedDef, getVar, getVarValue, inPage, isDef, itemParser, log, log, node, parent, parentContext, path, popContext, pushContext, removeFunction, removeNamedDef, resolvePath, setDef, setElement, setFunction, setInPage, setNamedDef, setNode, setPath, setVar, source, uid, withDef, withFunction, withInPage, withItemParser, withNamedDef, withParentOnly, withParentOnly, withRemoveFunction, withRemoveNamedDef, withVar
-
Field Details
-
CAPABILITY_PRINT
- See Also:
-
CAPABILITY_ANIMATE
- See Also:
-
CAPABILITY_SEARCH_HIGHLIGHTS
Host paints on-canvas search highlights (screen viewer); absent in PDF/HTML/image exports so they never appear there.- See Also:
-
-
Method Details
-
sizeRequirementsOf
-
pageLifecycle
Live lifecycle of the page currently being rendered, when the hosting renderer knows about page visibility (typically the screen renderer). Static renderers (PDF/image/HTML) return an empty optional.- See Also:
-
isPageShowing
default boolean isPageShowing()Whether the page being rendered is currently shown to the user. When the host does not track page visibility (PDF/image/HTML or an ad-hoc render) this returnstrueso components keep their usual behaviour.- See Also:
-
requestFrame
default void requestFrame()Requests one more animation frame from the hosting view (no-op when there is none). Prefer this overrepaint()for continuous animation so a single page-level frame driver can throttle all components together.- See Also:
-
pageElapsedSeconds
default double pageElapsedSeconds()Seconds elapsed since the page being rendered became visible;0while the page is hidden or when the host does not track page visibility (static PDF/image/HTML renders).This is the shared animation clock. A component's animation state should be a pure function of this value and the component's own rate (speed / period property), so any number of components can animate at different speeds while sharing a single page-level frame driver (FPS). Do not use
System.currentTimeMillis()directly in a component.- See Also:
-
requestAnimationFrame
default void requestAnimationFrame(boolean wantsAnimation) Convenience for animated components: requests one animation frame only when the component itself wants to animate (wantsAnimation), the host is actually animating (isAnimate()) and the page is currently showing (isPageShowing()). Otherwise it is a no-op, so it is always safe to call once at the end of a render method.This requests the page's frame rate (FPS); it does not define an animation speed. Speed is the component's own rate applied to
pageElapsedSeconds(). The frame period is owned by the hosting view, so several animated components on the same page share a single throttled frame driver.- Parameters:
wantsAnimation- whether this node instance wants animation (its own flag)- See Also:
-
newTimer
Registers a page-owned periodic animation tick for the current node; seeNtxPageLifecycle.newTimer(Object, long, Runnable). The tick runs on the UI thread everyperiodMswhile the page is showing, and is disposed with the page. Ticks with the same period share one underlying timer. ReturnsNtxAnimationTimer.NONEfor static renders (PDF/image/HTML), so it is always safe to call.Prefer
pageElapsedSeconds()+requestFrame()for animations whose state is a pure function of time; use a timer only for genuinely stateful stepping that must happen independently of repaint.- Parameters:
periodMs- desired period between ticks in milliseconds (> 0)tick- callback invoked on the UI thread while the page is showing
-
clippedGraphics
Returns a disposable copy of the current graphics whose clip is intersected withbounds. The caller is responsible for callingNTxGraphics.dispose()on the result. PreferwithinClip(NTxBounds2D, Consumer)which does it automatically.This is the reusable low-level primitive behind the
NTxPropName.OVERFLOWpolicy and the manual crop used by components (for example the antenna panels) that must never paint outside their own box. -
clippedGraphics
Returns a disposable copy of the current graphics whose clip is intersected withshape; seeclippedGraphics(NTxBounds2D). -
withinClip
Runsbodywith a renderer context whose graphics is clipped tobounds, then restores (disposes) the clip. The current context is left untouched, so sibling nodes are never affected by the crop.The clip is applied to a private copy of the graphics; anything the component paints outside
boundsis discarded, exactly like a SwingJPanelpainting into its own rectangle. -
withinClip
Same aswithinClip(NTxBounds2D, Consumer)but clips to an arbitrary shape. -
buildContext
NTxNodeBuilderContext buildContext() -
isSomeChange
boolean isSomeChange() -
selfBounds2D
NTxBounds2D selfBounds2D() -
globalBounds2D
NTxBounds2D globalBounds2D() -
parentBounds2D
NTxBounds2D parentBounds2D() -
realBounds2D
NTxBounds2D realBounds2D() -
realGlobalBounds2D
NTxBounds2D realGlobalBounds2D() -
defaultSelfBounds2D
NTxBounds2D defaultSelfBounds2D() -
selfBounds3D
NTxBounds3D selfBounds3D() -
globalBounds3D
NTxBounds3D globalBounds3D() -
parentBounds3D
NTxBounds3D parentBounds3D() -
realBounds3D
NTxBounds3D realBounds3D() -
realGlobalBounds3D
NTxBounds3D realGlobalBounds3D() -
defaultSelfBounds3D
NTxBounds3D defaultSelfBounds3D() -
dryMode
NTxRendererContext dryMode() -
pageStartTime
long pageStartTime() -
imageObserver
ImageObserver imageObserver() -
isDry
boolean isDry() -
graphics
NTxGraphics graphics() -
render
void render() -
computePropertyValue
-
computeProperties
-
withBuilderContext
-
resolveNode
-
withDefaultStyles
-
withParentBounds
-
withGraphics
-
withRealBounds3D
-
withRealGlobalBounds3D
-
sizeRef
NTxSizeRef sizeRef() -
isPrint
boolean isPrint() -
isAnimate
boolean isAnimate() -
repaint
void repaint() -
getCapability
-
hasCapability
-
isCapability
-
highlightNutsText
void highlightNutsText(String lang, String rawText, net.thevpc.nuts.text.NText parsedText, NTxTextRendererBuilder result) -
getColorProperty
-
getOrigin
-
getPosition
-
getStroke
net.thevpc.nuts.elem.NElement getStroke() -
selfBounds2D
-
isVisible
boolean isVisible() -
isLayoutNone
boolean isLayoutNone() -
getFontSize
double getFontSize() -
getFontFamily
String getFontFamily() -
isFontUnderlined
boolean isFontUnderlined() -
isFontStrike
boolean isFontStrike() -
isFontBold
boolean isFontBold() -
isFontItalic
boolean isFontItalic() -
getFont
Font getFont() -
getRoundCornerArcs
NTxDouble2 getRoundCornerArcs() -
getColSpan
int getColSpan() -
getRowSpan
int getRowSpan() -
get3D
Boolean get3D() -
getRaised
Boolean getRaised() -
readStyleAsShadow
-
getForegroundColor
-
getLineColor
-
resolveGridColor
Paint resolveGridColor() -
resolveBackgroundColor
Paint resolveBackgroundColor() -
resolveLineColor
-
isDrawContour
boolean isDrawContour() -
requireDrawGrid
boolean requireDrawGrid() -
requireFillBackground
boolean requireFillBackground() -
getColumns
int getColumns() -
getRows
int getRows() -
isDebug
boolean isDebug() -
getDebugLevel
int getDebugLevel() -
getDebugColor
Color getDebugColor() -
getStyleAsShadowDistance
-
mapDim
-
resolveStroke
Stroke resolveStroke() -
withStroke
-
applyStroke
boolean applyStroke() -
applyFont
void applyFont() -
mapDim
-
bounds
-
applyForeground
boolean applyForeground(boolean force) -
applyBackgroundColor
boolean applyBackgroundColor() -
applyGridColor
boolean applyGridColor(boolean force) -
applyLineColor
boolean applyLineColor(boolean force) -
applyContourColor
boolean applyContourColor(boolean force) -
colorFromPaint
-
paintBorderLine
-
paintBackground
-
compiledPage
NTxCompiledPage compiledPage()- Specified by:
compiledPagein interfaceNTxResolutionContext
-
compiledDocument
NTxCompiledDocument compiledDocument()- Specified by:
compiledDocumentin interfaceNTxResolutionContext
-
sourceMonitor
NTxSourceMonitor sourceMonitor() -
drawContour
void drawContour() -
renderDetachedNode
-
renderDetachedNode
-
resolveNode
///////- Specified by:
resolveNodein interfaceNTxResolutionContext
-
withElement
- Specified by:
withElementin interfaceNTxResolutionContext
-
withNode
- Specified by:
withNodein interfaceNTxResolutionContext
-
pushNode
- Specified by:
pushNodein interfaceNTxResolutionContext
-
popNode
NTxRendererContext popNode()- Specified by:
popNodein interfaceNTxResolutionContext
-