-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Updating Types #1509
Updating Types #1509
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ export class Canvas { | |
/** Constant used in PNG encoding methods. */ | ||
readonly PNG_FILTER_PAETH: number | ||
|
||
constructor(width: number, height: number, type?: 'pdf'|'svg') | ||
constructor(width: number, height: number, type?: 'pdf'|'svg'|'jpg') | ||
|
||
getContext(contextId: '2d', contextAttributes?: NodeCanvasRenderingContext2DSettings): NodeCanvasRenderingContext2D | ||
|
||
|
@@ -212,6 +212,10 @@ declare class NodeCanvasRenderingContext2D extends CanvasRenderingContext2D { | |
createPattern(...args: any[]): NodeCanvasCanvasPattern | ||
createLinearGradient(x0: number, y0: number, x1: number, y1: number): NodeCanvasCanvasGradient; | ||
createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): NodeCanvasCanvasGradient; | ||
/** | ||
* An additional method .addPage() is then available to create multiple page PDFs | ||
*/ | ||
addPage(width?: number, height?: number): void | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, good catch. Can you delete the incorrect declaration from line 130-134 (I had it on the Canvas instance instead of the rendering context) please? You could also copy the text from it that describes the default width/height values. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated! |
||
} | ||
export { NodeCanvasRenderingContext2D as CanvasRenderingContext2D } | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'jpg'
isn't a valid Canvas type, just'pdf'
and'svg'
. Anything else is ignored and creates an image canvas. If you want you could add'image'
here to maybe improve clarity...node-canvas/src/Canvas.cc
Lines 105 to 110 in 37d556c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh thanks for that clarity! Updated