| Modifier and Type | Field and Description |
|---|---|
| private Background | background
The background to use for drawing. |
| private Insets | backgroundInsets
The combined insets of all the backgrounds. |
| private Border | border
The border to use for drawing. |
| private static final int | CACHE_SLICE_H
Indicates the cached image can be sliced horizontally. |
| private static final int | CACHE_SLICE_V
Indicates the cached image can be sliced vertically. |
| private Integer | cacheKey
Is the key into the image cache that identifies the required background for the region. |
| private int | cacheMode
Determined when a background is set on the region, this flag indicates whether this background can be cached. |
| private boolean | cacheShape
Whether we should attempt to use region caching for a region with a shape. |
| private boolean | centerShape
Whether we should center the shape within the bounds of the region. |
| private float | height
The width and height of the region. |
| private static WeakHashMap | imageCacheMap
Screen to RegionImageCache mapping. |
| private NGShape | |
| private static final Offset | |
| private EffectFilter | |
| private List | normalizedFillCorners
The normalized list of CornerRadii have been precomputed at the FX layer to properly account for percentages, insets and radii scaling to prevent the radii from overflowing the dimensions of the region. |
| private List | |
| private float | opaqueBottom
A cached set of the opaque insets as given to us during synchronization. |
| private float | opaqueLeft
A cached set of the opaque insets as given to us during synchronization. |
| private float | opaqueRight
A cached set of the opaque insets as given to us during synchronization. |
| private float | opaqueTop
A cached set of the opaque insets as given to us during synchronization. |
| private boolean | scaleShape
Whether we should scale the shape to match the bounds of the region. |
| private static final Affine2D | SCRATCH_AFFINE
This scratch transform is used when transforming shapes. |
| private Shape | shape
The shape of the region. |
| private static final Rectangle | TEMP_RECT
Temporary rect for general use. |
| private float | width
The width and height of the region. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | clearDirty()
Overrides com. When cleaning the dirty flag, we also have to keep in mind the NGShape used by the NGRegion |
| protected RectBounds | computeOpaqueRegion(RectBounds opaqueRegion)
Overrides com. The opaque region of an NGRegion takes into account the opaque insets specified by the Region during synchronization. |
| protected NGNode. | computeRenderRoot(NodePath path, RectBounds dirtyRegion, int cullingIndex, BaseTransform tx, GeneralTransform3D pvTx)
Overrides com. * Culling Related Methods * * |
| private Path2D | createPath(float width, float height, float t, float l, float bo, float ro, CornerRadii radii)
Creates a rounded rectangle path with our width and height, different corner radii, offset with given offsets |
| private Path2D[] | createPaths(float t, float l, float bo, float ro, CornerRadii radii)
Creates a rounded rectangle path with our width and height, different corner radii, offset with given offsets. |
| private BasicStroke | Returns: A prism BasicStrokeThe BorderStrokeStyle sb, double The width of the stroke we're going to draw strokeWidth, double The total linear length of this stroke. This is needed for
handling "dashed" and "dotted" cases, otherwise, it is ignored. lineLength, boolean When this is set to true, the stroke is always centered.
The "outer/inner" stroking has to be done by moving the line forceCentered)Creates a Prism BasicStroke based on the stroke style, width, and line length. |
| private void | doCorner(Path2D path, CornerRadii radii, float x, float y, int quadrant, float tstart, float tend, boolean newPath)
Inserts geometry into the specified Path2D object for the specified corner of a general rounded rectangle. |
| pack-priv final Background | |
| pack-priv final Border | |
| private Integer | |
| pack-priv final float | |
| private RegionImageCache | getImageCache(final Graphics g)
* Implementations of methods defined in the parent classes, with the * exception of rendering methods. |
| private CornerRadii | Returns: the normalized radii for the indicated BackgroundFill objectthe index of the BackgroundFill object being processed index)Returns the normalized (non-percentage, non-overflowing) radii for the selected index into the BackgroundFill objects. |
| private CornerRadii | Returns: the normalized radii for the indicated BorderStroke objectthe index of the BorderStroke object being processed index)Returns the normalized (non-percentage, non-overflowing) radii for the selected index into the BorderStroke objects. |
| pack-priv static Paint | |
| pack-priv final float | |
| protected boolean | hasOpaqueRegion()
Overrides com. Called only on NGNode subclasses which override |
| protected boolean | |
| protected boolean | hasVisuals()
Overrides com. Marks if the node has some visuals and that the bounds change should be taken into account when using the dirty region. |
| public void | imagesUpdated()
Called by Region whenever an image that was being loaded in the background has finished loading. |
| private Path2D | |
| private void | paintTiles(Graphics g, Image img, BorderRepeat repeatX, BorderRepeat repeatY, Side horizontalSide, Side verticalSide, final float regionX, final float regionY, final float regionWidth, final float regionHeight, final int srcX, final int srcY, final int srcW, final int srcH, float tileX, float tileY, float tileWidth, float tileHeight)
|
| private void | paintTiles(Graphics
The graphics context to draw image into g, Image The image to draw img, BackgroundRepeat The horizontal repeat style for filling the area with the src image repeatX, BackgroundRepeat The vertical repeat style for filling the area with the src image repeatY, Side The left or right horizontalSide, Side The top or bottom verticalSide, final float The top left corner X of the area of the graphics context to fill with our img regionX, final float The top left corner Y of the area of the graphics context to fill with our img regionY, final float The width of the area of the graphics context to fill with our img regionWidth, final float The height of the area of the graphics context to fill with our img regionHeight, final int The top left corner X of the area of the image to paint with srcX, final int The top left corner Y of the area of the image to paint with srcY, final int The width of the area of the image to paint with, -1 to use the original image width srcW, final int The height of the area of the image to paint with, -1 to use the original image height srcH, float The top left corner X of the area of the first tile within the destination rectangle. In some
cases we begin by drawing the center tile, and working to the left & right (for example), so
this value is not always the same as regionX. tileX, float The top left corner Y of the area of the first tile within the destination rectangle tileY, float The width of the area of the first tile within the destination rectangle, if <= 0, then the use intrinsic value tileWidth, float The height of the area of the first tile within the destination rectangle, if <= 0, then the use intrinsic value tileHeight)Paints a subsection (srcX,srcY,srcW,srcH) of an image tiled or stretched to fill the destination area (regionWidth,regionHeight). |
| private void | renderAsRectangle(Graphics g)
* Drawing a region background and borders when the Region has no defined * shape, and is therefore treated as a rounded rectangle. |
| private void | renderAsShape(Graphics g)
* Drawing a region background and borders when the Region has been * specified to have a shape. |
| private void | |
| private void | renderBackgroundRectangleFromCache(Graphics g, RTTexture cached, Rectangle rect, int textureWidth, int textureHeight, double topInset, double rightInset, double bottomInset, double leftInset, int outsetsTop, int outsetsRight, int outsetsBottom, int outsetsLeft)
|
| private void | |
| private void | |
| private void | |
| protected void | |
| private Shape | resizeShape(float topOffset, float rightOffset, float bottomOffset, float leftOffset)
Create a bigger or smaller version of shape. |
| private int | |
| private void | |
| public void | setOpaqueInsets(float
The top, if NaN then there is no opaque inset at all top, float The right, must not be NaN or Infinity, etc. right, float The bottom, must not be NaN or Infinity, etc. bottom, float The left, must not be NaN or Infinity, etc. left)Called by the Region whenever it knows that the opaque insets have changed. |
| public void | setSize(float
The width of the region, not including insets or outsets width, float The height of the region, not including insets or outsets height)Called by the Region whenever the width or height of the region has changed. |
| private int | |
| protected boolean | supportsOpaqueRegions()
Overrides com. Gets whether this NGNode supports opaque regions at all. |
| public void | updateBackground(Background
Background, of type javafx.scene.layout.Background. Can be null. b)Called by the Region when the Background has changed. |
| private void | updateBackgroundInsets()
Visits each of the background fills and takes their radii into account to determine the insets. |
| public void | updateBorder(Border
Border, of type javafx.scene.layout.Border b)Called by the Region when the Border is changed. |
| public void | updateFillCorners(List<CornerRadii> normalizedFillCorners)
Called by the Region when any parameters are changed. |
| public void | updateShape(Object
The shape, may be null. shape, boolean whether to scale the shape scaleShape, boolean whether to center the shape positionShape, boolean cacheShape)Called by the Region during synchronization. |
| public void | updateStrokeCorners(List<CornerRadii>
a precomputed copy of the radii in the
BorderStroke objects that are not percentages and do not overflow normalizedStrokeCorners)Called by the Region when any parameters are changed. |
| private int |
| background | back to summary |
|---|---|
| private Background background The background to use for drawing. Since this is an immutable object, I can simply refer to its fields / methods directly when rendering. I will make sure this is not ever null at the time that we do the sync, so that the code in this class can assume non-null. | |
| backgroundInsets | back to summary |
|---|---|
| private Insets backgroundInsets The combined insets of all the backgrounds. As of right now, Background doesn't store this information itself, although it probably could (and probably should). | |
| border | back to summary |
|---|---|
| private Border border The border to use for drawing. Similar to background, this is not-null and immutable. | |
| CACHE_SLICE_H | back to summary |
|---|---|
| private static final int CACHE_SLICE_H Indicates the cached image can be sliced horizontally. | |
| CACHE_SLICE_V | back to summary |
|---|---|
| private static final int CACHE_SLICE_V Indicates the cached image can be sliced vertically. | |
| cacheKey | back to summary |
|---|---|
| private Integer cacheKey Is the key into the image cache that identifies the required background for the region. | |
| cacheMode | back to summary |
|---|---|
| private int cacheMode Determined when a background is set on the region, this flag indicates whether this background can be cached. As of this time, the only backgrounds which can be cached are those where there are only solid fills or linear gradients. | |
| cacheShape | back to summary |
|---|---|
| private boolean cacheShape Whether we should attempt to use region caching for a region with a shape. | |
| centerShape | back to summary |
|---|---|
| private boolean centerShape Whether we should center the shape within the bounds of the region. Only applies if the shape is not null. | |
| height | back to summary |
|---|---|
| private float height The width and height of the region. | |
| imageCacheMap | back to summary |
|---|---|
| private static WeakHashMap<Screen, RegionImageCache> imageCacheMap Screen to RegionImageCache mapping. This mapping is required as textures are only valid in graphics context used to create them (relies on a one to one mapping between Screen and GraphicsContext). | |
| ngShape | back to summary |
|---|---|
| private NGShape ngShape | |
| nopEffect | back to summary |
|---|---|
| private static final Offset nopEffect | |
| nopEffectFilter | back to summary |
|---|---|
| private EffectFilter nopEffectFilter | |
| normalizedFillCorners | back to summary |
|---|---|
| private List<CornerRadii> normalizedFillCorners The normalized list of CornerRadii have been precomputed at the FX layer to properly account for percentages, insets and radii scaling to prevent the radii from overflowing the dimensions of the region. The List objects are shared with the FX layer and are therefore unmodifiable. If the normalized list is null then it means that all of the raw radii in the list were already absolute and non-overflowing and so the originals can be used from the arrays of strokes and fills. | |
| normalizedStrokeCorners | back to summary |
|---|---|
| private List<CornerRadii> normalizedStrokeCorners | |
| opaqueBottom | back to summary |
|---|---|
| private float opaqueBottom A cached set of the opaque insets as given to us during synchronization. We hold on to this so that we can determine the opaque insets in the computeOpaqueRegion method. | |
| opaqueLeft | back to summary |
|---|---|
| private float opaqueLeft A cached set of the opaque insets as given to us during synchronization. We hold on to this so that we can determine the opaque insets in the computeOpaqueRegion method. | |
| opaqueRight | back to summary |
|---|---|
| private float opaqueRight A cached set of the opaque insets as given to us during synchronization. We hold on to this so that we can determine the opaque insets in the computeOpaqueRegion method. | |
| opaqueTop | back to summary |
|---|---|
| private float opaqueTop A cached set of the opaque insets as given to us during synchronization. We hold on to this so that we can determine the opaque insets in the computeOpaqueRegion method. | |
| scaleShape | back to summary |
|---|---|
| private boolean scaleShape Whether we should scale the shape to match the bounds of the region. Only applies if the shape is not null. | |
| SCRATCH_AFFINE | back to summary |
|---|---|
| private static final Affine2D SCRATCH_AFFINE This scratch transform is used when transforming shapes. Because this is a static variable, it is only intended to be used from a single thread, the render thread in this case. | |
| shape | back to summary |
|---|---|
| private Shape shape The shape of the region. Usually this will be null (except for things like check box checks, scroll bar down arrows / up arrows, etc). If this is not null, it determines the shape of the region to draw. If it is null, then the assumed shape of the region is one of a rounded rectangle. This shape is a com.sun.javafx.geom.Shape, and is not touched by the FX scene graph except during synchronization, so it is safe to access on the render thread. | |
| TEMP_RECT | back to summary |
|---|---|
| private static final Rectangle TEMP_RECT Temporary rect for general use. Because this is a static variable, it is only intended to be used from a single thread, the render thread in this case. | |
| width | back to summary |
|---|---|
| private float width The width and height of the region. | |
| NGRegion | back to summary |
|---|---|
| public NGRegion() | |
| clearDirty | back to summary |
|---|---|
| public void clearDirty() Overrides com. When cleaning the dirty flag, we also have to keep in mind the NGShape used by the NGRegion
| |
| computeOpaqueRegion | back to summary |
|---|---|
| protected RectBounds computeOpaqueRegion(RectBounds opaqueRegion) Overrides com. The opaque region of an NGRegion takes into account the opaque insets specified by the Region during synchronization. It also takes into account the clip and the effect.
| |
| computeRenderRoot | back to summary |
|---|---|
| protected NGNode. Overrides com. Doc from com. * Culling Related Methods * *
| |
| createPath | back to summary |
|---|---|
| private Path2D createPath(float width, float height, float t, float l, float bo, float ro, CornerRadii radii) Creates a rounded rectangle path with our width and height, different corner radii, offset with given offsets | |
| createPaths | back to summary |
|---|---|
| private Path2D[] createPaths(float t, float l, float bo, float ro, CornerRadii radii) Creates a rounded rectangle path with our width and height, different corner radii, offset with given offsets. Each side as a separate path. The sides are returned in the CSS standard order of top, right, bottom, left. | |
| createStroke | back to summary |
|---|---|
| private BasicStroke createStroke(BorderStrokeStyle sb, double strokeWidth, double lineLength, boolean forceCentered) Creates a Prism BasicStroke based on the stroke style, width, and line length.
| |
| doCorner | back to summary |
|---|---|
| private void doCorner(Path2D path, CornerRadii radii, float x, float y, int quadrant, float tstart, float tend, boolean newPath) Inserts geometry into the specified Path2D object for the specified corner of a general rounded rectangle. The corner drawn is specified by the quadrant parameter, whose least significant 2 bits specify the following corners and the associated start, corner, and end points (which are always drawn clockwise): 0 - Top Left: X + 0 , Y + VR, X, Y, X + HR, Y + 0 1 - Top Right: X - HR, Y + 0 , X, Y, X + 0 , Y + VR 2 - Bottom Right: X + 0 , Y - VR, X, Y, X - HR, Y + 0 3 - Bottom Left: X + HR, Y + 0 , X, Y, X + 0 , Y - VR The associated horizontal and vertical radii are fetched from the indicated CornerRadii object which is assumed to be absolute (not percentage based) and already scaled so that no pair of radii are larger than the indicated width/height of the rounded rectangle being expressed. The tstart and tend parameters specify what portion of the rounded corner should be drawn with 0f => 1f being the entire rounded corner. The newPath parameter indicates whether the path should reach the starting point with a moveTo() command or a lineTo() segment. | |
| getBackground | back to summary |
|---|---|
| pack-priv final Background getBackground() | |
| getBorder | back to summary |
|---|---|
| pack-priv final Border getBorder() | |
| getCacheKey | back to summary |
|---|---|
| private Integer getCacheKey(int w, int h) | |
| getHeight | back to summary |
|---|---|
| pack-priv final float getHeight() | |
| getImageCache | back to summary |
|---|---|
| private RegionImageCache getImageCache(final Graphics g) * Implementations of methods defined in the parent classes, with the * exception of rendering methods. * * | |
| getNormalizedFillRadii | back to summary |
|---|---|
| private CornerRadii getNormalizedFillRadii(int index) Returns the normalized (non-percentage, non-overflowing) radii for the selected index into the BackgroundFill objects. If a List was synchronized from the Region object, the value from that List, otherwise the raw radii are fetched from the indicated BackgroundFill object.
| |
| getNormalizedStrokeRadii | back to summary |
|---|---|
| private CornerRadii getNormalizedStrokeRadii(int index) Returns the normalized (non-percentage, non-overflowing) radii for the selected index into the BorderStroke objects. If a List was synchronized from the Region object, the value from that List, otherwise the raw radii are fetched from the indicated BorderStroke object.
| |
| getPlatformPaint | back to summary |
|---|---|
| pack-priv static Paint getPlatformPaint(Paint paint) Simple Helper Function for cleanup. | |
| getWidth | back to summary |
|---|---|
| pack-priv final float getWidth() | |
| hasOpaqueRegion | back to summary |
|---|---|
| protected boolean hasOpaqueRegion() Overrides com. Doc from com. Called only on NGNode subclasses which override
| |
| hasOverlappingContents | back to summary |
|---|---|
| protected boolean hasOverlappingContents() Overrides com.
| |
| hasVisuals | back to summary |
|---|---|
| protected boolean hasVisuals() Overrides com. Doc from com. Marks if the node has some visuals and that the bounds change should be taken into account when using the dirty region. This will be false for NGGroup (but not for NGRegion)
| |
| imagesUpdated | back to summary |
|---|---|
| public void imagesUpdated() Called by Region whenever an image that was being loaded in the background has finished loading. Nothing changes in terms of metrics or sizes or caches, but we do need to repaint everything. | |
| makeRoundedEdge | back to summary |
|---|---|
| private Path2D makeRoundedEdge(CornerRadii radii, float x0, float y0, float x1, float y1, int quadrant) | |
| paintTiles | back to summary |
|---|---|
| private void paintTiles(Graphics g, Image img, BorderRepeat repeatX, BorderRepeat repeatY, Side horizontalSide, Side verticalSide, final float regionX, final float regionY, final float regionWidth, final float regionHeight, final int srcX, final int srcY, final int srcW, final int srcH, float tileX, float tileY, float tileWidth, float tileHeight) | |
| paintTiles | back to summary |
|---|---|
| private void paintTiles(Graphics g, Image img, BackgroundRepeat repeatX, BackgroundRepeat repeatY, Side horizontalSide, Side verticalSide, final float regionX, final float regionY, final float regionWidth, final float regionHeight, final int srcX, final int srcY, final int srcW, final int srcH, float tileX, float tileY, float tileWidth, float tileHeight) Paints a subsection (srcX,srcY,srcW,srcH) of an image tiled or stretched to fill the destination area (regionWidth,regionHeight). It is assumed we are pre-transformed to the correct origin, top left or destination area. When tiling the first tile is positioned within the rectangle (tileX,tileY,tileW,tileH). Drawing two images next to each other on a non-pixel boundary can not be done simply so we use integers here. This assumption may be wrong when drawing though a scale transform.
| |
| renderAsRectangle | back to summary |
|---|---|
| private void renderAsRectangle(Graphics g) * Drawing a region background and borders when the Region has no defined * shape, and is therefore treated as a rounded rectangle. This is the * most common code path for UI Controls. * * | |
| renderAsShape | back to summary |
|---|---|
| private void renderAsShape(Graphics g) * Drawing a region background and borders when the Region has been * specified to have a shape. This is typically used to render some * portions of a UI Control, such as the tick on a CheckBox, the dot on a * RadioButton, or the disclosure node arrow on a TreeView. In these * cases, the overall region size is typically very small and can * therefore easily be cached. * * | |
| renderBackgroundRectangle | back to summary |
|---|---|
| private void renderBackgroundRectangle(Graphics g) | |
| renderBackgroundRectangleFromCache | back to summary |
|---|---|
| private void renderBackgroundRectangleFromCache(Graphics g, RTTexture cached, Rectangle rect, int textureWidth, int textureHeight, double topInset, double rightInset, double bottomInset, double leftInset, int outsetsTop, int outsetsRight, int outsetsBottom, int outsetsLeft) | |
| renderBackgroundRectanglesDirectly | back to summary |
|---|---|
| private void renderBackgroundRectanglesDirectly(Graphics g, float width, float height) | |
| renderBackgroundShape | back to summary |
|---|---|
| private void renderBackgroundShape(Graphics g) | |
| renderBorderRectangle | back to summary |
|---|---|
| private void renderBorderRectangle(Graphics g) | |
| renderContent | back to summary |
|---|---|
| protected void renderContent(Graphics g) Overrides com. * Region drawing. * *
| |
| resizeShape | back to summary |
|---|---|
| private Shape resizeShape(float topOffset, float rightOffset, float bottomOffset, float leftOffset) Create a bigger or smaller version of shape. If not scaleShape then the shape is just centered rather than resized. Proportions are not maintained when resizing. This is necessary so as to ensure that the fill never looks scaled. For example, a tile-imaged based background will look stretched if we were to render a scaled shape. Instead, we produce a new shape based on the scaled size and then fill that shape without additional transforms. | |
| roundUp | back to summary |
|---|---|
| private int roundUp(double d) | |
| setBorderStyle | back to summary |
|---|---|
| private void setBorderStyle(Graphics g, BorderStroke sb, double length, boolean forceCentered) | |
| setOpaqueInsets | back to summary |
|---|---|
| public void setOpaqueInsets(float top, float right, float bottom, float left) Called by the Region whenever it knows that the opaque insets have changed. The Region must make sure that these opaque insets include the opaque inset information from the Border and Background as well, the NGRegion will not recompute this information. This is done because Border and Background are immutable, and as such this information is computed once and stored rather than recomputed each time we have to render. Any developer supplied opaque insets must be combined with the Border / Background intrinsic opaque insets prior to this call and passed as the arguments to this method.
| |
| setSize | back to summary |
|---|---|
| public void setSize(float width, float height) Called by the Region whenever the width or height of the region has changed. The Region *should* only call this when the width or height have actually changed.
| |
| sliceSize | back to summary |
|---|---|
| private int sliceSize(boolean isPercent, double sliceSize, float objSize, float scale) | |
| supportsOpaqueRegions | back to summary |
|---|---|
| protected boolean supportsOpaqueRegions() Overrides com. Doc from com. Gets whether this NGNode supports opaque regions at all. Most node types do not, but some do. If an NGNode subclass is written to support opaque regions, it must override this method to return true. The subclass must then also override the computeDirtyRegion method to return the dirty region, or null if the node in its current state doesn't have one. This method is intended to be immutable.
| |
| updateBackground | back to summary |
|---|---|
| public void updateBackground(Background b) Called by the Region when the Background has changed. The Region *must* only call this method if the background object has actually changed, or excessive work may be done.
| |
| updateBackgroundInsets | back to summary |
|---|---|
| private void updateBackgroundInsets() Visits each of the background fills and takes their radii into account to determine the insets. The backgroundInsets variable is cleared whenever the fills change, or whenever the size of the region has changed (because if the size of the region changed and a radius is percentage based then we need to recompute the insets). | |
| updateBorder | back to summary |
|---|---|
| public void updateBorder(Border b) Called by the Region when the Border is changed. The Region *must* only call this method if the border object has actually changed, or excessive work may be done.
| |
| updateFillCorners | back to summary |
|---|---|
| public void updateFillCorners(List<CornerRadii> normalizedFillCorners) Called by the Region when any parameters are changed. It is only technically needed when a parameter that affects the size of any percentage or overflowing corner radii is changed, but since the data is not processed here in NGRegion, it is set on every update of the peers for any reason. A null value means that the raw radii in the BackgroundFill objects themselves were already absolute and non-overflowing. | |
| updateShape | back to summary |
|---|---|
| public void updateShape(Object shape, boolean scaleShape, boolean positionShape, boolean cacheShape) Called by the Region during synchronization. The Region *should* ensure that this is only called when one of these properties has changed. The cost of calling it excessively is only that the opaque region is invalidated excessively. Updating the shape and associated booleans is actually a very cheap operation.
| |
| updateStrokeCorners | back to summary |
|---|---|
| public void updateStrokeCorners(List<CornerRadii> normalizedStrokeCorners) Called by the Region when any parameters are changed. It is only technically needed when a parameter that affects the size of any percentage or overflowing corner radii is changed, but since the data is not processed here in NGRegion, it is set on every update of the peers for any reason. A null value means that the raw radii in the BorderStroke objects themselves were already absolute and non-overflowing.
| |
| widthSize | back to summary |
|---|---|
| private int widthSize(boolean isPercent, double sliceSize, float objSize) | |