C# 在VisualStudio中使用SkiaSharep
我正在研究SkiaSharep在未来项目中的使用,遵循GitHub上当前可用的文档: 我正在Windows 7上开发Visual Studio 2013。我尝试使用Xamarin Android应用程序项目类型,但它需要SkiaSharep包中DllImportAttribute的商业许可证C# 在VisualStudio中使用SkiaSharep,c#,visual-studio,xamarin,skia,skiasharp,C#,Visual Studio,Xamarin,Skia,Skiasharp,我正在研究SkiaSharep在未来项目中的使用,遵循GitHub上当前可用的文档: 我正在Windows 7上开发Visual Studio 2013。我尝试使用Xamarin Android应用程序项目类型,但它需要SkiaSharep包中DllImportAttribute的商业许可证 我想知道是否可以选择一个C Visual Studio项目,该项目将如何显示SkiaSharep画布,如果可以,我将如何执行此操作?评论上的链接当前已断开。由于文件夹示例将来可能会再次更改路径,任何需要的人
我想知道是否可以选择一个C Visual Studio项目,该项目将如何显示SkiaSharep画布,如果可以,我将如何执行此操作?评论上的链接当前已断开。由于文件夹示例将来可能会再次更改路径,任何需要的人都可以从页面开始探索 有关使用SkiaSharep的更多信息,请参阅和本文中关于使用绘图的部分 对于谁需要一个关于如何使用它的实用快速入门,这里有一些例子: 得到一张帆布 绘图文本 绘制位图 使用图像过滤器绘制
为什么会有否决票,请解释一下,这样我就可以改变我的问题了。我是按照《入门指南》进行的,其中没有包括windows集成。感谢您指向示例:-您能告诉我如何从这张图片返回吗?我需要生成带有一些文本的图像,然后通过流将其发送到打印机。所有这些都是在xamarin上完成的。我想我可以使用这些代码,但是如何提取图像jpg或其他内容并作为流发送?
using (var surface = SKSurface.Create (width: 640, height: 480, SKColorType.N_32, SKAlphaType.Premul)) {
SKCanvas myCanvas = surface.Canvas;
// Your drawing code goes here.
}
// clear the canvas / fill with white
canvas.DrawColor (SKColors.White);
// set up drawing tools
using (var paint = new SKPaint ()) {
paint.TextSize = 64.0f;
paint.IsAntialias = true;
paint.Color = new SKColor (0x42, 0x81, 0xA4);
paint.IsStroke = false;
// draw the text
canvas.DrawText ("Skia", 0.0f, 64.0f, paint);
}
Stream fileStream = File.OpenRead ("MyImage.png");
// clear the canvas / fill with white
canvas.DrawColor (SKColors.White);
// decode the bitmap from the stream
using (var stream = new SKManagedStream(fileStream))
using (var bitmap = SKBitmap.Decode(stream))
using (var paint = new SKPaint()) {
canvas.DrawBitmap(bitmap, SKRect.Create(Width, Height), paint);
}
Stream fileStream = File.OpenRead ("MyImage.png"); // open a stream to an image file
// clear the canvas / fill with white
canvas.DrawColor (SKColors.White);
// decode the bitmap from the stream
using (var stream = new SKManagedStream(fileStream))
using (var bitmap = SKBitmap.Decode(stream))
using (var paint = new SKPaint()) {
// create the image filter
using (var filter = SKImageFilter.CreateBlur(5, 5)) {
paint.ImageFilter = filter;
// draw the bitmap through the filter
canvas.DrawBitmap(bitmap, SKRect.Create(width, height), paint);
}
}