Currently, the internal Offset class used by DropShadow stores xoff and yoff as integers. This causes sub-pixel / fractional offsets to be truncated, leading to visual jumps when small CSS offsets (-fx-effect: dropshadow(..., 0.2, 0.2)) are used, particularly when the Node is scaled.
For example, consider an SVG-based icon designed to fit within a single unit (-0.5 .. 0.5). After scaling by 1em, it matches the font character size, providing precise, CSS-scaled icon sizing.
When applying the correct DropShadow, the x-offset and y-offset need to be very small (fractional pixels) to align correctly after scaling. However, these offsets are truncated to integers internally:
- 0.1 → 0
- 0.9 → 0
- 1 → suddenly jumps to 1em
This means it is impossible to position the shadow correctly.
Proposed Change:
- Update the internal Offset class to store offsets as float (matching Prism internal conventions) instead of int.
- Update DropShadow internals to pass offsets as float to Offset, avoiding truncation. The public API continues to use doubles.
- Keep all other behavior unchanged.
I already tested a solution, and the change is minimal and limited to just the Offset and DropShadow classes. The rest of the internals already use floats or doubles.
The Offset effect is only used by drop shadow.
For example, consider an SVG-based icon designed to fit within a single unit (-0.5 .. 0.5). After scaling by 1em, it matches the font character size, providing precise, CSS-scaled icon sizing.
When applying the correct DropShadow, the x-offset and y-offset need to be very small (fractional pixels) to align correctly after scaling. However, these offsets are truncated to integers internally:
- 0.1 → 0
- 0.9 → 0
- 1 → suddenly jumps to 1em
This means it is impossible to position the shadow correctly.
Proposed Change:
- Update the internal Offset class to store offsets as float (matching Prism internal conventions) instead of int.
- Update DropShadow internals to pass offsets as float to Offset, avoiding truncation. The public API continues to use doubles.
- Keep all other behavior unchanged.
I already tested a solution, and the change is minimal and limited to just the Offset and DropShadow classes. The rest of the internals already use floats or doubles.
The Offset effect is only used by drop shadow.