Exemplo n.º 1
0
        private void Bug669663(OpenXmlValidator validator)
        {
            var framePr = new FrameProperties();

            framePr.Height = 32767;

            var errors = validator.Validate(framePr);

            Assert.Single(errors);
            Assert.Equal(ValidationErrorType.Schema, errors.First().ErrorType);
            Assert.Equal("Sch_AttributeValueDataTypeDetailed", errors.First().Id);
            AssertValidationErrorCategory("Sch_MaxInclusiveConstraintFailed", errors.First());
        }
Exemplo n.º 2
0
        public void Bug669663(FileFormatVersions version)
        {
            var validator = new OpenXmlValidator(version);

            var framePr = new FrameProperties();

            framePr.Height = 32767;

            var errors = validator.Validate(framePr);

            Assert.Single(errors);
            Assert.Equal(ValidationErrorType.Schema, errors.First().ErrorType);
            Assert.Equal("Sch_AttributeValueDataTypeDetailed", errors.First().Id);
        }
Exemplo n.º 3
0
        //This creates the list of frames from the CSV file.
        //I create the list hesre as when I had it in the framePicker class, the first time the app opens there was no frames displayed
        //I think this was because the funciton that loads the csv file runs async so i dont think the frames had been loaded yet
        private async Task <List <Frame> > generateFrames()
        {
            List <Frame> frames = new List <Frame>();
            //Opens csv file that contains frame details. each line is a record.
            List <String> data = new List <String>();
            StorageFile   file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///CSV/Frames.csv"));

            Stream fileStream = await file.OpenStreamForReadAsync();

            using (StreamReader fileReader = new StreamReader(fileStream))
            {
                string   line;
                string[] row;
                fileReader.ReadLine();
                //Reads file line by line
                while ((line = fileReader.ReadLine()) != null)
                {
                    //Splits csv file
                    row = line.Split(',');
                    //Sets properties
                    FrameProperties frameProperties = new FrameProperties(row[0], row[1], row[2], row[3], row[4], row[5], row[6], Convert.ToInt32(row[7]), Convert.ToInt32(row[8]), Convert.ToInt32(row[9]), Convert.ToInt64(row[10]), row[11], row[12], Convert.ToBoolean(Convert.ToInt16(row[13])), Convert.ToBoolean(Convert.ToInt16(row[14])), row[15].Split(' '), row[16].Split(' '));
                    //Sets images and attaches imageFailed event. This sets the image uri to a default is no image is found at uri from CSV file
                    var img1 = new BitmapImage();
                    var img2 = new BitmapImage();
                    var img3 = new BitmapImage();
                    img1.ImageFailed += imageFailed;
                    img2.ImageFailed += imageFailed;
                    img3.ImageFailed += imageFailed;
                    img1.UriSource    = new Uri("ms-appx://" + row[17], UriKind.Absolute);
                    img2.UriSource    = new Uri("ms-appx://" + row[18], UriKind.Absolute);
                    img3.UriSource    = new Uri("ms-appx://" + row[19], UriKind.Absolute);
                    FrameImages frameImages = new FrameImages(new List <ImageSource>()
                    {
                        img1, img2, img3
                    }, img2, img3);
                    //Creates new frame instance and adds to list
                    Graded_Unit_2.Frame frame = new Graded_Unit_2.Frame(frameProperties, frameImages);
                    frames.Add(frame);
                }
            }
            return(frames);
        }
Exemplo n.º 4
0
 public static extern void GetFrameProperties(IntPtr session, ref FrameProperties properties);
Exemplo n.º 5
0
 public void setFrameProperties(FrameProperties frameProperties)
 {
     this.frameProperties = frameProperties;
 }
Exemplo n.º 6
0
 //Constructor
 public Frame(FrameProperties frameProperties, FrameImages frameImages)
 {
     this.frameProperties = frameProperties;
     this.frameImages     = frameImages;
 }
