@rfkit/renderer 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const colorCache=new Map;function hexToRGBA(hexColor,alpha){const hexRegex=/^#([A-Fa-f0-9]{3}){1,2}([A-Fa-f0-9]{2})?$/;if(!hexRegex.test(hexColor))throw new Error("Invalid hex color format");const hex=hexColor.replace("#","");let r;let g;let b;let a;if(3===hex.length){r=Number.parseInt(hex[0]+hex[0],16);g=Number.parseInt(hex[1]+hex[1],16);b=Number.parseInt(hex[2]+hex[2],16);a=255}else if(6===hex.length){r=Number.parseInt(hex.substring(0,2),16);g=Number.parseInt(hex.substring(2,4),16);b=Number.parseInt(hex.substring(4,6),16);a=255}else if(8===hex.length){r=Number.parseInt(hex.substring(0,2),16);g=Number.parseInt(hex.substring(2,4),16);b=Number.parseInt(hex.substring(4,6),16);a=Number.parseInt(hex.substring(6,8),16)}else throw new Error("Invalid hex color length");if("number"==typeof alpha)a=Math.round(255*Math.max(0,Math.min(1,alpha)));return{r,g,b,a}}function rgbToHex(r,g,b,a=255){const toHex=channel=>channel.toString(16).padStart(2,"0");const hex=`#${toHex(r)}${toHex(g)}${toHex(b)}`;return a<255?`${hex}${toHex(a)}`:hex}function parseColor(color){if("string"==typeof color){const cached=colorCache.get(color);if(cached)return cached;const result=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(color);const parsed=result?{r:parseInt(result[1],16),g:parseInt(result[2],16),b:parseInt(result[3],16),a:result[4]?parseInt(result[4],16):255}:{r:0,g:0,b:0,a:255};colorCache.set(color,parsed);return parsed}return{r:color.r,g:color.g,b:color.b,a:color.a??255}}function color2intensity(color,length=100){const colorArray=[];for(let i=0;i<=length;i++){const alphaHex=Math.round(i/length*255);const alphaHexString=alphaHex.toString(16).padStart(2,"0").toUpperCase();const colorWithOpacity=`${color}${alphaHexString}`;colorArray.push(colorWithOpacity)}return colorArray}function clearColorCache(){colorCache.clear()}class ColorInterpolator{colorsPresetList=[];range=[0,0,0];static transparent={r:0,g:0,b:0,a:0};constructor(colors,rangeMin,rangeMax,stepSize=.1){this.setColors(colors,rangeMin,rangeMax,stepSize)}setColors(colors,rangeMin,rangeMax,stepSize){this.colorsPresetList=[];const steps=Math.max(1,Math.floor((rangeMax-rangeMin)/stepSize));const rangeDiff=rangeMax-rangeMin;this.range=[rangeMin,rangeMax,rangeDiff];const parsedColors=colors.map(parseColor);for(let i=0;i<=steps;i++){const value=rangeMin+i*stepSize;const position=(value-rangeMin)/rangeDiff;this.colorsPresetList.push(this.interpolateColor(parsedColors,position))}}interpolateColor(colors,position){const index=Math.floor(position*(colors.length-1));const ratio=position*(colors.length-1)-index;const startColor=colors[index];const endColor=colors[index+1]||colors[index];const rgba={r:Math.round(startColor.r+ratio*(endColor.r-startColor.r)),g:Math.round(startColor.g+ratio*(endColor.g-startColor.g)),b:Math.round(startColor.b+ratio*(endColor.b-startColor.b)),a:Math.round(startColor.a+ratio*(endColor.a-startColor.a))};return{...rgba,hax:rgbToHex(rgba.r,rgba.g,rgba.b,rgba.a)}}getColor(value){if(!Number.isFinite(value))return ColorInterpolator.transparent;const[rangeMin,,rangeDiff]=this.range;const position=(value-rangeMin)/rangeDiff;if(position<=0)return this.colorsPresetList[0];if(position>=1)return this.colorsPresetList[this.colorsPresetList.length-1];const index=Math.min(Math.floor(position*this.colorsPresetList.length),this.colorsPresetList.length-1);return this.colorsPresetList[index]}}class Engine{state;constructor(props){this.state={id:props.id,container:void 0,canvas:null,ctx:null,range:props.range??[-20,100]};this.init(props)}updateProps(e){this.state={...this.state,...e}}init(_props){const{id}=this.state;const container=document.getElementById(id);const canvas=document.createElement("canvas");const ctx=canvas.getContext?.("2d");canvas.style.transform="scaleY(-1)";if(ctx){ctx.imageSmoothingEnabled=false;ctx.lineJoin="miter";ctx.lineCap="butt";ctx.textBaseline="middle"}if(ctx)this.updateProps({container:container??void 0,canvas,ctx});container?.appendChild(canvas);this.resize(false)}clearRect(){const{ctx,canvas}=this.state;ctx.clearRect(0,0,canvas.width,canvas.height)}resize(draw=true){const{canvas,container}=this.state;const{clientWidth,clientHeight}=container;if(!clientWidth||!clientHeight)return;canvas.width=clientWidth;canvas.height=clientHeight;if(draw)setTimeout(()=>{this.draw()})}draw(){}dispose(){const{canvas,container}=this.state;container?.removeChild(canvas)}}const DEFAULTS={COLOR:"#000000",THICKNESS:1,FILL_STYLE:"#ffffffB0",FILL_STYLE_PRIMARY:"#1890ff",FILL_STYLE_TRANSPARENT_BASE:"#ffffff10",LINE_COLOR:"#00ff00",POINT_COLOR:"#ff0000",DIAL_NORTH_COLOR:"#ff4d4f",DIAL_SOUTH_COLOR:"#1890ff",FLUORESCENCE_COLORS:["#000080","#0000FF","#00FFFF","#00FF00","#FFFF00","#FF0000"],RANGE:[-20,100]};var enums_OrientationType=/*#__PURE__*/function(OrientationType){OrientationType["Horizontal"]="horizontal";OrientationType["Vertical"]="vertical";return OrientationType}({});var enums_GraphicType=/*#__PURE__*/function(GraphicType){GraphicType["Circle"]="circle";GraphicType["Rect"]="rect";GraphicType["Line"]="line";GraphicType["Stepline"]="stepline";GraphicType["Bar"]="bar";GraphicType["Area"]="area";return GraphicType}({});var enums_RendererType=/*#__PURE__*/function(RendererType){RendererType["Canvas"]="canvas";RendererType["WebGL"]="webgl";return RendererType}({});const BLOCK_RENDER_MODE=true;class Fluorescence extends Engine{init(props){super.init(props);const{colors,display}=props;this.updateProps({colors,data:[],display});this.resize()}updateProps(e){super.updateProps(e)}clearImageData(){const{ctx,canvas:{height,width}}=this.state;if(height&&width)this.updateProps({imageData:ctx.createImageData(width,height)})}clearRect(){super.clearRect();this.clearImageData()}clear(){this.clearRect();this.updateProps({data:[]})}dispose(){this.intensityMatrixCache=null;this.gridCentersCache=null;this.weightLookupCache=null;this.colorLookupCache=null;this.colorCache.clear();this.lastRenderParams=null;this.blockPositionsCache=null;this.lastBlockRenderParams=null}drawBlocks(){const{imageData,data,canvas,ctx,colors=DEFAULTS.FLUORESCENCE_COLORS,range=DEFAULTS.RANGE,fluorescenceMaxCount=1}=this.state;if(!data||0===data.length||!imageData)return;const{width,height}=canvas;const[rangeMin,rangeMax]=range;const rangeSpan=rangeMax-rangeMin;if(rangeSpan<=0)return;const dataLength=data.length;const currentParams={dataLength,width,height,rangeMin,rangeMax};const paramsChanged=!this.lastBlockRenderParams||Object.keys(currentParams).some(key=>this.lastBlockRenderParams?.[key]!==currentParams[key]);if(paramsChanged||!this.blockPositionsCache||this.blockPositionsCache.length!==dataLength){this.blockPositionsCache=new Array(dataLength);const blockWidth=Math.max(1,Math.floor(width/dataLength));for(let i=0;i<dataLength;i++){const startX=Math.floor(i*width/dataLength);const endX=Math.min(width-1,startX+blockWidth-1);this.blockPositionsCache[i]={startX,endX,width:endX-startX+1}}}this.lastBlockRenderParams=currentParams;const pixelData=imageData.data;pixelData.fill(0);const invRangeSpan=1/rangeSpan;const heightMinus1=height-1;for(let dataIndex=0;dataIndex<dataLength;dataIndex++){const bin=data[dataIndex];if(!bin||0===bin.size)continue;const blockPos=this.blockPositionsCache[dataIndex];const{startX:blockStartX,endX:blockEndX}=blockPos;for(const[yValue,count]of bin.entries()){if(yValue<rangeMin||yValue>rangeMax||count<=0)continue;const normalizedY=(yValue-rangeMin)*invRangeSpan;const centerY=normalizedY*heightMinus1;const yValueCount=bin.size;const blockHeight=Math.max(1,Math.floor(height/Math.max(2*yValueCount,20)));const blockStartY=Math.max(0,Math.floor(centerY-blockHeight/2));const blockEndY=Math.min(heightMinus1,blockStartY+blockHeight-1);const intensity=Math.min(count/fluorescenceMaxCount,1);const alpha=Math.round(255*intensity);const blockColor=this.interpolateColor(colors,intensity);const{r:colorR,g:colorG,b:colorB}=blockColor;for(let py=blockStartY;py<=blockEndY;py++){const rowIndex=py*width;for(let px=blockStartX;px<=blockEndX;px++){const pixelIndex=(rowIndex+px)*4;pixelData[pixelIndex]=colorR;pixelData[pixelIndex+1]=colorG;pixelData[pixelIndex+2]=colorB;pixelData[pixelIndex+3]=alpha}}}}ctx.putImageData(imageData,0,0)}resize(){super.resize();this.clearImageData()}setRange(range){if(!range)return;this.updateProps({range});this.draw()}render(data){if(data?.fluorescenceData?.length>=0){this.state.data=data.fluorescenceData;this.state.fluorescenceMaxCount=data.fluorescenceMaxCount;this.draw()}}interpolateColor(colors,ratio){if(!colors||0===colors.length)return{r:255,g:255,b:255,a:255};ratio=Math.max(0,Math.min(1,ratio));const getColorRgb=color=>{if("string"==typeof color)return this.hexToRgb(color);return{r:color.r,g:color.g,b:color.b}};if(1===colors.length){const color=getColorRgb(colors[0]);return{...color,a:255}}if(0===ratio){const color=getColorRgb(colors[0]);return{...color,a:255}}if(1===ratio){const color=getColorRgb(colors[colors.length-1]);return{...color,a:255}}const scaledRatio=ratio*(colors.length-1);const index=Math.floor(scaledRatio);const localRatio=scaledRatio-index;const safeIndex=Math.min(index,colors.length-2);const color1=getColorRgb(colors[safeIndex]);const color2=getColorRgb(colors[safeIndex+1]);return{r:Math.round(color1.r+(color2.r-color1.r)*localRatio),g:Math.round(color1.g+(color2.g-color1.g)*localRatio),b:Math.round(color1.b+(color2.b-color1.b)*localRatio),a:255}}colorCache=new Map;hexToRgb(hex){const cached=this.colorCache.get(hex);if(cached)return cached;const parsed=parseColor(hex);const color={r:parsed.r,g:parsed.g,b:parsed.b};this.colorCache.set(hex,color);return color}lastRenderParams=null;intensityMatrixCache=null;gridCentersCache=null;weightLookupCache=null;colorLookupCache=null;blockPositionsCache=null;lastBlockRenderParams=null;draw(){const{imageData,data,canvas,ctx,colors=DEFAULTS.FLUORESCENCE_COLORS,range=DEFAULTS.RANGE,fluorescenceMaxCount=1,display}=this.state;if(!display)return;if(!data||0===data.length||!imageData)return;if(BLOCK_RENDER_MODE){this.drawBlocks();return}const{width,height}=canvas;const[rangeMin,rangeMax]=range;const rangeSpan=rangeMax-rangeMin;if(rangeSpan<=0)return;const currentParams={dataLength:data.length,rangeMin,rangeMax,width,height,maxCount:fluorescenceMaxCount};const paramsChanged=!this.lastRenderParams||Object.keys(currentParams).some(key=>this.lastRenderParams?.[key]!==currentParams[key]);if(!paramsChanged)return;const needRecalcGridCenters=!this.lastRenderParams||this.lastRenderParams.dataLength!==currentParams.dataLength||this.lastRenderParams.width!==currentParams.width;const needRecalcWeightLookup=!this.lastRenderParams||this.lastRenderParams.height!==currentParams.height;const needRecalcColorLookup=!this.colorLookupCache;this.lastRenderParams=currentParams;const pixelData=imageData.data;pixelData.fill(0);const interpolationRadius=Math.max(2,Math.floor(height/50));const radiusSquared=interpolationRadius*interpolationRadius;const dataLength=data.length;const matrixSize=width*height;if(this.intensityMatrixCache&&this.intensityMatrixCache.length===matrixSize)this.intensityMatrixCache.fill(0);else this.intensityMatrixCache=new Float32Array(matrixSize);const intensityMatrix=this.intensityMatrixCache;if(needRecalcGridCenters||!this.gridCentersCache||this.gridCentersCache.length!==dataLength){this.gridCentersCache=new Float32Array(dataLength);const cellWidth=width/dataLength;for(let i=0;i<dataLength;i++){const startX=Math.floor(cellWidth*i);const endX=Math.ceil(cellWidth*(i+1));this.gridCentersCache[i]=(startX+endX)/2}}const gridCenters=this.gridCentersCache;const maxDistance=interpolationRadius;const lookupSize=Math.ceil(10*maxDistance)+1;if(needRecalcWeightLookup||!this.weightLookupCache||this.weightLookupCache.length!==lookupSize){this.weightLookupCache=new Float32Array(lookupSize);for(let i=0;i<=10*maxDistance;i++){const distance=i/10;this.weightLookupCache[i]=Math.exp(-(distance*distance)/(2*radiusSquared))}}const weightLookup=this.weightLookupCache;let maxIntensity=0;for(let dataIndex=0;dataIndex<dataLength;dataIndex++){const bin=data[dataIndex];if(!bin||0===bin.size)continue;const centerX=gridCenters[dataIndex];for(const[yValue,count]of bin.entries()){if(yValue<rangeMin||yValue>rangeMax||count<=0)continue;const normalizedY=(yValue-rangeMin)/rangeSpan;const centerY=normalizedY*(height-1);const intensity=Math.min(count/fluorescenceMaxCount,1);const expandStartX=Math.max(0,Math.floor(centerX-interpolationRadius));const expandEndX=Math.min(width-1,Math.ceil(centerX+interpolationRadius));const startY=Math.max(0,Math.floor(centerY-interpolationRadius));const endY=Math.min(height-1,Math.ceil(centerY+interpolationRadius));for(let py=startY;py<=endY;py++){const dy=py-centerY;const dySquared=dy*dy;const rowIndex=py*width;for(let px=expandStartX;px<=expandEndX;px++){const dx=px-centerX;const distanceSquared=dx*dx+dySquared;if(distanceSquared>radiusSquared)continue;const distance=Math.sqrt(distanceSquared);const lookupIndex=Math.floor(10*distance);const weight=lookupIndex<weightLookup.length?weightLookup[lookupIndex]:0;const matrixIndex=rowIndex+px;const newIntensity=intensityMatrix[matrixIndex]+intensity*weight;intensityMatrix[matrixIndex]=newIntensity;if(newIntensity>maxIntensity)maxIntensity=newIntensity}}}}const intensityThreshold=.001;const invMaxIntensity=maxIntensity>0?1/maxIntensity:0;const colorSteps=256;if(needRecalcColorLookup||!this.colorLookupCache||this.colorLookupCache.length!==colorSteps){this.colorLookupCache=new Array(colorSteps);for(let i=0;i<colorSteps;i++){const ratio=i/(colorSteps-1);this.colorLookupCache[i]=this.interpolateColor(colors,ratio)}}const colorLookup=this.colorLookupCache;for(let i=0;i<intensityMatrix.length;i++){const rawIntensity=intensityMatrix[i];if(rawIntensity<=intensityThreshold)continue;const intensity=rawIntensity*invMaxIntensity;const colorIndex=Math.floor(intensity*(colorSteps-1));const color=colorLookup[colorIndex];const pixelIndex=4*i;pixelData[pixelIndex]=color.r;pixelData[pixelIndex+1]=color.g;pixelData[pixelIndex+2]=color.b;pixelData[pixelIndex+3]=Math.round(255*intensity)}ctx.putImageData(imageData,0,0)}}function fillImageData(canvasWidth,canvasHeight,data,imageData,getColor){if(!data)return;const numRows=data.length;const cellHeight=canvasHeight/numRows;let cellWidth=0;for(let r=0;r<numRows;r++){const rowData=data[r];const numCols=rowData.length;if(0===numCols)continue;if(0===cellWidth)cellWidth=canvasWidth/numCols;const startRow=Math.floor(cellHeight*r);const endRow=Math.ceil(cellHeight*(r+1));for(let c=0;c<numCols;c++){const value=rowData[c];const startCol=Math.floor(cellWidth*c);const endCol=Math.ceil(cellWidth*(c+1));const color=getColor(value);for(let y=startRow;y<endRow;y++){const rowIndex=y*canvasWidth;for(let x=startCol;x<endCol;x++){const index=(rowIndex+x)*4;imageData[index]=color.r;imageData[index+1]=color.g;imageData[index+2]=color.b;imageData[index+3]=color.a}}}}}function getMinMax(numbers){if(!Array.isArray(numbers)||0===numbers.length)throw new Error("Input must be a non-empty array.");let min=numbers[0];let max=numbers[0];for(let i=1;i<numbers.length;i++)if(numbers[i]<min)min=numbers[i];else if(numbers[i]>max)max=numbers[i];return[min,max]}function isNumberAlias(n){return"number"==typeof n&&Number.isFinite(n)}function convertToF64(odata){const flattened=odata.flatMap(row=>{if(0===row.length)return Array(odata[0].length).fill(Number.NaN);return row});return new Float64Array(flattened)}let webgl2Supported=null;function isWebGL2Supported(){if(null!==webgl2Supported)return webgl2Supported;try{const canvas=document.createElement("canvas");const gl=canvas.getContext("webgl2");webgl2Supported=!!gl;if(gl){const ext=gl.getExtension("WEBGL_lose_context");ext?.loseContext()}}catch{webgl2Supported=false}return webgl2Supported}class Gauge extends Engine{init(props){super.init(props);this.state.canvas.style.transform="scaleY(1)";const fillStyle=props.fillStyle??DEFAULTS.FILL_STYLE;const fillStylePrimary=props.fillStylePrimary??DEFAULTS.FILL_STYLE_PRIMARY;const fillStyleTransparentBase=props.fillStyleTransparentBase??DEFAULTS.FILL_STYLE_TRANSPARENT_BASE;const baseWidth=6;this.updateProps({fillStyle,fillStylePrimary,fillStyleTransparentBase,baseWidth,padding:props.padding??0,step:props.ticksStep??10,lineWidth:1,data:{value:0,limit:0}})}clear(){this.clearRect();const{ctx,BGCanvas}=this.state;if(BGCanvas)ctx.drawImage(BGCanvas,0,0)}resize(){super.resize();if(this.state.lineWidth)this.drawBackground()}render(data){this.state.data={...this.state.data,...data};this.draw()}draw(){const{data:{value},range:[min,max],canvas,ctx,baseWidth,padding,BGCanvas,fillStylePrimary}=this.state;this.clearRect();if(BGCanvas)ctx.drawImage(BGCanvas,0,0);const width=3*baseWidth;const height=canvas.height-2*padding;const x=(canvas.width-width)/2;const renderHeight=(value-min)/(max-min)*height;const y=height-renderHeight+padding;ctx.fillStyle=fillStylePrimary;ctx.fillRect(x,y,width,renderHeight);this.drawLimit()}drawLimit(){const{data:{limit},range:[min,max],canvas,ctx,baseWidth,padding,lineWidth,fillStylePrimary}=this.state;if(!isNumberAlias(limit))return;const width=3*baseWidth;const height=canvas.height-2*padding;const x=(canvas.width-width)/2;const y=height*(max-limit)/(max-min)+padding;const limitTagHeight=9;const triangleWidth=9;const rectangleWidth=30;ctx.beginPath();ctx.moveTo(x+width,y);ctx.lineTo(x+width+triangleWidth,y-limitTagHeight);ctx.lineTo(x+width+triangleWidth+rectangleWidth,y-limitTagHeight);ctx.lineTo(x+width+triangleWidth+rectangleWidth,y+limitTagHeight);ctx.lineTo(x+width+triangleWidth,y+limitTagHeight);ctx.lineTo(x+width,y);ctx.lineTo(x,y);ctx.lineWidth=lineWidth;ctx.strokeStyle=fillStylePrimary;ctx.stroke();ctx.fillStyle=fillStylePrimary;ctx.font="12px Arial";ctx.textAlign="center";ctx.textBaseline="middle";ctx.fillText(limit.toString(),x+width+triangleWidth+rectangleWidth/2,y+1)}drawBackground(){const{canvas,baseWidth,padding,lineWidth,step,range:[min,max],fillStyle,fillStyleTransparentBase}=this.state;const BGCanvas=document.createElement("canvas");BGCanvas.width=canvas.width;BGCanvas.height=canvas.height;const BGCtx=BGCanvas.getContext("2d");if(!BGCtx)return;const width=3*baseWidth;const height=canvas.height-2*padding;const x=(canvas.width-width)/2;const y=padding;const tagNun=11;const markedAngles=Array.from({length:tagNun},(_,i)=>min+Math.round(i*(max-min)/(tagNun-1)/step)*step);BGCtx.fillStyle=fillStyleTransparentBase;BGCtx.fillRect(x,y,width,height);for(let i=min;i<=max;i+=step){const isMarked=markedAngles.includes(i);const tagY=height*(max-i)/(max-min)+padding;BGCtx.beginPath();BGCtx.moveTo(x-(isMarked?baseWidth:baseWidth/2),tagY);BGCtx.lineTo(x,tagY);BGCtx.strokeStyle=fillStyle;BGCtx.lineWidth=isMarked?lineWidth:lineWidth/2;BGCtx.stroke();if(isMarked){BGCtx.fillStyle=fillStyle;BGCtx.font="12px Arial";BGCtx.textAlign="right";BGCtx.textBaseline="middle";BGCtx.fillText(i.toString(),x-1.2*baseWidth,tagY)}}this.state.BGCanvas=BGCanvas}}class WebGLEngine{state;constructor(props){this.state={id:props.id,container:void 0,canvas:null,gl:null,range:props.range??[-20,100]};this.init(props)}updateProps(e){this.state={...this.state,...e}}init(_props){const{id}=this.state;const container=document.getElementById(id);const canvas=document.createElement("canvas");const gl=canvas.getContext("webgl2",{alpha:true,antialias:false,premultipliedAlpha:false,preserveDrawingBuffer:false});if(!gl){console.error("WebGL 2.0 not supported");return}canvas.style.transform="scaleY(-1)";this.updateProps({container:container??void 0,canvas,gl});container?.appendChild(canvas);this.resize(false)}compileShader(type,source){const{gl}=this.state;const shader=gl.createShader(type);if(!shader)return null;gl.shaderSource(shader,source);gl.compileShader(shader);if(!gl.getShaderParameter(shader,gl.COMPILE_STATUS)){console.error("Shader compile error:",gl.getShaderInfoLog(shader));gl.deleteShader(shader);return null}return shader}createProgram(shaderSource){const{gl}=this.state;const vertexShader=this.compileShader(gl.VERTEX_SHADER,shaderSource.vertex);const fragmentShader=this.compileShader(gl.FRAGMENT_SHADER,shaderSource.fragment);if(!vertexShader||!fragmentShader)return null;const program=gl.createProgram();if(!program)return null;gl.attachShader(program,vertexShader);gl.attachShader(program,fragmentShader);gl.linkProgram(program);if(!gl.getProgramParameter(program,gl.LINK_STATUS)){console.error("Program link error:",gl.getProgramInfoLog(program));gl.deleteProgram(program);return null}gl.deleteShader(vertexShader);gl.deleteShader(fragmentShader);return program}createTexture(){const{gl}=this.state;const texture=gl.createTexture();if(!texture)return null;gl.bindTexture(gl.TEXTURE_2D,texture);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);return texture}createQuadBuffer(){const{gl}=this.state;const buffer=gl.createBuffer();if(!buffer)return null;gl.bindBuffer(gl.ARRAY_BUFFER,buffer);const vertices=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);gl.bufferData(gl.ARRAY_BUFFER,vertices,gl.STATIC_DRAW);return buffer}clearRect(){const{gl}=this.state;gl.clearColor(0,0,0,0);gl.clear(gl.COLOR_BUFFER_BIT)}resize(draw=true){const{canvas,container,gl}=this.state;if(!container)return;const{clientWidth,clientHeight}=container;if(!clientWidth||!clientHeight)return;canvas.width=clientWidth;canvas.height=clientHeight;gl.viewport(0,0,clientWidth,clientHeight);if(draw)setTimeout(()=>{this.draw()})}draw(){}dispose(){const{gl,canvas}=this.state;if(gl){const loseContext=gl.getExtension("WEBGL_lose_context");if(loseContext)loseContext.loseContext()}canvas?.remove()}}const VERTEX_SHADER=`#version 300 es
1
+ const colorCache=new Map;function hexToRGBA(hexColor,alpha){const hexRegex=/^#([A-Fa-f0-9]{3}){1,2}([A-Fa-f0-9]{2})?$/;if(!hexRegex.test(hexColor))throw new Error("Invalid hex color format");const hex=hexColor.replace("#","");let r;let g;let b;let a;if(3===hex.length){r=Number.parseInt(hex[0]+hex[0],16);g=Number.parseInt(hex[1]+hex[1],16);b=Number.parseInt(hex[2]+hex[2],16);a=255}else if(6===hex.length){r=Number.parseInt(hex.substring(0,2),16);g=Number.parseInt(hex.substring(2,4),16);b=Number.parseInt(hex.substring(4,6),16);a=255}else if(8===hex.length){r=Number.parseInt(hex.substring(0,2),16);g=Number.parseInt(hex.substring(2,4),16);b=Number.parseInt(hex.substring(4,6),16);a=Number.parseInt(hex.substring(6,8),16)}else throw new Error("Invalid hex color length");if("number"==typeof alpha)a=Math.round(255*Math.max(0,Math.min(1,alpha)));return{r,g,b,a}}function rgbToHex(r,g,b,a=255){const toHex=channel=>channel.toString(16).padStart(2,"0");const hex=`#${toHex(r)}${toHex(g)}${toHex(b)}`;return a<255?`${hex}${toHex(a)}`:hex}function parseColor(color){if("string"==typeof color){const cached=colorCache.get(color);if(cached)return cached;const result=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(color);const parsed=result?{r:parseInt(result[1],16),g:parseInt(result[2],16),b:parseInt(result[3],16),a:result[4]?parseInt(result[4],16):255}:{r:0,g:0,b:0,a:255};colorCache.set(color,parsed);return parsed}return{r:color.r,g:color.g,b:color.b,a:color.a??255}}function color2intensity(color,length=100){const colorArray=[];for(let i=0;i<=length;i++){const alphaHex=Math.round(i/length*255);const alphaHexString=alphaHex.toString(16).padStart(2,"0").toUpperCase();const colorWithOpacity=`${color}${alphaHexString}`;colorArray.push(colorWithOpacity)}return colorArray}function clearColorCache(){colorCache.clear()}class ColorInterpolator{colorsPresetList=[];range=[0,0,0];static transparent={r:0,g:0,b:0,a:0};constructor(colors,rangeMin,rangeMax,stepSize=.1){this.setColors(colors,rangeMin,rangeMax,stepSize)}setColors(colors,rangeMin,rangeMax,stepSize){this.colorsPresetList=[];const steps=Math.max(1,Math.floor((rangeMax-rangeMin)/stepSize));const rangeDiff=rangeMax-rangeMin;this.range=[rangeMin,rangeMax,rangeDiff];const parsedColors=colors.map(parseColor);for(let i=0;i<=steps;i++){const value=rangeMin+i*stepSize;const position=(value-rangeMin)/rangeDiff;this.colorsPresetList.push(this.interpolateColor(parsedColors,position))}}interpolateColor(colors,position){const index=Math.floor(position*(colors.length-1));const ratio=position*(colors.length-1)-index;const startColor=colors[index];const endColor=colors[index+1]||colors[index];const rgba={r:Math.round(startColor.r+ratio*(endColor.r-startColor.r)),g:Math.round(startColor.g+ratio*(endColor.g-startColor.g)),b:Math.round(startColor.b+ratio*(endColor.b-startColor.b)),a:Math.round(startColor.a+ratio*(endColor.a-startColor.a))};return{...rgba,hax:rgbToHex(rgba.r,rgba.g,rgba.b,rgba.a)}}getColor(value){if(!Number.isFinite(value))return ColorInterpolator.transparent;const[rangeMin,,rangeDiff]=this.range;const position=(value-rangeMin)/rangeDiff;if(position<=0)return this.colorsPresetList[0];if(position>=1)return this.colorsPresetList[this.colorsPresetList.length-1];const index=Math.min(Math.floor(position*this.colorsPresetList.length),this.colorsPresetList.length-1);return this.colorsPresetList[index]}}class Engine{state;constructor(props){this.state={id:props.id,container:void 0,canvas:null,ctx:null,range:props.range??[-20,100]};this.init(props)}updateProps(e){this.state={...this.state,...e}}init(_props){const{id}=this.state;const container=document.getElementById(id);const canvas=document.createElement("canvas");const ctx=canvas.getContext?.("2d");canvas.style.transform="scaleY(-1)";if(ctx){ctx.imageSmoothingEnabled=false;ctx.lineJoin="miter";ctx.lineCap="butt";ctx.textBaseline="middle"}if(ctx)this.updateProps({container:container??void 0,canvas,ctx});container?.appendChild(canvas);this.resize(false)}clearRect(){const{ctx,canvas}=this.state;ctx.clearRect(0,0,canvas.width,canvas.height)}resize(draw=true){const{canvas,container}=this.state;const{clientWidth,clientHeight}=container;if(!clientWidth||!clientHeight)return;canvas.width=clientWidth;canvas.height=clientHeight;if(draw)setTimeout(()=>{this.draw()})}draw(){}dispose(){const{canvas,container}=this.state;container?.removeChild(canvas)}}const DEFAULTS={COLOR:"#000000",THICKNESS:1,FILL_STYLE:"#ffffffB0",FILL_STYLE_PRIMARY:"#1890ff",FILL_STYLE_TRANSPARENT_BASE:"#ffffff10",LINE_COLOR:"#00ff00",POINT_COLOR:"#ff0000",DIAL_NORTH_COLOR:"#ff4d4f",DIAL_SOUTH_COLOR:"#1890ff",FLUORESCENCE_COLORS:["#000080","#0000FF","#00FFFF","#00FF00","#FFFF00","#FF0000"],RANGE:[-20,100]};const FLUORESCENCE={LEVEL_MIN:-20,LEVEL_MAX:140,LEVEL_RANGE:161};var enums_OrientationType=/*#__PURE__*/function(OrientationType){OrientationType["Horizontal"]="horizontal";OrientationType["Vertical"]="vertical";return OrientationType}({});var enums_GraphicType=/*#__PURE__*/function(GraphicType){GraphicType["Circle"]="circle";GraphicType["Rect"]="rect";GraphicType["Line"]="line";GraphicType["Stepline"]="stepline";GraphicType["Bar"]="bar";GraphicType["Area"]="area";return GraphicType}({});var enums_RendererType=/*#__PURE__*/function(RendererType){RendererType["Canvas"]="canvas";RendererType["WebGL"]="webgl";return RendererType}({});const BLOCK_RENDER_MODE=false;class Fluorescence extends Engine{init(props){super.init(props);const{colors,display}=props;this.updateProps({colors,data:new Uint32Array(0),display});this.resize()}updateProps(e){const rangeChanged=e.range&&(e.range[0]!==this.state.range?.[0]||e.range[1]!==this.state.range?.[1]);super.updateProps(e);if(rangeChanged&&this.state.data?.length>0)this.draw()}clearImageData(){const{ctx,canvas:{height,width}}=this.state;if(height&&width)this.updateProps({imageData:ctx.createImageData(width,height)})}clearRect(){super.clearRect();this.clearImageData()}clear(){this.clearRect();this.updateProps({data:new Uint32Array(0)})}dispose(){this.intensityMatrixCache=null;this.gridCentersCache=null;this.weightLookupCache=null;this.colorLookupCache=null;this.colorCache.clear();this.lastRenderParams=null;this.blockPositionsCache=null;this.lastBlockRenderParams=null}drawBlocks(){const{imageData,data,canvas,ctx,colors=DEFAULTS.FLUORESCENCE_COLORS,range=DEFAULTS.RANGE,fluorescenceMaxCount=1}=this.state;if(!data||0===data.length||!imageData)return;const{width,height}=canvas;const[rangeMin,rangeMax]=range;const rangeSpan=rangeMax-rangeMin;if(rangeSpan<=0)return;const dataLength=data.length/FLUORESCENCE.LEVEL_RANGE;const currentParams={dataLength,width,height,rangeMin,rangeMax};const paramsChanged=!this.lastBlockRenderParams||Object.keys(currentParams).some(key=>this.lastBlockRenderParams?.[key]!==currentParams[key]);if(paramsChanged||!this.blockPositionsCache||this.blockPositionsCache.length!==dataLength){this.blockPositionsCache=new Array(dataLength);const blockWidth=Math.max(1,Math.floor(width/dataLength));for(let i=0;i<dataLength;i++){const startX=Math.floor(i*width/dataLength);const endX=Math.min(width-1,startX+blockWidth-1);this.blockPositionsCache[i]={startX,endX,width:endX-startX+1}}}this.lastBlockRenderParams=currentParams;const pixelData=imageData.data;pixelData.fill(0);const invRangeSpan=1/rangeSpan;const heightMinus1=height-1;const pixelsPerDb=height/rangeSpan;const blockHeight=Math.max(1,Math.ceil(pixelsPerDb));for(let dataIndex=0;dataIndex<dataLength;dataIndex++){const blockPos=this.blockPositionsCache[dataIndex];const{startX:blockStartX,endX:blockEndX}=blockPos;const baseIndex=dataIndex*FLUORESCENCE.LEVEL_RANGE;for(let level=0;level<FLUORESCENCE.LEVEL_RANGE;level++){const count=data[baseIndex+level];if(count<=0)continue;const yValue=level+FLUORESCENCE.LEVEL_MIN;if(yValue<rangeMin||yValue>rangeMax)continue;const normalizedY=(yValue-rangeMin)*invRangeSpan;const centerY=normalizedY*heightMinus1;const blockStartY=Math.max(0,Math.floor(centerY-blockHeight/2));const blockEndY=Math.min(heightMinus1,blockStartY+blockHeight-1);const intensity=Math.log(count+1)/Math.log(fluorescenceMaxCount+1);const alpha=Math.round(255*intensity);const{r:colorR,g:colorG,b:colorB}=this.interpolateColor(colors,intensity);for(let py=blockStartY;py<=blockEndY;py++){const rowIndex=py*width;for(let px=blockStartX;px<=blockEndX;px++){const pixelIndex=(rowIndex+px)*4;pixelData[pixelIndex]=colorR;pixelData[pixelIndex+1]=colorG;pixelData[pixelIndex+2]=colorB;pixelData[pixelIndex+3]=alpha}}}}ctx.putImageData(imageData,0,0)}resize(){super.resize();this.clearImageData()}setRange(range){if(!range)return;this.updateProps({range});this.draw()}render(data){if(data?.fluorescenceData?.length>=0){const oldLength=this.state.data?.length??0;const newLength=data.fluorescenceData.length;if(oldLength!==newLength){this.clearImageData();this.intensityMatrixCache=null;this.gridCentersCache=null;this.blockPositionsCache=null;this.lastRenderParams=null;this.lastBlockRenderParams=null}this.state.data=data.fluorescenceData;this.state.fluorescenceMaxCount=data.fluorescenceMaxCount;this.draw()}}interpolateColor(colors,ratio){if(!colors||0===colors.length)return{r:255,g:255,b:255,a:255};ratio=Math.max(0,Math.min(1,ratio));const getColorRgb=color=>{if("string"==typeof color)return this.hexToRgb(color);return{r:color.r,g:color.g,b:color.b}};if(1===colors.length){const color=getColorRgb(colors[0]);return{...color,a:255}}if(0===ratio){const color=getColorRgb(colors[0]);return{...color,a:255}}if(1===ratio){const color=getColorRgb(colors[colors.length-1]);return{...color,a:255}}const scaledRatio=ratio*(colors.length-1);const index=Math.floor(scaledRatio);const localRatio=scaledRatio-index;const safeIndex=Math.min(index,colors.length-2);const color1=getColorRgb(colors[safeIndex]);const color2=getColorRgb(colors[safeIndex+1]);return{r:Math.round(color1.r+(color2.r-color1.r)*localRatio),g:Math.round(color1.g+(color2.g-color1.g)*localRatio),b:Math.round(color1.b+(color2.b-color1.b)*localRatio),a:255}}colorCache=new Map;hexToRgb(hex){const cached=this.colorCache.get(hex);if(cached)return cached;const parsed=parseColor(hex);const color={r:parsed.r,g:parsed.g,b:parsed.b};this.colorCache.set(hex,color);return color}lastRenderParams=null;intensityMatrixCache=null;gridCentersCache=null;weightLookupCache=null;colorLookupCache=null;blockPositionsCache=null;lastBlockRenderParams=null;draw(){const{imageData,data,canvas,ctx,colors=DEFAULTS.FLUORESCENCE_COLORS,range=DEFAULTS.RANGE,fluorescenceMaxCount=1,display}=this.state;if(!display)return;if(!data||0===data.length||!imageData)return;if(BLOCK_RENDER_MODE){this.drawBlocks();return}const{width,height}=canvas;const[rangeMin,rangeMax]=range;const rangeSpan=rangeMax-rangeMin;if(rangeSpan<=0)return;const dataLength=data.length/FLUORESCENCE.LEVEL_RANGE;const currentParams={dataLength,rangeMin,rangeMax,width,height,maxCount:fluorescenceMaxCount};const needRecalcGridCenters=!this.lastRenderParams||this.lastRenderParams.dataLength!==currentParams.dataLength||this.lastRenderParams.width!==currentParams.width;const needRecalcWeightLookup=!this.lastRenderParams||this.lastRenderParams.height!==currentParams.height;const needRecalcColorLookup=!this.colorLookupCache;this.lastRenderParams=currentParams;const pixelData=imageData.data;pixelData.fill(0);const pixelsPerLevel=height/rangeSpan;const interpolationRadius=Math.max(2,Math.ceil(pixelsPerLevel),Math.floor(height/50));const radiusSquared=interpolationRadius*interpolationRadius;const matrixSize=width*height;const cellWidth=width/dataLength;const radiusX=Math.max(interpolationRadius,Math.ceil(cellWidth));if(this.intensityMatrixCache&&this.intensityMatrixCache.length===matrixSize)this.intensityMatrixCache.fill(0);else this.intensityMatrixCache=new Float32Array(matrixSize);const intensityMatrix=this.intensityMatrixCache;if(needRecalcGridCenters||!this.gridCentersCache||this.gridCentersCache.length!==dataLength){this.gridCentersCache=new Float32Array(dataLength);const cellWidth=width/dataLength;for(let i=0;i<dataLength;i++){const startX=Math.floor(cellWidth*i);const endX=Math.ceil(cellWidth*(i+1));this.gridCentersCache[i]=(startX+endX)/2}}const gridCenters=this.gridCentersCache;const maxDistance=interpolationRadius;const lookupSize=Math.ceil(10*maxDistance)+1;if(needRecalcWeightLookup||!this.weightLookupCache||this.weightLookupCache.length!==lookupSize){this.weightLookupCache=new Float32Array(lookupSize);for(let i=0;i<=10*maxDistance;i++){const distance=i/10;this.weightLookupCache[i]=Math.exp(-(distance*distance)/(2*radiusSquared))}}const weightLookup=this.weightLookupCache;let maxIntensity=0;for(let dataIndex=0;dataIndex<dataLength;dataIndex++){const centerX=gridCenters[dataIndex];const baseIndex=dataIndex*FLUORESCENCE.LEVEL_RANGE;for(let level=0;level<FLUORESCENCE.LEVEL_RANGE;level++){const count=data[baseIndex+level];if(count<=0)continue;const yValue=level+FLUORESCENCE.LEVEL_MIN;if(yValue<rangeMin||yValue>rangeMax)continue;const normalizedY=(yValue-rangeMin)/rangeSpan;const centerY=normalizedY*(height-1);const intensity=Math.log(count+1)/Math.log(fluorescenceMaxCount+1);const expandStartX=Math.max(0,Math.floor(centerX-radiusX));const expandEndX=Math.min(width-1,Math.ceil(centerX+radiusX));const startY=Math.max(0,Math.floor(centerY-interpolationRadius));const endY=Math.min(height-1,Math.ceil(centerY+interpolationRadius));for(let py=startY;py<=endY;py++){const dy=py-centerY;const dySquared=dy*dy;const rowIndex=py*width;for(let px=expandStartX;px<=expandEndX;px++){const dx=px-centerX;const normalizedDx=dx*interpolationRadius/radiusX;const distanceSquared=normalizedDx*normalizedDx+dySquared;if(distanceSquared>radiusSquared)continue;const distance=Math.sqrt(distanceSquared);const lookupIndex=Math.floor(10*distance);const weight=lookupIndex<weightLookup.length?weightLookup[lookupIndex]:0;const matrixIndex=rowIndex+px;const newIntensity=intensityMatrix[matrixIndex]+intensity*weight;intensityMatrix[matrixIndex]=newIntensity;if(newIntensity>maxIntensity)maxIntensity=newIntensity}}}}const intensityThreshold=.001;const invMaxIntensity=maxIntensity>0?1/maxIntensity:0;const colorSteps=256;if(needRecalcColorLookup||!this.colorLookupCache||this.colorLookupCache.length!==colorSteps){this.colorLookupCache=new Array(colorSteps);for(let i=0;i<colorSteps;i++){const ratio=i/(colorSteps-1);this.colorLookupCache[i]=this.interpolateColor(colors,ratio)}}const colorLookup=this.colorLookupCache;for(let i=0;i<intensityMatrix.length;i++){const rawIntensity=intensityMatrix[i];if(rawIntensity<=intensityThreshold)continue;const intensity=Math.min(rawIntensity*invMaxIntensity,1);const colorIndex=Math.min(Math.floor(intensity*(colorSteps-1)),colorSteps-1);const color=colorLookup[colorIndex];const pixelIndex=4*i;pixelData[pixelIndex]=color.r;pixelData[pixelIndex+1]=color.g;pixelData[pixelIndex+2]=color.b;pixelData[pixelIndex+3]=Math.round(255*intensity)}ctx.putImageData(imageData,0,0)}}function fillImageData(canvasWidth,canvasHeight,data,imageData,getColor){if(!data)return;const numRows=data.length;const cellHeight=canvasHeight/numRows;let cellWidth=0;for(let r=0;r<numRows;r++){const rowData=data[r];const numCols=rowData.length;if(0===numCols)continue;if(0===cellWidth)cellWidth=canvasWidth/numCols;const startRow=Math.floor(cellHeight*r);const endRow=Math.ceil(cellHeight*(r+1));for(let c=0;c<numCols;c++){const value=rowData[c];const startCol=Math.floor(cellWidth*c);const endCol=Math.ceil(cellWidth*(c+1));const color=getColor(value);for(let y=startRow;y<endRow;y++){const rowIndex=y*canvasWidth;for(let x=startCol;x<endCol;x++){const index=(rowIndex+x)*4;imageData[index]=color.r;imageData[index+1]=color.g;imageData[index+2]=color.b;imageData[index+3]=color.a}}}}}function getMinMax(numbers){if(!Array.isArray(numbers)||0===numbers.length)throw new Error("Input must be a non-empty array.");let min=numbers[0];let max=numbers[0];for(let i=1;i<numbers.length;i++)if(numbers[i]<min)min=numbers[i];else if(numbers[i]>max)max=numbers[i];return[min,max]}function isNumberAlias(n){return"number"==typeof n&&Number.isFinite(n)}function convertToF64(odata){const flattened=odata.flatMap(row=>{if(0===row.length)return Array(odata[0].length).fill(Number.NaN);return row});return new Float64Array(flattened)}let webgl2Supported=null;function isWebGL2Supported(){if(null!==webgl2Supported)return webgl2Supported;try{const canvas=document.createElement("canvas");const gl=canvas.getContext("webgl2");webgl2Supported=!!gl;if(gl){const ext=gl.getExtension("WEBGL_lose_context");ext?.loseContext()}}catch{webgl2Supported=false}return webgl2Supported}class Gauge extends Engine{init(props){super.init(props);this.state.canvas.style.transform="scaleY(1)";const fillStyle=props.fillStyle??DEFAULTS.FILL_STYLE;const fillStylePrimary=props.fillStylePrimary??DEFAULTS.FILL_STYLE_PRIMARY;const fillStyleTransparentBase=props.fillStyleTransparentBase??DEFAULTS.FILL_STYLE_TRANSPARENT_BASE;const baseWidth=6;this.updateProps({fillStyle,fillStylePrimary,fillStyleTransparentBase,baseWidth,padding:props.padding??0,step:props.ticksStep??10,lineWidth:1,data:{value:0,limit:0}})}clear(){this.clearRect();const{ctx,BGCanvas}=this.state;if(BGCanvas)ctx.drawImage(BGCanvas,0,0)}resize(){super.resize();if(this.state.lineWidth)this.drawBackground()}render(data){this.state.data={...this.state.data,...data};this.draw()}draw(){const{data:{value},range:[min,max],canvas,ctx,baseWidth,padding,BGCanvas,fillStylePrimary}=this.state;this.clearRect();if(BGCanvas)ctx.drawImage(BGCanvas,0,0);const width=3*baseWidth;const height=canvas.height-2*padding;const x=(canvas.width-width)/2;const renderHeight=(value-min)/(max-min)*height;const y=height-renderHeight+padding;ctx.fillStyle=fillStylePrimary;ctx.fillRect(x,y,width,renderHeight);this.drawLimit()}drawLimit(){const{data:{limit},range:[min,max],canvas,ctx,baseWidth,padding,lineWidth,fillStylePrimary}=this.state;if(!isNumberAlias(limit))return;const width=3*baseWidth;const height=canvas.height-2*padding;const x=(canvas.width-width)/2;const y=height*(max-limit)/(max-min)+padding;const limitTagHeight=9;const triangleWidth=9;const rectangleWidth=30;ctx.beginPath();ctx.moveTo(x+width,y);ctx.lineTo(x+width+triangleWidth,y-limitTagHeight);ctx.lineTo(x+width+triangleWidth+rectangleWidth,y-limitTagHeight);ctx.lineTo(x+width+triangleWidth+rectangleWidth,y+limitTagHeight);ctx.lineTo(x+width+triangleWidth,y+limitTagHeight);ctx.lineTo(x+width,y);ctx.lineTo(x,y);ctx.lineWidth=lineWidth;ctx.strokeStyle=fillStylePrimary;ctx.stroke();ctx.fillStyle=fillStylePrimary;ctx.font="12px Arial";ctx.textAlign="center";ctx.textBaseline="middle";ctx.fillText(limit.toString(),x+width+triangleWidth+rectangleWidth/2,y+1)}drawBackground(){const{canvas,baseWidth,padding,lineWidth,step,range:[min,max],fillStyle,fillStyleTransparentBase}=this.state;const BGCanvas=document.createElement("canvas");BGCanvas.width=canvas.width;BGCanvas.height=canvas.height;const BGCtx=BGCanvas.getContext("2d");if(!BGCtx)return;const width=3*baseWidth;const height=canvas.height-2*padding;const x=(canvas.width-width)/2;const y=padding;const tagNun=11;const markedAngles=Array.from({length:tagNun},(_,i)=>min+Math.round(i*(max-min)/(tagNun-1)/step)*step);BGCtx.fillStyle=fillStyleTransparentBase;BGCtx.fillRect(x,y,width,height);for(let i=min;i<=max;i+=step){const isMarked=markedAngles.includes(i);const tagY=height*(max-i)/(max-min)+padding;BGCtx.beginPath();BGCtx.moveTo(x-(isMarked?baseWidth:baseWidth/2),tagY);BGCtx.lineTo(x,tagY);BGCtx.strokeStyle=fillStyle;BGCtx.lineWidth=isMarked?lineWidth:lineWidth/2;BGCtx.stroke();if(isMarked){BGCtx.fillStyle=fillStyle;BGCtx.font="12px Arial";BGCtx.textAlign="right";BGCtx.textBaseline="middle";BGCtx.fillText(i.toString(),x-1.2*baseWidth,tagY)}}this.state.BGCanvas=BGCanvas}}class WebGLEngine{state;constructor(props){this.state={id:props.id,container:void 0,canvas:null,gl:null,range:props.range??[-20,100]};this.init(props)}updateProps(e){this.state={...this.state,...e}}init(_props){const{id}=this.state;const container=document.getElementById(id);const canvas=document.createElement("canvas");const gl=canvas.getContext("webgl2",{alpha:true,antialias:false,premultipliedAlpha:false,preserveDrawingBuffer:false});if(!gl){console.error("WebGL 2.0 not supported");return}canvas.style.transform="scaleY(-1)";this.updateProps({container:container??void 0,canvas,gl});container?.appendChild(canvas);this.resize(false)}compileShader(type,source){const{gl}=this.state;const shader=gl.createShader(type);if(!shader)return null;gl.shaderSource(shader,source);gl.compileShader(shader);if(!gl.getShaderParameter(shader,gl.COMPILE_STATUS)){console.error("Shader compile error:",gl.getShaderInfoLog(shader));gl.deleteShader(shader);return null}return shader}createProgram(shaderSource){const{gl}=this.state;const vertexShader=this.compileShader(gl.VERTEX_SHADER,shaderSource.vertex);const fragmentShader=this.compileShader(gl.FRAGMENT_SHADER,shaderSource.fragment);if(!vertexShader||!fragmentShader)return null;const program=gl.createProgram();if(!program)return null;gl.attachShader(program,vertexShader);gl.attachShader(program,fragmentShader);gl.linkProgram(program);if(!gl.getProgramParameter(program,gl.LINK_STATUS)){console.error("Program link error:",gl.getProgramInfoLog(program));gl.deleteProgram(program);return null}gl.deleteShader(vertexShader);gl.deleteShader(fragmentShader);return program}createTexture(){const{gl}=this.state;const texture=gl.createTexture();if(!texture)return null;gl.bindTexture(gl.TEXTURE_2D,texture);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);return texture}createQuadBuffer(){const{gl}=this.state;const buffer=gl.createBuffer();if(!buffer)return null;gl.bindBuffer(gl.ARRAY_BUFFER,buffer);const vertices=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);gl.bufferData(gl.ARRAY_BUFFER,vertices,gl.STATIC_DRAW);return buffer}clearRect(){const{gl}=this.state;gl.clearColor(0,0,0,0);gl.clear(gl.COLOR_BUFFER_BIT)}resize(draw=true){const{canvas,container,gl}=this.state;if(!container)return;const{clientWidth,clientHeight}=container;if(!clientWidth||!clientHeight)return;canvas.width=clientWidth;canvas.height=clientHeight;gl.viewport(0,0,clientWidth,clientHeight);if(draw)setTimeout(()=>{this.draw()})}draw(){}dispose(){const{gl,canvas}=this.state;if(gl){const loseContext=gl.getExtension("WEBGL_lose_context");if(loseContext)loseContext.loseContext()}canvas?.remove()}}const VERTEX_SHADER=`#version 300 es
2
2
  in vec2 a_position;
3
3
  out vec2 v_texCoord;
4
4
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "types": "index.d.ts",
6
6
  "author": "Hxgh",
7
7
  "license": "MIT",
8
- "version": "0.1.5",
8
+ "version": "0.1.6",
9
9
  "private": false,
10
10
  "keywords": [
11
11
  "canvas",
@@ -1 +1 @@
1
- {"version":3,"file":"Fluorescence.d.ts","sourceRoot":"","sources":["../../../src/renderers/cartesian/Fluorescence.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,KAAK,EACV,sBAAsB,EACtB,iBAAiB,EACjB,SAAS,EACT,KAAK,EACN,MAAM,aAAa,C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38
38
  RANGE: [number, number];
39
39
  };
40
+ /** 荧光谱常量(与 spectrum-analyzer 保持一致) */
41
+ export declare const FLUORESCENCE: {
42
+ readonly LEVEL_MIN: -20;
43
+ readonly LEVEL_MAX: 140;
44
+ readonly LEVEL_RANGE: 161;
45
+ };
40
46
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,MAAM,WAAW,IAAI;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,8BAA8B;AAC9B,MAAM,MAAM,UAAU,GAClB,MAAM,GACN;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD,sBAAsB;AACtB,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAErC,8BAA8B;AAC9B,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD,UAAU;AACV,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,YAAY;AACZ,eAAO,MAAM,QAAQ;;;;;;;;;;yBA0Bd,MAAM,EAAE;WAGQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACtC,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,MAAM,WAAW,IAAI;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,8BAA8B;AAC9B,MAAM,MAAM,UAAU,GAClB,MAAM,GACN;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD,sBAAsB;AACtB,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAErC,8BAA8B;AAC9B,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD,UAAU;AACV,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,YAAY;AACZ,eAAO,MAAM,QAAQ;;;;;;;;;;yBA0Bd,MAAM,EAAE;WAGQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACtC,CAAC;AAEF,sCAAsC;AACtC,eAAO,MAAM,YAAY;;;;CAIf,CAAC"}
package/types/data.d.ts CHANGED
@@ -39,7 +39,7 @@ export interface GaugeData {
39
39
  }
40
40
  /** Fluorescence 渲染数据 */
41
41
  export interface FluorescenceRenderData {
42
- fluorescenceData: Map<number, number>[];
42
+ fluorescenceData: Uint32Array;
43
43
  fluorescenceMaxCount: number;
44
44
  }
45
45
  //# sourceMappingURL=data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/types/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE5D,sBAAsB;AACtB,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE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C;CAC9B"}
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { ColorValue, Point, Range, RangeWithSpan, RGBA } from './common';
2
- export { DEFAULTS } from './common';
2
+ export { DEFAULTS, FLUORESCENCE } from './common';
3
3
  export type { AxisYRange, CircularData, CircularSeriesItem, FluorescenceRenderData, GaugeData, IQData, SeriesConfig } from './data';
4
4
  export { GraphicType, OrientationType, RendererType } from './enums';
5
5
  export type { BaseState, CircularState, FluorescenceState, GaugeDataType, GaugeState, HeatmapState, InitProps, IQEyeState, IQState, SeriesState, StateProps } from './state';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,YAAY,EACV,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,SAAS,EACT,MAAM,EACN,YAAY,EACb,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGrE,YAAY,EACV,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,OAAO,EACP,WAAW,EACX,UAAU,EACX,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAElD,YAAY,EACV,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,SAAS,EACT,MAAM,EACN,YAAY,EACb,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGrE,YAAY,EACV,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,OAAO,EACP,WAAW,EACX,UAAU,EACX,MAAM,SAAS,CAAC"}
package/types/state.d.ts CHANGED
@@ -52,7 +52,7 @@ export interface HeatmapState extends BaseState {
52
52
  }
53
53
  /** Fluorescence 状态 */
54
54
  export interface FluorescenceState extends BaseState {
55
- data: Map<number, number>[];
55
+ data: Uint32Array;
56
56
  colors: ColorValue[];
57
57
  imageData: ImageData;
58
58
  fluorescenceMaxCount: number;
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/types/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAe;AACf,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,GAAG,EAAE,wBAAwB,CAAC;IAC9B,KAAK,EAAE,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAED,oBAAoB;AACpB,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,C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