Skip to content

Commit 4af19f7

Browse files
committed
Add more matrix gradients.
1 parent 936a8fc commit 4af19f7

File tree

1 file changed

+40
-5
lines changed

1 file changed

+40
-5
lines changed

src/pg/inputPixelEditor/utils/generateGradient.ts

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,44 @@
1-
// Define a Bayer matrix (e.g., 4x4)
1+
// Not used but included
2+
const byerMatrix2x2 = [
3+
[0, 2],
4+
[3, 1]
5+
];
6+
27
const bayerMatrix4x4 = [
3-
[0, 8, 2, 10],
4-
[12, 4, 14, 6],
5-
[3, 11, 1, 9],
6-
[15, 7, 13, 5]
8+
[0, 8, 2, 10],
9+
[12, 4, 14, 6],
10+
[3, 11, 1, 9],
11+
[15, 7, 13, 5]
12+
];
13+
14+
const bayerMatrix8x8 = [
15+
[0, 32, 8, 40, 2, 34, 10, 42],
16+
[48, 16, 56, 24, 50, 18, 58, 26],
17+
[12, 44, 4, 36, 14, 46, 6, 38],
18+
[60, 28, 52, 20, 62, 30, 54, 22],
19+
[3, 35, 11, 43, 1, 33, 9, 41],
20+
[51, 19, 59, 27, 49, 17, 57, 25],
21+
[15, 47, 7, 39, 13, 45, 5, 37],
22+
[63, 31, 55, 23, 61, 29, 53, 21]
23+
];
24+
25+
const bayerMatrix16x16 = [
26+
[0, 128, 32, 160, 8, 136, 40, 168, 2, 130, 34, 162, 10, 138, 42, 170],
27+
[192, 64, 224, 96, 200, 72, 232, 104, 194, 66, 226, 98, 202, 74, 234, 106],
28+
[48, 176, 16, 144, 56, 184, 24, 152, 50, 178, 18, 146, 58, 186, 26, 154],
29+
[240, 112, 208, 80, 248, 120, 216, 88, 242, 114, 210, 82, 250, 122, 218, 90],
30+
[12, 140, 44, 172, 4, 132, 36, 164, 14, 142, 46, 174, 6, 134, 38, 166],
31+
[204, 76, 236, 108, 196, 68, 228, 100, 206, 78, 238, 110, 198, 70, 230, 102],
32+
[60, 188, 28, 156, 52, 180, 20, 148, 62, 190, 30, 158, 54, 182, 22, 150],
33+
[252, 124, 220, 92, 244, 116, 212, 84, 254, 126, 222, 94, 246, 118, 214, 86],
34+
[3, 131, 35, 163, 11, 139, 43, 171, 1, 129, 33, 161, 9, 137, 41, 169],
35+
[195, 67, 227, 99, 203, 75, 235, 107, 193, 65, 225, 97, 201, 73, 233, 105],
36+
[51, 179, 19, 147, 59, 187, 27, 155, 49, 177, 17, 145, 57, 185, 25, 153],
37+
[243, 115, 211, 83, 251, 123, 219, 91, 241, 113, 209, 81, 249, 121, 217, 89],
38+
[15, 143, 47, 175, 7, 135, 39, 167, 13, 141, 45, 173, 5, 133, 37, 165],
39+
[207, 79, 239, 111, 199, 71, 231, 103, 205, 77, 237, 109, 197, 69, 229, 101],
40+
[63, 191, 31, 159, 55, 183, 23, 151, 61, 189, 29, 157, 53, 181, 21, 149],
41+
[255, 127, 223, 95, 247, 119, 215, 87, 253, 125, 221, 93, 245, 117, 213, 85]
742
];
843

944
// Normalize the Bayer matrix values to a 0-1 range

0 commit comments

Comments
 (0)