PageSourceSearch

https://asenno.com/_app/immutable/chunks/TFOQmzDr.js

js asenno.com collected 2026-10-08 13:54:52 UTC 12,133 bytes, 119 lines download raw bytes

1function e(e,{width:t,height:l},a){const{mode:i,sharpness:o,edgeType:n,showOriginal:s,showDifference:r,antiAlias:c,pixelGrid:f,testPattern:h}=a
2e.imageSmoothingEnabled=c,e.imageSmoothingQuality=c?"high":"low",e.fillStyle="#404040",e.fillRect(0,0,t,l)
3const p=new OffscreenCanvas(t,l),g=p.getContext("2d")
4switch(g.imageSmoothingEnabled=!1,i){case"edge-test":((e,t,l,a)=>{const{edgeType:i,testPattern:o}=a
5switch(o){case"synthetic":((e,t,l,a)=>{const i=l/2,o=200,n=t/5
6for(let t=0;t<5;t++){const l=t*n+n/2
7switch(a){case"step":e.fillStyle="#000000",e.fillRect(l-100,i-100,100,200),e.fillStyle="#FFFFFF",e.fillRect(l,i-100,100,200)
8break
9case"ramp":const t=e.createLinearGradient(l-100,0,l+100,0)
10t.addColorStop(0,"#000000"),t.addColorStop(1,"#FFFFFF"),e.fillStyle=t,e.fillRect(l-100,i-100,o,200)
11break
12case"sine":const a=e.createImageData(o,200),data=a.data
13for(let e=0;e<200;e++)for(let t=0;t<o;t++){const l=t/o,a=Math.floor(127.5*(Math.sin((l-.5)*Math.PI)+1)),i=4*(e*o+t)
14data[i]=a,data[i+1]=a,data[i+2]=a,data[i+3]=255}e.putImageData(a,l-100,i-100)
15break
16case"impulse":e.fillStyle="#808080",e.fillRect(l-100,i-100,o,200),e.fillStyle="#FFFFFF",e.fillRect(l-1,i-100,2,200)}e.fillStyle="#00FF00",e.font="12px monospace",e.textAlign="center",e.fillText(20*t+"% sharp",l,i+120)}})(e,t,l,i)
17break
18case"circles":((e,t,l)=>{const a=t/2,i=l/2,o=.45*Math.min(t,l)
19e.strokeStyle="#FFFFFF",e.fillStyle="#000000",e.fillRect(0,0,t,l)
20for(let t=1;t<=20;t++){const l=t/20*o,n=1+.2*(t-1)
21e.lineWidth=n,e.beginPath(),e.arc(a,i,l,0,2*Math.PI),e.stroke()}e.lineWidth=1
22for(let t=0;t<2*Math.PI;t+=Math.PI/12)e.beginPath(),e.moveTo(a,i),e.lineTo(a+Math.cos(t)*o,i+Math.sin(t)*o),e.stroke()})(e,t,l)
23break
24case"text":((e,t,l)=>{e.fillStyle="#000000",e.fillRect(0,0,t,l)
25e.fillStyle="#FFFFFF",e.textAlign="center",[{size:8,text:"Sharpening Test 8px"},{size:10,text:"Sharpening Test 10px"},{size:12,text:"Sharpening Test 12px"},{size:14,text:"Sharpening Test 14px"},{size:16,text:"Sharpening Test 16px"},{size:20,text:"Sharpening Test 20px"},{size:24,text:"Sharpening Test 24px"},{size:32,text:"Sharpening Test 32px"}].forEach((l,a)=>{e.font=`${l.size}px monospace`
26const i=50+60*a
27e.fillText(l.text,t/2,i),e.font=`bold ${l.size}px monospace`,e.fillText("Bold: "+l.text,t/2,i+25)})})(e,t,l)
28break
29case"checker":((e,t,l)=>{const a=[1,2,4,8,16],i=t/a.length
30a.forEach((t,a)=>{const o=a*i
31for(let a=0;a<l;a+=t)for(let l=0;l<i;l+=t){const i=(l/t+a/t)%2==0
32e.fillStyle=i?"#FFFFFF":"#000000",e.fillRect(o+l,a,t,t)}e.fillStyle="#00FF00",e.fillRect(o,l-30,i,30),e.fillStyle="#000000",e.font="bold 14px monospace",e.textAlign="center",e.fillText(`${t}px`,o+i/2,l-10)})})(e,t,l)
33break
34case"photo":((e,t,l)=>{e.fillStyle="#404040",e.fillRect(0,0,t,l),[{type:"building",x:100,y:100,w:150,h:200},{type:"tree",x:300,y:150,r:80},{type:"person",x:500,y:100,w:60,h:150},{type:"car",x:700,y:200,w:120,h:60}].forEach(t=>{switch(e.fillStyle="#808080",t.type){case"building":e.fillRect(t.x,t.y,t.w,t.h),e.fillStyle="#CCCCCC"
35for(let l=0;l<t.h-20;l+=30)for(let a=0;a<t.w-20;a+=25)e.fillRect(t.x+a+10,t.y+l+10,15,20)
36break
37case"tree":e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI),e.fill(),e.fillStyle="#606060",e.fillRect(t.x-10,t.y+t.r-10,20,60)
38break
39case"person":e.beginPath(),e.arc(t.x+t.w/2,t.y+20,20,0,2*Math.PI),e.fill(),e.fillRect(t.x,t.y+40,t.w,t.h-40)
40break
41case"car":e.fillRect(t.x,t.y,t.w,t.h),e.fillStyle="#303030",e.beginPath(),e.arc(t.x+25,t.y+t.h,15,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x+t.w-25,t.y+t.h,15,0,2*Math.PI),e.fill()}})})(e,t,l)}})(g,t,l,a)
42break
43case"unsharp-mask":((e,t,l)=>{const a=t/2,i=l/2
44e.fillStyle="#404040",e.fillRect(0,0,t,l),e.strokeStyle="#FFFFFF",e.fillStyle="#FFFFFF"
45for(let t=0;t<5;t++){const l=a-200+100*t,o=1+t
46e.lineWidth=o,e.beginPath(),e.moveTo(l,i-150),e.lineTo(l,i+150),e.stroke()}e.lineWidth=1
47for(let l=0;l<5;l++){const a=i-100+50*l,o=255-40*l
48e.fillStyle=`rgb(${o}, ${o}, ${o})`,e.fillRect(100,a,t-200,20)}e.strokeStyle="#FFFFFF",e.lineWidth=2,e.beginPath(),e.moveTo(100,100),e.lineTo(t-100,l-100),e.stroke(),e.beginPath(),e.moveTo(t-100,100),e.lineTo(100,l-100),e.stroke()})(g,t,l)
49break
50case"overshoot-test":((e,t,l,a)=>{const{contrastBoost:i}=a
51e.fillStyle="#808080",e.fillRect(0,0,t,l)
52const o=t/10,n=.6*l,s=(l-n)/2
53for(let t=0;t<10;t++){const l=t*o,a=t%2==0
54let r=a?255:0
55if(i>0&&t>0&&t<9){const e=i/100
56r=a?Math.min(255,255+50*e):Math.max(0,0-50*e)}e.fillStyle=`rgb(${r}, ${r}, ${r})`,e.fillRect(l,s,o,n)}e.strokeStyle="#00FF00",e.lineWidth=1,e.setLineDash([5,5])
57for(let t=1;t<10;t++){const a=t*o
58e.beginPath(),e.moveTo(a,0),e.lineTo(a,l),e.stroke()}e.setLineDash([])})(g,t,l,a)
59break
60case"ringing-test":((e,t,l)=>{e.fillStyle="#808080",e.fillRect(0,0,t,l)
61const a=[{type:"hline",y:.2*l,width:1},{type:"hline",y:.3*l,width:2},{type:"hline",y:.4*l,width:3},{type:"square",x:.2*t,y:.5*l,size:50},{type:"square",x:.4*t,y:.5*l,size:100},{type:"square",x:.6*t,y:.5*l,size:150},{type:"circle",x:.3*t,y:.8*l,r:30},{type:"circle",x:.5*t,y:.8*l,r:50},{type:"circle",x:.7*t,y:.8*l,r:70}]
62e.fillStyle="#FFFFFF",e.strokeStyle="#FFFFFF",a.forEach(l=>{switch(l.type){case"hline":e.lineWidth=l.width,e.beginPath(),e.moveTo(50,l.y),e.lineTo(t-50,l.y),e.stroke()
63break
64case"square":e.fillRect(l.x-l.size/2,l.y-l.size/2,l.size,l.size)
65break
66case"circle":e.beginPath(),e.arc(l.x,l.y,l.r,0,2*Math.PI),e.fill()}})})(g,t,l)
67break
68case"depth-field":((e,t,l)=>{const a=l/5
69for(let l=0;l<5;l++){const i=l*a,o=2*l
70e.save(),o>0&&(e.filter=`blur(${o}px)`)
71const n=128+30*(l-2)
72e.fillStyle=`rgb(${n}, ${n}, ${n})`,e.fillRect(0,i,t,a),e.fillStyle="#FFFFFF",e.strokeStyle="#000000",e.lineWidth=2,e.font="16px monospace",e.textAlign="left",e.fillText(`Blur: ${o}px`,20,i+a/2)
73for(let l=200;l<t-100;l+=20)e.beginPath(),e.moveTo(l,i+10),e.lineTo(l,i+a-10),e.stroke()
74e.restore()}})(g,t,l)
75break
76case"dof-targets":((e,t,l,a)=>{const{sharpness:i,antiAlias:o}=a
77e.fillStyle="#404040",e.fillRect(0,0,t,l);[{name:"Far Field",blur:4,y:.1,sharpBoost:0},{name:"Focus Plane",blur:0,y:.35,sharpBoost:i},{name:"Near Field",blur:2,y:.65,sharpBoost:.5*i},{name:"Extreme Near",blur:6,y:.85,sharpBoost:0}].forEach((a,i)=>{const n=a.y*l,s=.2*l,r=new OffscreenCanvas(t,s),c=r.getContext("2d")
78c.imageSmoothingEnabled=o,((e,t,l,a)=>{switch(a){case 0:((e,t,l)=>{e.fillStyle="#808080",e.fillRect(0,0,t,l),e.fillStyle="#606060",e.beginPath(),e.moveTo(0,l)
79for(let a=0;a<t;a+=50){const t=Math.sin(a/100)*l*.3+.4*l
80e.lineTo(a,t)}e.lineTo(t,l),e.fill()})(e,t,l)
81break
82case 1:((e,t,l)=>{e.fillStyle="#707070",e.fillRect(0,0,t,l),e.fillStyle="#FFFFFF",e.font="12px monospace"
83for(let t=20;t<l;t+=25)e.fillText("Fine text detail for sharpening test ABCDEFG 123456",20,t)
84e.strokeStyle="#FFFFFF",e.lineWidth=1
85for(let a=t-200;a<t-50;a+=3)e.beginPath(),e.moveTo(a,10),e.lineTo(a,l-10),e.stroke()})(e,t,l)
86break
87case 2:((e,t,l)=>{e.fillStyle="#606060",e.fillRect(0,0,t,l),e.fillStyle="#909090"
88for(let a=0;a<t;a+=40)for(let t=0;t<l;t+=30)(a+t)%80<40&&e.fillRect(a,t,20,15)})(e,t,l)
89break
90case 3:((e,t,l)=>{e.fillStyle="#505050",e.fillRect(0,0,t,l)
91const a=e.createImageData(t,l),data=a.data
92for(let e=0;e<data.length;e+=4){const t=100*Math.random()+80
93data[e]=t,data[e+1]=t,data[e+2]=t,data[e+3]=255}e.putImageData(a,0,0)})(e,t,l)}})(c,t,s,i),a.blur>0&&(c.filter=`blur(${a.blur}px)`,c.drawImage(r,0,0),c.filter="none"),a.sharpBoost>0&&((e,t,l,a)=>{const data=e.getImageData(0,0,t,l).data,i=new Uint8ClampedArray(data),o=a/50
94for(let e=2;e<l-2;e++)for(let l=2;l<t-2;l++){const a=4*(e*t+l)
95for(let n=0;n<3;n++){let s=0,r=0
96for(let a=-2;a<=2;a++)for(let i=-2;i<=2;i++){if(0===i&&0===a)continue
97const o=4*((e+a)*t+(l+i))+n,c=1/(1+Math.sqrt(i*i+a*a))
98s+=data[o]*c,r+=c}const c=s/r,f=data[a+n]-c
99i[a+n]=Math.max(0,Math.min(255,data[a+n]+f*o))}}const n=new ImageData(i,t,l)
100e.putImageData(n,0,0)})(c,t,s,a.sharpBoost),e.drawImage(r,0,n),e.fillStyle="Focus Plane"===a.name?"#00FF00":"#CCCCCC",e.font="bold 14px monospace",e.fillText(a.name,20,n+25)
101const f=a.sharpBoost>0?` +${a.sharpBoost}% sharp`:""
102e.font="12px monospace",e.fillText(`Blur: ${a.blur}px${f}`,20,n+45)}),((e,t,l)=>{const a=.45*l,i=.2*l
103e.strokeStyle="#00FF00",e.lineWidth=3,e.setLineDash([]),e.beginPath(),e.moveTo(10,a),e.lineTo(30,a),e.moveTo(10,a+i),e.lineTo(30,a+i),e.moveTo(10,a),e.lineTo(10,a+i),e.stroke(),e.beginPath(),e.moveTo(t-30,a),e.lineTo(t-10,a),e.moveTo(t-30,a+i),e.lineTo(t-10,a+i),e.moveTo(t-10,a),e.lineTo(t-10,a+i),e.stroke()})(e,t,l),((e,t,l)=>{const a=t-400-20,i=l-150-20
104e.fillStyle="rgba(0, 0, 0, 0.9)",e.fillRect(a,i,400,150),e.strokeStyle="rgba(255, 255, 255, 0.3)",e.lineWidth=1,e.strokeRect(a,i,400,150),e.fillStyle="#FFFFFF",e.font="bold 14px monospace",e.fillText("DOF Sharpening Analysis",a+15,i+25),e.font="12px monospace",e.fillStyle="#CCCCCC",["Simulates camera depth-of-field with artificial sharpening.","Focus plane (green brackets) shows enhanced details.","Look for:","\u2022 Oversharpening halos on focused elements","\u2022 Unnatural detail enhancement","\u2022 Processing artifacts in fine textures","","Adjust sharpness to see enhancement effects."].forEach((t,l)=>{e.fillText(t,a+15,i+45+15*l)})})(e,t,l)})(g,t,l,a)}o>0&&!s&&((e,t,l,a)=>{const data=e.getImageData(0,0,t,l).data,i=new Uint8ClampedArray(data),o=a/100
105for(let e=1;e<l-1;e++)for(let l=1;l<t-1;l++){const a=4*(e*t+l)
106for(let n=0;n<3;n++){let s=0,r=0
107for(let a=-1;a<=1;a++)for(let i=-1;
107i<=1;i++)0===i&&0===a||(s+=data[4*((e+a)*t+(l+i))+n],r++)
108const c=s/r,f=data[a+n]-c
109i[a+n]=Math.max(0,Math.min(255,data[a+n]+f*o))}}const n=new ImageData(i,t,l)
110e.putImageData(n,0,0)})(g,t,l,o),e.drawImage(p,0,0),r&&o>0&&((e,t,l,a)=>{const i=e.getImageData(0,0,l,a),o=t.getContext("2d").getImageData(0,0,l,a),data=i.data,n=o.data
111for(let e=0;e<data.length;e+=4)Math.abs(data[e]-n[e])>10&&(data[e]=255,data[e+1]=0,data[e+2]=0)
112e.putImageData(i,0,0)})(e,p,t,l),f&&((e,t,l)=>{e.strokeStyle="rgba(0, 255, 0, 0.2)",e.lineWidth=.5
113for(let a=0;a<t;a+=10)e.beginPath(),e.moveTo(a+.5,0),e.lineTo(a+.5,l),e.stroke()
114for(let a=0;a<l;a+=10)e.beginPath(),e.moveTo(0,a+.5),e.lineTo(t,a+.5),e.stroke()})(e,t,l),((e,t,l,a)=>{const{mode:i,sharpness:o,edgeType:n,antiAlias:s}=a,r=t-300-20,c=l-150-20
115e.fillStyle="rgba(0, 0, 0, 0.85)",e.fillRect(r,c,300,150),e.fillStyle="#FFFFFF",e.font="bold 14px monospace",e.fillText("Sharpening Analysis",r+15,c+25),e.font="12px monospace",e.fillStyle="#CCCCCC";[`Mode: ${i}`,`Sharpness: ${o}%`,`Edge Type: ${n}`,"Anti-alias: "+(s?"ON":"OFF"),"","Look for:","\u2022 Halo artifacts","\u2022 Over/undershoot","\u2022 Ringing patterns"].forEach((t,l)=>{e.fillText(t,r+15,c+45+15*l)})})(e,t,l,a)}const t="Sharpening & Edge Enhancement Test - AV Tools | asenno",l="sharpening",a={mode:"edge-test",sharpness:0,edgeType:"step",showOriginal:!1,showDifference:!1,antiAlias:!1,pixelGrid:!1,testPattern:"synthetic",contrastBoost:0},i={"edge-test":"Edge Enhancement Test","unsharp-mask":"Unsharp Mask Simulation","overshoot-test":"Overshoot/Undershoot","ringing-test":"Ringing Artifacts","depth-field":"Depth of Field Test"},o={step:"Step Edge",ramp:"Gradient Ramp",sine:"Sine Wave",impulse:"Impulse/Line"},n={synthetic:"Synthetic Edges",circles:"Concentric Circles",text:"Text Rendering",checker:"Checkerboard",photo:"Photo Simulation"},s={infoText:"Tests display sharpening and edge enhancement. Adjustable unsharp mask reveals halos, overshoot, and ringing artifacts. Toggle anti-aliasing to see native vs processed edges.",animate:!1},r={handlers:{m:e=>{const t=Object.keys(i),l=t.indexOf(e.mode)
116return{mode:t[(l+1)%t.length]}},e:e=>{const t=Object.keys(o),l=t.indexOf(e.edgeType)
117return{edgeType:t[(l+1)%t.length]}},t:e=>{const t=Object.keys(n),l=t.indexOf(e.testPattern)
118return{testPattern:t[(l+1)%t.length]}},o:e=>({showOriginal:!e.showOriginal}),d:e=>({showDifference:!e.showDifference}),a:e=>({antiAlias:!e.antiAlias}),g:e=>({pixelGrid:!e.pixelGrid}),ArrowUp:e=>({sharpness:Math.min(e.sharpness+10,200)}),ArrowDown:e=>({sharpness:Math.max(e.sharpness-10,0)}),"+":e=>({contrastBoost:Math.min(e.contrastBoost+10,100)}),"-":e=>({contrastBoost:Math.max(e.contrastBoost-10,0)})}}
119export{s as controls,a as defaultSettings,o as edgeTypes,l as id,r as keyboard,i as modes,e as render,n as testPatterns,t as title}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.