Ejemplo n.º 1
0
 internal System.Drawing.Pen RealizeGdiPen()
 {
     if (_dirty)
     {
         if (_gdiPen == null)
         {
             _gdiPen = new System.Drawing.Pen(_color.ToGdiColor(), (float)_width);
         }
         else
         {
             _gdiPen.Color = _color.ToGdiColor();
             _gdiPen.Width = (float)_width;
         }
         LineCap lineCap = XConvert.ToLineCap(_lineCap);
         _gdiPen.StartCap   = lineCap;
         _gdiPen.EndCap     = lineCap;
         _gdiPen.LineJoin   = XConvert.ToLineJoin(_lineJoin);
         _gdiPen.DashOffset = (float)_dashOffset;
         if (_dashStyle == XDashStyle.Custom)
         {
             int     len     = _dashPattern == null ? 0 : _dashPattern.Length;
             float[] pattern = new float[len];
             for (int idx = 0; idx < len; idx++)
             {
                 pattern[idx] = (float)_dashPattern[idx];
             }
             _gdiPen.DashPattern = pattern;
         }
         else
         {
             _gdiPen.DashStyle = (System.Drawing.Drawing2D.DashStyle)_dashStyle;
         }
     }
     return(_gdiPen);
 }
Ejemplo n.º 2
0
        internal override System.Drawing.Brush RealizeGdiBrush()
        {
            if (_gdiDirty)
            {
                if (_gdiBrush == null)
                {
                    _gdiBrush = new SolidBrush(_color.ToGdiColor());
                }
                else
                {
                    _gdiBrush.Color = _color.ToGdiColor();
                }
                _gdiDirty = false;
            }

#if DEBUG
            System.Drawing.Color clr    = _color.ToGdiColor();
            SolidBrush           brush1 = new SolidBrush(clr);
            Debug.Assert(_gdiBrush.Color == brush1.Color);
#endif
            return(_gdiBrush);
        }
Ejemplo n.º 3
0
    //public void Flush();
    //public void Flush(FlushIntention intention);

    #region Drawing

    // ----- Clear --------------------------------------------------------------------------------

    /// <summary>
    /// Fills the entire drawing surface with the specified color. The functions works only if
    /// the current transformation is identity, i.e. the function should be called only immediately
    /// after the XGraphics object was created.
    /// </summary>
    public void Clear(XColor color)
    {
      if (this.drawGraphics)
      {
#if GDI
        if (this.targetContext == XGraphicTargetContext.GDI)
          this.gfx.Clear(color.ToGdiColor());
#endif
#if WPF
        if (this.targetContext == XGraphicTargetContext.WPF)
        {
          Rect rc = new Rect();
          rc.Width = rc.Height = 10000;
          this.dc.DrawRectangle(new SolidColorBrush(color.ToWpfColor()), null, rc);
        }
#endif
      }

      if (this.renderer != null)
        this.renderer.Clear(color);
    }
Ejemplo n.º 4
0
    //public void Flush();
    //public void Flush(FlushIntention intention);

    #region Drawing

    // ----- Clear --------------------------------------------------------------------------------

    /// <summary>
    /// Fills the entire drawing surface with the specified color. The functions works only if
    /// the current transformation is identity, i.e. the function should be called only immediately
    /// after the XGraphics object was created.
    /// </summary>
    public void Clear(XColor color)
    {
      if (this.drawGraphics)
        this.gfx.Clear(color.ToGdiColor());

      if (this.renderer != null)
        this.renderer.Clear(color);
    }
Ejemplo n.º 5
0
 /// <summary>
 /// Convert from WinForms color to core color.
 /// </summary>
 public static RColor Convert(XColor c)
 {
     var gc = c.ToGdiColor();
     return RColor.FromArgb(gc.A, gc.R, gc.G, gc.B);
 }