Exemplo n.º 7
0
        private void Bug669663(OpenXmlValidator validator)
        {
            var framePr = new FrameProperties();
            framePr.Height = 32767;

            var errors = validator.Validate(framePr);
            Assert.Equal(1, errors.Count());
            Assert.Equal(ValidationErrorType.Schema, errors.First().ErrorType);
            Assert.Equal("Sch_AttributeValueDataTypeDetailed", errors.First().Id);
            AssertValidationErrorCategory("Sch_MaxInclusiveConstraintFailed", errors.First());
        }
Exemplo n.º 8
0
 public FormFrameControl(int id, int posX, int posY, int width, int height) : base(id, posX, posY, width, height)
 {
     Properties = new FrameProperties(this);
 }
Exemplo n.º 9
0
 public static extern void PrepareRender(ref FrameProperties properties);
Exemplo n.º 10
0
 [DllImport(Core.DllName)] private static extern int VideoBlenderContext_Get(IntPtr handle, IntPtr frame, long pts, ref FrameProperties frameProperties);
Exemplo n.º 11
0
 public static extern unsafe void PrepareRender(IntPtr session, FrameProperties* properties);
Exemplo n.º 12
0
            private async Task AdvanceFrame()
            {
                if (_bitmapDecoder.FrameCount == 0)
                {
                    return;
                }

                var         frameIndex = _currentFrameIndex;
                BitmapFrame frame      = null;

                if (!_frameProperties[frameIndex].HasValue)
                {
                    frame = await _bitmapDecoder.GetFrameAsync((uint)frameIndex);

                    _frameProperties[frameIndex] = await RetrieveFramePropertiesAsync(frame);
                }
                FrameProperties frameProperties = _frameProperties[frameIndex].Value;

                // Increment frame index and loop count
                _currentFrameIndex++;
                if (_currentFrameIndex >= _bitmapDecoder.FrameCount)
                {
                    _completedLoops++;
                    _currentFrameIndex = 0;
                }

                // Set up the timer to display the next frame
                if (_imageProperties.IsAnimated &&
                    (_imageProperties.LoopCount == 0 || _completedLoops < _imageProperties.LoopCount))
                {
                    _animationTimer.Interval = TimeSpan.FromMilliseconds(frameProperties.DelayMilliseconds);
                }
                else
                {
                    _animationTimer.Stop();
                }

                // Decode the frame
                if (frame == null)
                {
                    frame = await _bitmapDecoder.GetFrameAsync((uint)frameIndex);
                }
                var pixelData = await frame.GetPixelDataAsync(
                    BitmapPixelFormat.Bgra8,
                    BitmapAlphaMode.Premultiplied,
                    new BitmapTransform(),
                    ExifOrientationMode.IgnoreExifOrientation,
                    ColorManagementMode.DoNotColorManage
                    );

                var pixels           = pixelData.DetachPixelData();
                var frameRectangle   = frameProperties.Rect;
                var disposeRectangle = Rect.Empty;

                if (frameIndex > 0)
                {
                    var previousFrameProperties = _frameProperties[frameIndex - 1].GetValueOrDefault();
                    if (previousFrameProperties.ShouldDispose)
                    {
                        // Clear the pixels from the last frame
                        disposeRectangle = previousFrameProperties.Rect;
                    }
                }
                else
                {
                    disposeRectangle = new Rect(0, 0, _imageProperties.PixelWidth, _imageProperties.PixelHeight);
                }


                // Compose and display the frame
                try
                {
                    PrepareFrame(pixels, frameRectangle, disposeRectangle);
                    UpdateImageSource(frameRectangle);
                }
                catch (Exception e) when(_canvasImageSource.Device.IsDeviceLost(e.HResult))
                {
                    // XAML will also raise a SurfaceContentsLost event, and we use this to trigger
                    // redrawing the surface. Therefore, ignore this error.
                }
            }
        private void SetNextFrame()
        {
            if (_currentFrameIndex == _maxFrameIndex)
            {
                _currentFrameIndex = 0;

                var isOffScreen = IsOffScreen();
                if (isOffScreen && _canvasControl != null)
                {
                    Stop();
                    InactiveGifManager.Add(this);
                    return;
                }
            }
            else
            {
                _currentFrameIndex++;
            }

            _currentGifFrame = _frameProperties[_currentFrameIndex];
            _nextFrame.OnNext(_currentGifFrame);
        }