Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

skinview-utils

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skinview-utils - npm Package Compare versions

Comparing version 0.5.8 to 0.5.9

31

build/process.js

@@ -126,2 +126,17 @@ function copyImage(context, sX, sY, w, h, dX, dY, flipHorizontal) {

}
function isAreaBlack(context, x0, y0, w, h) {
const imgData = context.getImageData(x0, y0, w, h);
for (let x = 0; x < w; x++) {
for (let y = 0; y < h; y++) {
const offset = (x + y * w) * 4;
if (!(imgData.data[offset + 0] === 0 &&
imgData.data[offset + 1] === 0 &&
imgData.data[offset + 2] === 0 &&
imgData.data[offset + 3] === 0xff)) {
return false;
}
}
}
return true;
}
export function inferModelType(canvas) {

@@ -166,11 +181,17 @@ // The right arm area of *default* skins:

// as transparent pixels are not allowed in the first layer.
// If the 4 areas are all black, the skin is also considered as slim.
const scale = computeSkinScale(canvas.width);
const context = canvas.getContext("2d");
const checkArea = (x, y, w, h) => hasTransparency(context, x * scale, y * scale, w * scale, h * scale);
const isSlim = checkArea(50, 16, 2, 4) ||
checkArea(54, 20, 2, 12) ||
checkArea(42, 48, 2, 4) ||
checkArea(46, 52, 2, 12);
const checkTransparency = (x, y, w, h) => hasTransparency(context, x * scale, y * scale, w * scale, h * scale);
const checkBlack = (x, y, w, h) => isAreaBlack(context, x * scale, y * scale, w * scale, h * scale);
const isSlim = (checkTransparency(50, 16, 2, 4) ||
checkTransparency(54, 20, 2, 12) ||
checkTransparency(42, 48, 2, 4) ||
checkTransparency(46, 52, 2, 12)) ||
(checkBlack(50, 16, 2, 4) &&
checkBlack(54, 20, 2, 12) &&
checkBlack(42, 48, 2, 4) &&
checkBlack(46, 52, 2, 12));
return isSlim ? "slim" : "default";
}
//# sourceMappingURL=process.js.map

20

package.json
{
"name": "skinview-utils",
"version": "0.5.8",
"version": "0.5.9",
"description": "Utilities for working with Minecraft skins",

@@ -14,3 +14,3 @@ "type": "module",

"devDependencies": {
"@rollup/plugin-commonjs": "^15.0.0",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-image": "^2.0.5",

@@ -21,15 +21,15 @@ "@rollup/plugin-node-resolve": "^9.0.0",

"@types/mocha": "^8.0.3",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0",
"chai": "^4.2.0",
"eslint": "^7.7.0",
"karma": "^5.1.1",
"eslint": "^7.10.0",
"karma": "^5.2.3",
"karma-chrome-launcher": "^3.1.0",
"karma-mocha": "^2.0.1",
"karma-rollup-preprocessor": "^7.0.5",
"mocha": "^8.1.1",
"puppeteer": "^5.2.1",
"mocha": "^8.1.3",
"puppeteer": "^5.3.1",
"rimraf": "^3.0.2",
"rollup": "^2.26.3",
"typescript": "^4.0.2"
"rollup": "^2.28.2",
"typescript": "^4.0.3"
},

@@ -36,0 +36,0 @@ "files": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc