Skip to content
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

Error when creatingCanvas(0, 0)(Create skia surface failed) #713

Closed
yisibl opened this issue Aug 23, 2023 · 4 comments
Closed

Error when creatingCanvas(0, 0)(Create skia surface failed) #713

yisibl opened this issue Aug 23, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@yisibl
Copy link
Collaborator

yisibl commented Aug 23, 2023

const { createCanvas } = require('@napi-rs/canvas')
const canvas = createCanvas(0, 0)

console.info('canvas', canvas)
return isSvgBackend ? new SVGCanvas(width, height, flag) : new CanvasElement(width, height)
                                                             ^

Error: Create skia surface failed
    at createCanvas (/Users/yisi/works/canvas/index.js:67:62)
    at Object.<anonymous> (/Users/yisi/works/canvas/example/simple.js:3:16)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47 {
  code: 'GenericFailure'
}
@yisibl yisibl added the bug Something isn't working label Aug 23, 2023
@yisibl
Copy link
Collaborator Author

yisibl commented Aug 24, 2023

Also, we might want to consider fallback to the default 350*150 when there is no aspect value. this is consistent with browsers and skia-canvas

const canvas = createCanvas() // == createCanvas(350, 150)
const canvas = createCanvas(-20, -1) // == createCanvas(350, 150)
const canvas = createCanvas(-20, 621) // == createCanvas(350, 621)

@alimoezzi
Copy link

I'm having this issue when using it together with pdf.js

@ImLunaHey
Copy link

@Brooooooklyn was this fixed? (if so in which release/commit?)

@twlite
Copy link
Contributor

twlite commented Oct 14, 2024

@Brooooooklyn was this fixed? (if so in which release/commit?)

#739

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants