<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 김기선</title>
    <description>The latest articles on DEV Community by 김기선 (@_f2ad1d4a811a87449655b).</description>
    <link>https://dev.to/_f2ad1d4a811a87449655b</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4220035%2F21bbe0a8-cf5f-4100-a4b7-7e8cb0b671e9.png</url>
      <title>DEV Community: 김기선</title>
      <link>https://dev.to/_f2ad1d4a811a87449655b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/_f2ad1d4a811a87449655b"/>
    <language>en</language>
    <item>
      <title>Why Photoshot keeps the original color when you edit in black and white</title>
      <dc:creator>김기선</dc:creator>
      <pubDate>Thu, 19 Nov 2026 09:10:40 +0000</pubDate>
      <link>https://dev.to/_f2ad1d4a811a87449655b/why-photoshot-keeps-the-original-color-when-you-edit-in-black-and-white-5748</link>
      <guid>https://dev.to/_f2ad1d4a811a87449655b/why-photoshot-keeps-the-original-color-when-you-edit-in-black-and-white-5748</guid>
      <description>&lt;p&gt;&lt;em&gt;Photoshot Looks development journal, part 1 of 9.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the first build of Silver for Photoshot Looks, I converted a three-color test image to black and white and tried two different Color Filter hues. Both produced identical pixels. I could see the same problem with a Control Point. Changing how strongly it selected by color had no effect after the image went monochrome.&lt;/p&gt;

&lt;p&gt;Nik Silver Efex gave me a clue. It opens in neutral black and white, yet it still lets you brighten or darken parts of the image based on their original hues. Its local controls also let you adjust lightness and chroma selectivity separately. Those behaviors suggested a design for Photoshot. &lt;strong&gt;Keep the original color available for selection, and apply the edit to the image as it looks now.&lt;/strong&gt; &lt;a href="https://userguides.dxo.com/en/nikcollection/silver-efex" rel="noopener noreferrer"&gt;DxO Silver Efex guide&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I inferred and built
&lt;/h2&gt;

&lt;p&gt;The Color Filter now reads hue from the original photo and uses it to shift the brightness of the current monochrome image. That keeps the tonal work already in the edit. A Control Point uses lightness from the image at that stage and color from the original. The radius and feather tell it where to look, and the sampled lightness and color help it decide which nearby pixels to select.&lt;/p&gt;

&lt;p&gt;I also had to decide where a local edit belongs in the rendering order. The first build used the point as a mask for the global adjustment. Placing a point on a face could make an exposure adjustment disappear from the rest of the frame. The new renderer applies the global adjustment first and layers the point’s own settings on top. A brighter face and an unchanged background are now two outcomes I can test in the same image.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I adapted from public implementations
&lt;/h2&gt;

&lt;p&gt;I used Björn Ottosson’s published Oklab coefficients in a NumPy implementation. For Levels &amp;amp; Curves, I adapted the weighted slope calculation documented by SciPy’s PCHIP implementation, simplified the endpoint rules, and sampled the curve into a lookup table. I studied darktable’s Tone Equalizer source for how it preserves detail around edges. Photoshot’s own tone controls use smooth weights for shadows, midtones, and highlights, with OpenCV’s guided filter separating detail at different scales.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://bottosson.github.io/posts/gamutclipping/" rel="noopener noreferrer"&gt;Oklab reference implementation&lt;/a&gt; · &lt;a href="https://github.com/scipy/scipy/blob/main/scipy/interpolate/_cubic.py" rel="noopener noreferrer"&gt;SciPy source&lt;/a&gt; · &lt;a href="https://github.com/darktable-org/darktable/blob/master/src/iop/toneequal.c" rel="noopener noreferrer"&gt;darktable source&lt;/a&gt; · &lt;a href="https://docs.opencv.org/4.x/da/d17/group__ximgproc__filters.html" rel="noopener noreferrer"&gt;OpenCV guided filter&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How I checked the result
&lt;/h2&gt;

&lt;p&gt;After the fix, the two Color Filter hues gave different results on the same test patches. In the local-adjustment test, the sampled area inside the point changed by an average of &lt;strong&gt;26 levels on an 8-bit scale&lt;/strong&gt;. The sampled area outside it stayed exactly the same as the global-only render. A print-border test also confirmed that the center of the image stayed untouched.&lt;/p&gt;

&lt;p&gt;The portrait in the demo puts those decisions together. I started with &lt;strong&gt;Silver Print&lt;/strong&gt;, lifted the light on the face with one Control Point, added a print border, and compared the result with the color original. That workflow shipped in Photoshot Looks 0.4.6 for the web editor with the Windows companion.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI drafted the prose from the project’s implementation and test records under the project owner’s direction.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>design</category>
      <category>tools</category>
    </item>
    <item>
      <title>Why our retouching service returns patches and masks instead of only a JPEG</title>
      <dc:creator>김기선</dc:creator>
      <pubDate>Sat, 14 Nov 2026 11:02:45 +0000</pubDate>
      <link>https://dev.to/_f2ad1d4a811a87449655b/why-our-retouching-service-returns-patches-and-masks-instead-of-only-a-jpeg-5bcd</link>
      <guid>https://dev.to/_f2ad1d4a811a87449655b/why-our-retouching-service-returns-patches-and-masks-instead-of-only-a-jpeg-5bcd</guid>
      <description>&lt;p&gt;A finished JPEG is an easy output for an automatic retouching feature. It is a less useful output when the user likes the skin adjustment but wants to remove another effect. The return format matters as much as the processing step.&lt;/p&gt;

&lt;p&gt;This follow-up Photoshot development note examines the preserved Python service for Photoshot Retouch. It is a source walkthrough, not a report of a newly completed end-to-end deployment. I reviewed the service files on November 14, 2026; I did not repeat the current browser editor's import, Undo, save, and reopen workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reuse the analysis components, then define the editing contract
&lt;/h2&gt;

&lt;p&gt;The service uses Google's MediaPipe Face Landmarker and Image Segmenter. These supply facial landmarks and segmentation data. The app's own integration decides how to turn those results into protected areas, effect masks, and output layers.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;regions.py&lt;/code&gt;, the skin mask combines two skin channels and subtracts a dilated protection mask around the eyes and lips. This is an application policy built on existing model output. It would be misleading to describe the entire vision stack as a new engine written by AI.&lt;/p&gt;

&lt;p&gt;The model URLs use versioned paths. &lt;code&gt;models.py&lt;/code&gt; also checks SHA-256 digests before accepting the downloaded files. The preserved package metadata identifies MediaPipe 0.10.32 and NumPy 2.2.6. These identify this local package, not every currently running production component.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate working resolution from output resolution
&lt;/h2&gt;

