Merge branch 'develop-next' of github.com:mono/SkiaSharp into develop-next

This commit is contained in:
Matthew Leibowitz 2016-11-25 10:59:33 +02:00
Родитель d58c92c252 90e2b57eac
Коммит 59fa0b1205
2 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,43 @@
using SkiaSharp;
namespace SkiaSharpSample.Samples
{
[Preserve(AllMembers = true)]
public class PathEffect2DPathSample : SampleBase
{
[Preserve]
public PathEffect2DPathSample()
{
}
public override string Title => "2D Path Effect";
public override SampleCategories Category => SampleCategories.PathEffects | SampleCategories.Paths;
protected override void OnDrawSample(SKCanvas canvas, int width, int height)
{
canvas.Clear(SKColors.White);
var blockSize = 30;
// create the path
var path = new SKPath();
// the rect must be offset as the path uses the center
var rect = SKRect.Create(blockSize / -2, blockSize / -2, blockSize, blockSize);
path.AddRect(rect);
// move the path around: across 1 block
var offsetMatrix = SKMatrix.MakeScale(2 * blockSize, blockSize);
// each row, move across a bit / offset
SKMatrix.PreConcat(ref offsetMatrix, SKMatrix.MakeSkew(0.5f, 0));
// create the paint
var paint = new SKPaint();
paint.PathEffect = SKPathEffect.Create2DPath(offsetMatrix, path);
paint.Color = SKColors.LightGray;
// draw a rectangle
canvas.DrawRect(SKRect.Create(width, height), paint);
}
}
}

Просмотреть файл

@ -54,6 +54,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Samples\DilateImageFilterSample.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Samples\DilateImageFilterSample.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Samples\ErodeImageFilterSample.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Samples\ErodeImageFilterSample.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Samples\ColorTableColorFilterSample.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Samples\ColorTableColorFilterSample.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Samples\PathEffect2DPathSample.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Media\adobe-dng.dng" /> <EmbeddedResource Include="$(MSBuildThisFileDirectory)Media\adobe-dng.dng" />