Inheritance: SKObject
Example #1
0
		public static SKShader CreateColorFilter (SKShader shader, SKColorFilter filter)
		{
			if (shader == null)
				throw new ArgumentNullException (nameof (shader));
			if (filter == null)
				throw new ArgumentNullException (nameof (filter));
			return GetObject<SKShader> (SkiaApi.sk_shader_new_color_filter (shader.Handle, filter.Handle));
		}
Example #2
0
 public static SKShader CreateCompose(SKShader shaderA, SKShader shaderB, SKXferMode mode)
 {
     return(GetObject <SKShader>(SkiaApi.sk_shader_new_compose_with_mode(shaderA.Handle, shaderB.Handle, mode)));
 }
Example #3
0
 public static SKShader CreateCompose(SKShader shaderA, SKShader shaderB)
 {
     return(GetObject <SKShader>(SkiaApi.sk_shader_new_compose(shaderA.Handle, shaderB.Handle)));
 }
Example #4
0
 public SKShader ToShader(SKShaderTileMode tmx, SKShaderTileMode tmy, SKMatrix localMatrix) =>
 SKShader.CreateBitmap(this, tmx, tmy, localMatrix);
Example #5
0
 public SKShader ToShader(SKShaderTileMode tmx, SKShaderTileMode tmy) =>
 SKShader.CreateBitmap(this, tmx, tmy);
Example #6
0
 public SKShader ToShader(SKShaderTileMode tmx, SKShaderTileMode tmy, SKMatrix localMatrix, SKRect tile) =>
 SKShader.CreatePicture(this, tmx, tmy, localMatrix, tile);
 public static SKShader CreateCompose(SKShader shaderA, SKShader shaderB, SKXferMode mode)
 {
     return(CreateCompose(shaderA, shaderA, (SKBlendMode)mode));
 }
 public PaintState(SKPaint paint, SKColor color, SKShader shader)
 {
     _paint = paint;
     _color = color;
     _shader = shader;
 }
Example #9
0
 public SKShader ToShader(SKShaderTileMode tmx, SKShaderTileMode tmy) =>
 SKShader.GetObject(SkiaApi.sk_bitmap_make_shader(Handle, tmx, tmy, null));
Example #10
0
		// CreateCompose

		public static SKShader CreateCompose (SKShader shaderA, SKShader shaderB) =>
			CreateCompose (shaderA, shaderB, SKBlendMode.SrcOver);
Example #11
0
 public SKShader ToShader(SKShaderTileMode tileX, SKShaderTileMode tileY, SKMatrix localMatrix) =>
 SKShader.GetObject(SkiaApi.sk_image_make_shader(Handle, tileX, tileY, &localMatrix));
Example #12
0
 public SKShader ToShader(SKShaderTileMode tileX, SKShaderTileMode tileY) =>
 SKShader.GetObject(SkiaApi.sk_image_make_shader(Handle, tileX, tileY, null));
Example #13
0
		public static SKShader CreateLocalMatrix (SKShader shader, SKMatrix localMatrix)
		{
			if (shader == null)
				throw new ArgumentNullException (nameof (shader));
			return GetObject<SKShader> (SkiaApi.sk_shader_new_local_matrix (shader.Handle, ref localMatrix));
		}
Example #14
0
		public static SKShader CreateCompose (SKShader shaderA, SKShader shaderB, SKXferMode mode)
		{
			if (shaderA == null)
				throw new ArgumentNullException (nameof (shaderA));
			if (shaderB == null)
				throw new ArgumentNullException (nameof (shaderB));
			return GetObject<SKShader> (SkiaApi.sk_shader_new_compose_with_mode (shaderA.Handle, shaderB.Handle, mode));
		}
Example #15
0
 public static SKShader CreateColorFilter(SKShader shader, SKColorFilter filter)
 {
     return(GetObject <SKShader> (SkiaApi.sk_shader_new_color_filter(shader.Handle, filter.Handle)));
 }
Example #16
0
 public SKShader ToShader(SKShaderTileMode tmx, SKShaderTileMode tmy, SKMatrix localMatrix) =>
 SKShader.GetObject(SkiaApi.sk_bitmap_make_shader(Handle, tmx, tmy, &localMatrix));
Example #17
0
 public static SKShader CreateLocalMatrix(SKShader shader, SKMatrix localMatrix)
 {
     return(GetObject <SKShader> (SkiaApi.sk_shader_new_local_matrix(shader.Handle, ref localMatrix)));
 }
Example #18
0
 public SKShader ToShader(SKShaderTileMode tmx, SKShaderTileMode tmy) =>
 SKShader.CreatePicture(this, tmx, tmy);
Example #19
0
        public static void Xfermode(SKCanvas canvas, int width, int height)
        {
            var modes = Enum.GetValues(typeof(SKXferMode)).Cast <SKXferMode> ().ToArray();

            var cols = width < height ? 3 : 5;
            var rows = (modes.Length - 1) / cols + 1;

            var w         = (float)width / cols;
            var h         = (float)height / rows;
            var rect      = SKRect.Create(w, h);
            var srcPoints = new[] {
                new SKPoint(0.0f, 0.0f),
                new SKPoint(w, 0.0f)
            };
            var srcColors = new [] {
                SKColors.Magenta.WithAlpha(0),
                SKColors.Magenta
            };
            var dstPoints = new [] {
                new SKPoint(0.0f, 0.0f),
                new SKPoint(0.0f, h)
            };
            var dstColors = new [] {
                SKColors.Cyan.WithAlpha(0),
                SKColors.Cyan
            };

            using (var text = new SKPaint())
                using (var stroke = new SKPaint())
                    using (var src = new SKPaint())
                        using (var dst = new SKPaint())
                            using (var srcShader = SKShader.CreateLinearGradient(srcPoints [0], srcPoints [1], srcColors, null, SKShaderTileMode.Clamp))
                                using (var dstShader = SKShader.CreateLinearGradient(dstPoints [0], dstPoints [1], dstColors, null, SKShaderTileMode.Clamp)) {
                                    text.TextSize    = 12.0f;
                                    text.IsAntialias = true;
                                    text.TextAlign   = SKTextAlign.Center;
                                    stroke.IsStroke  = true;
                                    src.Shader       = srcShader;
                                    dst.Shader       = dstShader;

                                    canvas.Clear(SKColors.White);

                                    for (var i = 0; i < modes.Length; ++i)
                                    {
                                        using (new SKAutoCanvasRestore(canvas, true)) {
                                            canvas.Translate(w * (i / rows), h * (i % rows));

                                            canvas.ClipRect(rect);
                                            canvas.DrawColor(SKColors.LightGray);

                                            canvas.SaveLayer(null);
                                            canvas.Clear(SKColors.Transparent);
                                            canvas.DrawPaint(dst);

                                            src.XferMode = modes [i];
                                            canvas.DrawPaint(src);
                                            canvas.DrawRect(rect, stroke);

                                            var desc = modes [i].ToString();
                                            canvas.DrawText(desc, w / 2f, h / 2f, text);
                                        }
                                    }
                                }
        }
Example #20
0
 public SKShader ToShader(SKShaderTileMode tmx, SKShaderTileMode tmy, SKMatrix localMatrix, SKRect tile) =>
 SKShader.GetObject(SkiaApi.sk_picture_make_shader(Handle, tmx, tmy, &localMatrix, &tile));