コード例 #1
0
ファイル: web_color.cs プロジェクト: smorey2/litehtml.net
 public web_color(web_color val)
 {
     blue  = val.blue;
     green = val.green;
     red   = val.red;
     alpha = val.alpha;
 }
コード例 #2
0
ファイル: background.cs プロジェクト: smorey2/litehtml.net
 public void assignTo(background val)
 {
     attachment = val._attachment;
     baseurl    = val._baseurl;
     image      = val._image;
     repeat     = val._repeat;
     color      = val._color;
 }
コード例 #3
0
ファイル: background.cs プロジェクト: smorey2/litehtml.net
 public background_paint()
 {
     color      = new web_color(0, 0, 0, 0);
     position_x = 0;
     position_y = 0;
     position_z = 0; //:h3ml
     attachment = background_attachment.scroll;
     repeat     = background_repeat.repeat;
     is_root    = false;
 }
コード例 #4
0
ファイル: background.cs プロジェクト: smorey2/litehtml.net
 public background_paint(background_paint val)
 {
     image         = val.image;
     baseurl       = val.baseurl;
     attachment    = val.attachment;
     repeat        = val.repeat;
     color         = val.color;
     clip_box      = val.clip_box;
     origin_box    = val.origin_box;
     border_box    = val.border_box;
     border_radius = val.border_radius;
     image_size    = val.image_size;
     position_x    = val.position_x;
     position_y    = val.position_y;
     position_z    = val.position_z; //:h3ml
     is_root       = val.is_root;
 }
コード例 #5
0
ファイル: web_color.cs プロジェクト: smorey2/litehtml.net
 public static web_color from_string(string str, Icontainer 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.TryParse(tokens[0], out var v) ? v : 0);
         }
         if (tokens.Count >= 2)
         {
             clr.green = (byte)(int.TryParse(tokens[1], out var v) ? v : 0);
         }
         if (tokens.Count >= 3)
         {
             clr.blue = (byte)(int.TryParse(tokens[2], out var v) ? v : 0);
         }
         if (tokens.Count >= 4)
         {
             clr.alpha = (byte)((double.TryParse(tokens[3], out var v) ? v : 0.0) * 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));
 }
コード例 #6
0
 public void draw_text(object hdc, string text, object hFont, web_color color, position pos)
 {
 }
コード例 #7
0
ファイル: element.cs プロジェクト: smorey2/litehtml.net
        public web_color get_color(string prop_name, bool inherited, web_color def_color = new web_color())
        {
            var clrstr = get_style_property(prop_name, inherited, null);

            return(clrstr == null ? def_color : web_color.from_string(clrstr, get_document().container));
        }