&lt;p&gt;The engine caps the working image's long edge at 1,400 pixels. Larger inputs are reduced for analysis and effect computation. It then expands the effect difference and mask back to the original dimensions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;scale&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;WORK_EDGE&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nb"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# base is the reduced current image&lt;/span&gt;
&lt;span class="n"&gt;candidate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;small_mask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"operation"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;delta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;full&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;candidate&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;mask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;full&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;small_mask&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This preserves the distinction between the original image and the change being applied. It does not establish that fine detail was analyzed at full resolution. Small faces, hair boundaries, and difficult lighting still need actual image-based checks. I am not attaching a performance or quality percentage to this design.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcs4ho2y61ekvo6syt1xz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcs4ho2y61ekvo6syt1xz.png" alt="Original RGB, reduced analysis, expanded effect differences and patch output" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Explanatory source-flow diagram; not an editor screenshot or a benchmark.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Return a patch, a mask, and its location
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;record&lt;/code&gt; helper finds pixels where the mask is at least &lt;code&gt;1 / 255&lt;/code&gt;, computes their bounding rectangle, and writes only that rectangle. Each result includes &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt;, and &lt;code&gt;height&lt;/code&gt; so the editor can place the patch back over the original image.&lt;/p&gt;

&lt;p&gt;RGB patches follow the input depth: 8-bit or 16-bit. Masks are encoded at 8-bit. Supporting a 16-bit RGB input therefore does not mean the mask also has 16-bit precision.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;layers&lt;/code&gt; mode, the engine records effect-specific patches. In &lt;code&gt;merged&lt;/code&gt; mode, it applies the sequence and records a combined changed region. The skin-mask-only path is different again: it records a white patch and mask with visibility initially disabled. Creating a mask is kept separate from immediately changing the visible photograph.&lt;/p&gt;

&lt;p&gt;This output supplies ingredients for editable results. It does not, by itself, prove that the browser's document history is connected correctly. That requires applying the returned layers in the editor and checking Undo, Redo, saving, and reopening.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cancellation is part of the output contract
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;jobs.py&lt;/code&gt; stores jobs in SQLite and processes them through a single worker. A submission identifier is unique within an owner. Repeating the same identifier with the same settings returns the existing job; different settings do not silently become the same request.&lt;/p&gt;

&lt;p&gt;Cancellation changes the job state. The engine checks progress before each tool and after the complete sequence. A checkpoint fails if the job is no longer running. The final success update is conditional too:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;jobs&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'succeeded'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;updated&lt;/span&gt;&lt;span class="o"&gt;=?&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=?&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'running'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prevents that update from overwriting a cancellation state. It is cooperative cancellation at checkpoints, not a promise that a long-running operation stops at the exact instant the user clicks Cancel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6dtxx5hd0010vs7g5g2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6dtxx5hd0010vs7g5g2m.png" alt="Layered versus merged output and cancellation checkpoints" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The diagram summarizes output modes and cooperative cancellation checkpoints.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What remains to verify
&lt;/h2&gt;

&lt;p&gt;The next integration check is concrete: apply two effects to the same input, inspect patch placement and masks, hide one result, Undo and Redo the import, then save and reopen the document. Compare object state as well as the rendered image.&lt;/p&gt;

&lt;p&gt;The useful result of this design is control over the output. A retouching feature becomes more valuable inside an editor when users can inspect and adjust the changes it returns.&lt;/p&gt;

&lt;h3&gt;
  
  
  References and authorship
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developers.google.com/edge/mediapipe/solutions/vision/image_segmenter" rel="noopener noreferrer"&gt;Google's Image Segmenter documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.python.org/3/library/sqlite3.html" rel="noopener noreferrer"&gt;Python sqlite3 documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article was generated autonomously by an AI assistant from preserved project code and development records, then checked against those materials. Diagrams describe source structure; they are not screenshots or measured performance results. The accompanying SLOHERO website edition is prepared but its deployment is pending; no unpublished website URL is presented as the original published page.&lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
    </item>
    <item>
      <title>When paste in place moved the artwork: separating shortcut intent in Si</title>
      <dc:creator>김기선</dc:creator>
      <pubDate>Sat, 14 Nov 2026 10:59:13 +0000</pubDate>
      <link>https://dev.to/_f2ad1d4a811a87449655b/when-paste-in-place-moved-the-artwork-separating-shortcut-intent-in-si-1khh</link>
      <guid>https://dev.to/_f2ad1d4a811a87449655b/when-paste-in-place-moved-the-artwork-separating-shortcut-intent-in-si-1khh</guid>
      <description>&lt;p&gt;A paste-in-place command moved an object by 20 units on both axes. Another shortcut, intended to toggle the bounding box, created an additional object. Both looked plausible in the menu. Neither produced the document the user requested.&lt;/p&gt;

&lt;p&gt;This is Si development study 06, a retrospective on the October 19 shortcut investigation. It follows our study of view-only link-panel settings, but revisits an earlier failure. The historical investigation and a preserved deployment bundle are the evidence here. This is not a claim that these bugs were discovered or repaired today.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the document result, not just the selected tool
&lt;/h2&gt;

&lt;p&gt;The original inspection found that pressing B selected the brush tool, but dragging still displayed an unimplemented-tool message. Tool activation and an actual editing operation were separate milestones.&lt;/p&gt;

&lt;p&gt;The shortcut collisions were more damaging. &lt;code&gt;Ctrl+Shift+V&lt;/code&gt; followed a normal-paste placement path instead of retaining the source location. &lt;code&gt;Ctrl+Shift+B&lt;/code&gt; inserted another object instead of only changing a selection-view setting. Handling combinations too broadly around their letter key lost the meaning of the modifiers.&lt;/p&gt;

&lt;p&gt;The right assertions concern document state. Paste in place must preserve position. Toggling a bounding box must not change object count or coordinates. A menu label cannot establish either result.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate intent before reusing the implementation
&lt;/h2&gt;

&lt;p&gt;The preserved bundle maps paste commands to distinct modes. This readable reconstruction shows the mapping; it is not a verbatim source-file excerpt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;pasteModes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"edit.paste"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"normal"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"edit.pastePlace"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"place"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"edit.pasteFront"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"front"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"edit.pasteBack"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"back"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These commands can reuse the clipboard-reading and document-insertion code. Their placement intent still has to survive through that shared path. A policy that offsets a normal pasted copy must not accidentally apply to paste in place.&lt;/p&gt;

&lt;p&gt;The separation also makes a useful test boundary: resolve the input to a command first, then test the command's document effect. That is more informative than asking only whether a keyboard event handler ran.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo6b7lbd7ibgtp8g6q4sx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo6b7lbd7ibgtp8g6q4sx.png" alt="Distinct paste commands retain their placement mode" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Source-structure diagram; labels reproduce the command names. This is not a UI screenshot.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Internal memory is not a cross-tab clipboard
&lt;/h2&gt;

&lt;p&gt;The early implementation kept a copied selection in app memory. Another browser tab had its own execution space, so copying in one did not automatically make the objects available in the other.&lt;/p&gt;

&lt;p&gt;The preserved implementation writes SVG to the system clipboard. When the SVG contains Si's editing metadata, the paste path reconstructs a Si document. Ordinary SVG uses the SVG import path instead. JSON-formatted Si document content is handled separately.&lt;/p&gt;

&lt;p&gt;That distinction preserves two different goals: exchanging artwork and retaining editable project structure. An externally supplied SVG and Si's own serialized objects are not interchangeable inputs.&lt;/p&gt;

&lt;p&gt;There are fallback paths through browser storage or the internal copy when clipboard access is unavailable. They are useful alternatives, but their existence does not prove universal cross-browser or cross-tab compatibility. Permissions and input formats still determine which path is usable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Respect text composition and active UI context
&lt;/h2&gt;

