移除color

This commit is contained in:
yhh
2020-12-06 23:09:03 +08:00
parent 8b3b645fbb
commit 2a0d4ef4dd
4 changed files with 1 additions and 162 deletions

View File

@@ -2953,24 +2953,6 @@ declare module es {
static decodeCSV(input: string): Array<number>;
}
}
declare module es {
class Color {
/**
* 存储为RGBA
*/
private _packedValue;
/**
* 从代表红、绿、蓝和alpha值的标量构造RGBA颜色。
*/
constructor(r: number, g: number, b: number, alpha: number);
b: number;
g: number;
r: number;
a: number;
packedValue: number;
equals(other: Color): boolean;
}
}
declare module es {
class EdgeExt {
static oppositeEdge(self: Edge): Edge;

View File

@@ -7523,81 +7523,6 @@ var es;
es.Base64Utils = Base64Utils;
})(es || (es = {}));
var es;
(function (es) {
var Color = /** @class */ (function () {
/**
* 从代表红、绿、蓝和alpha值的标量构造RGBA颜色。
*/
function Color(r, g, b, alpha) {
if (((r | g | b | alpha) & 0xFFFFFF00) != 0) {
var clampedR = es.MathHelper.clamp(r, 0, 255);
var clampedG = es.MathHelper.clamp(g, 0, 255);
var clampedB = es.MathHelper.clamp(b, 0, 255);
var clampedA = es.MathHelper.clamp(alpha, 0, 255);
this._packedValue = (clampedA << 24) | (clampedB << 16) | (clampedG << 8) | (clampedR);
}
else {
this._packedValue = (alpha << 24) | (b << 16) | (g << 8) | r;
}
}
Object.defineProperty(Color.prototype, "b", {
get: function () {
return this._packedValue >> 16;
},
set: function (value) {
this._packedValue = (this._packedValue & 0xff00ffff) | (value << 16);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Color.prototype, "g", {
get: function () {
return this._packedValue >> 8;
},
set: function (value) {
this._packedValue = (this._packedValue & 0xffff00ff) | (value << 8);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Color.prototype, "r", {
get: function () {
return this._packedValue;
},
set: function (value) {
this._packedValue = (this._packedValue & 0xffffff00) | value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Color.prototype, "a", {
get: function () {
return this._packedValue >> 24;
},
set: function (value) {
this._packedValue = (this._packedValue & 0x00ffffff) | (value << 24);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Color.prototype, "packedValue", {
get: function () {
return this._packedValue;
},
set: function (value) {
this._packedValue = value;
},
enumerable: true,
configurable: true
});
Color.prototype.equals = function (other) {
return this._packedValue == other._packedValue;
};
return Color;
}());
es.Color = Color;
})(es || (es = {}));
var es;
(function (es) {
var EdgeExt = /** @class */ (function () {
function EdgeExt() {

File diff suppressed because one or more lines are too long

View File

@@ -1,68 +0,0 @@
module es {
export class Color {
/**
* 存储为RGBA
*/
private _packedValue: number;
/**
* 从代表红、绿、蓝和alpha值的标量构造RGBA颜色。
*/
constructor(r: number, g: number,b: number, alpha: number){
if (((r | g |b | alpha) & 0xFFFFFF00) != 0){
let clampedR = MathHelper.clamp(r, 0, 255);
let clampedG = MathHelper.clamp(g, 0, 255);
let clampedB = MathHelper.clamp(b, 0, 255);
let clampedA = MathHelper.clamp(alpha, 0, 255);
this._packedValue = (clampedA << 24) | (clampedB << 16) | (clampedG << 8) | (clampedR);
}else{
this._packedValue = (alpha << 24 ) | (b << 16) | (g << 8) | r;
}
}
public get b(){
return this._packedValue >> 16;
}
public set b(value: number){
this._packedValue = (this._packedValue & 0xff00ffff) | (value << 16);
}
public get g(){
return this._packedValue >> 8;
}
public set g(value: number){
this._packedValue = (this._packedValue & 0xffff00ff) | (value << 8)
}
public get r(){
return this._packedValue;
}
public set r(value: number){
this._packedValue = (this._packedValue & 0xffffff00) | value;
}
public get a(){
return this._packedValue >> 24;
}
public set a(value: number){
this._packedValue = (this._packedValue & 0x00ffffff) | (value << 24);
}
public get packedValue(){
return this._packedValue;
}
public set packedValue(value: number){
this._packedValue = value;
}
public equals(other: Color):boolean{
return this._packedValue == other._packedValue;
}
}
}