We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 57b8e31 commit a6a2219Copy full SHA for a6a2219
src/canvas.ts
@@ -209,6 +209,12 @@ export class Canvas {
209
flush() {
210
if (this[_gpu]) sk_canvas_flush(this[_ptr]);
211
}
212
+
213
+ [Symbol.for("Jupyter.display")]() {
214
+ return {
215
+ "image/png": encodeBase64(this.encode("png")),
216
+ };
217
+ }
218
219
220
/**
src/svgcanvas.ts
@@ -114,6 +114,13 @@ export class SvgCanvas {
114
);
115
const text = new TextDecoder().decode(buffer);
116
sk_data_free(skdata);
117
+ Object.defineProperty(text, Symbol.for("Jupyter.display"), {
118
+ value: function (this: string) {
119
120
+ "image/svg+xml": this,
121
122
+ },
123
+ });
124
return text;
125
126
0 commit comments