clear background

33 vues
Accéder directement au premier message non lu

Diego Alberti

non lue,
19 mars 2021, 16:46:2019/03/2021
à Paper.js
Hi:
I'm trying to use paper.js to draw on top of an already drawn canvas.
my problem is (no matter what) when I add any shape the paper.js view is fulfilled on black occluding the previously drawn image.

It's quite impossible to paste real code so I'll try pseudo:

+ there's a canvas tag id "myCanvas"
+ paper.setup(canvas);
+ paper.view.autoUpdate = false;
+ another library renders a raster image on "myCanvas"
+ paper.js -> new paper.Path.circle(blabla);
+ paper.view.update()

the image does not appears. 
I'm pretty sure paper.js is filling with black because paper.view is smaller than the whole canvas. so I can actually see portions of the background image around.

I'm working with cornerstone.js a library for medical imaging.

make sense?
any though will be kindly appreciated.
thanks !


dx

 

Sean Johnson

non lue,
20 mars 2021, 16:27:5520/03/2021
à pap...@googlegroups.com
I would suggest layering two canvases on top of each other using absolute positioning. The bottom canvas being your existing canvas, and the top being the paper.is one.

--
You received this message because you are subscribed to the Google Groups "Paper.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to paperjs+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/paperjs/98206e20-4df7-41eb-b999-63a8f629f600n%40googlegroups.com.

Michael Sartore

non lue,
20 mars 2021, 22:53:3220/03/2021
à Paper.js
Hi,
I had the same issue and solved it by adjusting the  "globalAlpha" property to 0.

Diego Alberti

non lue,
21 mars 2021, 12:14:3521/03/2021
à Paper.js
thanks ! that's what actually did.
I'm gonna leave this here for further reference:


const canvas = evt.detail.element.querySelector('canvas.cornerstone-canvas');
var otherCanvas = document.createElement('canvas');
otherCanvas.setAttribute('style', 'position: absolute');
canvas.parentNode.insertBefore(otherCanvas, canvas);
paper.setup(otherCanvas);
paper.view.autoUpdate = false;

dx


Diego Alberti

non lue,
21 mars 2021, 12:15:1521/03/2021
à Paper.js
thank you. solved already. ! I'll try it later anyway.
thx

dx
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message