Ejemplo n.º 1
0
        XnaDrawObject CreateXnaDrawObject(SvgElement svge)
        {
            XnaDrawObject o = null;

            switch (svge.getElementType())
            {
            case SvgElement._SvgElementType.typeLine:
                o = XnaDrawLine.Create((SvgLine )svge);
                break;

            case SvgElement._SvgElementType.typeRect:
                o = XnaDrawRectangle.Create((SvgRect )svge);
                break;

            case SvgElement._SvgElementType.typeEllipse:
                o = DrawEllipse.Create((SvgEllipse )svge);
                break;

            case SvgElement._SvgElementType.typePolyline:
                o = XnaDrawPolygon.Create((SvgPolyline )svge);
                break;

            case SvgElement._SvgElementType.typeImage:
                o = DrawImage.Create((SvgImage )svge);
                break;

            case SvgElement._SvgElementType.typeText:
                o = XnaDrawText.Create((SvgText )svge);
                break;

            case SvgElement._SvgElementType.typeGroup:
                o = CreateGroup((SvgGroup )svge);
                break;

            case SvgElement._SvgElementType.typePath:
                o = XnaDrawPath.Create((SvgPath)svge);
                break;

            case SvgElement._SvgElementType.typeDesc:
                Description = ((SvgDesc)svge).Value;
                break;

            default:
                break;
            }
            return(o);
        }
Ejemplo n.º 2
0
        public static XnaDrawRectangle Create(SvgRect svg)
        {
            try
            {
                var dobj = new XnaDrawRectangle(ParseSize(svg.X, Dpi.X),
                                                ParseSize(svg.Y, Dpi.Y),
                                                ParseSize(svg.Width, Dpi.X),
                                                ParseSize(svg.Height, Dpi.Y));
                dobj.SetStyleFromSvg(svg);
                dobj.Name = svg.ShapeName;

                return(dobj);
            }
            catch (Exception ex)
            {
                ErrH.Log("DrawRectangle", "CreateRectangle:", ex.ToString(), ErrH._LogPriority.Info);
                return(null);
            }
        }