Example #1
0
 internal void Compile(IEnumerator<HtmlChunk> source, int width, string id = null, HtFont font = null, HtColor color = default(HtColor), TextAlign align = TextAlign.Left, VertAlign valign = VertAlign.Bottom)
 {
     this.d.Clear();
     this.CompiledWidth = width;
     this.d.Parse(source, width, id, font, color, align, valign);
     this.MergeSameTextChunks();
     this.UpdateHeight();
     //this.UpdateWidth();
 }
Example #2
0
 public override void Draw(string id, HtRect rect, HtColor color, string linkText, object userData)
 {
     Console.WriteLine("DrawImage {0} {1} {2} {3} {4} {5}", this, id, rect, color, linkText, userData);
 }
Example #3
0
 public override void FillRect(HtRect rect, HtColor color, object userData)
 {
     Console.WriteLine("FillRect {0} {1} {2}", rect, color, userData);
 }
 public override void FillRect(HtRect rect, HtColor color) { Console.WriteLine("FillRect {0} {1}", rect, color); }
Example #5
0
 public override void Draw(string id, HtRect rect, HtColor color, string text, bool isEffect, Core.DrawTextEffect effect, HtColor effectColor, int effectAmount, string linkText, object userData)
 {
     Console.WriteLine("DrawText: {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10}", this, id, rect, color, text, isEffect, effect, effectColor, effectAmount, linkText, userData);
 }
 public override void Draw(HtRect rect, HtColor color, string text) { Console.WriteLine("DrawText: {0} {1} {2} {3}", this, rect, color, text); }
 public override void Draw(HtRect rect, HtColor color) { Console.WriteLine("DrawImage {0} {1} {2}", this, rect, color); }
Example #8
0
        public static HtColor Parse(string text, HtColor onError)
        {
            if (string.IsNullOrEmpty(text)) return onError;
            if (text.StartsWith("#"))
            {
                string rs, gs, bs;
                byte r = 0, g = 0, b = 0;
                switch (text.Length)
                {
                    case 4: // #RGB
                        rs = text.Substring(1, 1);
                        rs += rs;
                        gs = text.Substring(2, 1);
                        gs += gs;
                        bs = text.Substring(3, 1);
                        bs += bs;
                        if (TryParse(rs, gs, bs, ref r, ref g, ref b))
                            return RGBA(r, g, b);
                        break;
                    case 7: // #RRGGBB
                        rs = text.Substring(1, 2);
                        gs = text.Substring(3, 2);
                        bs = text.Substring(5, 2);
                        if (TryParse(rs, gs, bs, ref r, ref g, ref b))
                            return RGBA(r, g, b);
                        break;
                    case 9: // #RRGGBBAA
                        rs = text.Substring(1, 2);
                        gs = text.Substring(3, 2);
                        bs = text.Substring(5, 2);
                        byte a = 0xFF;
                        var aa = text.Substring(7, 2);
                        if (TryParse(rs, gs, bs, aa, ref r, ref g, ref b, ref a))
                            return RGBA(r, g, b, a);
                        break;
                }
            }
            else
            {
                switch (text)
                {
                    case "transparent":
                        return transparent;

                    case "maroon":
                        return maroon;
                    case "red":
                        return red;
                    case "orange":
                        return orange;
                    case "yellow":
                        return yellow;
                    case "olive":
                        return olive;
                    case "purple":
                        return purple;
                    case "fuchsia":
                        return fuchsia;
                    case "white":
                        return white;
                    case "lime":
                        return lime;
                    case "green":
                        return green;
                    case "navy":
                        return navy;
                    case "blue":
                        return blue;
                    case "aqua":
                        return aqua;
                    case "teal":
                        return teal;
                    case "black":
                        return black;
                    case "silver":
                        return silver;
                    case "gray":
                        return gray;
                }
            }

            return onError;
        }