&lt;p&gt;A correct key combination can still be wrong to execute while the user is typing. The preserved normalizer checks composition state, key code 229, and AltGraph. The outer handler also excludes active text inputs, dialogs, menus, and events that were already handled.&lt;/p&gt;

&lt;p&gt;A simplified illustration of one guard is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Readable illustration of a condition found in the bundle.&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isComposing&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;keyCode&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;229&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These guards are especially important for Korean input. The user should not trigger a canvas command in the middle of composing a character. Shortcut handling therefore depends on both the key combination and the current editing context.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fffc1j8l51oj5ld90mf7b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fffc1j8l51oj5ld90mf7b.png" alt="Si metadata, ordinary SVG, system clipboard and fallback paths" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Clipboard routing diagram, explained in the surrounding text. No cross-browser test result is implied.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Reuse an engine without overstating what it provides
&lt;/h2&gt;

&lt;p&gt;Si uses Paper.js for its vector foundation. An existing path engine does not automatically supply the application's command routing, clipboard interchange, document history, and saved project format. Those connections are application work.&lt;/p&gt;

&lt;p&gt;The development record should distinguish the existing open-source engine from the integration written with AI assistance. Paper.js is MIT-licensed. The exact original commit for each historical change was not established from the deployment bundle reviewed for this article; I am not substituting a version mentioned in another post for a verified source revision here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep historical results historical
&lt;/h2&gt;

&lt;p&gt;The October 19 completion record reports 33 public-site checks, including key shortcuts, cross-tab copying, Korean document editing, and saving and reopening. That is a historical result, not a fresh run against today's site.&lt;/p&gt;

&lt;p&gt;For a new regression check, copy one shape, paste it in place, compare coordinates, Undo only the inserted copy, Redo, then save and reopen. Check object count and positions again. Test the bounding-box command separately and confirm it changes only the intended view state.&lt;/p&gt;

&lt;p&gt;An editor has not fulfilled a shortcut merely because a button responds. It has fulfilled it when the document left behind matches what that shortcut promised.&lt;/p&gt;

&lt;h3&gt;
  
  
  References and authorship
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html" rel="noopener noreferrer"&gt;Adobe's official Illustrator shortcut reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/paperjs/paper.js/blob/develop/LICENSE.txt" rel="noopener noreferrer"&gt;Paper.js source and MIT license&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article was generated autonomously by an AI assistant using preserved project code and historical development records, then checked against those materials. Diagrams are explanatory drawings, not UI screenshots. The accompanying website edition is prepared but deployment is pending; no unpublished website URL is claimed as an existing original.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Sorting an image-links panel without changing the artwork — Si study 05</title>
      <dc:creator>김기선</dc:creator>
      <pubDate>Fri, 13 Nov 2026 08:15:10 +0000</pubDate>
      <link>https://dev.to/_f2ad1d4a811a87449655b/sorting-an-image-links-panel-without-changing-the-artwork-si-study-05-2ba1</link>
      <guid>https://dev.to/_f2ad1d4a811a87449655b/sorting-an-image-links-panel-without-changing-the-artwork-si-study-05-2ba1</guid>
      <description>&lt;p&gt;A large image on a canvas is not necessarily a large file. In Si, our local vector editor, the missing control was more basic: a file-size sort and a thumbnail-size selector were not exposed in the Links panel. Work 112 added those controls while keeping view preferences separate from the document and its undo history.&lt;/p&gt;

&lt;h2&gt;
  
  
  A list operation should stay a list operation
&lt;/h2&gt;

&lt;p&gt;An earlier pass already covered document order, name, status and file-type sorting. The initial work-112 inspection recorded zero File Size and Thumbnail Size inputs. That distinction matters: a byte-count helper existing in source is not proof that an author can use it from the interface.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvh05xlxdsy702yu23z5l.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvh05xlxdsy702yu23z5l.jpeg" alt="작업112의 실제 Si 화면. File Size 내림차순과 Large 썸네일을 선택한 세 이미지 자료입니다." width="799" height="544"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the actual saved work-112 UI: descending File Size order and the Large thumbnail setting. It is a historical capture, not a replay of the latest editor build.&lt;/p&gt;

&lt;p&gt;Adobe’s Links-panel documentation was the behavioral reference for size sorting and thumbnail display. We did not copy an Adobe implementation or establish parity with every behavior in an installed Illustrator version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Count the stored source, not the displayed dimensions
&lt;/h2&gt;

&lt;p&gt;The comparator uses the encoded original source where one is retained, falling back to the placed image source. For the current whitespace-free Base64 representation, decoded byte length equals floor(payloadLength × 3 / 4) minus the trailing padding. The project-owned helper is effectively:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const source = image.original?.source ?? image.source;
const length = source.length - source.indexOf(',') - 1;
return Math.floor(length * 3 / 4)
  - (source.endsWith('==') ? 2 : source.endsWith('=') ? 1 : 0);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Actual input file&lt;/th&gt;
&lt;th&gt;Bytes&lt;/th&gt;
&lt;th&gt;Ascending position&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;40-opaque.jpg&lt;/td&gt;
&lt;td&gt;1,642&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;40-icons.png&lt;/td&gt;
&lt;td&gt;15,737&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;40-logo.png&lt;/td&gt;
&lt;td&gt;67,825&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff419r7tyrhqib973qfzf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff419r7tyrhqib973qfzf.png" alt="실제 원본 파일의 바이트 수를 비교한 계산 도표. 1642, 15737, 67825 bytes입니다." width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The chart reports file bytes, not runtime memory or a performance benchmark. KiB means bytes divided by 1,024. For this article, I decoded the saved document’s three sources and compared them with the real input files.&lt;/p&gt;

&lt;p&gt;LinksPanel filters the collected image entries into a separate visible array and sorts that array numerically. It does not reorder Paper.js document children or change stacking order. Descending order only reverses the comparison sign. Thumbnail options are 24, 36 and 64 CSS pixels; hiding thumbnails disables that selector, while showing them restores the chosen size.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep preferences outside the edit history
&lt;/h2&gt;

&lt;p&gt;React display state and a dedicated local preference record hold sorting and thumbnail choices. No document-edit command is invoked for these settings. That lets Undo continue to undo the actual placement, rather than consuming a step for a different way of looking at the same list.&lt;/p&gt;

&lt;p&gt;The saved work-112 UI report contains 18 passing assertions: both sort directions, retained selection, measured thumbnail boxes, hide/show behavior, Undo/Redo, browser restart, and document reopening. These are historical assertions. For this article, five read-only comparisons of saved artifacts passed again: original file bytes, complete document equality before/after view changes, Undo objects, Redo objects, and reopened objects. I did not rerun the current editor UI or deploy a new editor build.&lt;/p&gt;

&lt;p&gt;An initial verification attempt closed the panel with the Properties toggle and then failed to select a file. The procedure was corrected to inspect panel visibility before acting. That interaction failure was not counted as a defect in the sorting comparator.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dependencies and limits
&lt;/h2&gt;

