Multiplied channels by alpha when less than Vector4
This commit is contained in:
@@ -28,16 +28,16 @@ public static class ImageUtil {
|
|||||||
for (int x = 0; x < width; x++) {
|
for (int x = 0; x < width; x++) {
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case float[,] f:
|
case float[,] f:
|
||||||
f[x, y] = span[x].R / max;
|
f[x, y] = span[x].R / max * (span[x].A / max);
|
||||||
break;
|
break;
|
||||||
case Vector2[,] f:
|
case Vector2[,] f:
|
||||||
f[x, y] = new(span[x].R / max, span[x].G / max);
|
f[x, y] = new Vector2(span[x].R / max, span[x].G / max) * new Vector2(span[x].A / max);
|
||||||
break;
|
break;
|
||||||
case Vector3[,] f:
|
case Vector3[,] f:
|
||||||
f[x, y] = new(span[x].R / max, span[x].G / max, span[x].B / max);
|
f[x, y] = new Vector3(span[x].R / max, span[x].G / max, span[x].B / max) * new Vector3(span[x].A / max);
|
||||||
break;
|
break;
|
||||||
case Vector4[,] f:
|
case Vector4[,] f:
|
||||||
f[x, y] = new(span[x].R / max, span[x].G / max, span[x].B / max, span[x].A / max);
|
f[x, y] = new Vector4(span[x].R / max, span[x].G / max, span[x].B / max, span[x].A / max);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,16 +88,16 @@ public static class ImageUtil {
|
|||||||
for (int x = 0; x < width; x++) {
|
for (int x = 0; x < width; x++) {
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case float[,] f:
|
case float[,] f:
|
||||||
f[x, y] = span[x].R / max;
|
f[x, y] = span[x].R / max * (span[x].A / max);
|
||||||
break;
|
break;
|
||||||
case Vector2[,] f:
|
case Vector2[,] f:
|
||||||
f[x, y] = new(span[x].R / max, span[x].G / max);
|
f[x, y] = new Vector2(span[x].R / max, span[x].G / max) * new Vector2(span[x].A / max);
|
||||||
break;
|
break;
|
||||||
case Vector3[,] f:
|
case Vector3[,] f:
|
||||||
f[x, y] = new(span[x].R / max, span[x].G / max, span[x].B / max);
|
f[x, y] = new Vector3(span[x].R / max, span[x].G / max, span[x].B / max) * new Vector3(span[x].A / max);
|
||||||
break;
|
break;
|
||||||
case Vector4[,] f:
|
case Vector4[,] f:
|
||||||
f[x, y] = new(span[x].R / max, span[x].G / max, span[x].B / max, span[x].A / max);
|
f[x, y] = new Vector4(span[x].R / max, span[x].G / max, span[x].B / max, span[x].A / max);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user