treeform / pixie

Full-featured 2d graphics library for Nim.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shadow with negative spread doesn't match figma

AmjadHD opened this issue · comments

A continuation for #372 (comment)

Figma:

  1. create a 47x47px frame
  2. add a 29x29px rectangle at x=y=9
  3. set the corner radii to 6px
  4. set the fill to white and the opacity to 0.001% (it should become 0% when confirmed).

image
6. export the frame

Pixie:

proc drawShadow() =
  let image = newImage(47, 47)

  let r = 6f32
  let path = newPath()
  path.roundedRect(rect(9, 9, 29, 29), r, r, r, r)

  image.fillPath(path, "white")

  image.shadow(
    offset = vec2(0, 0),
    spread = -2,
    blur = 0,
    color = color(0, 0, 0, 0.4)
  ).writeFile("shadow_pixie_negative_spread_no_blur.png")

Figma:
shadow_figma_negative_spread_no_blur

  • 25x25px rect
  • corner radius is 4px (6 - 2):

Pixie:
shadow_pixie_negative_spread_no_blur

  • 25x25px rect
  • corner radius is 6px (unchanged):

Thank you for the issue!

You are totally right. I have looked into this and we don't match.

We will fix this eventually.

I believe shadow()'s logic is correct as is, Are you going to add box-shadow() function ?