&lt;p&gt;React 19.2.6 (MIT) is an existing npm runtime dependency: useState/useEffect connect the view settings and their persistence. Existing vendored Paper.js 0.12.18 (MIT) supplies the item tree read by imageLinks. The byte helper and list comparator are project-owned glue. Playwright 1.63.0 (Apache-2.0) served historical UI verification only. No new third-party implementation source was copied for this article.&lt;/p&gt;

&lt;p&gt;These checks cover the three named inputs and the saved documents. They do not establish all-format support, large-list performance, cloud-link compatibility or that later source-link changes passed a fresh full-editor test. Publishing this study does not deploy the editor.&lt;/p&gt;

&lt;p&gt;Sources: &lt;a href="https://helpx.adobe.com/illustrator/desktop/add-and-import-files/import-from-other-apps/links-panel-in-illustrator.html" rel="noopener noreferrer"&gt;Adobe Links panel&lt;/a&gt;; &lt;a href="https://react.dev/reference/react/useState" rel="noopener noreferrer"&gt;React useState&lt;/a&gt;; &lt;a href="https://github.com/paperjs/paper.js/tree/c1d88390d2c86901db152827fe778c3e39cfb073" rel="noopener noreferrer"&gt;pinned Paper.js source&lt;/a&gt;; &lt;a href="https://github.com/microsoft/playwright/tree/v1.63.0" rel="noopener noreferrer"&gt;Playwright 1.63.0&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Authoring disclosure: An AI agent wrote this report from project source, recorded UI work and repeated saved-artifact comparisons. Screenshots are actual captures; the chart uses measured source-file sizes.&lt;/p&gt;

&lt;p&gt;Authoring disclosure: This article was written by AI (Fully Autonomous).&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>typescript</category>
      <category>graphics</category>
    </item>
    <item>
      <title>Why a gradient stroke vanished from our PDF export</title>
      <dc:creator>김기선</dc:creator>
      <pubDate>Thu, 12 Nov 2026 14:04:25 +0000</pubDate>
      <link>https://dev.to/_f2ad1d4a811a87449655b/why-a-gradient-stroke-vanished-from-our-pdf-export-3mf9</link>
      <guid>https://dev.to/_f2ad1d4a811a87449655b/why-a-gradient-stroke-vanished-from-our-pdf-export-3mf9</guid>
      <description>&lt;p&gt;A gradient stroke looked correct in our browser vector editor, Si, and in its PNG export. The PDF opened successfully, but the stroke had disappeared. That made “a file downloaded” a poor definition of export success.&lt;/p&gt;

&lt;p&gt;This fourth Si development study follows the failing output through Paper.js, SVG conversion and PDF writing. The fix preserves the editable path and changes only an export copy.&lt;/p&gt;

&lt;h2&gt;
  
  
  The saved PDF exposed the gap
&lt;/h2&gt;

&lt;p&gt;The recorded document has two existing paths on a 600 by 500 point artboard. One has a 20-point gradient stroke around a white fill. Comparing the saved PDF with the PNG showed that the conversion path had lost the gradient stroke. This is an observed failure of our configured exporter, not a claim that PDF cannot represent gradients.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcz5k8twsgpq0x4bsi0qg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcz5k8twsgpq0x4bsi0qg.png" alt="The actual failing PDF, independently rendered on opaque white." width="600" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The actual failing PDF, independently rendered on opaque white.&lt;/p&gt;

&lt;h2&gt;
  
  
  Outline a copy, keep the original editable
&lt;/h2&gt;

&lt;p&gt;Our exporter builds an artboard SVG and passes it through svg2pdf.js and jsPDF. For PDF output, it now clones the artwork without inserting it into the document and calls &lt;code&gt;outlineGradientStrokes&lt;/code&gt; before SVG generation. The helper converts a gradient stroke to filled vector geometry, carries over the stops, and translates the gradient endpoints into the outline’s coordinate system.&lt;/p&gt;

&lt;p&gt;A separate copy retains the original fill where needed. Clipping-mask paths are skipped. The original path, width and &lt;code&gt;strokeGradient&lt;/code&gt; data stay in the editable document.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;clone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;art&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clone&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pdfStrokeOutlines&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;outlineGradientStrokes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;clone&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;clone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exportSVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;asString&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;precision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;clone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shortened extract is from &lt;code&gt;src/editor/exchange.ts&lt;/code&gt;. The outline helper is in &lt;code&gt;src/editor/advanced.ts&lt;/code&gt;; the editor’s separate stroke-gradient representation is in its model and serialization code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdu8e7lk4meb2yw9xjexu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdu8e7lk4meb2yw9xjexu.png" alt="The corrected saved PDF. The grayscale gradient border is present." width="600" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The corrected saved PDF. The grayscale gradient border is present.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the output checks establish
&lt;/h2&gt;

&lt;p&gt;The earlier local UI session exercised linear, radial and three-color strokes, exports, an SVG reimport, fill/stroke swap with Undo, and style data reopened through the editor. For this article, we repeated independent checks on those saved PDFs with PyMuPDF 1.26.6.&lt;/p&gt;

&lt;p&gt;At 72 dpi, each 600 by 500 point page renders to 600 by 500 pixels. We compared RGB channels at six fixed coordinates against the PNG on the same white background. The largest absolute difference was 231 before correction; the corrected linear, three-color and radial cases measured 1, 2 and 1 respectively on the 0–255 channel scale.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Case&lt;/th&gt;
&lt;th&gt;Maximum sampled RGB difference&lt;/th&gt;
&lt;th&gt;Embedded raster images&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Failing linear PDF&lt;/td&gt;
&lt;td&gt;231&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Corrected linear PDF&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Corrected three-color PDF&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Corrected radial PDF&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The six (x,y) coordinates were (100,112), (130,112), (160,112), (190,112), (215,112) and (150,170), measured from the top left. The corrected cases passed a tolerance of 3. These finite samples are not a whole-image or arbitrary-document guarantee.&lt;/p&gt;

&lt;p&gt;Each PDF contained one page and no embedded raster images. The parsed native document JSON before and after PDF export was identical. The test therefore supports two specific claims: these outputs retained vector content, and exporting did not rewrite the editable document.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dependencies and limits
&lt;/h2&gt;

&lt;p&gt;This is integration work around Paper.js 0.12.18, paperjs-offset 2.2.1, jsPDF 4.2.1 and svg2pdf.js 2.8.1, all MIT-licensed. Si supplies the document representation, target selection, export-copy handling and verification. The full report links the pinned source revisions and downloadable outputs.&lt;/p&gt;

&lt;p&gt;The change supports gradients within the stroke. Along-stroke, across-stroke and freeform modes remain outside it. Imported alpha, transform, clipping and effect combinations were not exhaustively checked. The recorded reopen used Si-format clipboard serialization; native Save As file-picker success was not established.&lt;/p&gt;

&lt;p&gt;This is locally verified development work. Publishing this report does not deploy the editor changes. Normal-blend vector cases were checked; separate blend-mode raster fallback is outside the vector claim.&lt;/p&gt;

&lt;p&gt;Authoring disclosure: An AI agent wrote this report from source files, saved UI work and independent output checks. The figures are renders of actual exported PDFs.&lt;/p&gt;

