SPB Git

Repository Public

ink-width-law.json 2.5 KB 152 lines json

1{2  "description": "SP Note ink width law, shared by the web (src/lib/editor/ink.ts) and the Swift core. pen: width × (0.35 + 0.65·p); marker and highlighter: constant width; a point without pressure counts as p = 1; an opaque highlighter colour is drawn at alpha 0.40. `expected[i]` belongs to `ink.strokes[i]`: the pressure read for each point, the drawn width at each point (rounded to 3 decimals) and the stroke bounds [minX, minY, maxX, maxY] (points ± half the widest width).",3  "law": {4    "pen": "width * (0.35 + 0.65 * p)",5    "marker": "width",6    "highlighter": "width",7    "missingPressure": 1,8    "highlighterAlpha": 0.49  },10  "highlighterAlpha": 0.4,11  "ink": {12    "format": "spn-ink-1",13    "width": 400,14    "height": 300,15    "strokes": [16      {17        "tool": "pen",18        "color": "#1a1f2bff",19        "width": 4,20        "points": [21          [22            10,23            10,24            025          ],26          [27            20,28            10,29            0.2530          ],31          [32            30,33            10,34            0.535          ],36          [37            40,38            10,39            0.7540          ],41          [42            50,43            10,44            145          ],46          [47            60,48            1049          ]50        ]51      },52      {53        "tool": "marker",54        "color": "#2f5ddbff",55        "width": 6,56        "points": [57          [58            10,59            50,60            0.261          ],62          [63            60,64            50,65            0.966          ],67          [68            110,69            5070          ]71        ]72      },73      {74        "tool": "highlighter",75        "color": "#ffd60aff",76        "width": 20,77        "points": [78          [79            10,80            100,81            0.182          ],83          [84            200,85            10086          ]87        ]88      }89    ]90  },91  "expected": [92    {93      "pressures": [94        0,95        0.25,96        0.5,97        0.75,98        1,99        1100      ],101      "widths": [102        1.4,103        2.05,104        2.7,105        3.35,106        4,107        4108      ],109      "bounds": [110        8,111        8,112        62,113        12114      ]115    },116    {117      "pressures": [118        0.2,119        0.9,120        1121      ],122      "widths": [123        6,124        6,125        6126      ],127      "bounds": [128        7,129        47,130        113,131        53132      ]133    },134    {135      "pressures": [136        0.1,137        1138      ],139      "widths": [140        20,141        20142      ],143      "bounds": [144        0,145        90,146        210,147        110148      ]149    }150  ]151}152
Files main
Menu

Theme