Beispiel #1
0
        public static XnaDrawing.Pen Create(GraphicsDevice device, Drawing.Pen pen)
        {
            if (pen.GetType() == typeof(Drawing.Pen))
            {
                XnaDrawing.Brush brush = BrushFactory.Create(device, pen.Brush);
                return(new XnaDrawing.Pen(brush, (int)pen.Width));
            }
            else if (pen.GetType() == typeof(Drawing.PrimitivePen))
            {
                Drawing.SolidColorBrush brush = pen.Brush as Drawing.SolidColorBrush;
                return(new XnaDrawing.PrimitivePen(brush.Color.ToXnaColor()));
            }

            return(null);
        }
 protected virtual void InitializeResources(GraphicsDevice device)
 {
     if (_fillBrush == null && _data.Fill != null)
     {
         _fillBrush = BrushFactory.Create(device, _data.Fill);
     }
     if (_fillGlowBrush == null && _data.FillGlow != null)
     {
         _fillGlowBrush = BrushFactory.Create(device, _data.FillGlow);
     }
     if (_outlinePen == null && _data.Outline != null)
     {
         _outlinePen = PenFactory.Create(device, _data.Outline);
     }
     if (_outlineGlowPen == null && _data.OutlineGlow != null)
     {
         _outlineGlowPen = PenFactory.Create(device, _data.OutlineGlow);
     }
 }