UNPKG

tav-media

Version:

Cross platform media editing framework

92 lines (91 loc) 3.54 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import { tav } from '../tav'; import { Effect } from './tav-effect'; /** * Make transparent background for the video. * @category Effects */ export class ChromaMattingEffect extends Effect { constructor() { super(...arguments); this.type = 'ChromaMattingEffect'; this._chromaMattingConfig = { intensity: 0, shadow: 0, selectedColor: { red: 0, green: 0, blue: 0, alpha: 0, }, }; } /** * Creates a new Chroma Matting Effect. */ static Make() { const chromaMattingEffect = new ChromaMattingEffect(); return chromaMattingEffect; } clone() { const newColorTuningEffect = new ChromaMattingEffect(); const _a = this, { _nativeObject: _nativeClip, parent, id, nativeInvalidated } = _a, otherProperties = __rest(_a, ["_nativeObject", "parent", "id", "nativeInvalidated"]); return Object.assign(newColorTuningEffect, otherProperties); } createClip() { return __awaiter(this, void 0, void 0, function* () { const chromaMattingEffect = yield tav.ChromaMattingEffect.Make(this.chromaMattingConfig); return chromaMattingEffect; }); } updateClip(effect) { const _super = Object.create(null, { updateClip: { get: () => super.updateClip } }); return __awaiter(this, void 0, void 0, function* () { yield _super.updateClip.call(this, effect); }); } updateConfig() { var _a, _b; if (!this.nativeClip) { this.invalidated(); return; } if (tav.webAssemblyQueue.exec) { tav.webAssemblyQueue.exec((_a = tav.ChromaMattingEffect) === null || _a === void 0 ? void 0 : _a.updateConfig, tav.ChromaMattingEffect, this.nativeClip, this.chromaMattingConfig); } else { (_b = tav.ChromaMattingEffect) === null || _b === void 0 ? void 0 : _b.updateConfig(this.nativeClip, this.chromaMattingConfig); } } /** * Get or set a ChromaMattingConfig object. */ get chromaMattingConfig() { return this._chromaMattingConfig; } set chromaMattingConfig(val) { this._chromaMattingConfig = val; this.updateConfig(); } }