mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2025-10-16 12:08:43 +00:00
两个版本的插件
This commit is contained in:
37
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Color.js
Normal file
37
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Color.js
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Color = void 0;
|
||||
class Color {
|
||||
constructor(r, g, b, a) {
|
||||
this.r = Math.ceil(r || 0);
|
||||
this.g = Math.ceil(g || 0);
|
||||
this.b = Math.ceil(b || 0);
|
||||
this.a = Math.ceil(a || 0);
|
||||
}
|
||||
set(color) {
|
||||
this.r = Math.ceil(color.r || 0);
|
||||
this.g = Math.ceil(color.g || 0);
|
||||
this.b = Math.ceil(color.b || 0);
|
||||
this.a = Math.ceil(color.a || 0);
|
||||
}
|
||||
toHEX(fmt = '#rrggbb') {
|
||||
const prefix = '0';
|
||||
// #rrggbb
|
||||
const hex = [
|
||||
(this.r < 16 ? prefix : '') + (this.r).toString(16),
|
||||
(this.g < 16 ? prefix : '') + (this.g).toString(16),
|
||||
(this.b < 16 ? prefix : '') + (this.b).toString(16),
|
||||
];
|
||||
const i = -1;
|
||||
if (fmt === '#rgb') {
|
||||
hex[0] = hex[0][0];
|
||||
hex[1] = hex[1][0];
|
||||
hex[2] = hex[2][0];
|
||||
}
|
||||
else if (fmt === '#rrggbbaa') {
|
||||
hex.push((this.a < 16 ? prefix : '') + (this.a).toString(16));
|
||||
}
|
||||
return hex.join('');
|
||||
}
|
||||
}
|
||||
exports.Color = Color;
|
22
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Rect.js
Normal file
22
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Rect.js
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Rect = void 0;
|
||||
class Rect {
|
||||
constructor(left = 0, right = 0, top = 0, bottom = 0) {
|
||||
if (typeof left == 'object') {
|
||||
this.set(left);
|
||||
return;
|
||||
}
|
||||
this.left = left || 0;
|
||||
this.right = right || 0;
|
||||
this.top = top || 0;
|
||||
this.bottom = bottom || 0;
|
||||
}
|
||||
set(rect) {
|
||||
this.left = rect.left;
|
||||
this.right = rect.right;
|
||||
this.top = rect.top;
|
||||
this.bottom = rect.bottom;
|
||||
}
|
||||
}
|
||||
exports.Rect = Rect;
|
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Size.js
Normal file
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Size.js
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Size = void 0;
|
||||
class Size {
|
||||
constructor(width = 0, height = 0) {
|
||||
this.width = width || 0;
|
||||
this.height = height || 0;
|
||||
}
|
||||
}
|
||||
exports.Size = Size;
|
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Vec2.js
Normal file
10
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Vec2.js
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Vec2 = void 0;
|
||||
class Vec2 {
|
||||
constructor(x = 0, y = 0) {
|
||||
this.x = x || 0;
|
||||
this.y = y || 0;
|
||||
}
|
||||
}
|
||||
exports.Vec2 = Vec2;
|
11
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Vec3.js
Normal file
11
ccc-tnt-psd2ui-v2.4.x/libs/psd2ui/values/Vec3.js
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Vec3 = void 0;
|
||||
class Vec3 {
|
||||
constructor(x = 0, y = 0, z = 0) {
|
||||
this.x = x || 0;
|
||||
this.y = y || 0;
|
||||
this.z = z || 0;
|
||||
}
|
||||
}
|
||||
exports.Vec3 = Vec3;
|
Reference in New Issue
Block a user