UNPKG

tav-media

Version:

Cross platform media editing framework

87 lines (86 loc) 3.49 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'; /** * Use color tuning effect to change the video color, like brightness, contrast, saturation, etc. * @category Effects */ export class ColorTuningEffect extends Effect { constructor() { super(...arguments); this.type = 'ColorTuningEffect'; this._colorTuning = {}; } /** * Create new ColorTuningEffect object. * @returns new ColorTuningEffect object */ static MakeColorTuningEffect() { const colorTuningEffect = new ColorTuningEffect(); return colorTuningEffect; } clone() { const newColorTuningEffect = new ColorTuningEffect(); 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 colorTuningEffect = yield tav.ColorTuningEffect.MakeColorTuningEffect(this.colorTuning); return colorTuningEffect; }); } 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); }); } updateColorTuning() { var _a; if (!this.nativeClip) { this.invalidated(); ; return; } if (this.nativeClip && tav.ColorTuningEffect) { if (tav.webAssemblyQueue.exec) { tav.webAssemblyQueue.exec(tav.ColorTuningEffect.updateColorTuning, tav.ColorTuningEffect, this.nativeClip, this.colorTuning); } else { (_a = tav.ColorTuningEffect) === null || _a === void 0 ? void 0 : _a.updateColorTuning(this.nativeClip, this.colorTuning); } } } /** * Get or set a ColorTuning object to describe how to change the video color. */ get colorTuning() { return this._colorTuning; } set colorTuning(val) { this._colorTuning = val; this.updateColorTuning(); } }