[Pas2js] pas2js array of UInt8ClampedArray constants

nick's hardware nickshardware2020 at gmail.com
Wed Oct 6 15:35:05 CEST 2021


thank you Michael. I would of never thought of this. i was using a for
loop to copy from a regular pasal constant array to clamped array. I
knew it wasn't the best but didn't think there was better way. I'm
glad i asked.

On Wed, 6 Oct 2021 at 02:56, Michael Van Canneyt <michael at freepascal.org> wrote:
>
>
>
> On Tue, 5 Oct 2021, nick's hardware wrote:
>
> > Is there a pas2js way of doing what this javascript code does?
> >
> > var Image  = new Uint8ClampedArray([0,0,0,255,0,0,0,255,0,0]);
>
> This works:
>
> var
>    a : TByteDynArray;
>    Image : TJSUint8ClampedArray;
> begin
>    a:=[0,0,0,255,0,0,0,255,0,0];
>    Image:=TJSUint8ClampedArray.From(a);
> end;
>
> Michael.
> _______________________________________________
> Pas2js maillist  -  Pas2js at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js


More information about the Pas2js mailing list