mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
revised color conversion methods
This commit is contained in:
@@ -206,7 +206,6 @@ public class Video implements PConstants {
|
||||
int t = 0;
|
||||
int p = 0;
|
||||
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
|
||||
|
||||
// RGBA to ARGB conversion: shifting RGB 8 bits to the right,
|
||||
// and placing A 24 bits to the left.
|
||||
for (int y = 0; y < height; y++) {
|
||||
@@ -215,18 +214,14 @@ public class Video implements PConstants {
|
||||
pixels[t++] = (pixel >>> 8) | ((pixel << 24) & 0xFF000000);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// We have to convert ABGR into ARGB, so R and B must be swapped,
|
||||
// A and G just brought back in.
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
int pixel = pixels[p++];
|
||||
pixels[t++] = ((pixel & 0xFF) << 16) |
|
||||
((pixel & 0xFF0000) >> 16) |
|
||||
pixels[t++] = ((pixel & 0xFF) << 16) | ((pixel & 0xFF0000) >> 16) |
|
||||
(pixel & 0xFF00FF00);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user