Пример #1
0
 public override void PostProcess(SKCanvas canvas, SKRect bounds, SKPaint paint)
 {
     if (_imageFilter != null)
     {
         paint.ImageFilter = SKImageFilter.CreateMerge(paint.ImageFilter, _imageFilter);
     }
 }
        /// <summary>
        /// Creates the image filter.
        /// </summary>
        /// <param name="drawingContext">The drawing context.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        public override void CreateFilter(SkiaSharpDrawingContext drawingContext)
        {
            var imageFilters = new SKImageFilter[_filters.Length];
            var i            = 0;

            foreach (var item in _filters)
            {
                item.CreateFilter(drawingContext);
                if (item.SKImageFilter is null)
                {
                    throw new System.Exception("Image filter is not valid");
                }
                imageFilters[i++] = item.SKImageFilter;
            }

            SKImageFilter = SKImageFilter.CreateMerge(imageFilters, _cropRect);
        }
Пример #3
0
        public void MergeFilterAcceptsSourceGraphicInputs()
        {
            var filter = SKImageFilter.CreateMerge(new SKImageFilter[] { null });

            Assert.NotNull(filter);
        }