| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SharpPlot Tutorials General Tutorials Chart Samples Style Examples SharpLeaf Tutorials Document Layout Tutorials Text Flow Tutorials Table Tutorials Visual Glossaries SharpPlot Reference SharpPlot Class SharpPlot Properties SharpPlot Methods SharpPlot Structures SharpPlot Enumerations PageMap Class SharpLeaf Reference SharpLeaf Class SharpLeaf Properties SharpLeaf Methods Table Class Table Properties Table Methods SharpLeaf Structures FontType Structure ParagraphStyle Structure BoxStyle Structure SharpLeaf Enumerations DocumentLayout Classes DocumentLayout Class PageLayout Class PageElement Abstract Class Frame : PageElement Class TextBlock : PageElement Class ImageBlock : PageElement Class Box : PageElement Class Rule : PageElement Class Document Class VectorMath Class DbUtil Class Download Release Notes Licensing |
Common Reference > FillStyle Struct FillStyle StructFill-styles (built-in and user-defined tilings). SharpPlot offers a good range of pre-defined shading patterns, but the majority of output formats allow you to add your own custom fills. For SVG, these would typically be more sophisticated gradients, or 3D-effect filters to give the effect of extrusion and lighting on the completed graphic. For raster output, you can use any standard .Net Brush object here. See Gradients for more background on how the fills may be customised. public struct FillStyle Public Static Properties
Creating Fills for Vector OutputCreates a custom shading from an existing gradient or URI to a file. public FillStyle( string sourceName // Brush is also accepted here ); sp.SetBackground(Color.Bisque,FillStyle.GradientBottomRight); FillStyle fs = new FillStyle("#gentlelight"); // SVG filter sp.SetBackground(new FillStyle("tartan.png")); Bitmap fills are currently only supported in output rendered as VML, XAML and raster. Customised gradients may be used with any of the formats, and arbitrary filters are specific to SVG. A typical filter could look like: <defs> <desc>Background wash (light colour)</desc> <linearGradient id="wash" gradientTransform="rotate(35)" > <stop offset="15%" style="stop-color:#D7E1E3"/> <stop offset="90%" style="stop-color:#9CDCEE"/> </linearGradient> </defs> You refer to this as “#wash” in the source name for the fill style. Remember to Include the source for the filter in the chart so that it is added at the beginning of the SVG output. Creating Fills for Raster OutputTo create a custom shading from an existing Brush: public FillStyle( Brush brush ); bg = new TextureBrush(new Bitmap("marble.jpg")); sp.SetChartBackground(new FillStyle(bg)); You can use the WrapMode setting of the Brush to determine how the texture is tiled. It may be convenient to combine both methods to create a chart which can render either to vector or raster outout. In this case you may pass the Brush object and the URL to the image when you create the custom fill: bg = new TextureBrush(new Bitmap("marble.jpg")); sp.SetChartBackground(new FillStyle(bg,"http://serverpath/marble.jpg")); Clearly, the vector output may require a full http path to the image, and you may choose a completely different image here. RequirementsNamespace: Causeway Assembly: SharpPlot (in sharpplot.dll) See also ...BoxStyle Structure | Using the Gradient fills | SharpPlot.SetBackground Method | SharpPlot.SetChartBackground Method | SharpPlot.SetFillStyles Method | SharpPlot.SetFrameBackground Method | SharpPlot.SetKeyBackground Method | SharpPlot.SetNoteBackground Method |