我正在使用最新的SkiaSharp 1.68.0在灰度图像上使用SKPoints绘制一个简单的多边形,正在绘制的线条可以在示例图像中看到,但是未应用颜色。
对于普通图像,将应用颜色。
示例代码:
var original = SKBitmap.Decode("D://white_rose_560933.jpg");
SKRectI imageBounds = SKRectI.Create(0, 0, original.Width, original.Height);
SKPoint[] points = GetRectanglePointsF(123, 123);
//Get the cropped area based on the focus point
SKRectI cropArea = GetCropRectangleF(new SKPoint(22,22), imageBounds);
var canvas = new SKCanvas(original);
var paint = new SKPaint() { Color = SKColors.Orange, StrokeWidth = 2 };
canvas.DrawPoints(SKPointMode.Polygon, points, paint);
canvas.Flush();
var image = SKImage.FromBitmap(original);
var subset = image.Subset(cropArea);
var data = subset.Encode(SKEncodedImageFormat.Jpeg, 100);
data.SaveTo(outputStream);
我尝试了几种混合模式,但似乎没有任何效果,我是否缺少油漆中灰度图像的属性?