Skip to main content

Module clip_path

Module clip_path 

Source
Expand description

CSS clip-path 解析および内外判定・幾何計算モジュール。

W3C CSS Masking Module Level 1 準拠:

  • 基本形状: circle(), ellipse(), inset(), polygon()
  • 単位解決: px, %, rem (16px), em (font_px), pt (4/3px), 裸数値
  • キーワード位置: left, top, right, bottom, center
  • inset() の角丸半径(round 構文)
  • polygon() の fill-rule(nonzero, evenodd)

Enums§

ClipShape

Functions§

clip_inside
Returns true if point (ox, oy) in element-local pixels is inside the clip shape. 計算量: O(V) — V は多角形の頂点数(polygon() の場合)。 円・楕円・矩形は O(1)。
clip_len
clip_len_with_font
clip_pos
clip_pos_with_font
parse_clip_shape
Parse CSS clip-path value into pixel coordinates relative to the element. w and h are the element’s rendered width and height in pixels.
parse_clip_shape_with_font
Parse CSS clip-path value with element font size for resolving em units.
point_in_rounded_rect
polygon_contains 🔒
even-odd 規則(既定のfill-rule)での内外判定。自己交差の無い多角形では nonzero と同じ結果になるが、自己交差する多角形では領域の解釈が異なる。
polygon_contains_nonzero 🔒
nonzero 規則(clip-path: polygon(nonzero, ...))での内外判定。各辺との交差方向 (上向き/下向き)を winding number として加減算し、合計が0でなければ内側とする。