/// <summary> /// Draws the marker (circle) inside the box /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="Unconditional"></param> private void DrawMarker(Gdk.Window win, int x, int y, bool Unconditional) // ***** { // * | * if (x < 0) { x = 0; // * | * } if (x > this.Allocation.Width - 4) { x = this.Allocation.Width - 4; // * | * } if (y < 0) { y = 0; // * | * } if (y > this.Allocation.Height - 4) { y = this.Allocation.Height - 4; // *----X----* } // * | * if (m_iMarker_Y == y && m_iMarker_X == x && !Unconditional) // * | * { return; // * | * } // * | * ClearMarker(win); // ***** m_iMarker_X = x; m_iMarker_Y = y; //Graphics g = Gtk.DotNet.Graphics.FromDrawable( win ); //Pen pen; GraphUtil.HSL _hsl = GetColor(x, y); // The selected color determines the color of the marker drawn over // it (black or white) Color color = Color.White; if (_hsl.L < (double)200 / 255) { color = Color.White; // White marker if selected color is dark } else if (_hsl.H < (double)26 / 360 || _hsl.H > (double)200 / 360) { if (_hsl.S > (double)70 / 255) { color = Color.White; } else { color = Color.Black; // Else use a black marker for lighter colors } } else { color = Color.Black; } Gdk.GC gc = new Gdk.GC(win); gc.RgbFgColor = GraphUtil.gdkColorFromWinForms(color); win.DrawArc(gc, false, x - 3, y - 3, 10, 10, 0 * 64, 360 * 64); //DrawBorder(win); // Force the border to be redrawn, just in case the marker has been drawn over it. }