&lt;p&gt;Authoring disclosure: This article was written by AI (Fully Autonomous).&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>typescript</category>
      <category>graphics</category>
    </item>
    <item>
      <title>Can you release a clipping mask after saving and reopening?</title>
      <dc:creator>김기선</dc:creator>
      <pubDate>Mon, 09 Nov 2026 11:09:07 +0000</pubDate>
      <link>https://dev.to/_f2ad1d4a811a87449655b/can-you-release-a-clipping-mask-after-saving-and-reopening-3p68</link>
      <guid>https://dev.to/_f2ad1d4a811a87449655b/can-you-release-a-clipping-mask-after-saving-and-reopening-3p68</guid>
      <description>&lt;p&gt;A clipping mask can look right while you work and still be broken after a save. In Si, our browser-based vector editor, we used a simple test: reopen a masked file and release the mask. Can we still recover the artwork that was hidden?&lt;/p&gt;

&lt;h2&gt;
  
  
  A small reproduction
&lt;/h2&gt;

&lt;p&gt;Draw a filled rectangle. Place an ellipse above it and select both objects in the same layer and group. Make a clipping mask, save the native vector document, and open the file you just saved. Release the mask and check that the full rectangle returns. Undo should restore the clipped view.&lt;/p&gt;

&lt;p&gt;We also tested a JPEG under a closed path. The pair below shows the same image immediately after reopening and after releasing the mask.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg94471s52638adidxee0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg94471s52638adidxee0.png" alt="Si after reopening. The rectangular mask hides the right side of the JPEG." width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1bklpfr9icfbrxq54smh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1bklpfr9icfbrxq54smh.png" alt="Si after release. The remainder of the same JPEG is visible." width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the boundary and artwork together
&lt;/h2&gt;

&lt;p&gt;The top selected path becomes the first child of a clip object. The other children retain their own object data. In the JPEG case, that includes the embedded image and its transform. When loading the file, Si checks that the group has at least two children and that the first child is a closed path or compound path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Rebuilding the saved children as a Paper.js group.&lt;/span&gt;
&lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Group&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;child&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;restoreItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;child&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
  &lt;span class="na"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;objectType&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;clip&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;firstChild&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clipMask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clipped&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Releasing the group turns clipping off and returns the children as separate objects. Paper.js handles the clipping. Si owns the document format and the release operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the checks covered
&lt;/h2&gt;

&lt;p&gt;In two fresh local browser sessions, the vector and raster fixtures both passed save, reopen, release, and Undo. The saved bytes matched the document snapshot. Reopening regenerated the document ID and preserved the rest of the snapshot. Release returned both objects and preserved the artwork record. Undo restored the clipping group and its children.&lt;/p&gt;

&lt;p&gt;The automated test captures the data sent to the file writer. It covers two native Si documents. Native picker behavior, nested masks, and SVG or PDF exchange are outside that test.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://slohero.com/blog/si-development-03-clipping-masks" rel="noopener noreferrer"&gt;Slohero engineering report&lt;/a&gt; includes the two downloadable files and source references.&lt;/p&gt;

&lt;p&gt;Authoring disclosure: An AI agent drafted this article from Si source code, saved test artifacts, and the browser checks described above.&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
    <item>
      <title>What should a vector editor remember after you hide its panels?</title>
      <dc:creator>김기선</dc:creator>
      <pubDate>Mon, 02 Nov 2026 12:37:35 +0000</pubDate>
      <link>https://dev.to/_f2ad1d4a811a87449655b/what-should-a-vector-editor-remember-after-you-hide-its-panels-afd</link>
      <guid>https://dev.to/_f2ad1d4a811a87449655b/what-should-a-vector-editor-remember-after-you-hide-its-panels-afd</guid>
      <description>&lt;p&gt;A familiar editor layout has to do more than resemble its reference. In Si, our browser-based vector editor, the workspace must distinguish a persistent preference from a temporary interaction. This is the second development entry, following a study of request-time document snapshots.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three meanings of “hidden”
&lt;/h2&gt;

&lt;p&gt;The current workspace source has three separate fields: &lt;code&gt;allHidden&lt;/code&gt;, &lt;code&gt;sideHidden&lt;/code&gt;, and &lt;code&gt;collapsed&lt;/code&gt;. They describe hiding the broad interface, hiding only the side area, and keeping a compact panel arrangement. &lt;code&gt;panel&lt;/code&gt; records the selected panel. A single visibility flag would erase information needed to restore the previous arrangement.&lt;/p&gt;

&lt;p&gt;The reducer toggles those fields independently. An explicit panel selection also clears the two hiding flags, so asking for Layers can actually reveal Layers. Here is the current reducer, from &lt;code&gt;src/ui/workspace-state.ts&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;workspaceReducer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;WorkspaceState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;WorkspaceAction&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="nx"&gt;WorkspaceState&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="k"&gt;switch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
 &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;toggleAll&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;allHidden&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;allHidden&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
 &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;toggleSide&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;sideHidden&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sideHidden&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
 &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;panel&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;allHidden&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;sideHidden&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;collapsed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toggle&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;panel&lt;/span&gt;&lt;span class="o"&gt;===&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;panel&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;!&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;collapsed&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;!&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sideHidden&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;!&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;allHidden&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;panel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;panel&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
 &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;reset&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;DEFAULT_WORKSPACE&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
 &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;patch&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,...&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;patch&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk8u4h6w2ehvtxn5ybz0o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk8u4h6w2ehvtxn5ybz0o.png" alt="Current public Si with its tools and Properties panel visible" width="799" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The screenshot is from the current public interface. The original stage-two implementation had a preview artboard, while later stages connected document and drawing engines. I am keeping those stages separate rather than using a current screenshot to claim every control already worked in the historical build.&lt;/p&gt;

&lt;h2&gt;
  
  
  Persist the layout, not every transient condition
&lt;/h2&gt;

&lt;p&gt;Panel width and panel choice are useful preferences. A temporary hide command should not make the next session look empty. The write boundary therefore overrides three fields in the stored record:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;writeWorkspace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;WorkspaceState&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;UI_STORAGE_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({...&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;allHidden&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;sideHidden&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;selection&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}));}&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* The workspace stays usable when browser storage is unavailable. */&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The read path starts from defaults, checks the storage version, accepts recognized panel names and units, and clamps a finite width to 220–420 pixels. Invalid JSON restores defaults. The write catch keeps the current workspace usable if storage fails, but it does not establish that persistence succeeded; quota failures were outside this test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2qh6hopjtb6zb5u7hob6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2qh6hopjtb6zb5u7hob6.png" alt="Public Si after Tab hides tools and side panels" width="799" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A keyboard boundary, too
&lt;/h2&gt;

&lt;p&gt;The preserved development log records a Shift+Equal mismatch: the event key could be &lt;code&gt;=&lt;/code&gt; instead of &lt;code&gt;+&lt;/code&gt;. The current keyboard normalizer recognizes a plus character, NumpadAdd, or Equal with Shift and without Alt. It resolves those inputs to the symbol chord &lt;code&gt;Plus&lt;/code&gt;; the command table maps that chord to &lt;code&gt;tool.addAnchor&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The current code also ignores composition and AltGraph before resolving commands. The project uses an existing Photoshot-derived shortcut helper; this UI stage did not introduce a newly copied GitHub patch. React and React DOM are dependencies, while the product-specific state rules were written with AI assistance. Adobe’s documentation is a behavioral reference, not imported application code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What was actually checked
&lt;/h2&gt;

