Skip to content

browser/index.js overwrites window.screen #1397

Description

@tfrisvold

Expected Behavior

When using the browser/index.js, Jimp works fine however it overwrites window.screen and causes out application issues when needing the screen details to adjust the UX. I would expect the Jimp required global/window functions not to collide with standard objects. details of the screen standard here: https://developer.mozilla.org/en-US/docs/Web/API/Window/screen. We did not see this issue in 0.22.12 or earlier releases of Jimp.

Current Behavior

With Jimp 0.22.12, window.screen is:
Screen {
availHeight: 1366
availLeft: 0
availTop: 0
availWidth: 1024
colorDepth: 24
height: 1366
isExtended: true
onchange: null
orientation: ScreenOrientation {angle: 0, type: 'portrait-primary', onchange: null}
pixelDepth: 24
width: 1024
}

With Jimp 1.6.0 via browser/index.js:
function screen(e, t, i=1) {
e.a *= i;
const r = t.a + e.a - t.a * e.a
, n = e.r * e.a
, a = e.g * e.a
, o = e.b * e.a
, s = t.r * t.a
, l = t.g * t.a
, u = t.b * t.a;
return {
r: (n * t.a + s * e.a - n * s + n * (1 - t.a) + s * (1 - e.a)) / r,
g: (a * t.a + l * e.a - a * l + a * (1 - t.a) + l * (1 - e.a)) / r,
b: (o * t.a + u * e.a - o * u + o * (1 - t.a) + u * (1 - e.a)) / r,
a: r
}
}

Failure Information (for bugs)

The failure is the blocking of the screen information when using Jimp 1.6.0.

Steps to Reproduce

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions