예제 #1
0
 public static void SetSvgFontSize(this HtmlElement element, double fontSize, SvgValueConverter converter)
 {
     if (fontSize.IsNaN())
     {
         element.ClearHtmlStyleProperty("font-size");
     }
     else
     {
         element.SetSvgAttribute("font-size", converter.ToPixelString(fontSize));
     }
 }
예제 #2
0
 public static void SetSvgSize(this HtmlElement element, Size size, SvgValueConverter converter)
 {
     if (size.IsNullOrEmpty())
     {
         element.RemoveAttribute("width");
         element.RemoveAttribute("height");
     }
     else
     {
         element.SetAttribute("width", converter.ToImplicitValueString(size.Width));
         element.SetAttribute("height", converter.ToImplicitValueString(size.Height));
     }
 }
예제 #3
0
        public WebApplicationHost()
        {
            RenderQueue                   renderQueue                   = new RenderQueue();
            HtmlValueConverter            htmlValueConverter            = new HtmlValueConverter();
            SvgValueConverter             svgValueConverter             = new SvgValueConverter();
            SvgDefinitionContainer        svgDefinitionContainer        = new SvgDefinitionContainer(renderQueue);
            ImageElementContainer         imageElementContainer         = new ImageElementContainer();
            EmbeddedResourceObjectFactory embeddedResourceObjectFactory = new EmbeddedResourceObjectFactory(htmlValueConverter);

            HtmlRenderElementFactory htmlRenderElementFactory = new HtmlRenderElementFactory(renderQueue, htmlValueConverter, imageElementContainer, embeddedResourceObjectFactory, svgValueConverter, svgDefinitionContainer);

            PresentationSourceFactory = new PresentationSourceFactory(htmlRenderElementFactory, htmlValueConverter, imageElementContainer, svgDefinitionContainer);
            TaskScheduler             = new TaskScheduler();
            TextMeasurementService    = new TextMeasurementService(htmlValueConverter);
        }
예제 #4
0
 private static void SetSvgAttribute(this HtmlElement element, string attributeName, double value, SvgValueConverter converter)
 {
     if (value.IsNaN())
     {
         element.RemoveAttribute(attributeName);
     }
     else
     {
         element.SetAttribute(attributeName, converter.ToImplicitValueString(value));
     }
 }
예제 #5
0
 public static void SetSvgTransform(this HtmlElement element, Matrix transform, SvgValueConverter converter)
 {
     if (transform.IsNullOrIdentity())
     {
         element.RemoveAttribute("transform");
     }
     else
     {
         element.SetAttribute("transform", converter.ToMatrixString(transform));
     }
 }
예제 #6
0
 public static void SetSvgLocation(this HtmlElement element, Point location, SvgValueConverter converter)
 {
     element.SetSvgPointAttributes("x", "y", location, converter);
 }
예제 #7
0
 public static void SetSvgSpreadMethod(this HtmlElement element, GradientSpreadMethod spreadMethod, SvgValueConverter converter)
 {
     element.SetAttribute("spreadMethod", converter.ToSpreadMethodString(spreadMethod));
 }
예제 #8
0
 public static void SetSvgMappingMode(this HtmlElement element, BrushMappingMode mappingMode, SvgValueConverter converter)
 {
     element.SetAttribute("gradientUnits", converter.ToGradientUnitsString(mappingMode));
 }
예제 #9
0
 public static void SetSvgFontStyle(this HTMLElement element, System.Windows.FontStyle fontStyle, SvgValueConverter converter)
 {
     if (fontStyle == System.Windows.FontStyle.Normal)
     {
         element.ClearHtmlStyleProperty("font-style");
     }
     else
     {
         element.SetSvgAttribute("font-style", converter.ToFontStyleString(fontStyle));
     }
 }
예제 #10
0
 public static void SetSvgGradientOrigin(this HtmlElement element, Point gradientOrigin, SvgValueConverter converter)
 {
     element.SetSvgPointAttributes("fx", "fy", gradientOrigin, converter);
 }
예제 #11
0
 public static void SetSvgBounds(this HtmlElement element, Rect bounds, SvgValueConverter converter)
 {
     element.SetSvgLocation(bounds.Location, converter);
     element.SetSvgSize(bounds.Size, converter);
 }
예제 #12
0
 public static void SetSvgOpacity(this HtmlElement element, double opacity, SvgValueConverter converter)
 {
     element.SetSvgAttribute("opacity", opacity, converter);
 }
예제 #13
0
 public static void SetSvgFontStretch(this HtmlElement element, System.Windows.FontStretch fontStretch, SvgValueConverter converter)
 {
     if (fontStretch == System.Windows.FontStretch.Normal)
     {
         element.ClearHtmlStyleProperty("font-stretch");
     }
     else
     {
         element.SetSvgAttribute("font-stretch", converter.ToFontStretchString(fontStretch));
     }
 }
예제 #14
0
 public static void SetSvgEndPoint(this HtmlElement element, Point endPoint, SvgValueConverter converter)
 {
     element.SetSvgPointAttributes("x2", "y2", endPoint, converter);
 }
예제 #15
0
 public static void SetSvgFontWeight(this HtmlElement element, FontWeight fontWeight, SvgValueConverter converter)
 {
     if (fontWeight == FontWeight.Normal)
     {
         element.ClearHtmlStyleProperty("font-weight");
     }
     else
     {
         element.SetSvgAttribute("font-weight", converter.ToFontWeightString(fontWeight));
     }
 }
예제 #16
0
 public static void SetSvgStartPoint(this HtmlElement element, Point startPoint, SvgValueConverter converter)
 {
     element.SetSvgPointAttributes("x1", "y1", startPoint, converter);
 }
예제 #17
0
 public static void SetSvgFontFamily(this HtmlElement element, FontFamily fontFamily, SvgValueConverter converter)
 {
     if (!fontFamily.FamilyNames.Any())
     {
         element.ClearHtmlStyleProperty("font-family");
     }
     else
     {
         element.SetSvgAttribute("font-family", converter.ToFontFamilyNamesString(fontFamily));
     }
 }
예제 #18
0
 public static void SetSvgImageSource(this HtmlElement element, ImageSource imageSource, IRenderElementFactory factory, SvgValueConverter converter)
 {
     element.SetAttributeNS(SvgDocument.XlinkNamespaceUri, "href", converter.ToImageUrl(imageSource, factory));
 }
예제 #19
0
 private static void SetSvgPointAttributes(this HtmlElement element, string xAttributeName, string yAttributeName, Point point, SvgValueConverter converter)
 {
     if (point.IsNullOrEmpty())
     {
         element.RemoveAttribute(xAttributeName);
         element.RemoveAttribute(yAttributeName);
     }
     else
     {
         element.SetAttribute(xAttributeName, converter.ToImplicitValueString(point.X));
         element.SetAttribute(yAttributeName, converter.ToImplicitValueString(point.Y));
     }
 }
예제 #20
0
 public static void SetSvgStrokeThickness(this HtmlElement element, double strokeThickness, SvgValueConverter converter)
 {
     element.SetSvgAttribute("stroke-width", strokeThickness, converter);
 }
예제 #21
0
 public static void SetSvgCenter(this HtmlElement element, Point center, SvgValueConverter converter)
 {
     element.SetSvgPointAttributes("cx", "cy", center, converter);
 }