Skip to content

Commit

Permalink
Bugfix/nt 72/drop alpha channel (#572)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
s1hofmann authored Mar 27, 2024
1 parent 46f1d01 commit 758b417
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 21 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/snapshot_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,3 @@ jobs:
run: pnpm run publish:next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/setup-node@v3
with:
registry-url: "https://npm.pkg.github.com"
- name: Publish snapshot release to GPR
run: npm run publish:next
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 0 additions & 7 deletions .github/workflows/tagged_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,3 @@ jobs:
run: pnpm run publish:release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/setup-node@v3
with:
registry-url: "https://npm.pkg.github.com"
- name: Publish tagged release to GPR
run: pnpm run publish:release
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion core/nut.js/lib/provider/io/jimp-image-reader.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class implements ImageReader {
jimpImage.bitmap.width,
jimpImage.bitmap.height,
jimpImage.bitmap.data,
jimpImage.hasAlpha() ? 4 : 3,
4,
parameters,
jimpImage.bitmap.data.length /
(jimpImage.bitmap.width * jimpImage.bitmap.height),
Expand Down
5 changes: 3 additions & 2 deletions core/shared/lib/objects/rgba.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ export class RGBA {
public readonly G: number,
public readonly B: number,
public readonly A: number
) {}
) {
}

public toString(): string {
return `rgb(${this.R},${this.G},${this.B})`;
return `rgba(${this.R},${this.G},${this.B},${this.A})`;
}

public toHex(): string {
Expand Down
4 changes: 2 additions & 2 deletions providers/libnut/lib/libnut-screen.class.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("libnut screen action", () => {
colorAt: jest.fn(),
height: screenShotSize.height,
image: Buffer.from(
new Array(screenShotSize.width * screenShotSize.height * 4 + 10).fill(
new Array(screenShotSize.width * screenShotSize.height * 4).fill(
0
)
),
Expand Down Expand Up @@ -72,7 +72,7 @@ describe("libnut screen action", () => {
colorAt: jest.fn(),
height: screenShotSize.height,
image: Buffer.from(
new Array(screenShotSize.width * screenShotSize.height * 4 + 10).fill(
new Array(screenShotSize.width * screenShotSize.height * 4).fill(
0
)
),
Expand Down
4 changes: 2 additions & 2 deletions providers/libnut/lib/libnut-screen.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class ScreenAction implements ScreenProviderInterface {
new Image(
screenShot.width,
screenShot.height,
screenShot.image.slice(0, screenShot.width * screenShot.height * 4),
screenShot.image,
4,
"grabScreenResult",
screenShot.bitsPerPixel,
Expand Down Expand Up @@ -62,7 +62,7 @@ export default class ScreenAction implements ScreenProviderInterface {
new Image(
screenShot.width,
screenShot.height,
screenShot.image.slice(0, screenShot.width * screenShot.height * 4),
screenShot.image,
4,
"grabScreenRegionResult",
screenShot.bitsPerPixel,
Expand Down

0 comments on commit 758b417

Please sign in to comment.