Skip to content

Commit 758b417

Browse files
authored
Bugfix/nt 72/drop alpha channel (#572)
* Disable GitHub package registry * (NT-72) Fix toString representation of RGBA * (NT-72) Default to 32 bit images (4 8 bit channels) * (NT-72) Update test for libnut screen action * (NT-72) Enable snapshot releases
1 parent 46f1d01 commit 758b417

File tree

6 files changed

+8
-21
lines changed

6 files changed

+8
-21
lines changed

Diff for: .github/workflows/snapshot_release.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,3 @@ jobs:
7474
run: pnpm run publish:next
7575
env:
7676
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
77-
- uses: actions/setup-node@v3
78-
with:
79-
registry-url: "https://npm.pkg.github.com"
80-
- name: Publish snapshot release to GPR
81-
run: npm run publish:next
82-
env:
83-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: .github/workflows/tagged_release.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,3 @@ jobs:
6868
run: pnpm run publish:release
6969
env:
7070
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
71-
- uses: actions/setup-node@v3
72-
with:
73-
registry-url: "https://npm.pkg.github.com"
74-
- name: Publish tagged release to GPR
75-
run: pnpm run publish:release
76-
env:
77-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: core/nut.js/lib/provider/io/jimp-image-reader.class.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default class implements ImageReader {
2424
jimpImage.bitmap.width,
2525
jimpImage.bitmap.height,
2626
jimpImage.bitmap.data,
27-
jimpImage.hasAlpha() ? 4 : 3,
27+
4,
2828
parameters,
2929
jimpImage.bitmap.data.length /
3030
(jimpImage.bitmap.width * jimpImage.bitmap.height),

Diff for: core/shared/lib/objects/rgba.class.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ export class RGBA {
44
public readonly G: number,
55
public readonly B: number,
66
public readonly A: number
7-
) {}
7+
) {
8+
}
89

910
public toString(): string {
10-
return `rgb(${this.R},${this.G},${this.B})`;
11+
return `rgba(${this.R},${this.G},${this.B},${this.A})`;
1112
}
1213

1314
public toHex(): string {

Diff for: providers/libnut/lib/libnut-screen.class.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe("libnut screen action", () => {
3636
colorAt: jest.fn(),
3737
height: screenShotSize.height,
3838
image: Buffer.from(
39-
new Array(screenShotSize.width * screenShotSize.height * 4 + 10).fill(
39+
new Array(screenShotSize.width * screenShotSize.height * 4).fill(
4040
0
4141
)
4242
),
@@ -72,7 +72,7 @@ describe("libnut screen action", () => {
7272
colorAt: jest.fn(),
7373
height: screenShotSize.height,
7474
image: Buffer.from(
75-
new Array(screenShotSize.width * screenShotSize.height * 4 + 10).fill(
75+
new Array(screenShotSize.width * screenShotSize.height * 4).fill(
7676
0
7777
)
7878
),

Diff for: providers/libnut/lib/libnut-screen.class.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default class ScreenAction implements ScreenProviderInterface {
3030
new Image(
3131
screenShot.width,
3232
screenShot.height,
33-
screenShot.image.slice(0, screenShot.width * screenShot.height * 4),
33+
screenShot.image,
3434
4,
3535
"grabScreenResult",
3636
screenShot.bitsPerPixel,
@@ -62,7 +62,7 @@ export default class ScreenAction implements ScreenProviderInterface {
6262
new Image(
6363
screenShot.width,
6464
screenShot.height,
65-
screenShot.image.slice(0, screenShot.width * screenShot.height * 4),
65+
screenShot.image,
6666
4,
6767
"grabScreenRegionResult",
6868
screenShot.bitsPerPixel,

0 commit comments

Comments
 (0)