v3.0 #255
              
                
                  
                  Pinned
              
          
                  
                    
                      samizdatco
                    
                  
                
                  announced in
                Announcements
              
            
            
              v3.0
            
            #255
          
          
        Replies: 1 comment
-
| I've been waiting for this. I made a simple text layout engine on top of skia-canvas. https://github.com/seanghay/sone | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Skia Canvas is a Node.js implementation of the HTML Canvas drawing API for both on- and off-screen rendering. Since it uses Google’s Skia graphics engine, its output is very similar to Chrome’s
<canvas>element — though it's also capable of things the browser’s Canvas still can't achieve.See the project website for details and documentation.
Changes in Version 3.0
New Features
GUI
Appglobal now has aneventLoopproperty which can be set to:"native"(the default) in which case the Node event loop is suspended while the OS handles displaying GUI windows"node"where the Node event loop maintains control (allowingsetIntervalandsetTimeoutto run) and handles GUI events manually every few milliseconds (though note some of the caveats associated with the Winit feature this uses).closedproperty and emit acloseevent when they are closed. Closed windows can later be re-opened by calling the newopen()method.borderlessattribute allows Window titlebars and borders to be hidden (thanks to @hydroperx Window#decorations #230)Imagery
loadImage()andloadImageData()helpers now usenode-fetchto handle web requests and can accept a fetch options object as the final argument.Imageobjects can now be created by passing a Buffer or dataURL-containing string as a constructor argument and will be immeditately drawable (no asynchronous loading required).sharpnpm module has been installed):loadImage()&loadImageData()can now be called with a Sharp object as their sole argumentsrcproperty on a new Image object can be set to a Sharp object and it will begin asynchronously loadingcreateTexture()for setting the line cap style and selecting whether vector patterns should be clipped or outlinedRendering
downsampleflag (for jpegs only), which enables 4:2:0 chroma-subsampling. By default, no subsampling (a.k.a. 4:4:4) will be performeddensity,matte, andmsaa) which behave the same as their equivalents in the toFile() method.Typography
textContrast— a number in the range 0.0–1.0 controlling the amount of additional weight to add (defaults to0.0)textGamma— a number in the range 0.0–4.0 controlling how glyph edges are blended with the background (defaults to1.4)textAlignattribute can now be set to"justify"measureText()has been rewritten to calculate metrics based not just on the font specified infontbut also any fallback fonts that were used for character glyphs not present in the ‘main’ font. The line-by-line measurements now include arunsarray with bounds and metrics for each single-font range of characters on the line.Supported Platforms
fontconfig. As a result:libfontconfigpackages no longer need to be installed on the host system usingapt,apk,yum,dnf, etc.Breaking Changes
saveAs()andsaveAsSync()are now calledtoFile()andtoFileSync()toDataURL()now behaves the same as its browser equivalent: it is synchronous and its only configuration option is a numericalqualitysettingtoDataURLSync()has been removedtoURL()andtoURLSync()produce data URLs and support the same enhanced export options astoBufferoutlineoption is set totruefast-globdependency). If you want the old behavior, try adding thefast-globorglobmodules to your package and using them like this.Misc. Improvements
node_modulesdirectories installed from 83 to 8 for the published module and 312 to 22 when including dev dependencies)App.launch()now returns a Promise that resolves when the final window is closed, allowing you to schedule code to run before the process would otherwise exit (see also the newidleevent which fires under the same circumstances).inputevent objects now contain aninputTypeproperty to distinguish between insertion, deletion, and IME compositionmousemoveevents)buttonsattributedensityoption passed to toFile() or toBuffer())SKIA_CANVAS_STRICTenvironment variable to1ortrue.file:URLs (allowing relative paths to be constructed withimport.meta.url)gpuproperty which can be set tofalsein order to use CPU-based renderingBugfixes
cursorproperty to "none" now hides the cursormovedwindow events are no longer emitted during resizesresizeevents now update the window object’s width & height properties in addition to providing the new size in the event objectroundRect()now reflects context's current transform state and accepts plain{x, y}objects for corner-radii in addition to Numbers and DOMPoints (thanks to @mpaperno Accept any{x:number, y:number}object when parsing corner radii #223)createConicGradient()are no longer incorrectly offset by 90°lineToon an empty Path2D no longer adds a line from the origin to the specified coordinates: it now acts as if it were amoveTomeasureText()now correctly calculates widths when letterSpacing has been setstartRangeandendRangein TextMetrics.lines[] now correspond to character indices in the string passed to measureText(), not byte indices into the UTF-8 buffer backing itFull Changelog: v2.0.2...v3.0.8
Beta Was this translation helpful? Give feedback.
All reactions