&lt;p&gt;On 2 November 2026, eight public-interface checks passed: Tab hiding and restoration, Shift+Tab retaining the tools, F7 selecting Layers, selected-panel persistence after reload, width persistence at 242 pixels, Shift+Equal selecting Add Anchor Point, and a Tab round-trip at 1266×738. Afterward, the width was restored to 252 pixels, the panel to Properties, and the tool to Selection.&lt;/p&gt;

&lt;p&gt;Ten isolated source checks passed as well, covering keyboard routing, composition rejection, reducer transitions, transient reset, a width bound, and malformed JSON fallback. Those source checks use an in-memory storage substitute in Node. They are not browser durability tests. Historical tests are reported separately rather than added to today’s totals.&lt;/p&gt;

&lt;p&gt;Tool selection is not evidence that every anchor-editing operation works. This report also does not certify unrestricted docking, all keyboard layouts, or full Illustrator compatibility. The useful outcome is a small contract: normalized input changes explicit state; persistent preferences survive reload; temporary interaction does not silently become a preference.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://slohero.com/blog/si-development-02-workspace-state" rel="noopener noreferrer"&gt;full report and downloadable test records&lt;/a&gt; include the complete read path, provenance, historical limits, and results. The official references checked for the article are &lt;a href="https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/workspace-overview.html" rel="noopener noreferrer"&gt;Adobe’s workspace overview&lt;/a&gt;, &lt;a href="https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html" rel="noopener noreferrer"&gt;Illustrator shortcuts&lt;/a&gt;, and &lt;a href="https://react.dev/learn/extracting-state-logic-into-a-reducer" rel="noopener noreferrer"&gt;React’s reducer guide&lt;/a&gt;. The React guide was checked for this report; it is not evidence of when the original implementation was researched.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authoring disclosure:&lt;/strong&gt; An AI agent prepared this article from the project’s source, preserved development records, and the checks described above. Historical observations and current tests are identified separately.&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
    <item>
      <title>Why a levels gamma handle is not the midpoint: a browser editor case study</title>
      <dc:creator>김기선</dc:creator>
      <pubDate>Mon, 02 Nov 2026 11:45:25 +0000</pubDate>
      <link>https://dev.to/_f2ad1d4a811a87449655b/why-a-levels-gamma-handle-is-not-the-midpoint-a-browser-editor-case-study-59k9</link>
      <guid>https://dev.to/_f2ad1d4a811a87449655b/why-a-levels-gamma-handle-is-not-the-midpoint-a-browser-editor-case-study-59k9</guid>
      <description>&lt;p&gt;Photoshot development note 03 examines a small UI contract: the middle levels handle should mark the input that maps to output 0.5. A correct pixel transform is not enough if its control communicates a different operation.&lt;/p&gt;

&lt;p&gt;This is a standalone summary of the &lt;a href="https://slohero.com/photoshot/guides/levels-histogram/en/" rel="noopener noreferrer"&gt;full development note&lt;/a&gt;, using pinned Photoshot revision &lt;code&gt;19f45ed&lt;/code&gt;. Photoshot is an independent browser image editor.&lt;/p&gt;

&lt;h2&gt;
  
  
  The mismatch to test
&lt;/h2&gt;

&lt;p&gt;The archived September 18 work connected numeric settings to the adjustment engine. The September 22 work added image-derived histograms and draggable handles. Those were separate implementation stages.&lt;/p&gt;

&lt;p&gt;For normalized input &lt;code&gt;t&lt;/code&gt;, the midtone transform is &lt;code&gt;t ** (1 / gamma)&lt;/code&gt;. At gamma 2, a handle placed halfway through input 0–255 points to 127.5, whose output is about 0.707. If the handle means “input that becomes 0.5,” it belongs at 63.75 instead. This is a diagnostic counterexample calculated for this revision, not a claim that a preserved historical failure screen showed that exact bug.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh8h7eesr5bl3s68yziss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh8h7eesr5bl3s68yziss.png" alt="Gamma curves and the input positions that map to output 0.5" width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 1. Deterministic response curves for input 0–255 and normalized output 0–1. These are calculated relationships, not measurements from a photograph.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Make the control the inverse of the transform
&lt;/h2&gt;

&lt;p&gt;Solving &lt;code&gt;t ** (1 / gamma) = 0.5&lt;/code&gt; gives &lt;code&gt;t = 0.5 ** gamma&lt;/code&gt;. The first function maps the gamma number to an input position. The second converts a drag position back to gamma.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;clamp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// The middle handle marks the input that becomes 50% after inverse gamma.&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;gammaPosition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;black&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;white&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;gamma&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;black&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;white&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;black&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;gamma&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;gammaAtPosition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;black&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;white&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;black&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;white&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;black&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both listings are from &lt;a href="https://github.com/Abraham721/photoshot/blob/19f45ed6dd99800f910c0587baa53e73d46ab4fb/src/levels-controls.ts#L1-L13" rel="noopener noreferrer"&gt;src/levels-controls.ts, lines 1–13&lt;/a&gt;. Gamma is constrained to 0.1–10; the inverse rounds the displayed number to two decimals. Clamping matters near the endpoints because taking a logarithm at zero is not a valid UI value.&lt;/p&gt;

&lt;p&gt;The existing adjustment pipeline applies combined RGB levels before the individual-channel transform. These handle functions translate the same settings used by that pipeline; they do not apply a separate visual effect.&lt;/p&gt;

&lt;h2&gt;
  
  
  The histogram needs its own definition
&lt;/h2&gt;

&lt;p&gt;A graph labelled RGB must not silently become a weighted brightness graph. One opaque pure-red pixel makes the distinction concrete: weighted brightness goes to bin 54, while the combined RGB distribution places 2/3 at bin 0 and 1/3 at bin 255. A fully transparent second pixel contributes nothing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fja4k6yxp90noipizp9r0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fja4k6yxp90noipizp9r0.png" alt="Weighted brightness and combined RGB distributions for one red pixel" width="800" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 2. Results calculated with the actual source for one opaque red pixel and one fully transparent pixel. The RGB graph averages the three channel bins.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The source uses &lt;code&gt;alpha / 255&lt;/code&gt; as a weight, skips zero-alpha pixels, and accumulates brightness and individual channel bins separately. A logarithmic graph height makes small peaks visible without changing the levels transform itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the checks establish
&lt;/h2&gt;

&lt;p&gt;The pinned-source checks passed 18 cases: six gamma values across three input ranges, including a one-step range. Position-to-gamma recovered each selected gamma, and every marker mapped to output 0.5. Existing tests also covered alpha weighting, brightness versus channel distributions, empty data and the rightmost histogram bin.&lt;/p&gt;

&lt;p&gt;For input 18/1.12/235 and output 0/255, all nine gray outputs matched the archived Photoshot values. In a browser session using locally served deployment files, a new 1536×1024 portrait was adjusted, undone and redone. Input white changed 235 → 255 → 235. Saving, closing and reopening the editable project restored both layers and the settings.&lt;/p&gt;

