diff --git a/src/js/Aladin.js b/src/js/Aladin.js index 73a98558..92d89006 100644 --- a/src/js/Aladin.js +++ b/src/js/Aladin.js @@ -2180,8 +2180,15 @@ aladin.on("positionChanged", ({ra, dec}) => { return canvasDataURL; }; - Aladin.prototype.getViewImageBuffer = async function (withLogo) { - return await this.view.getCanvasBuffer("image/png", null, null, withLogo); + /** + * Return the current view as a png ArrayBuffer + * Parameters : + * - withLogo (optional): boolean to display the Aladin Lite logo + * + * @API + */ + Aladin.prototype.getViewArrayBuffer = async function (withLogo) { + return await this.view.getCanvasArrayBuffer("image/png", null, null, withLogo); } /** diff --git a/src/js/View.js b/src/js/View.js index 7552dc2c..c7f41267 100644 --- a/src/js/View.js +++ b/src/js/View.js @@ -446,7 +446,7 @@ export let View = (function () { this.catalogCanvas.style.cursor = cursor; }; - View.prototype.getCanvasContext = async function (imgType, width, height, withLogo=true) { + View.prototype.getCanvas = async function (imgType, width, height, withLogo=true) { const loadImage = function (url) { return new Promise((resolve, reject) => { const image = new Image() @@ -480,18 +480,18 @@ export let View = (function () { } /** - * return dataURL string corresponding to the current view + * Return dataURL string corresponding to the current view */ View.prototype.getCanvasDataURL = async function (imgType, width, height, withLogo=true) { - const c = await this.getCanvasContext(imgType, width, height, withLogo); + const c = await this.getCanvas(imgType, width, height, withLogo); return c.toDataURL(imgType); }; /** - * return ArrayBuffer corresponding to the current view + * Return ArrayBuffer corresponding to the current view */ - View.prototype.getCanvasBuffer = async function (imgType, width, height, withLogo=true) { - const c = await this.getCanvasContext(imgType, width, height, withLogo); + View.prototype.getCanvasArrayBuffer = async function (imgType, width, height, withLogo=true) { + const c = await this.getCanvas(imgType, width, height, withLogo); return new Promise((resolve, reject) => { c.toBlob(blob => { if (blob) {