node-openvg-canvas icon indicating copy to clipboard operation
node-openvg-canvas copied to clipboard

globalAlpha and image transparency

Open pixelami opened this issue 12 years ago • 6 comments

Hi, great work on this library !

The performance on the pi seems great running over video.

One question I have is regarding image alpha / globalAlpha. It seems that globalAlpha does not seem to work on images. I am able to grab the image data and iterate over the RGBA values and set the alpha like that - but this seems quite slow from within node at least. What would you suggest as a better alternative ? And is it something you plan to add support for. i.e. globalAlpha for images.

Also animating images with alpha has a performance hit (actually it's still not too bad). but is there some optimisation you could suggest ?

pixelami avatar Mar 04 '13 19:03 pixelami

Actually I just noticed something related to animating images - I think the issue is related to putImageData vs drawImage,

when animating drawImage seems smoother / faster.

pixelami avatar Mar 04 '13 20:03 pixelami

Thank you for the feedback!

Hi, globalAlpha should be supported. I'll take a look at that.

Regarding performance: Anything done on the JS side tends to be fairly slow. I'll investigate the drawImage vs putImageData and get back to you.

eendeego avatar Mar 05 '13 13:03 eendeego

@pixelami You mention that you were able to get a canvas over video on the pi. How did you achieve this? Thanks ahead of time.

markalosey avatar May 01 '13 19:05 markalosey

@luismreis I am not able to get globalAlpha to work too. I have tried 1, 0.5, 0.1 and 0, but the subsequent drawImage still draws an opaque image.

I am using NodeJS v0.10.15 and openvg-canvas v1.1.7 by the way (I installed openvg-canvas via npm).

kokhoor avatar Aug 16 '13 00:08 kokhoor

Hi, sorry for late response I had to make a small hack in node-openvg that basically created the drawing surface on layer 1 instead of layer 0. https://github.com/luismreis/node-openvg/blob/master/src/egl.cc#L92

Then I can launch e.g. omxplayer and have my canvas rendering on top.

A.

On Wed, May 1, 2013 at 8:05 PM, Mark Losey [email protected] wrote:

@pixelami https://github.com/pixelami You mention that you were able to get a canvas over video on the pi. How did you achieve this? Thanks ahead of time.

— Reply to this email directly or view it on GitHubhttps://github.com/luismreis/node-openvg-canvas/issues/9#issuecomment-17299687 .

pixelami avatar Aug 16 '13 11:08 pixelami

@luismreis,

Hello Luis, I am not able to get globalAlpha to work on images. Any chance you may have some insight on how to go about this?

Thanks!

Vic

ghost avatar Oct 21 '13 22:10 ghost