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); }
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))); }
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); }
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))); }
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)); }
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)); }
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*/);
public bool Contains(SKPointI xy) => SkiaApi.sk_region_contains2(Handle, xy.X, xy.Y);
public bool ExtractAlpha(SKBitmap destination, out SKPointI offset) { return(ExtractAlpha(destination, null, out offset)); }
public static SKPointI Add(SKPointI pt, SKSizeI sz) { return(new SKPointI(pt.X + sz.Width, pt.Y + sz.Height)); }
public void Offset(SKPointI p) { Offset(p.X, p.Y); }
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)); }
public extern static sk_shader_t sk_shader_new_perlin_noise_turbulence(float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, ref SKPointI tileSize);
public void Offset(SKPointI p) { x += p.X; y += p.Y; }
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))); }
public static SKShader CreatePerlinNoiseTurbulence (float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, SKPointI tileSize) => CreatePerlinNoiseTurbulence (baseFrequencyX, baseFrequencyY, numOctaves, seed, (SKSizeI)tileSize);
public static SKPointI Subtract(SKPointI pt, SKSizeI sz) { return(new SKPointI(pt.X - sz.Width, pt.Y - sz.Height)); }
public bool Contains(SKPointI xy) { return SkiaApi.sk_region_contains2(Handle, xy.X, xy.Y); }
public static SKPointI Subtract(SKPointI pt, SKPointI sz) => pt - sz;
public bool Contains(SKPointI xy) { return(SkiaApi.sk_region_contains2(Handle, xy.X, xy.Y)); }
public bool Contains(SKPointI pt) { return Contains(pt.X, pt.Y); }
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))); }
public static SKRectI Create(SKPointI location, SKSizeI size) { return SKRectI.Create(location.X, location.Y, size.Width, size.Height); }
public static SKPointI Add(SKPointI pt, SKPointI sz) => pt + sz;
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)); }
public SKSizeI(SKPointI pt) { this.width = pt.X; this.height = pt.Y; }
public static SKPointI Add(SKPointI pt, SKSizeI sz) => pt + sz;
public void Offset(SKPointI pos) { Offset(pos.X, pos.Y); }
public static SKPointI Subtract(SKPointI pt, SKSizeI sz) => pt - sz;
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))); } }
public SKSizeI(SKPointI pt) { w = pt.X; h = pt.Y; }
public static SKPoint Add(SKPoint pt, SKPointI sz) => pt + sz;
public static SKPoint Subtract(SKPoint pt, SKPointI sz) => pt - sz;
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))); } }
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);