export function getDevicePixelRatio() {
    if (typeof window === "undefined")
        return 1;
    const dpr = window.devicePixelRatio || 1;
    return Number.isFinite(dpr) && dpr > 0 ? dpr : 1;
}
export function toDevicePixels(value, dpr = getDevicePixelRatio()) {
    return Math.round(value * dpr);
}
export function toDevicePixelsCeil(value, dpr = getDevicePixelRatio()) {
    return Math.ceil(value * dpr);
}
export function toCssPixels(value, dpr = getDevicePixelRatio()) {
    return value / dpr;
}
export function snapToDevice(value, dpr = getDevicePixelRatio()) {
    return toCssPixels(toDevicePixels(value, dpr), dpr);
}
export function snapToDeviceCeil(value, dpr = getDevicePixelRatio()) {
    return toCssPixels(toDevicePixelsCeil(value, dpr), dpr);
}
//# sourceMappingURL=pixelAlign.js.map