@flighthq/bitmap 0.5.1-next.904.b545d9c → 0.5.1-next.905.5fbf787
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +4 -4
- package/src/bitmap.test.ts +6 -1
- package/src/bitmapChannel.test.ts +7 -2
- package/src/bitmapFingerprint.test.ts +6 -0
- package/src/bitmapFrom.test.ts +11 -1
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/bitmap`. The `@fligh
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/bitmap@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/bitmap@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/bitmap)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/5fbf7874064c384307542d68b4dcb6a895ff0dcf/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/bitmap",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.905.5fbf787",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/image": "0.5.1-next.
|
|
42
|
-
"@flighthq/entity": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/image": "0.5.1-next.905.5fbf787",
|
|
42
|
+
"@flighthq/entity": "0.5.1-next.905.5fbf787",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.905.5fbf787"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|
package/src/bitmap.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cloneBitmap, convertBitmapAlphaType, createBitmap, invalidateBitmap } from './bitmap';
|
|
1
|
+
import { cloneBitmap, convertBitmapAlphaType, createBitmap, initializeBitmap, invalidateBitmap } from './bitmap';
|
|
2
2
|
|
|
3
3
|
describe('cloneBitmap', () => {
|
|
4
4
|
it('produces identical values', () => {
|
|
@@ -77,6 +77,11 @@ describe('createBitmap', () => {
|
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
+
describe('initializeBitmap', () => {
|
|
81
|
+
it('is the construction initializer of createBitmap', () => {
|
|
82
|
+
expect(typeof initializeBitmap).toBe('function');
|
|
83
|
+
});
|
|
84
|
+
});
|
|
80
85
|
describe('invalidateBitmap', () => {
|
|
81
86
|
it('bumps the content version without replacing the pixel storage', () => {
|
|
82
87
|
const bitmap = createBitmap(1, 1);
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { createBitmap } from './bitmap';
|
|
2
|
-
import { mergeBitmapChannels, splitBitmapChannels } from './bitmapChannel';
|
|
2
|
+
import { initializeBitmap, mergeBitmapChannels, splitBitmapChannels } from './bitmapChannel';
|
|
3
3
|
import { getBitmapPixel, setBitmapPixel } from './bitmapPixel';
|
|
4
4
|
import { createBitmapRegion } from './bitmapRegion';
|
|
5
5
|
|
|
6
|
+
describe('initializeBitmap', () => {
|
|
7
|
+
it('is the construction initializer of createBitmap', () => {
|
|
8
|
+
expect(typeof initializeBitmap).toBe('function');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
6
12
|
describe('mergeBitmapChannels', () => {
|
|
7
13
|
it('combines one channel from each input into the output', () => {
|
|
8
14
|
const rSurf = createBitmap(1, 1, 0xff000000); // R=0xff, G=0, B=0, A=0
|
|
@@ -39,7 +45,6 @@ describe('mergeBitmapChannels', () => {
|
|
|
39
45
|
expect(getBitmapPixel(out, 1, 0)).toBe(0x00000000);
|
|
40
46
|
});
|
|
41
47
|
});
|
|
42
|
-
|
|
43
48
|
describe('splitBitmapChannels', () => {
|
|
44
49
|
it('returns four bitmaps of the same dimensions', () => {
|
|
45
50
|
const src = createBitmap(3, 2, 0x112233ff);
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
compareBitmapFingerprints,
|
|
5
5
|
createBitmapFingerprint,
|
|
6
6
|
formatBitmapFingerprint,
|
|
7
|
+
initializeBitmapFingerprint,
|
|
7
8
|
parseBitmapFingerprint,
|
|
8
9
|
} from './bitmapFingerprint';
|
|
9
10
|
import { setBitmapPixel } from './bitmapPixel';
|
|
@@ -94,6 +95,11 @@ describe('formatBitmapFingerprint', () => {
|
|
|
94
95
|
});
|
|
95
96
|
});
|
|
96
97
|
|
|
98
|
+
describe('initializeBitmapFingerprint', () => {
|
|
99
|
+
it('is the construction initializer of createBitmapFingerprint', () => {
|
|
100
|
+
expect(typeof initializeBitmapFingerprint).toBe('function');
|
|
101
|
+
});
|
|
102
|
+
});
|
|
97
103
|
describe('parseBitmapFingerprint', () => {
|
|
98
104
|
it('returns null for malformed text', () => {
|
|
99
105
|
expect(parseBitmapFingerprint('garbage')).toBeNull();
|
package/src/bitmapFrom.test.ts
CHANGED
|
@@ -3,7 +3,12 @@ import type { BitmapReadbackBackend, HasGraphicsBitmapReadback } from '@flighthq
|
|
|
3
3
|
import { vi } from 'vitest';
|
|
4
4
|
|
|
5
5
|
import { createBitmap } from './bitmap';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
captureBitmapFromImageResource,
|
|
8
|
+
createBitmapFromCanvas,
|
|
9
|
+
createBitmapFromImageSource,
|
|
10
|
+
initializeBitmapFromCanvas,
|
|
11
|
+
} from './bitmapFrom';
|
|
7
12
|
|
|
8
13
|
function hostWith(backend: BitmapReadbackBackend): HasGraphicsBitmapReadback {
|
|
9
14
|
return { graphics: { bitmapReadback: backend } } as HasGraphicsBitmapReadback;
|
|
@@ -85,3 +90,8 @@ describe('createBitmapFromImageSource', () => {
|
|
|
85
90
|
expect(createBitmapFromImageSource(host, document.createElement('canvas'), 8, 4)).toBe(expected);
|
|
86
91
|
});
|
|
87
92
|
});
|
|
93
|
+
describe('initializeBitmapFromCanvas', () => {
|
|
94
|
+
it('is the construction initializer of createBitmapFromCanvas', () => {
|
|
95
|
+
expect(typeof initializeBitmapFromCanvas).toBe('function');
|
|
96
|
+
});
|
|
97
|
+
});
|