Some checks failed
Publish to npm / publish (push) Has been cancelled
- Remove all Chinese characters from src/, example/, ios/, patches/, tests/ - Add esbuild-based build obfuscation (minify + identifier mangle + no sourcemaps) - Drop src/ from npm publish, only ship minified dist/ - Remove source maps and declaration maps from build output - Add README icons and visual polish throughout - Fix broken Table of Contents anchor links in README Co-authored-by: Cursor <cursoragent@cursor.com>
2 lines
2.3 KiB
JavaScript
2 lines
2.3 KiB
JavaScript
"use strict";var p=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var C=(e,r)=>{for(var n in r)p(e,n,{get:r[n],enumerable:!0})},F=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of O(r))!b.call(e,a)&&a!==n&&p(e,a,{get:()=>r[a],enumerable:!(o=x(r,a))||o.enumerable});return e};var M=e=>F(p({},"__esModule",{value:!0}),e);var T={};C(T,{PaintShaderLayer:()=>q,buildPaintShaderUniforms:()=>P,createPaintColorMapForPaint:()=>R,getRegionPaintEffect:()=>d,releasePaintShaderTextures:()=>L,renderPaintedImageOffscreen:()=>E});module.exports=M(T);var i=require("react/jsx-runtime"),t=require("@shopify/react-native-skia"),I=require("../shaders/regionPaint.sksl"),l=require("./maskSegmentRuntime"),S=require("./paintColorMapTexture");let s=null;function d(){if(s)return s;const e=t.Skia.RuntimeEffect.Make(I.REGION_PAINT_SKSL);if(!e)throw new Error("regionPaint SkSL compile failed");return s=e,e}function P(e){const r=(0,l.getMaskSegmentRuntimeConfig)().paint;return{colorBaseOpacity:r.colorBaseOpacity,lLightOpacity:r.lLightOpacity,textureOpacity:r.textureOpacity,showOrigin:e?1:0}}function u(e){const{originImage:r,paintColorMap:n,lowFreqImage:o,highFreqImage:a,x:m,y:c,width:f,height:h,showOrigin:y=!1}=e,k=d(),w=P(y),g={fit:"fill",tx:"clamp",ty:"clamp",rect:{x:m,y:c,width:f,height:h}};return(0,i.jsx)(t.Rect,{x:m,y:c,width:f,height:h,children:(0,i.jsxs)(t.Shader,{source:k,uniforms:w,children:[(0,i.jsx)(t.ImageShader,{image:r,...g}),(0,i.jsx)(t.ImageShader,{image:n,...g}),(0,i.jsx)(t.ImageShader,{image:o,...g}),(0,i.jsx)(t.ImageShader,{image:a,...g})]})})}function q(e){return u(e)}function R(e,r,n,o){const m=(0,l.getMaskSegmentRuntimeConfig)().paint.maskFeatherColor??0;return(0,S.buildPaintColorMapImage)(e,r,n,o,m)}async function E(e){const{width:r,height:n,showOrigin:o=!1,...a}=e;if(!a.originImage||!a.paintColorMap||!a.lowFreqImage||!a.highFreqImage)return console.warn("[VIZ-SAVE] renderPaintedImageOffscreen: missing one or more shader textures, will fallback"),null;const m=(0,i.jsx)(t.Group,{children:u({...a,x:0,y:0,width:r,height:n,showOrigin:o})});return(0,t.drawAsImage)(m,{width:r,height:n})}function L(e){e.originImage?.dispose(),e.paintColorMap?.dispose(),e.lowFreqImage?.dispose(),e.highFreqImage?.dispose()}
|