Class BpxDrawingPattern

A 4x4 drawing pattern definition of which pixels should be drawn with the primary and which with the secondary of BpxPatternColors.

const prevPattern = $d.setDrawingPattern(BpxDrawingPattern.from(`
##--
##--
--##
--##
`));
$d.rectFilled($v(10), $v(20), BpxPatternColors.of($rgb_red, $rgb_blue));
$d.setDrawingPattern(prevPattern);

Static factories

Static values

Other

Static factories

  • Creates a BpxDrawingPattern from a numeric representation of 4 columns and 4 rows. Recommended way is to defined the pattern as a binary number, with group separator put between each 4 digits, e.g. 0b0101_1010_0101_1010. The 1 stands for the primary color and the 0 – for the secondary one.

    Parameters

    • bits: number

    Returns BpxDrawingPattern

Static values

primaryOnly: BpxDrawingPattern = ...

The pattern used by default, which uses the primary color only. An equivalent of BpxDrawingPattern.of(0b1111_1111_1111_1111).

secondaryOnly: BpxDrawingPattern = ...

The pattern which uses the secondary color only. An equivalent of BpxDrawingPattern.of(0b0000_0000_0000_0000).

Other

  • The method to check whether a primary or a secondary color should be put at a given (X,Y) when this pattern is applied.

    Usually, you wouldn't have to use this method, since it's already used by internals of BeetPx drawing API.

    Parameters

    • x: number
    • y: number

    Returns boolean