-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintenance 2024 #172
Merged
Merged
Maintenance 2024 #172
+13,547
−8,089
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
samizdatco
force-pushed
the
maintenance-2024
branch
from
October 24, 2024 17:15
9319b5a
to
d6189d6
Compare
- use vendored version of skulpin
- upgrade ash to match version vulkano is using
- the error message/device info is accessible through the status() accessor
- ported to use the deprecated `run_on_demand` event loop - should refactor to use `run_app_on_demand`
- in order to let the App make callback connections to the js runtime, the `roundtrip` function is passed in as a closure after capturing the `cx` from the initial launch() call - removed a bunch of UserEvent wrapping; now just passing CanvasEvents to the windows as-is
- moved `App` & `Cadence` into their own module and separated `Window` and `WIndowManager`
- use the instance passed as args to lifecycle methods
- remove the unsafe Send impl from VulkanRenderer (which gets created on the main thread before being sent to the window thread)
- e.g., `brightness(2)` and `brightness(200%)` are now equivalent
* Added functionality to load images from decoded pixel buffers * sync up with maintenance-2024 changes * add settings arg to ImageData constructor - colorType can be 'rgba' (the default), 'rgb', 'bgra', or 'argb' - colorSpace can currently only be 'srgb' but 'display-p3' support is on the todo list * add `loadImageData` helper - uses a common implementation with the Image.src loader (thus the weird callback design of `fetchData` to fulfill Image's expectations of sync loads for local files) * Added functionality to export canvas as raw pixel data, skipping encoding step. Adds support for "raw" format to existing export options and adds specific `Canvas#toRaw()` method. * sync up with maintenance-2024 * support `colorType` arg in get/put/createImageData methods - dropped the alias from 'argb' to the odd-seeming 16 bit color type (is it actually commonly used though?) * support `colorType` arg in saveAs/toBuffer * allow ImageData to be passed to drawImage * test ImageData initialization * consolidate ImageData typedefs * test the `this` mapping in Image.onload * only perform null-check once * allow ImageData to be passed to `createPattern` * add `.bytesPerPixel` property to ImageData * note that BMP is not being used as an encoding - it's just so we can use the common parts of the encoded-image path * make Image into a proper EventEmitter - the `.onload` and `.onerror` properties are still supported, but `on`, `once`, and `off` now work too - moved the fetchData routine back into Image as a static method so it can still be used by loadImageData * use async i/o for loading local image files - previously img.src='./local/file/path' would synchronously load the data and the image would immediately be ready for use - now, even local files should wait for img.decode() or img.on('load') to resolve first * set `complete` even if load failed - the real way to judge success is complete==true *and* non-zero width/height * genericize return type for with_surface - it now just uses the closure's Result type * use cpu renderer for filter test - since the output differs, use the version that will be stable across CI runs * nudge the test point to avoid cpu/gpu antialiasing differences * use gpu for `getImageData` and cache bitmap between calls - significantly faster for single `get`s and absurdly fast for subsequent gets of the same canvas content (since it's using a cached bitmap that's invalidated on the next drawing command) - required adding a reference to the ctx's Canvas to the call so it can access the current gpu::RenderingEngine mode (and initialize it if needed) * drop unnecessary imports & muts * update `with_surface` signatures for Vulkan and dummy engine * fix ImageData constructor's arg parsing * update changelog * include `colorType` arg when passing export opts * allow ImageData to be initialized from Image * update Image & ImageData docs * update changelog * update class ToC * add `colorType` layout test --------- Co-authored-by: ggolda <[email protected]> Co-authored-by: Christian Swinehart <[email protected]> Co-authored-by: Max Paperno <[email protected]>
* update changelog * split main js file into /lib/classes * fix cjs/mjs exports * fix missing `pixelSize` import * inline exportOptions in browser polyfill * drop matrix helper imports * update cjs/mjs/browser exports * satisfy linter * rename path2d to path * fix missing exports * check for gui support before panicking * add `engine.threads` link * update class doc headers
- now able to access the viewbox and using it to set the height to 150 and width to the appropriate proportion to match the original aspect ratio (i.e., Chrome's behavior)
- skia_safe 0.80 removed the depot_tools dependency, so the python downgrade can go away in favor of installing ninja manually
This was referenced Nov 21, 2024
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New Features
Website
Imagery
drawImage()
(thanks to @mpaperno Support SVG image rendering #180). Note that Images loaded from SVG files that don't have awidth
andheight
set on their root<svg>
element have some quirks as of this release:height
will report being150
and thewidth
will be set to accurately capture the image's aspect ratiodrawImage()
without size arguments, the SVG will be scaled to a size that fits within the Canvas's current bounds (using an approach akin to CSS'sobject-fit: contain
).drawImage()
, the ‘crop’ arguments (sx
,sy
,sWidth
, &sHeight
) will correspond to this scaled-to-fit size, not the Image's reportedwidth
&height
.toBuffer()
andsaveAs()
methods now support"raw"
as a format name and/or file extension, causing them to return non-encoded pixel data (by default in an"rgba"
layout like a standard ImageData buffer)colorType
argument to specify alternative pixel data layouts (e.g.,"rgb"
or"bgra"
)new ImageData()
constructor, the optional settings arg now allows you to select thecolorType
for the buffer's pixels.Typography
outlineText()
method now takes an optionalwidth
argument and supports all the context's typographic settings (e.g.,.font
,.fontVariant
,.textWrap
,.textTracking
, etc.).fontStretch
property. Note that stretch values included in the.font
string will overwrite the current.fontStretch
setting (or will reset it tonormal
if omitted).serif
,sans-serif
,monospace
, andsystem-ui
families are currently supported..textDecoration
property..letterSpacing
and.wordSpacing
properties.GUI
resizable
property which can be set tofalse
to prevent the window from being manually resized or maximized (contributed by @nornagon add window.resizable property #124).input
event now reports the composed character, not the individual keystrokes.Rendering
engine
property which describes whether the CPU or GPU is being used, which graphics device was selected, and what (if any) error prevented it from being initialized..transform
and.setTransform
methods on Context, Path2D, and CanvasPattern objects can now take their arguments in additional formats. They can now be passed a DOMMatrix object or a string with a list of transformation operations compatible with the CSStransform
property. The DOMMatrix constructor also supports these strings as well as plain, matrix-like objects with numeric attributes nameda
,b
,c
,d
,e
, &f
(contributed by @mpaperno Allow.transform()
to take DOMMatrix or CSStransform
strings as arguments #178).SKIA_CANVAS_THREADS
environment variableBreaking Changes
src
property has been set to a local path. As a result, it's now necessary toawait img.decode()
or set up an.on("load", …)
handler before drawing it—even when thesrc
is non-remote.keyup
/keydown
andinput
event listeners now has fields and values consistent with browser behavior. In particular,code
is now a name (e.g.,ShiftLeft
orKeyS
) rather than a numeric scancode,key
is a straightforward label for the key (e.g.,Shift
ors
) and the newlocation
field provides a numeric description of which variant of a key was pressed..async
property has been removed. See the v0.9.28 release notes for details..textTracking
property has been removed in favor of the new.letterSpacing
propertyBugfixes
vulkano
crate and makes better selections among devices present (previously it was just using the first result, which is not always optimal).this
to point to the new image (contributed by @mpaperno & @ForkKILLET).fullscreen
set totrue
now takes effect immediately (previously it was failing silently)canvas::draw_path()
when trying to draw a path with an invalid transform matrix. #175).on("draw")
handlers no longer become unresponsive on macOS 14+ after being fully occluded by other windowsPath2D::add_ellipse()
where trying to draw a complete circle from certain angle combinations produced nothing. #176)drawCanvas()
method now clips to the specified crop size (contributed by @mpaperno Fix clipping not being applied to the source indrawCanvas()
9-argument version #179)isPointInPath
andisPointInStroke
now works correctly when called with a Path2D object as the first argumentMisc. Improvements
roundRect
method (contributed by @sandy85625 & @santilema)winit
and replaced the end-of-life’d skulpin-based Vulkan renderer with a new implementation using Vulkano for window-drawing on Windows and Linux..gpu
property tofalse
immediately after creation will prevent any GPU-related resource acquisition from occurring (though rendering speed will be predictably slower).msaa
export argument. If omitted, defaults to 4x MSAA.import {Image} from "skia-canvs"
) when used as an ES Module.