Table of Contents

Class PatternFill

Namespace
DocWright.Core.Rendering
Assembly
DocWright.Core.dll

A tiled pattern interior paint for a VectorPath: a two-colour 8x8 tile, set or clear, or an 8x8 tile of coverage on a grid of its own.

public sealed class PatternFill : IEquatable<PatternFill>
Inheritance
PatternFill
Implements
Inherited Members

Remarks

The two-colour tile is an 8x8 monochrome bitmap packed into a ulong: the most significant byte is the top row and bit 7 of each byte is its leftmost pixel. A set bit paints Foreground and a clear bit Background; a null background leaves those pixels untouched, which is how a pattern over existing content stays transparent between its marks. The tile is stated in device-independent cells and the renderer decides how large a cell is, so a pattern is not resolution-locked.

The coverage tile (Coverage) states its own grid: CellsPerInch cells to the inch, a tile's top-left cell at (OriginX, OriginY) on the page, repeating from there in both directions. Each cell is the foreground over the background at the cell's coverage, each colour at its own opacity (Cell(int, out ColorRgb, out byte)), so an antialiased hatch, a translucent ground and clear lines are all said exactly. It is what a report item's hatch is: the reference draws the item into a bitmap of its own and tiles a GDI+ hatch brush from that bitmap's corner, a cell to a pixel. Renderers average the cells a device pixel covers by area, so the pattern reads alike at any resolution.

Constructors

PatternFill(IReadOnlyList<byte>, ColorRgb, byte, ColorRgb, byte, int, Twips, Twips)

Initializes a pattern of coverage on a grid of its own: each cell the foreground over the background at its coverage.

PatternFill(IReadOnlyList<byte>, ColorRgb, byte, ColorRgb, byte, int, Twips, Twips, bool)

Initializes a pattern of coverage on a grid of its own, stating how a rasterizer is to draw its tile.

PatternFill(ulong, ColorRgb, ColorRgb?)

Initializes a pattern fill.

Fields

MaxCellsPerInch

The finest grid a coverage tile may state, in cells to the inch: a twentieth of a twip, finer than any device.

TileCellCount

The number of cells in a tile: eight rows of eight.

Properties

Background

Gets the colour painted where a tile bit is clear, or null when those pixels are left alone; a coverage tile's background.

BackgroundAlpha

Gets the background's opacity, 0 to 255: for a two-colour tile, opaque, or clear with no background.

CellsPerInch

Gets a coverage tile's grid in cells to the inch, or zero for a two-colour tile, whose cell the renderer chooses.

Coverage

Gets a coverage tile's 64 cells' coverage, row by row from the top-left, or null for a two-colour tile.

Foreground

Gets the colour painted where a tile bit is set, or a coverage tile's foreground.

ForegroundAlpha

Gets the foreground's opacity, 0 to 255: opaque for a two-colour tile.

OriginX

Gets the left edge of a coverage tile's first cell on the page, in twips; zero for a two-colour tile.

OriginY

Gets the top edge of a coverage tile's first cell on the page, in twips; zero for a two-colour tile.

ResampledAsImage

Gets a value indicating whether a coverage tile is an image a rasterizer resamples and repeats on whole pixels, rather than cells covered exactly.

Tile

Gets the 8x8 tile bits; zero for a coverage tile.

Methods

Blend(byte, ColorRgb, byte, ColorRgb, byte, out ColorRgb, out byte)

The foreground over the background at a coverage, composited premultiplied: the colour of a cell (Cell(int, out ColorRgb, out byte)) at that coverage.

Cell(int, out ColorRgb, out byte)

The colour and opacity of a coverage tile's cell: the foreground over the background at the cell's coverage, composited premultiplied, the way a brush paints a partly covered pixel — so a clear background lends no colour.

Equals(PatternFill?)

Determines equality.

Equals(object?)

Determines equality.

GetHashCode()

Computes a hash code.