private void RenderColour(bool renderMatchedArea) { var bitmap = new System.Drawing.Bitmap(256, 256); var points = new List <Point>(); for (var i = 0; i < 256; i++) { for (var g = 0; g < 256; g++) { var r = (byte)this.FindColourValue; var b = (byte)i; if (this.pixelClassifier.Mode == PixelClassifier.ClassifierMode.Blue) { r = (byte)i; b = (byte)this.FindColourValue; } if (pixelClassifier.IsMatch(r, (byte)g, b)) { points.Add(new Point(i, g)); } bitmap.SetPixel(i, g, Color.FromArgb(r, g, b)); } } if (ScreenCapture == null) { ScreenCapture = WowScreen.GetBitmap(); renderMatchedArea = true; } this.ColourDisplay.Source = bitmap.ToBitmapImage(); this.WowScreenshot.Source = ScreenCapture.ToBitmapImage(); if (renderMatchedArea) { Dispatch(() => { MarkEdgeOfRedArea(bitmap, points); this.ColourDisplay.Source = bitmap.ToBitmapImage(); }); Dispatch(() => { Bitmap bmp = new Bitmap(ScreenCapture); MarkHighlightOnBitmap(bmp); this.WowScreenshot.Source = bmp.ToBitmapImage(); }); } }
private void RenderColour(bool renderMatchedArea) { var bitmap = new System.Drawing.Bitmap(256, 256); var points = new List <Point>(); for (var b = 0; b < 256; b++) { for (var g = 0; g < 256; g++) { if (pixelClassifier.IsMatch((byte)this.RedValue, (byte)g, (byte)b)) { points.Add(new Point(b, g)); } bitmap.SetPixel(b, g, System.Drawing.Color.FromArgb(this.RedValue, g, b)); } } if (ScreenCapture == null) { ScreenCapture = WowScreen.GetBitmap(); renderMatchedArea = true; } this.ColourDisplay.Source = bitmap.ToBitmapImage(); this.WowScreenshot.Source = ScreenCapture.ToBitmapImage(); if (renderMatchedArea) { Dispatch(() => { MarkEdgeOfRedArea(bitmap, points); this.ColourDisplay.Source = bitmap.ToBitmapImage(); }); Dispatch(() => { Bitmap bmp = new Bitmap(ScreenCapture); MarkRedOnBitmap(bmp); this.WowScreenshot.Source = bmp.ToBitmapImage(); }); } }
public override BitmapImage Precache(int width, int height) { using (var fs = new FileStream(FileList.CurrentPath, FileMode.Open, FileAccess.Read)) { var bmp = new Bitmap(fs); _pagesCount = bmp.GetFrameCount(FrameDimension.Page); bmp.SelectActiveFrame(FrameDimension.Page, CurrentPage); _bmp = new Bitmap(bmp); } return _bmp.ToBitmapImage(width, height); }
private void S(double x, double y, double width, double height) { int ix = Convert.ToInt32(x + 2); int iy = Convert.ToInt32(y + 2); int iw = Convert.ToInt32(width - 4); int ih = Convert.ToInt32(height - 4); bitmap = new Bitmap(iw, ih); using (System.Drawing.Graphics graphics = Graphics.FromImage(bitmap)) { graphics.CopyFromScreen(ix, iy, 0, 0, new System.Drawing.Size(iw, ih)); } (CaptureCanvas.Children[0] as Border).Background = new ImageBrush(bitmap.ToBitmapImage()); }
public BitmapImage Load(ToxKey publicKey, out byte[] result) { byte[] bytes = LoadBytes(publicKey); if (bytes == null) { result = null; return null; } MemoryStream stream = new MemoryStream(bytes); using (Bitmap bmp = new Bitmap(stream)) { result = bytes; return bmp.ToBitmapImage(ImageFormat.Png); } }
private void SetBmp(Drawing.Bitmap bmp) { imageSource = bmp.ToBitmapImage(Drawing.Imaging.ImageFormat.Bmp); Width = bmp.Width; Height = bmp.Height; }
private void Display(Bitmap bitmap) { Webcam.Source = bitmap.ToBitmapImage(); }