Пример #1
0
 public ImageData(ReadOnlySpan <byte> image, int imageWidth, int imageHeight)
 {
     using (var uint8ClampedArray = Uint8ClampedArray.From(image))
     {
         Handle = new HostObject("ImageData", uint8ClampedArray, imageWidth, imageHeight);
     }
 }
Пример #2
0
        public static void Uint8ClampedArrayFrom(Function objectPrototype)
        {
            var clamped            = new byte[50];
            Uint8ClampedArray from = Uint8ClampedArray.From(clamped);

            Assert.Equal(50, from.Length);
            Assert.Equal("[object Uint8ClampedArray]", objectPrototype.Call(from));
        }
Пример #3
0
        public static Uint8ClampedArray Uint8ClampedArrayFrom()
        {
            var clamped = new byte[50];

            return(Uint8ClampedArray.From(clamped));
        }
Пример #4
0
        public static IEnumerable <object[]> ArrayType_TestData()
        {
            _objectPrototype ??= new Function("return Object.prototype.toString;");
            yield return(new object[] { _objectPrototype.Call(), "Uint8Array", Uint8Array.From(new byte[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Uint8ClampedArray", Uint8ClampedArray.From(new byte[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Int8Array", Int8Array.From(new sbyte[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Uint16Array", Uint16Array.From(new ushort[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Int16Array", Int16Array.From(new short[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Uint32Array", Uint32Array.From(new uint[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Int32Array", Int32Array.From(new int[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Float32Array", Float32Array.From(new float[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Float64Array", Float64Array.From(new double[10]) });

            yield return(new object[] { _objectPrototype.Call(), "Array", new Array(10) });
        }