|
@@ -37,18 +37,19 @@ abstract PixelsARGB(Pixels) to Pixels {
|
|
|
@:noDebug
|
|
|
class Pixels {
|
|
|
public var bytes : haxe.io.Bytes;
|
|
|
- public var format(default,set) : PixelFormat;
|
|
|
+ public var format(get,never) : PixelFormat;
|
|
|
public var width : Int;
|
|
|
public var height : Int;
|
|
|
public var offset : Int;
|
|
|
public var flags: haxe.EnumFlags<Flags>;
|
|
|
var bpp : Int;
|
|
|
+ var innerFormat(default, set) : PixelFormat;
|
|
|
|
|
|
public function new(width : Int, height : Int, bytes : haxe.io.Bytes, format : hxd.PixelFormat, offset = 0) {
|
|
|
this.width = width;
|
|
|
this.height = height;
|
|
|
this.bytes = bytes;
|
|
|
- this.format = format;
|
|
|
+ this.innerFormat = format;
|
|
|
this.offset = offset;
|
|
|
}
|
|
|
|
|
@@ -60,8 +61,10 @@ class Pixels {
|
|
|
return (v & 0xFF00FF00) | ((v << 16) & 0xFF0000) | ((v >> 16) & 0xFF);
|
|
|
}
|
|
|
|
|
|
- function set_format(fmt) {
|
|
|
- this.format = fmt;
|
|
|
+ inline function get_format() return innerFormat;
|
|
|
+
|
|
|
+ function set_innerFormat(fmt) {
|
|
|
+ this.innerFormat = fmt;
|
|
|
bpp = bytesPerPixel(fmt);
|
|
|
return fmt;
|
|
|
}
|
|
@@ -289,7 +292,7 @@ class Pixels {
|
|
|
default:
|
|
|
throw "Cannot convert from " + format + " to " + target;
|
|
|
}
|
|
|
- format = target;
|
|
|
+ innerFormat = target;
|
|
|
}
|
|
|
|
|
|
public function getPixel(x, y) : Int {
|