Common Reference > FillStyle Struct

FillStyle Struct

Fill-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

Background

Shape is filled with the current background

BackwardDiagonal

Shape is diagonally hatched right to left

Cross

Shape is filled with crossing vertical and horizontal lines

DashedDownwardDiagonal

Shape is filled with diagonal dashed lines running from top left to bottom right

DashedHorizontal

Shape is filled with dashed horizontal lines

DashedUpwardDiagonal

Shape is filled with diagonal dashed lines running from bottom left top right

DashedVertical

Shape is filled with dashed vertical lines

DiagonalCross

Shape is diagonally cross-hatched

Dome

Fill has 3D domed effect

Drum

Fill has 3D Column effect

ForwardDiagonal

Shape is diagonally hatched left to right

GradientBottom

Fill has S-N gradient

GradientBottomLeft

Fill has SW-NE gradient

GradientBottomRight

Fill has SE-NW gradient

GradientLeft

Fill has W-E gradient

GradientRight

Fill has E-W gradient

GradientTop

Fill has N-S gradient

GradientTopLeft

Fill has NW-SE gradient

GradientTopRight

Fill has NE-SW gradient

Halftone

Fill colour has 50% saturation

Horizontal

Shape is filled with horizontal lines

HorizontalBrick

Shape is filled with bricking pattern

Opacity18

Fill colour has 18% opacity

Opacity30

Fill colour has 30% opacity

Opacity42

Fill colour has 42% opacity

Opacity54

Fill colour has 54% opacity

Opacity6

Fill colour has 6% opacity

Opacity66

Fill colour has 66% opacity

Opacity78

Fill colour has 78% opacity

Opacity90

Fill colour has 90% opacity

Pipe

Fill has 3D Pipe effect

Saturate10

Fill colour has 10% saturation

Saturate20

Fill colour has 20% saturation

Saturate30

Fill colour has 30% saturation

Saturate60

Fill colour has 60% saturation

Saturate80

Fill colour has 80% saturation

Saturate90

Fill colour has 90% saturation

Shingle

Shape is filled with fish-scale pattern

Solid

Shape is filled with solid colour

SpotBottomLeft

Fill has Bottom-Left spotlight

SpotBottomRight

Fill has Bottom-Right spotlight

SpotTopLeft

Fill has Top-Left spotlight

SpotTopRight

Fill has Top-Right spotlight

Sunrise

Fill has Sunrise gradient

Unfilled

Shape is not filled

Vertical

Shape is filled with vertical lines

Weave

Shape is shaded with basket-weave pattern

Creating Fills for Vector Output

Creates 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 Output

To 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.

Requirements

Namespace: 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


Send comments on this topic
© Dyalog Ltd 2021