Exemplo n.º 1
0
 public void drawCardFace(Gdk.Window win, Gdk.GC outline, Gdk.GC fill, int x, int y, int w, int h)
 {
     int top = y, bottom = h+y, left = x, right = w+x, corner = 25;
     int hcorner = (int)Math.Ceiling((double)corner/2); // half corner
     /* Outline of Arcs */
     win.DrawArc(outline, true, left-1, top-1, corner, corner, 90 * 64, 90 * 64);
     win.DrawArc(outline, true, left-1, bottom-corner+1, corner, corner, 180 * 64, 90 * 64);
     win.DrawArc(outline, true, right-corner+1, bottom-corner+1, corner, corner, 270 * 64, 90 * 64);
     win.DrawArc(outline, true, right-corner+1, top-1, corner, corner, 360 * 64, 90 * 64);
     /* Fill of Arcs */
     win.DrawArc(fill, true, left, top, corner, corner, 90 * 64, 90 * 64);
     win.DrawArc(fill, true, left, bottom-corner, corner, corner, 180 * 64, 90 * 64);
     win.DrawArc(fill, true, right-corner, bottom-corner, corner, corner, 270 * 64, 90 * 64);
     win.DrawArc(fill, true, right-corner, top, corner, corner, 360 * 64, 90 * 64);
     /* Fill of Card */
     win.DrawRectangle(fill, true, left+hcorner, top, right-left-corner, bottom-top);
     win.DrawRectangle(fill, true, left, top+hcorner, right-left, bottom-top-corner);
     /* Outline of Card */
     win.DrawLine(outline, left+hcorner, top, right-hcorner, top);
     win.DrawLine(outline, left+hcorner, bottom, right-hcorner, bottom);
     win.DrawLine(outline, left, top+hcorner, left, bottom-hcorner);
     win.DrawLine(outline, right, top+hcorner, right, bottom-hcorner);
 }
Exemplo n.º 2
0
        //       *****
        /// <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.
        }