&lt;p&gt;The historical September 25 Photoshop chart comparison reported mean absolute channel difference 0.229 and maximum 1. That full comparison was not rerun for this article. The new tests do not establish performance, every color-profile workflow or full live-service behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  Source and scope
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://docs.gimp.org/3.0/en/gimp-tool-levels.html" rel="noopener noreferrer"&gt;GIMP Levels manual&lt;/a&gt; supplied conceptual definitions; this was not a port of GIMP C code. Photoshot's &lt;a href="https://github.com/Abraham721/photoshot/blob/19f45ed6dd99800f910c0587baa53e73d46ab4fb/COPYRIGHT.md" rel="noopener noreferrer"&gt;copyright notice&lt;/a&gt; permits viewing its source but does not grant an open-source license for its original code.&lt;/p&gt;

&lt;p&gt;The useful result is a testable contract between a number, its handle and its graph. The &lt;a href="https://slohero.com/photoshot/guides/levels-histogram/en/" rel="noopener noreferrer"&gt;full note&lt;/a&gt; includes the adjustment calculation, histogram accumulation, actual UI figure and downloadable replay data.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI disclosure: this article was prepared by an AI agent from the author's project source and archived development records. The reported source checks and browser actions were executed during preparation; historical measurements are identified separately.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
    <item>
      <title>Why brightness and contrast order mattered: correcting a browser editor’s pixel response</title>
      <dc:creator>김기선</dc:creator>
      <pubDate>Sun, 01 Nov 2026 07:22:41 +0000</pubDate>
      <link>https://dev.to/_f2ad1d4a811a87449655b/why-brightness-and-contrast-order-mattered-correcting-a-browser-editors-pixel-response-492h</link>
      <guid>https://dev.to/_f2ad1d4a811a87449655b/why-brightness-and-contrast-order-mattered-correcting-a-browser-editors-pixel-response-492h</guid>
      <description>&lt;p&gt;A brightness slider can work perfectly as UI while producing the wrong pixels. In Photoshot, my browser image editor, the difficult part was matching a measured brightness/contrast response while keeping the adjustment non-destructive and integrated with masks, opacity and saved projects.&lt;/p&gt;

&lt;p&gt;This is a compact account of the reference code, the numerical failure, the correction, and what was actually verified.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The first implementation and its reference
&lt;/h2&gt;

&lt;p&gt;The September 18 development record shows Konva's &lt;code&gt;src/filters/Contrast.ts&lt;/code&gt; being inspected before the first adjustment engine was written. Its midpoint-centered pixel loop was useful for understanding the channel range and the fact that contrast need not modify alpha.&lt;/p&gt;

&lt;p&gt;Photoshot used separately written expressions: brighten toward white or darken toward black, then apply contrast around normalized midpoint 0.5. The original-revision branch remains in the source:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;brightness&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;revision&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;brightness&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;brightness&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;brightness&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
          &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;contrast&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;contrast&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;contrast&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;contrast&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;101&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;contrast&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The engine already compiled three 256-entry channel lookup tables. The later correction changed their response calculation, not the existence of lookup tables.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The measured failure
&lt;/h2&gt;

&lt;p&gt;On September 25, an intermediate &lt;strong&gt;normal-mode approximation&lt;/strong&gt; was compared with Photoshop 27.3.1 at brightness +30 and contrast +20. It produced mean absolute RGB-channel error &lt;strong&gt;11.505&lt;/strong&gt; and maximum error &lt;strong&gt;25&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Two retained gray samples make the failure concrete:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Intermediate output&lt;/th&gt;
&lt;th&gt;Archived Photoshop output&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;td&gt;168&lt;/td&gt;
&lt;td&gt;157&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Those errors belong to the intermediate build used in that comparison. They must not be presented as a measurement of the first September 18 legacy formula.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqjcl6vwlnsizqhj3l985.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqjcl6vwlnsizqhj3l985.png" alt="Archived mean and maximum errors before correction and with both response orders" width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Historical chart measurements at +30/+20; each bar is one deterministic evaluation.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Why consulting GitHub was not the entire solution
&lt;/h2&gt;

&lt;p&gt;Konva was a consulted source, not an installed, verbatim replacement for our filter. A public contrast implementation may target a different response curve. It also does not supply our adjustment-layer serialization, mask integration or old-project behavior.&lt;/p&gt;

&lt;p&gt;The actual chronology was reference lookup → application implementation → later comparison → calibration. The reference was not first discovered after the September 25 failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Replace the approximation with sampled responses
&lt;/h2&gt;

&lt;p&gt;Calibration used a synthetic gray ramp in Photoshop normal mode. Brightness was sampled from −150 to +150 and contrast from −50 to +100, in steps of 10, with the other control held at zero. The data are retained in &lt;code&gt;tone-response.ts&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sampleResponse&lt;/code&gt; interpolates intermediate settings and channel positions. Revision 2 normal mode applies brightness first, then contrast:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;            &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sampleResponse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;toneResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;brightness&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;brightness&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sampleResponse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;toneResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;contrast&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;contrast&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The order is meaningful: &lt;strong&gt;C(B(x)) generally differs from B(C(x))&lt;/strong&gt;. The result still flows through the existing floating-point channel tables. Masks and opacity remain compositor responsibilities; old revision behavior and the separate Legacy option remain distinct branches.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. The result—and a control that reverses the order
&lt;/h2&gt;

&lt;p&gt;The historical chart was 256 × 32 pixels: eight gray-ramp rows followed by mixed RGB rows. Alpha was excluded, leaving 24,576 channel samples.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Historical implementation, +30/+20&lt;/th&gt;
&lt;th&gt;Mean absolute error&lt;/th&gt;
&lt;th&gt;Maximum&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Intermediate approximation&lt;/td&gt;
&lt;td&gt;11.505&lt;/td&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Measured response, brightness → contrast&lt;/td&gt;
&lt;td&gt;0.241211&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Measured response, contrast → brightness&lt;/td&gt;
&lt;td&gt;1.149740&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For that chart condition, the mean error fell by approximately &lt;strong&gt;97.9%&lt;/strong&gt; relative to the intermediate approximation. That is an error reduction, not a universal compatibility or visual-quality score. Each row is one deterministic chart evaluation, so there is no invented confidence interval or speed claim.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmdmczmwcs1v9yl9jzjka.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmdmczmwcs1v9yl9jzjka.png" alt="Archived failed gray values, Photoshop comparison points and the current source replay" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Numeric records visualized as patches and curves; historical measurements and the new replay remain distinct.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. What the current rerun verifies
&lt;/h2&gt;

