excubo-ag / Blazor.Canvas

Home Page:https://excubo-ag.github.io/Blazor.Canvas/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pixel Manipulation putImageData

stefanloerwald opened this issue · comments

Is there any documentation on how to use this part of the API? The first parameter is an id parameter which is later looked up on the window object. This can be created with create image data. But this only receives two double values and two int values instead of the whole image data?

Link to MDN

What‘s the recommended way to pass the image data to the API?
Is it like in the MDN article where you first retrieve the data and the manipulate it to then put it again?

Thanks in advance for clearing this up.

Hi @discontinuedtv,

The ImageData object should be referenced by name. This is because the ImageData object does not live in C#, only in JS.

In JS, create and modify the ImageData object as desired:

window.myImageData = new ImageData(200, 100);

From Blazor, reference the object:

context.PutImageDataAsync("myImageData", dx, dy);

Hope that helps
Stefan

Thank you for the reply.