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