v0.1 for XNA 3.1

This commit is contained in:
headhunter45_cp
2010-09-26 21:30:05 +00:00
parent fc39e5d411
commit 4369d2296a
5 changed files with 645 additions and 16 deletions

View File

@@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using PlanB.Html.Utility;
namespace PlanB.Html.Nodes
{
@@ -180,7 +182,24 @@ namespace PlanB.Html.Nodes
public void AddStyle(KeyValuePair<string, string> style)
{
KeyValuePair<string, string> newStyle = new KeyValuePair<string,string>(style.Key.ToLower(), style.Value);
string key = style.Key.ToLower();
string value = style.Value;
if (key == "color")
{
Color color = ColorHelper.FromCss(value);
if (color.A == 0xff)
{
value = String.Format("rgb({0}, {1}, {2})", color.R, color.G, color.B);
}
else
{
value = String.Format("rgba({0}, {1}, {2}, {3})", color.R, color.G, color.B, color.A);
}
}
KeyValuePair<string, string> newStyle = new KeyValuePair<string, string>(key, value);
Styles.RemoveAll(i => i.Key == newStyle.Key);
Styles.Add(newStyle);