&lt;p&gt;The unchanged public engine's response tables were compared with the archived calibration JSON and match exactly. A fresh source-level replay then evaluated nine retained gray inputs at each of +30/+20, +17/+13 and −65/−23: &lt;strong&gt;27/27 outputs equal the archived Photoshot outputs&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That does not mean 27/27 equal Photoshop exactly; some retained Photoshop comparisons differ by one channel value. Nor does this rerun recompute the full-chart means: the original reference PNGs were unavailable in the reviewed folder. Historical chart statistics, archived Photoshop samples and the new replay are deliberately separated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources and full figures
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/konvajs/konva/blob/master/src/filters/Contrast.ts" rel="noopener noreferrer"&gt;Konva Contrast.ts: consulted reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Abraham721/photoshot/blob/19f45ed6dd99800f910c0587baa53e73d46ab4fb/src/adjustments.ts" rel="noopener noreferrer"&gt;Photoshot adjustment engine at 19f45ed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Abraham721/photoshot/blob/19f45ed6dd99800f910c0587baa53e73d46ab4fb/src/tone-response.ts" rel="noopener noreferrer"&gt;Measured response data and interpolation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the full version, including the pipeline diagram, before/after error charts, gray-value comparisons and reproducibility files, read the &lt;a href="https://slohero.com/photoshot/guides/brightness-contrast/en/" rel="noopener noreferrer"&gt;complete research note on my website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Writing and source review were assisted by AI. Claims above are tied to the cited source and retained measurement records.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
    <item>
      <title>Building reversible layer masks in a browser image editor</title>
      <dc:creator>김기선</dc:creator>
      <pubDate>Sun, 01 Nov 2026 07:13:49 +0000</pubDate>
      <link>https://dev.to/_f2ad1d4a811a87449655b/building-reversible-layer-masks-in-a-browser-image-editor-4mjk</link>
      <guid>https://dev.to/_f2ad1d4a811a87449655b/building-reversible-layer-masks-in-a-browser-image-editor-4mjk</guid>
      <description>&lt;p&gt;The feature I wanted was a reversible layer mask: hide part of an image without destroying its source, disable the mask to recover the image, and retain the same document state when it is serialized and composited again. This is a concise engineering account of the implementation in Photoshot, a browser image editor.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Start with the document contract
&lt;/h2&gt;

&lt;p&gt;A layer needs its own position, dimensions, rotation, opacity and blend mode. A mask belongs to the editable document, separately from its source image or paint strokes. A rendered display object is a temporary interpretation of that document.&lt;/p&gt;

&lt;p&gt;The first public Stage used React and PixiJS. Its adapter created a Sprite and transferred the document fields into renderer properties:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Sprite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Texture&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
      &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;anchor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rotation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rotation&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PI&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;alpha&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;blendMode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;blend&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The half-width/height offset follows the centered anchor. Rotation is converted from degrees to radians. These are application-specific integration decisions; installing PixiJS does not supply them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4tj4uihlrev3w5k6grxh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4tj4uihlrev3w5k6grxh.png" alt="Document state, temporary surface and shared compositor" width="799" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Source-level architecture; arrows show data flow, not timing.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Where the implementation became difficult
&lt;/h2&gt;

&lt;p&gt;A Sprite does not define our project schema, mask history or export semantics. The early preview used PixiJS while export had a separate Canvas composition loop. That split created two places that needed to interpret the same document correctly.&lt;/p&gt;

&lt;p&gt;Source inspection establishes the separate paths. It does &lt;strong&gt;not&lt;/strong&gt; establish an archived preview/export mismatch for every image. The problem addressed here is the responsibility boundary between persistent state and rendering.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What came from GitHub—and what was written locally
&lt;/h2&gt;

&lt;p&gt;React supplied UI infrastructure. PixiJS supplied the early rendering APIs. The document model, coordinate adapter, mask plumbing and later common compositor were Photoshot code. This was library reuse plus application integration, rather than a transplanted third-party editor.&lt;/p&gt;

&lt;p&gt;Photopea's mask documentation was a behavioral reference: disabling a mask should recover content. It was not a source-code transplant. The concrete implementation references are the initial Photoshot commit &lt;code&gt;eead3ca&lt;/code&gt; and the later &lt;code&gt;19f45ed&lt;/code&gt; (&lt;code&gt;v0.16.0&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Preserve the source; mask a temporary surface
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;layerSurface&lt;/code&gt; draws the retained source into a fresh Canvas and applies the mask there:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;layer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mask&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;globalCompositeOperation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;destination-in&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;drawImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;maskSurface&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;layer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mask&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;globalCompositeOperation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;source-over&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;destination-in&lt;/code&gt; retains destination pixels according to mask alpha. The code then restores &lt;code&gt;source-over&lt;/code&gt;. Source strokes and mask strokes remain separate document fields, so disabling the mask regenerates the surface from the source.&lt;/p&gt;

&lt;p&gt;The later Stage also calls the shared &lt;code&gt;composite&lt;/code&gt; function for preview. That consolidates layer order, transforms, blending and adjustments. Preview still bounds the longest edge to 1,600 pixels, so a preview and a full-resolution export need a resolution-matched comparison before claiming pixel equivalence.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foz4o3mlkx8i1lk4tb151.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foz4o3mlkx8i1lk4tb151.png" alt="Source, enabled mask, destructive control and recovered document mask" width="799" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;New diagnostic outputs. The destructive control is not a historical product screenshot.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. A controlled failure and a successful recovery
&lt;/h2&gt;

&lt;p&gt;For this article, the unchanged document engine was run with Node and native Canvas on a 100 × 100 pixel paint layer. A 40-pixel mask stroke hid the center. Five deterministic checks passed:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;th&gt;Observation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Source document before/after rendering&lt;/td&gt;
&lt;td&gt;Identical JSON&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enabled mask at the center&lt;/td&gt;
&lt;td&gt;Alpha 0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Restoring a smaller mask stroke&lt;/td&gt;
&lt;td&gt;Center alpha 255&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Disabling the document mask&lt;/td&gt;
&lt;td&gt;Entire RGBA array equals the source&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JSON serialize → validate → composite&lt;/td&gt;
&lt;td&gt;Equals the masked render&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The negative control erased pixels directly from a retained Canvas. Stopping that erase operation left the center transparent, while disabling the document mask restored it to alpha 255. This control was constructed for the diagnostic; it is &lt;strong&gt;not&lt;/strong&gt; a recovered screenshot of an old Photoshot failure.&lt;/p&gt;

&lt;p&gt;The result supports source preservation for this input and revision. It is not a browser interaction test, an IndexedDB durability test, or a claim that every blend mode and format matches Photoshop.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources and the complete research note
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/Abraham721/photoshot/blob/eead3caec5407c14cdd8cdb698a12c633295f8ef/src/stage.tsx" rel="noopener noreferrer"&gt;Initial Stage and PixiJS adapter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Abraham721/photoshot/blob/19f45ed6dd99800f910c0587baa53e73d46ab4fb/src/document.ts" rel="noopener noreferrer"&gt;Later document engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/react/react" rel="noopener noreferrer"&gt;React&lt;/a&gt;, &lt;a href="https://github.com/pixijs/pixijs" rel="noopener noreferrer"&gt;PixiJS&lt;/a&gt;, and &lt;a href="https://www.photopea.com/learn/masks" rel="noopener noreferrer"&gt;Photopea's mask behavior guide&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the full version, including architecture diagrams, rendered failure/recovery panels, the alpha profile and reproducibility files, read the &lt;a href="https://slohero.com/photoshot/guides/basic-tools/en/" rel="noopener noreferrer"&gt;complete research note on my website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Writing and source review were assisted by AI. This account is grounded in the cited project revisions and recorded diagnostic results.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
