Something went wrong. Try again.
Fork of dvui, the immediate-mode Zig GUI, with a font face index for Pipit
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334const dvui = @import("dvui.zig");
const Point = dvui.Point;const Rect = dvui.Rect;
const RectScale = @This();
r: Rect.Physical = .{},s: f32 = 1.0,
pub fn rectToRectScale(rs: *const RectScale, r: Rect) RectScale { return .{ .r = r.scale(rs.s, Rect.Physical).offset(rs.r), .s = rs.s };}
pub fn rectToPhysical(rs: *const RectScale, r: Rect) Rect.Physical { return r.scale(rs.s, Rect.Physical).offset(rs.r);}
pub fn rectFromPhysical(rs: *const RectScale, r: Rect.Physical) Rect { return r.offsetNeg(rs.r).scale(1 / rs.s, Rect);}
pub fn pointToPhysical(rs: *const RectScale, p: Point) Point.Physical { return p.scale(rs.s, Point.Physical).plus(rs.r.topLeft());}
pub fn pointFromPhysical(rs: *const RectScale, p: Point.Physical) Point { return p.diff(rs.r.topLeft()).scale(1 / rs.s, Point);}
test { @import("std").testing.refAllDecls(@This());}