Esempio n. 1
0
 public void DrawPath(SKCanvas canvas, SKPath path)
 {
     if (InteriorColor != null)
     {
         var fillColor = InteriorSKColor.Value;
         using (var paint = new SKPaint {
             Color = fillColor, Style = SKPaintStyle.Fill
         })
         {
             var cloudPath = BorderEffect?.Apply(paint, path) ?? path;
             canvas.DrawPath(cloudPath, paint);
             if (cloudPath != path)
             {
                 cloudPath.Dispose();
             }
         }
     }
     if (Border != null && Color != null && !Color.IsZero)
     {
         var color = Color == null ? SKColors.Black : DeviceColorSpace.CalcSKColor(Color, Alpha);
         using (var paint = new SKPaint {
             Color = color
         })
         {
             Border?.Apply(paint, BorderEffect);
             canvas.DrawPath(path, paint);
         }
     }
 }
Esempio n. 2
0
 public DocumentImageRaw(byte[] image, int width, int height, int bitsPerComponent, DeviceColorSpace colorSpace)
 {
     this.image            = image;
     this.width            = width;
     this.height           = height;
     this.bitsPerComponent = bitsPerComponent;
     this.colorSpace       = colorSpace;
 }
Esempio n. 3
0
        public static DocumentImage GetRawImage(byte[] image, int widht, int height, int bitsPerComponent, DeviceColorSpace colorSpace)
        {
            byte[] hashBytes = sha1.ComputeHash(image);
            string hash      = string.Concat(hashBytes.Select(b => b.ToString("x2")));

            lock (lck) {
                if (dct.ContainsKey(hash))
                {
                    return(dct[hash]);
                }

                var img = new DocumentImageRaw(image, widht, height, bitsPerComponent, colorSpace);
                dct.Add(hash, img);
                return(img);
            }
        }