public static void Update() { var BG = (Invert ? (255 - BackgroundLevel) : BackgroundLevel); var FG = (Invert ? (255 - GrayLevel) : GrayLevel); Pixbuf.Fill(((uint)BG << 24) | ((uint)BG << 16) | ((uint)BG << 8) | 255); using (OpenCV opencv = new OpenCV()) { var patternColor = new Color((byte)FG, (byte)FG, (byte)FG); if (Custom) { Copy(CustomPixbuf); } if (Cross || Plus) { using (Pixbuf pattern = opencv.DrawCrossPlus(Pixbuf, Cross, Plus, MarkerSize, patternColor)) { Render(pattern); } } if (Grating) { using (Pixbuf pattern = opencv.DrawGrating(Pixbuf, PeriodX, PeriodY, FillX, FillY, TL, TR, BL, BR, patternColor)) { Render(pattern); } } double AspectRatio = System.Convert.ToDouble(AspectX / AspectY); if (Ring) { using (Pixbuf pattern = opencv.DrawRing(Pixbuf, RingDiameter, AspectRatio, MarkerSize, patternColor, FillRing, Rings, RingPeriod * MarkerSize)) { Render(pattern); } } if (Box) { using (Pixbuf pattern = opencv.DrawBox(Pixbuf, BoxWidth, AspectRatio, MarkerSize, patternColor, FillBox, Boxes, BoxPeriod * MarkerSize)) { Render(pattern); } } if (!Preview) { using (Pixbuf pattern = GtkSelection.Render(Pixbuf, opencv, patternColor, 0, patternColor, true, false)) { Render(pattern); } } if (FlipX) { using (Pixbuf pattern = opencv.Flip(Pixbuf, opencv.FlipX)) { Copy(pattern); } } if (FlipY) { using (Pixbuf pattern = opencv.Flip(Pixbuf, opencv.FlipY)) { Copy(pattern); } } } }
public static Pixbuf Flip(VirtualCamera camera, OpenCV cv, FlipType flipCode) { return(camera != null?cv.Flip(camera.Pixbuf(), flipCode) : null); }