UNPKG

companion-module-utils

Version:

Utility tools for use in Bitfocus Companion modules

23 lines (22 loc) 598 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.combineRGB = exports.Cache = void 0; /** * Cache to prever redrawing existing imagebuffers */ class Cache { constructor() { this.data = new Map(); this.get = (key) => { return this.data.get(key) || null; }; this.set = (key, imageBuffer) => { this.data.set(key, imageBuffer); }; } } exports.Cache = Cache; const combineRGB = (r, g, b) => { return ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }; exports.combineRGB = combineRGB;