Example #1
0
        public override HashSet <AnimatedPoint> RenderFrame(int currentFrame)
        {
            var animatedPoints = new HashSet <AnimatedPoint>();

            //accumulate all points in the current column represented by frame index
            List <SkiaSharp.SKPoint> framePoints = new List <SkiaSharp.SKPoint>();

            for (int i = 0; i < NumFrames; i++)
            {
                var p = new SkiaSharp.SKPointI(currentFrame, i);
                if (SeperatedPoints.ContainsKey(p))
                {
                    framePoints.AddRange(SeperatedPoints[p]);
                }
            }

            foreach (var point in framePoints)
            {
                var distCanMove = shortestDistanceFromPoints(point);
                var xComponent  = Geometry.getXComponent(_direction, distCanMove);
                var yComponent  = Geometry.getYComponent(_direction, distCanMove);
                var p           = new AnimatedPoint(point, (float)xComponent, (float)yComponent);
                animatedPoints.Add(p);
            }
            return(animatedPoints);
        }
Example #2
0
        public static SKPointI Normalize(SKPointI point)
        {
            var ls      = point.x * point.x + point.y * point.y;
            var invNorm = 1.0 / Math.Sqrt(ls);

            return(new SKPointI((int)(point.x * invNorm), (int)(point.y * invNorm)));
        }
Example #3
0
        public static float DistanceSquared(SKPointI point, SKPointI other)
        {
            var dx = point.x - other.x;
            var dy = point.y - other.y;

            return(dx * dx + dy * dy);
        }
Example #4
0
        public static SKPointI Reflect(SKPointI point, SKPointI normal)
        {
            var dot = point.x * point.x + point.y * point.y;

            return(new SKPointI(
                       (int)(point.x - 2.0f * dot * normal.x),
                       (int)(point.y - 2.0f * dot * normal.y)));
        }
Example #5
0
 public bool ExtractAlpha(SKBitmap destination, SKPaint paint, out SKPointI offset)
 {
     if (destination == null)
     {
         throw new ArgumentNullException(nameof(destination));
     }
     return(SkiaApi.sk_bitmap_extract_alpha(Handle, destination.Handle, paint == null ? IntPtr.Zero : paint.Handle, out offset));
 }
Example #6
0
        public static float Distance(SKPointI point, SKPointI other)
        {
            var dx = point.x - other.x;
            var dy = point.y - other.y;
            var ls = dx * dx + dy * dy;

            return((float)Math.Sqrt(ls));
        }
Example #7
0
		public extern static sk_imagefilter_t sk_imagefilter_new_matrix_convolution(ref SKSizeI kernelSize, float[] kernel, float gain, float bias, ref SKPointI kernelOffset, SKMatrixConvolutionTileMode tileMode, bool convolveAlpha, sk_imagefilter_t input /*NULL*/, sk_imagefilter_croprect_t cropRect /*NULL*/);
Example #8
0
 public bool Contains(SKPointI xy) =>
 SkiaApi.sk_region_contains2(Handle, xy.X, xy.Y);
Example #9
0
 public bool ExtractAlpha(SKBitmap destination, out SKPointI offset)
 {
     return(ExtractAlpha(destination, null, out offset));
 }
Example #10
0
 public static SKPointI Add(SKPointI pt, SKSizeI sz)
 {
     return(new SKPointI(pt.X + sz.Width, pt.Y + sz.Height));
 }
Example #11
0
 public void Offset(SKPointI p)
 {
     Offset(p.X, p.Y);
 }
Example #12
0
		public static SKImageFilter CreateMatrixConvolution(SKSizeI kernelSize, float[] kernel, float gain, float bias, SKPointI kernelOffset, SKMatrixConvolutionTileMode tileMode, bool convolveAlpha, SKImageFilter input = null, SKImageFilter.CropRect cropRect = null)
		{
			if (kernel == null)
				throw new ArgumentNullException(nameof(kernel));
			if (kernel.Length != kernelSize.Width * kernelSize.Height)
				throw new ArgumentException("Kernel length must match the dimensions of the kernel size (Width * Height).", nameof(kernel));
			return GetObject<SKImageFilter>(SkiaApi.sk_imagefilter_new_matrix_convolution(ref kernelSize, kernel, gain, bias, ref kernelOffset, tileMode, convolveAlpha, input == null ? IntPtr.Zero : input.Handle, cropRect == null ? IntPtr.Zero : cropRect.Handle));
		}
Example #13
0
 public extern static sk_shader_t sk_shader_new_perlin_noise_turbulence(float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, ref SKPointI tileSize);
Example #14
0
 public void Offset(SKPointI p)
 {
     x += p.X;
     y += p.Y;
 }
Example #15
0
 public static SKShader CreatePerlinNoiseFractalNoise(float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, SKPointI tileSize)
 {
     return(new SKShader(SkiaApi.sk_shader_new_perlin_noise_fractal_noise(baseFrequencyX, baseFrequencyY, numOctaves, seed, ref tileSize)));
 }
