diff --git a/src/jcanvas.d.ts b/src/jcanvas.d.ts index 3b12d6b..5be8e11 100644 --- a/src/jcanvas.d.ts +++ b/src/jcanvas.d.ts @@ -139,30 +139,30 @@ interface JQuery { stopLayer(layerId: JCanvasLayerId, clearQueue?: boolean): void; stopLayerGroup(groupId: jCanvasLayerGroupId, clearQueue?: boolean): void; draw(args: Partial): JQuery; - clearCanvas(args?: JCanvasObject): void; - saveCanvas(args?: JCanvasObject): void; - restoreCanvas(args?: JCanvasObject): void; - rotateCanvas(args?: JCanvasObject): void; - scaleCanvas(args?: JCanvasObject): void; - translateCanvas(args?: JCanvasObject): void; - drawRect(args: Partial): void; - drawArc(args: Partial): void; - drawEllipse(args: Partial): void; - drawPolygon(args: Partial): void; - drawSlice(args: Partial): void; - drawLine(args: Partial): void; - drawQuadratic(args: Partial): void; - drawBezier(args: Partial): void; - drawVector(args: Partial): void; - drawPath(args: Partial): void; - drawText(args: Partial): void; - measureText(args: JCanvasLayerId): void; - drawImage(args: Partial): void; - createPattern(args: Partial): void; - createGradient(args: Partial): void; + clearCanvas(args?: JCanvasObject): JQuery; + saveCanvas(args?: JCanvasObject): JQuery; + restoreCanvas(args?: JCanvasObject): JQuery; + rotateCanvas(args?: JCanvasObject): JQuery; + scaleCanvas(args?: JCanvasObject): JQuery; + translateCanvas(args?: JCanvasObject): JQuery; + drawRect(args: Partial): JQuery; + drawArc(args: Partial): JQuery; + drawEllipse(args: Partial): JQuery; + drawPolygon(args: Partial): JQuery; + drawSlice(args: Partial): JQuery; + drawLine(args: Partial): JQuery; + drawQuadratic(args: Partial): JQuery; + drawBezier(args: Partial): JQuery; + drawVector(args: Partial): JQuery; + drawPath(args: Partial): JQuery; + drawText(args: Partial): JQuery; + measureText(args: JCanvasLayerId): JCanvasObject; + drawImage(args: Partial): JQuery; + createPattern(args: Partial): CanvasPattern | null; + createGradient(args: Partial): CanvasGradient | null; setPixels(args: Partial): void; - getCanvasImage(type: string, quality?: number): void; - detectPixelRatio(callback?: (ratio: number) => void): void; + getCanvasImage(type: string, quality?: number): string | null; + detectPixelRatio(callback?: (ratio: number) => void): JQuery; } interface JCanvasDefaults { diff --git a/src/jcanvas.ts b/src/jcanvas.ts index 0b13819..e41ca3f 100644 --- a/src/jcanvas.ts +++ b/src/jcanvas.ts @@ -4325,11 +4325,11 @@ $.fn.createGradient = function createGradient(args) { const params = new jCanvasObject(args); const canvas = $canvases[0]; if (!_isCanvas(canvas)) { - return; + return null; } const ctx = _getContext(canvas); if (!ctx) { - return; + return null; } // Gradient coordinates must be defined params.x1 = params.x1 || 0;