MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / appendBitmap

Method appendBitmap

tools/mcmanifest.js:2200–2243  ·  view source on GitHub ↗
(name, path, include, suffix)

Source from the content-addressed store, hash-verified

2198
2199class ResourcesRule extends Rule {
2200 appendBitmap(name, path, include, suffix) {
2201 var tool = this.tool;
2202 let colorFile, alphaFile;
2203 if (tool.bmpAlphaFiles.already[path] || tool.bmpColorFiles.already[path] || tool.bmpMaskFiles.already[path])
2204 return;
2205 if (suffix == "-color") {
2206 colorFile = this.appendFile(tool.bmpColorFiles, name + "-color" + tool.bitmapExtension, path, include);
2207 }
2208 else if ((suffix == "-color-monochrome") || (suffix == "-color-monochromealigned")) {
2209 colorFile = this.appendFile(tool.bmpColorFiles, name + "-color.bm4", path, include);
2210 colorFile.monochrome = (suffix == "-color-monochrome") ? 1 : 2;
2211 }
2212 else if (suffix == "-color-argb4444") {
2213 colorFile = this.appendFile(tool.bmpColorFiles, name + "-color" + tool.bitmapExtension, path, include);
2214 colorFile.format = "argb4444";
2215 }
2216 else if (suffix == "-alpha") {
2217 alphaFile = this.appendFile(tool.bmpAlphaFiles, name + "-alpha" + tool.bitmapExtension, path, include);
2218 }
2219 else if ((suffix == "-alpha-monochrome") || (suffix == "-alpha-monochromealigned")) {
2220 alphaFile = this.appendFile(tool.bmpAlphaFiles, name + "-alpha.bm4", path, include);
2221 alphaFile.monochrome = (suffix == "-alpha-monochrome") ? 1 : 2;
2222 }
2223 else if (suffix == "-mask") {
2224 alphaFile = this.appendFile(tool.bmpMaskFiles, name + "-alpha.bm4", path, include);
2225 }
2226 else if ((suffix == "-monochrome") || (suffix == "-monochromealigned")) {
2227 colorFile = this.appendFile(tool.bmpColorFiles, name + "-color.bm4", path, include);
2228 colorFile.monochrome = (suffix == "-monochrome") ? 1 : 2;;
2229 alphaFile = this.appendFile(tool.bmpAlphaFiles, name + "-alpha.bm4", path, include);
2230 alphaFile.monochrome = colorFile.monochrome;
2231 alphaFile.colorFile = colorFile;
2232 colorFile.alphaFile = alphaFile;
2233 }
2234 else {
2235 colorFile = this.appendFile(tool.bmpColorFiles, name + "-color" + tool.bitmapExtension, path, include);
2236 alphaFile = this.appendFile(tool.bmpAlphaFiles, name + "-alpha" + tool.bitmapExtension, path, include);
2237 alphaFile.colorFile = colorFile;
2238 colorFile.alphaFile = alphaFile;
2239 }
2240 if (colorFile) {
2241 colorFile.clutName = tool.clutFiles.current;
2242 }
2243 }
2244 appendFont(name, path, include, suffix) {
2245 var tool = this.tool;
2246 if (suffix == "-mask") {

Callers 1

appendSourceMethod · 0.95

Calls 1

appendFileMethod · 0.45

Tested by

no test coverage detected