Skip to content

gui_toolkit 0.339.0

Choose a tag to compare

@sachahjkl sachahjkl released this 21 Nov 11:05
· 425 commits to master since this release
v0.339.0
1f34362

Changed

  • Every angle is in turns: a whole circle is 1, a quarter turn 0.25, in every package (src/md/infrastructure/angles.md). The new package gt:turn gives sin, cos, sincos, tan, atan2 (in turns), asin, acos, wrap and the conversions from_degrees, to_degrees, from_radians, to_radians (docs/turn.md); a multiple of a quarter turn is exact (sincos(0.25) is (1, 0)), so a rotation by a quarter turn is an exact matrix. Degrees and radians remain only where a system, a file or a person gives them (a pen's tilt, SVG, CSS text, a COLR font, the PDF engine), converted once; tests/angles holds the rule. A program changes each of these calls (the direction and the zero of each are unchanged):
    • draw.affine_rotate(radians) -> affine_rotate(turns); draw.affine_skew(ax, ay): radians -> turns
    • draw.filter_hue_rotate(radians) -> filter_hue_rotate(turns)
    • draw.Gradient.angle (Conic, clockwise from up): radians -> turns
    • draw.path_arc(p, center, radii, from, to): radians -> turns (a whole ellipse: 0 to 1)
    • paint.rotate_at(m, degrees, cx, cy) -> rotate_at(m, turns, cx, cy); paint.arc(p, x, y, w, h, start, sweep): degrees -> turns
    • image.hue_rotate(img, degrees) -> hue_rotate(img, turns); image.Fill.angle (0 upward, as CSS): degrees -> turns
    • ink.Sample.tilt (-90..90 -> -0.25..0.25) and ink.Pen.nib_angle (30 -> 1.0 / 12): degrees -> turns
    • platform.Pointer_Info.tilt (-0.25..0.25) and .twist (0..1), so ui.pointer_device().tilt: degrees -> turns
    • pdf.Stamp.tilt (-45..45 -> -0.125..0.125): degrees -> turns
    • a count of quarter turns is named quarters, an angle turns: pdf.Stamp.turns -> pdf.Stamp.quarters, pdf.Page.turns -> pdf.Page.quarters, image.rotate(img, quarter_turns) -> image.rotate(img, quarters) (the values unchanged)
    • render.Video_Picture.rotation: an int of degrees (0, 90, 180, 270) -> an f32 of turns (0, 0.25, 0.5, 0.75)
    • ui.Exploded_View.yaw and .pitch, ui.Licence_Card_Look.rx and .ry, ui.licence_card_seal_reveal(rx, ry): degrees -> turns
    • ui.srgb_to_hsl, ui.hsl_to_srgb, ui.srgb_to_oklch, ui.oklch_to_srgb, ui.to_oklch, ui.from_oklch: the hue in degrees -> turns (CSS text keeps its degrees: color_parse and color_text convert)