Skip to content

TestPatternGenerator

Namespace: Hex1b.Automation

Assembly: Hex1b.dll

Generates well-known test pattern images for verifying graphics rendering. These patterns have predictable, easily verifiable outputs.

csharp
public static class TestPatternGenerator

Inheritance

ObjectTestPatternGenerator

Methods

ConvertToSixel(byte[], int, int)

Converts raw RGBA pixel data to a Sixel payload string.

Parameters:

  • pixels (Byte[]): RGBA pixel data (4 bytes per pixel).
  • width (Int32): Image width in pixels.
  • height (Int32): Image height in pixels.

Returns: String

Complete Sixel DCS sequence.

csharp
public static string ConvertToSixel(byte[] pixels, int width, int height)

GenerateCheckerboard(int, int, int, (byte R, byte G, byte B)?, (byte R, byte G, byte B)?)

Generates a checkerboard pattern with specified colors.

Parameters:

Returns: Byte[]

RGBA pixel data.

csharp
public static byte[] GenerateCheckerboard(int width, int height, int squareSize = 8, (byte R, byte G, byte B)? color1 = null, (byte R, byte G, byte B)? color2 = null)

GenerateColorGrid(int, int)

Generates a 3x3 grid of primary and secondary colors. Layout: Red Green Blue Yellow Cyan Magenta Black Gray White

Parameters:

  • width (Int32): Image width in pixels (should be divisible by 3).
  • height (Int32): Image height in pixels (should be divisible by 3).

Returns: Byte[]

RGBA pixel data.

csharp
public static byte[] GenerateColorGrid(int width, int height)

GenerateGrayscaleGradient(int, int)

Generates a horizontal grayscale gradient from black (left) to white (right).

Parameters:

  • width (Int32): Image width in pixels.
  • height (Int32): Image height in pixels.

Returns: Byte[]

RGBA pixel data.

csharp
public static byte[] GenerateGrayscaleGradient(int width, int height)

GenerateRegistrationMarks(int, int)

Generates a crosshair/registration mark pattern useful for alignment testing. White background with black crosshairs and corner markers.

Parameters:

  • width (Int32): Image width in pixels.
  • height (Int32): Image height in pixels.

Returns: Byte[]

RGBA pixel data.

csharp
public static byte[] GenerateRegistrationMarks(int width, int height)

GenerateRgbGradients(int, int)

Generates RGB gradient bars (3 horizontal bands: R gradient, G gradient, B gradient).

Parameters:

  • width (Int32): Image width in pixels.
  • height (Int32): Image height in pixels (should be divisible by 3).

Returns: Byte[]

RGBA pixel data.

csharp
public static byte[] GenerateRgbGradients(int width, int height)

GenerateSmpteColorBars(int, int)

Generates SMPTE-style color bars (simplified 7-bar version). Colors from left to right: White, Yellow, Cyan, Green, Magenta, Red, Blue.

Parameters:

  • width (Int32): Image width in pixels.
  • height (Int32): Image height in pixels.

Returns: Byte[]

RGBA pixel data.

csharp
public static byte[] GenerateSmpteColorBars(int width, int height)

Released under the MIT License.