Example #16
0
		public static SKShader CreatePerlinNoiseTurbulence (float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, SKPointI tileSize) =>
			CreatePerlinNoiseTurbulence (baseFrequencyX, baseFrequencyY, numOctaves, seed, (SKSizeI)tileSize);
Example #17
0
 public static SKPointI Subtract(SKPointI pt, SKSizeI sz)
 {
     return(new SKPointI(pt.X - sz.Width, pt.Y - sz.Height));
 }
Example #18
0
 public void Offset(SKPointI p)
 {
     Offset(p.X, p.Y);
 }
Example #19
0
		public bool Contains(SKPointI xy)
		{
			return SkiaApi.sk_region_contains2(Handle, xy.X, xy.Y);
		}
Example #20
0
		public extern static sk_shader_t sk_shader_new_perlin_noise_turbulence(float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, ref SKPointI tileSize);
Example #21
0
 public extern static sk_imagefilter_t sk_imagefilter_new_matrix_convolution(ref SKSizeI kernelSize, float[] kernel, float gain, float bias, ref SKPointI kernelOffset, SKMatrixConvolutionTileMode tileMode, bool convolveAlpha, sk_imagefilter_t input /*NULL*/, sk_imagefilter_croprect_t cropRect /*NULL*/);
Example #22
0
 public static SKPointI Subtract(SKPointI pt, SKPointI sz) => pt - sz;
Example #23
0
 public bool Contains(SKPointI xy)
 {
     return(SkiaApi.sk_region_contains2(Handle, xy.X, xy.Y));
 }
Example #24
0
 public bool Contains(SKPointI pt)
 {
     return Contains(pt.X, pt.Y);
 }
Example #25
0
 public static SKShader CreatePerlinNoiseTurbulence(float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, SKPointI tileSize)
 {
     return(GetObject <SKShader>(SkiaApi.sk_shader_new_perlin_noise_turbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, ref tileSize)));
 }
Example #26
0
 public static SKRectI Create(SKPointI location, SKSizeI size)
 {
     return SKRectI.Create(location.X, location.Y, size.Width, size.Height);
 }
Example #27
0
 public static SKPointI Add(SKPointI pt, SKPointI sz) => pt + sz;
Example #28
0
		public static SKShader CreatePerlinNoiseTurbulence(float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, SKPointI tileSize)
		{
			return GetObject<SKShader>(SkiaApi.sk_shader_new_perlin_noise_turbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, ref tileSize));
		}
Example #29
0
 public SKSizeI(SKPointI pt)
 {
     this.width = pt.X;
     this.height = pt.Y;
 }
Example #30
0
 public static SKPointI Add(SKPointI pt, SKSizeI sz) => pt + sz;
Example #31
0
 public void Offset(SKPointI pos)
 {
     Offset(pos.X, pos.Y);
 }
Example #32
0
 public static SKPointI Subtract(SKPointI pt, SKSizeI sz) => pt - sz;
Example #33
0
        public SKImage ApplyImageFilter(SKImageFilter filter, SKRectI subset, SKRectI clipBounds, out SKRectI outSubset, out SKPointI outOffset)
        {
            if (filter == null)
                throw new ArgumentNullException(nameof(filter));

            fixed(SKRectI *os = &outSubset)
            fixed(SKPointI * oo = &outOffset)
            {
                return(GetObject <SKImage> (SkiaApi.sk_image_make_with_filter(Handle, filter.Handle, &subset, &clipBounds, os, oo)));
            }
        }
Example #34
0
 public SKSizeI(SKPointI pt)
 {
     w = pt.X;
     h = pt.Y;
 }
Example #35
0
 public static SKPoint Add(SKPoint pt, SKPointI sz) => pt + sz;
Example #36
0
 public static SKPoint Subtract(SKPoint pt, SKPointI sz) => pt - sz;
Example #37
0
 public static SKImageFilter CreateMatrixConvolution(SKSizeI kernelSize, float[] kernel, float gain, float bias, SKPointI kernelOffset, SKMatrixConvolutionTileMode tileMode, bool convolveAlpha, SKImageFilter input = null, SKImageFilter.CropRect cropRect = null)
 {
     if (kernel == null)
     {
         throw new ArgumentNullException(nameof(kernel));
     }
     if (kernel.Length != kernelSize.Width * kernelSize.Height)
     {
         throw new ArgumentException("Kernel length must match the dimensions of the kernel size (Width * Height).", nameof(kernel));
         fixed(float *k = kernel)
         {
             return(GetObject <SKImageFilter> (SkiaApi.sk_imagefilter_new_matrix_convolution(&kernelSize, k, gain, bias, &kernelOffset, tileMode, convolveAlpha, input == null ? IntPtr.Zero : input.Handle, cropRect == null ? IntPtr.Zero : cropRect.Handle)));
         }
 }
Example #38
0
 public SKImage ApplyImageFilter(GRContext context, SKImageFilter filter, SKRectI subset, SKRectI clipBounds, out SKRectI outSubset, out SKPointI outOffset) =>
 ApplyImageFilter((GRRecordingContext)context, filter, subset, clipBounds, out outSubset, out outOffset);