Esempio n. 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);
        }
Esempio n. 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)));
        }
Esempio n. 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);
        }
Esempio n. 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)));
        }
Esempio n. 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));
 }
Esempio n. 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));
        }
Esempio n. 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*/);
Esempio n. 8
0
 public bool Contains(SKPointI xy) =>
 SkiaApi.sk_region_contains2(Handle, xy.X, xy.Y);
Esempio n. 9
0
 public bool ExtractAlpha(SKBitmap destination, out SKPointI offset)
 {
     return(ExtractAlpha(destination, null, out offset));
 }
Esempio n. 10
0
 public static SKPointI Add(SKPointI pt, SKSizeI sz)
 {
     return(new SKPointI(pt.X + sz.Width, pt.Y + sz.Height));
 }
Esempio n. 11
0
 public void Offset(SKPointI p)
 {
     Offset(p.X, p.Y);
 }
Esempio n. 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));
		}
Esempio n. 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);
Esempio n. 14
0
 public void Offset(SKPointI p)
 {
     x += p.X;
     y += p.Y;
 }
Esempio n. 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)));
 }
Esempio n. 16
0
		public static SKShader CreatePerlinNoiseTurbulence (float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, SKPointI tileSize) =>
			CreatePerlinNoiseTurbulence (baseFrequencyX, baseFrequencyY, numOctaves, seed, (SKSizeI)tileSize);
Esempio n. 17
0
 public static SKPointI Subtract(SKPointI pt, SKSizeI sz)
 {
     return(new SKPointI(pt.X - sz.Width, pt.Y - sz.Height));
 }
Esempio n. 18
0
 public void Offset(SKPointI p)
 {
     Offset(p.X, p.Y);
 }
Esempio n. 19
0
		public bool Contains(SKPointI xy)
		{
			return SkiaApi.sk_region_contains2(Handle, xy.X, xy.Y);
		}
Esempio n. 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);
Esempio n. 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*/);
Esempio n. 22
0
 public static SKPointI Subtract(SKPointI pt, SKPointI sz) => pt - sz;
Esempio n. 23
0
 public bool Contains(SKPointI xy)
 {
     return(SkiaApi.sk_region_contains2(Handle, xy.X, xy.Y));
 }
Esempio n. 24
0
 public bool Contains(SKPointI pt)
 {
     return Contains(pt.X, pt.Y);
 }
Esempio n. 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)));
 }
Esempio n. 26
0
 public static SKRectI Create(SKPointI location, SKSizeI size)
 {
     return SKRectI.Create(location.X, location.Y, size.Width, size.Height);
 }
Esempio n. 27
0
 public static SKPointI Add(SKPointI pt, SKPointI sz) => pt + sz;
Esempio n. 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));
		}
Esempio n. 29
0
 public SKSizeI(SKPointI pt)
 {
     this.width = pt.X;
     this.height = pt.Y;
 }
Esempio n. 30
0
 public static SKPointI Add(SKPointI pt, SKSizeI sz) => pt + sz;
Esempio n. 31
0
 public void Offset(SKPointI pos)
 {
     Offset(pos.X, pos.Y);
 }
Esempio n. 32
0
 public static SKPointI Subtract(SKPointI pt, SKSizeI sz) => pt - sz;
Esempio n. 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)));
            }
        }
Esempio n. 34
0
 public SKSizeI(SKPointI pt)
 {
     w = pt.X;
     h = pt.Y;
 }
Esempio n. 35
0
 public static SKPoint Add(SKPoint pt, SKPointI sz) => pt + sz;
Esempio n. 36
0
 public static SKPoint Subtract(SKPoint pt, SKPointI sz) => pt - sz;
Esempio n. 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)));
         }
 }
Esempio n. 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);