Esempio n. 1
0
        public bool  Draw(byte[] buffer)
        {
            _log += DateTime.Now.TimeOfDay + " \r\n";
            ;
            var rgb = _scale.Convert(buffer);

            lock (_lockObj)
            {
                Bitmap bitmap = new Bitmap(this.srcWidth, this.srcHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

                BitmapData imageData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

                Marshal.Copy(rgb, 0, imageData.Scan0, rgb.Length);

                bitmap.UnlockBits(imageData);
                var bmp = GraphicsGDIPuls.KiResizeImage(bitmap, this.Size.Width, this.Size.Height);
                bitmap.Dispose();
                using (Graphics g = Graphics.FromImage(this.Background))
                {
                    g.DrawImage(bmp, PointF.Empty);
                    LogOsd(g);
                }
                bmp.Dispose();
            }
            return(true);
        }
Esempio n. 2
0
 public VideoCanvas(Point location, Size size, System.Drawing.Image backgroud)
     : base(location, size)
 {
     this.Location    = location;
     this.Size        = size;
     this.Background  = GraphicsGDIPuls.KiResizeImage(backgroud, size.Width, size.Height);
     this.CanvasStyle = CanvasStyle.Video;
 }