Beispiel #1
0
        protected override void OnDrawSample(SKCanvas canvas, int width, int height)
        {
            canvas.DrawColor(SKColors.White);

            var rect = SKRect.Create(width / 3, height / 3, width / 3, height / 3);

            float    occluderHeight = 2.0f;
            SKPoint3 lightPos       = new SKPoint3(0, 0, 50);
            float    lightWidth     = 500;
            float    ambientAlpha   = 0.75f;
            float    spotAlpha      = 0.75f;

            using (var paint = new SKPaint())
                using (var filter = SKMaskFilter.CreateShadow(occluderHeight, lightPos, lightWidth, ambientAlpha, spotAlpha))
                {
                    paint.IsAntialias = true;
                    paint.Color       = SKColors.Black;
                    paint.MaskFilter  = filter;

                    // draw the shadow
                    canvas.DrawRect(rect, paint);

                    paint.Color      = SKColors.DarkBlue;
                    paint.MaskFilter = null;

                    // draw the rectangle
                    canvas.DrawRect(rect, paint);
                }
        }
 public EllipseParticle(SKColor color,
                        SKPoint3 rotationSpeed,
                        float translationSpeed,
                        float direction,
                        SKPoint3 orientation,
                        SKPoint position,
                        SKSize size,
                        float blurFactor) : base(color, rotationSpeed, translationSpeed, direction, orientation, position, size, blurFactor)
 {
 }
Beispiel #3
0
        public ParticleBase(SKPoint3 rotationSpeed, float translationSpeed, float direction, SKPoint3 orientation, SKPoint position, SKSize size)
        {
            RotationSpeed    = rotationSpeed;
            TranslationSpeed = translationSpeed;
            Direction        = direction;

            Orientation        = orientation;
            InitialOrientation = orientation;

            Position        = position;
            InitialPosition = position;

            Size = size;
        }
        protected override void OnDrawSample(SKCanvas canvas, int width, int height)
        {
            canvas.DrawColor(SKColors.White);

            SKPoint3 direction = new SKPoint3(1.0f, 1.0f, 1.0f);

            using (var paint = new SKPaint())
                using (var filter = SKMaskFilter.CreateEmboss(2.0f, direction, 0.3f, 0.1f))
                {
                    paint.IsAntialias = true;
                    paint.TextSize    = 120;
                    paint.TextAlign   = SKTextAlign.Center;
                    paint.MaskFilter  = filter;

                    canvas.DrawText("SkiaSharp", width / 2f, height / 2f, paint);
                }
        }
        public RectParticle(SKColor color,
                            SKPoint3 rotationSpeed,
                            float translationSpeed,
                            float direction,
                            SKPoint3 orientation,
                            SKPoint position,
                            SKSize size, float blurFactor)
            : base(rotationSpeed, translationSpeed, direction, orientation, position, size)
        {
            _blurFactor = blurFactor;

            Paint = new SKPaint
            {
                IsAntialias = true,
                Color       = color,
                Style       = SKPaintStyle.Fill,
                ImageFilter = SKImageFilter.CreateBlur(blurFactor, blurFactor)
            };
        }
Beispiel #6
0
        public void Load([NotNull] Tools.Courseplay.v2019.Waypoint waypoint)
        {
            if (waypoint == null)
            {
                throw new ArgumentNullException(nameof(waypoint));
            }

            Speed       = waypoint.Speed;
            Angle       = waypoint.Angle;
            Point       = new SKPoint3(waypoint.PointX, waypoint.PointY, waypoint.PointZ);
            Reverse     = ToBool(waypoint.Reverse);
            Crossing    = ToBool(waypoint.Crossing);
            TurnStart   = ToBool(waypoint.TurnStart);
            TurnEnd     = ToBool(waypoint.TurnEnd);
            Wait        = ToBool(waypoint.Wait);
            Unload      = ToBool(waypoint.Unload);
            Generated   = waypoint.Generated;
            Ridgemarker = waypoint.Ridgemarker;
        }
Beispiel #7
0
 public Waypoint()
 {
     Point = new SKPoint3();
 }
Beispiel #8
0
 public static SkiaSharp.SKPoint3 ToSKPoint3(this SKPoint3 point3)
 {
     return(new(point3.X, point3.Y, point3.Z));
 }
 public GoogleLogoParticle(SKPoint3 rotationSpeed, float translationSpeed, float direction, SKPoint3 orientation, SKPoint position, SKSize size) : base(rotationSpeed, translationSpeed, direction, orientation, position, size)
 {
 }
Beispiel #10
0
 private static SKPoint ToSkPoint(SKPoint3 point)
 {
     return(new SKPoint(point.X, point.Y));
 }