Skip to content

Commit 48b0042

Browse files
committed
0.119.1 Updated enums to match Skia
1 parent a757c7b commit 48b0042

File tree

5 files changed

+55
-17
lines changed

5 files changed

+55
-17
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 0.119.1 - Dec 2, 2025
2+
3+
Fixed:
4+
5+
- `ColorType`, `EncodedImageFormat`, `FramebufferFormat`, `SurfaceColorFormat` updated to match Skia enums
6+
- `ColorType.N32` value on macOS
7+
18
# 0.119.0 - Nov 28, 2025
29

310
Changed:

shared/java/ColorType.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public enum ColorType {
7171
/**
7272
* Pixel with 10 used bits (most significant) followed by 6 unused bits for red, green, blue, alpha; in 64-bit word
7373
*/
74-
RGBA_10x6,
74+
RGBA_10X6,
7575

7676
/**
7777
* Pixel with grayscale level in 8-bit byte
@@ -124,7 +124,11 @@ public enum ColorType {
124124
/**
125125
* Pixel with a little endian uint16_t for red, green, blue, and alpha
126126
*/
127-
R16G16B16A16_UNORM;
127+
R16G16B16A16_UNORM,
128+
129+
SRGBA_8888,
130+
131+
R8_UNORM;
128132

129133
static { Library.staticLoad(); }
130134

@@ -133,7 +137,8 @@ public enum ColorType {
133137
/**
134138
* Native ARGB 32-bit encoding
135139
*/
136-
public static ColorType N32 = BGRA_8888;
140+
public static final ColorType N32 = OperatingSystem.CURRENT == OperatingSystem.WINDOWS || OperatingSystem.CURRENT == OperatingSystem.LINUX ? BGRA_8888 : RGBA_8888;
141+
137142

138143
/**
139144
* Returns the number of bytes required to store a pixel, including unused padding.
@@ -155,7 +160,7 @@ public int getBytesPerPixel() {
155160
case BGRA_1010102: return 4;
156161
case BGR_101010X: return 4;
157162
case BGR_101010X_XR: return 4;
158-
case RGBA_10x6: return 8;
163+
case RGBA_10X6: return 8;
159164
case GRAY_8: return 1;
160165
case RGBA_F16NORM: return 8;
161166
case RGBA_F16: return 8;
@@ -166,6 +171,8 @@ public int getBytesPerPixel() {
166171
case A16_FLOAT: return 2;
167172
case R16G16_FLOAT: return 4;
168173
case R16G16B16A16_UNORM: return 8;
174+
case SRGBA_8888: return 4;
175+
case R8_UNORM: return 1;
169176
}
170177
throw new RuntimeException("Unreachable");
171178
}
@@ -184,7 +191,7 @@ public int getShiftPerPixel() {
184191
case BGRA_1010102: return 2;
185192
case BGR_101010X: return 2;
186193
case BGR_101010X_XR: return 2;
187-
case RGBA_10x6: return 3;
194+
case RGBA_10X6: return 3;
188195
case GRAY_8: return 0;
189196
case RGBA_F16NORM: return 3;
190197
case RGBA_F16: return 3;
@@ -195,6 +202,8 @@ public int getShiftPerPixel() {
195202
case A16_FLOAT: return 1;
196203
case R16G16_FLOAT: return 2;
197204
case R16G16B16A16_UNORM: return 3;
205+
case SRGBA_8888: return 2;
206+
case R8_UNORM: return 0;
198207
}
199208
throw new RuntimeException("Unreachable");
200209
}
@@ -233,13 +242,14 @@ public ColorAlphaType validateAlphaType(ColorAlphaType alphaType) {
233242
// fall-through
234243
case ARGB_4444:
235244
case RGBA_8888:
245+
case SRGBA_8888:
236246
case BGRA_8888:
237247
case RGBA_1010102:
238248
case BGRA_1010102:
249+
case RGBA_10X6:
239250
case RGBA_F16NORM:
240251
case RGBA_F16:
241252
case RGBA_F32:
242-
case RGBA_10x6:
243253
case R16G16B16A16_UNORM:
244254
if (ColorAlphaType.UNKNOWN == alphaType)
245255
return null;
@@ -253,6 +263,7 @@ public ColorAlphaType validateAlphaType(ColorAlphaType alphaType) {
253263
case RGB_101010X:
254264
case BGR_101010X:
255265
case BGR_101010X_XR:
266+
case R8_UNORM:
256267
alphaType = ColorAlphaType.OPAQUE;
257268
break;
258269
}
@@ -288,6 +299,7 @@ public float getR(short color) {
288299
public float getR(int color) {
289300
switch (this) {
290301
case RGBA_8888:
302+
case SRGBA_8888:
291303
return ((color >> 24) & 0xFF) / 255f;
292304
case RGB_888X:
293305
return ((color >> 24) & 0xFF) / 255f;
@@ -329,6 +341,7 @@ public float getG(short color) {
329341
public float getG(int color) {
330342
switch (this) {
331343
case RGBA_8888:
344+
case SRGBA_8888:
332345
return ((color >> 16) & 0xFF) / 255f;
333346
case RGB_888X:
334347
return ((color >> 16) & 0xFF) / 255f;
@@ -370,6 +383,7 @@ public float getB(short color) {
370383
public float getB(int color) {
371384
switch (this) {
372385
case RGBA_8888:
386+
case SRGBA_8888:
373387
return ((color >> 8) & 0xFF) / 255f;
374388
case RGB_888X:
375389
return ((color >> 8) & 0xFF) / 255f;
@@ -409,6 +423,7 @@ public float getA(short color) {
409423
public float getA(int color) {
410424
switch (this) {
411425
case RGBA_8888:
426+
case SRGBA_8888:
412427
return (color & 0xFF) / 255f;
413428
case BGRA_8888:
414429
return (color & 0xFF) / 255f;

shared/java/EncodedImageFormat.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ public enum EncodedImageFormat {
1818
KTX,
1919
ASTC,
2020
DNG,
21-
HEIF;
21+
HEIF,
22+
AVIF,
23+
JPEGXL;
2224

2325
@ApiStatus.Internal public static final EncodedImageFormat[] _values = values();
2426
}

shared/java/FramebufferFormat.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public interface FramebufferFormat {
4848

4949
/* Luminance sized formats */
5050
int GR_GL_LUMINANCE8 = 0x8040;
51+
int GR_GL_LUMINANCE8_ALPHA8 = 0x8045;
5152
int GR_GL_LUMINANCE16F = 0x881E;
5253

5354
/* Alpha sized formats */
@@ -84,6 +85,7 @@ public interface FramebufferFormat {
8485
int GR_GL_RGB565 = 0x8D62;
8586
int GR_GL_RGB8 = 0x8051;
8687
int GR_GL_SRGB8 = 0x8C41;
88+
int GR_GL_RGBX8 = 0x96BA;
8789

8890
/* RGB integer sized formats */
8991
int GR_GL_RGB8I = 0x8D8F;

shared/java/SurfaceColorFormat.java

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,36 @@ public enum SurfaceColorFormat {
88
RGB_565, //!< pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
99
ARGB_4444, //!< pixel with 4 bits for alpha, red, green, blue; in 16-bit word
1010
RGBA_8888, //!< pixel with 8 bits for red, green, blue, alpha; in 32-bit word
11-
RGB_888x, //!< pixel with 8 bits each for red, green, blue; in 32-bit word
11+
RGB_888X, //!< pixel with 8 bits each for red, green, blue; in 32-bit word
1212
BGRA_8888, //!< pixel with 8 bits for blue, green, red, alpha; in 32-bit word
1313
RGBA_1010102, //!< 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
14-
RGB_101010x, //!< pixel with 10 bits each for red, green, blue; in 32-bit word
14+
BGRA_1010102, //!< 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
15+
RGB_101010X, //!< pixel with 10 bits each for red, green, blue; in 32-bit word
16+
BGR_101010X, //!< pixel with 10 bits each for blue, green, red; in 32-bit word
17+
BGR_101010X_XR, //!< pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
18+
RGBA_10X6, //!< pixel with 10 used bits (most significant) followed by 6 unused
19+
// bits for red, green, blue, alpha; in 64-bit word
1520
GRAY_8, //!< pixel with grayscale level in 8-bit byte
16-
RGBA_F16_NORM, //!< pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word
17-
RGBA_F16, //!< pixel with half floats for red, green, blue, alpha; in 64-bit word
21+
RGBA_F16NORM, //!< pixel with half floats in [0,1] for red, green, blue, alpha;
22+
// in 64-bit word
23+
RGBA_F16, //!< pixel with half floats for red, green, blue, alpha;
24+
// in 64-bit word
1825
RGBA_F32, //!< pixel using C float for red, green, blue, alpha; in 128-bit word
1926

2027
// The following 6 colortypes are just for reading from - not for rendering to
21-
R8G8_UNORM, //<! pixel with a uint8_t for red and green
28+
R8G8_UNORM, //!< pixel with a uint8_t for red and green
2229

23-
A16_FLOAT, //<! pixel with a half float for alpha
24-
R16G16_FLOAT, //<! pixel with a half float for red and green
30+
A16_FLOAT, //!< pixel with a half float for alpha
31+
R16G16_FLOAT, //!< pixel with a half float for red and green
2532

26-
A16_UNORM, //<! pixel with a little endian uint16_t for alpha
27-
R16G16_UNORM, //<! pixel with a little endian uint16_t for red and green
28-
R16G16B16A16_UNORM; //<! pixel with a little endian uint16_t for red, green, blue, and alpha
33+
A16_UNORM, //!< pixel with a little endian uint16_t for alpha
34+
R16G16_UNORM, //!< pixel with a little endian uint16_t for red and green
35+
R16G16B16A16_UNORM, //!< pixel with a little endian uint16_t for red, green, blue
36+
// and alpha
37+
SRGBA_8888,
38+
R8_UNORM;
2939

3040
@ApiStatus.Internal public static final SurfaceColorFormat[] _values = values();
3141
}
42+
43+

0 commit comments

Comments
 (0)