Example #9
0
        public static HtColor Parse(string text, HtColor onError)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(onError);
            }
            if (text.StartsWith("#"))
            {
                string rs, gs, bs;
                byte   r = 0, g = 0, b = 0;
                switch (text.Length)
                {
                case 4:     // #RGB
                    rs  = text.Substring(1, 1);
                    rs += rs;
                    gs  = text.Substring(2, 1);
                    gs += gs;
                    bs  = text.Substring(3, 1);
                    bs += bs;
                    if (TryParse(rs, gs, bs, ref r, ref g, ref b))
                    {
                        return(RGBA(r, g, b));
                    }
                    break;

                case 7:     // #RRGGBB
                    rs = text.Substring(1, 2);
                    gs = text.Substring(3, 2);
                    bs = text.Substring(5, 2);
                    if (TryParse(rs, gs, bs, ref r, ref g, ref b))
                    {
                        return(RGBA(r, g, b));
                    }
                    break;

                case 9:     // #RRGGBBAA
                    rs = text.Substring(1, 2);
                    gs = text.Substring(3, 2);
                    bs = text.Substring(5, 2);
                    byte a  = 0xFF;
                    var  aa = text.Substring(7, 2);
                    if (TryParse(rs, gs, bs, aa, ref r, ref g, ref b, ref a))
                    {
                        return(RGBA(r, g, b, a));
                    }
                    break;
                }
            }
            else
            {
                switch (text)
                {
                case "transparent":
                    return(transparent);

                case "maroon":
                    return(maroon);

                case "red":
                    return(red);

                case "orange":
                    return(orange);

                case "yellow":
                    return(yellow);

                case "olive":
                    return(olive);

                case "purple":
                    return(purple);

                case "fuchsia":
                    return(fuchsia);

                case "white":
                    return(white);

                case "lime":
                    return(lime);

                case "green":
                    return(green);

                case "navy":
                    return(navy);

                case "blue":
                    return(blue);

                case "aqua":
                    return(aqua);

                case "teal":
                    return(teal);

                case "black":
                    return(black);

                case "silver":
                    return(silver);

                case "gray":
                    return(gray);
                }
            }

            return(onError);
        }
Example #10
0
 public override void Draw(HtRect rect, HtColor color, string text)
 {
     Console.WriteLine("DrawText: {0} {1} {2} {3}", this, rect, color, text);
 }
Example #11
0
 internal void Compile(IEnumerator <HtmlChunk> source, int width, string id = null, HtFont font = null, HtColor color = default(HtColor), TextAlign align = TextAlign.Left, VertAlign valign = VertAlign.Bottom)
 {
     this.d.Clear();
     this.CompiledWidth = width;
     this.d.Parse(source, width, id, font, color, align, valign);
     this.MergeSameTextChunks();
     this.UpdateHeight();
 }
Example #12
0
 public override void FillRect(HtRect rect, HtColor color)
 {
     Console.WriteLine("FillRect {0} {1}", rect, color);
 }
Example #13
0
 public override void Draw(HtRect rect, HtColor color)
 {
     Console.WriteLine("DrawImage {0} {1} {2}", this, rect, color);
 }
Example #14
0
 public override void Draw(HtSpan span, string id, HtRect rect, HtColor color, string text, bool isEffect, Core.DrawTextEffect effect, HtColor effectColor, int effectAmount, Core.HtmlLink link, object userData)
 {
         Console.WriteLine("DrawText: {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10}", 
             this, 
             id, 
             rect, 
             color, 
             text, 
             isEffect, 
             effect, 
             effectColor, 
             effectAmount, 
             link == null ? null : link.linkText, 
             userData);
 }
Example #15
0
 public override void FillRect(HtRect rect, HtColor color, object userData) { Console.WriteLine("FillRect {0} {1} {2}", rect, color, userData); }
Example #16
0
 public override void Draw(string id, HtRect rect, HtColor color, Core.HtmlLink link, object userData) {
   Console.WriteLine("DrawImage {0} {1} {2} {3} {4} {5}", 
       this,
       id, 
       rect, 
       color,
       link == null ? null : link.linkText, 
       userData);
 }