clear background

33 vistas
Ir al primer mensaje no leído

Diego Alberti

no leída,
19 mar 2021, 4:46:20 p.m.19/3/2021
para 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

no leída,
20 mar 2021, 4:27:55 p.m.20/3/2021
para 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

no leída,
20 mar 2021, 10:53:32 p.m.20/3/2021
para Paper.js
Hi,
I had the same issue and solved it by adjusting the  "globalAlpha" property to 0.

Diego Alberti

no leída,
21 mar 2021, 12:14:35 p.m.21/3/2021
para 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

no leída,
21 mar 2021, 12:15:15 p.m.21/3/2021
para Paper.js
thank you. solved already. ! I'll try it later anyway.
thx

dx
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos