Quellcode durchsuchen

Adding R8 getPixel and toPng functions.

clementlandrin vor 2 Jahren
Ursprung
Commit
77c9c7fca1
1 geänderte Dateien mit 4 neuen und 0 gelöschten Zeilen
  1. 4 0
      hxd/Pixels.hx

+ 4 - 0
hxd/Pixels.hx

@@ -440,6 +440,8 @@ class Pixels {
 		case RG8:
 			var b = bytes.getUInt16(p);
 			return ((b & 0xff) << 8) | (b >> 8);
+		case R8:
+			return bytes.get(p);
 		default:
 			invalidFormat();
 			return 0;
@@ -519,6 +521,8 @@ class Pixels {
  		switch( format ) {
 		case ARGB:
 			png = std.format.png.Tools.build32ARGB(width, height, bytes #if (format >= "3.3") , level #end);
+		case R8:
+			png = std.format.png.Tools.buildGrey(width, height, bytes #if (format >= "3.3") , level #end);
 		default:
 			convert(BGRA);
 			png = std.format.png.Tools.build32BGRA(width, height, bytes #if (format >= "3.3") , level #end);