Exemplo n.º 1
0
 public web_color(web_color val)
 {
     blue  = val.blue;
     green = val.green;
     red   = val.red;
     alpha = val.alpha;
 }
Exemplo n.º 2
0
 public asset_paint()
 {
     color      = new web_color(0, 0, 0, 0);
     position_x = 0;
     position_y = 0;
     position_z = 0; //:h3ml
     is_root    = false;
 }
Exemplo n.º 3
0
 public asset_paint(asset_paint val)
 {
     asset      = val.asset;
     attributes = val.attributes;
     baseurl    = val.baseurl;
     color      = val.color;
     clip_box   = val.clip_box;
     origin_box = val.origin_box;
     border_box = val.border_box;
     asset_size = val.asset_size;
     position_x = val.position_x;
     position_y = val.position_y;
     position_z = val.position_z; //:h3ml
     is_root    = val.is_root;
 }
Exemplo n.º 4
0
 public void draw_text(object hdc, string text, object hFont, web_color color, position pos)
 {
 }
Exemplo n.º 5
0
 public static web_color from_string(string str, Idocument_container callback)
 {
     if (string.IsNullOrEmpty(str))
     {
         return(new web_color(0, 0, 0));
     }
     if (str[0] == '#')
     {
         var red   = string.Empty;
         var green = string.Empty;
         var blue  = string.Empty;
         if (str.Length - 1 == 3)
         {
             red   += str[1];
             red   += str[1];
             green += str[2];
             green += str[2];
             blue  += str[3];
             blue  += str[3];
         }
         else if (str.Length - 1 == 6)
         {
             red   += str[1];
             red   += str[2];
             green += str[3];
             green += str[4];
             blue  += str[5];
             blue  += str[6];
         }
         return(new web_color
         {
             red = (byte)Convert.ToInt64(red, 16),
             green = (byte)Convert.ToInt64(green, 16),
             blue = (byte)Convert.ToInt64(blue, 16)
         });
     }
     else if (str.StartsWith("rgb"))
     {
         var s   = str;
         var pos = s.IndexOf("(");
         if (pos != -1)
         {
             s = s.Substring(pos + 1);
         }
         pos = s.IndexOf(")");
         if (pos != -1)
         {
             s = s.Remove(pos, s.Length - pos);
         }
         var tokens = new List <string>();
         html.split_string(s, tokens, ", \t");
         var clr = new web_color();
         if (tokens.Count >= 1)
         {
             clr.red = (byte)int.Parse(tokens[0]);
         }
         if (tokens.Count >= 2)
         {
             clr.green = (byte)int.Parse(tokens[1]);
         }
         if (tokens.Count >= 3)
         {
             clr.blue = (byte)int.Parse(tokens[2]);
         }
         if (tokens.Count >= 4)
         {
             clr.alpha = (byte)(double.Parse(tokens[3]) * 255.0);
         }
         return(clr);
     }
     else
     {
         var rgb = resolve_name(str, callback);
         if (!string.IsNullOrEmpty(rgb))
         {
             return(from_string(rgb, callback));
         }
     }
     return(new web_color(0, 0, 0));
 }