#
Class: BitmapBitmap
object
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap
#
Hierarchy- Bitmap
#
Constructors#
constructor+ new Bitmap(bin_bitmap_list
: string[]): Bitmap
Initialize a Bitmap
object. Load binary bitmap data (array
of string
s).
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap
#
Parameters:Name | Type | Description |
---|---|---|
bin_bitmap_list | string[] | Binary bitmap data |
Returns: Bitmap
Defined in: bdfparser.ts:1188
#
Properties#
bindata• bindata: string[]
Defined in: bdfparser.ts:1188
#
Methods#
bytepadâ–¸ bytepad(bits?
: null | number): Bitmap
Pad each line (row) to multiple of 8 (or other numbers) bits/pixels, with '0'
s.
Do this before using the bitmap for a glyph in a BDF font.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#bytepad
#
Parameters:Name | Type | Description |
---|---|---|
bits? | null | number | Each line should be padded to multiple of how many bits/pixels |
Returns: Bitmap
The Bitmap
object itself, which now has the altered bitmap as its .bindata
Defined in: bdfparser.ts:1734
#
cloneâ–¸ clone(): Bitmap
Get a deep copy / clone of the Bitmap
object.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#clone
Returns: Bitmap
A deep copy of the original Bitmap
object
Defined in: bdfparser.ts:1256
#
concatâ–¸ concat(bitmap
: Bitmap, options?
: { align?
: undefined | null | 0 | 1 ; direction?
: undefined | null | 0 | 1 | -1 | 2 ; offset?
: undefined | null | number }): Bitmap
Concatenate another Bitmap
objects to the current one.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#concat
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
bitmap | Bitmap | - | Bitmap to concatenate |
options | { align? : undefined | null | 0 | 1 ; direction? : undefined | null | 0 | 1 | -1 | 2 ; offset? : undefined | null | number } | ... | - |
Returns: Bitmap
The Bitmap
object itself, which now has the combined bitmap as its .bindata
Defined in: bdfparser.ts:1538
#
cropâ–¸ crop(w
: number, h
: number, xoff?
: null | number, yoff?
: null | number): Bitmap
Crop and/or extend the bitmap.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#crop
#
Parameters:Name | Type | Description |
---|---|---|
w | number | Width |
h | number | Height |
xoff? | null | number | X offset |
yoff? | null | number | Y offset |
Returns: Bitmap
The Bitmap
object itself, which now has only the specified area as its .bindata
Defined in: bdfparser.ts:1380
#
draw2canvasâ–¸ draw2canvas(context
: CanvasContext, pixelcolors?
: null | Record<0 | 1 | 2, null | string>): Bitmap
Draw the bitmap to HTML canvas
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#draw2canvas
#
Parameters:Name | Type | Description |
---|---|---|
context | CanvasContext | Canvas 2D context (canvas.getContext("2d") ) |
pixelcolors? | null | Record<0 | 1 | 2, null | string> | Object mapping '0' /'1' /'2' in the bitmap data to color |
Returns: Bitmap
The Bitmap
object itself
Defined in: bdfparser.ts:1806
#
enlargeâ–¸ enlarge(x?
: number, y?
: number): Bitmap
Enlarge a Bitmap
object, by multiplying every pixel in x (right) direction and in y (top) direction.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#enlarge
#
Parameters:Name | Type | Description |
---|---|---|
x? | number | Multiplier in x (right) direction |
y? | number | Multiplier in y (top) direction |
Returns: Bitmap
The Bitmap
object itself, which now has the enlarged bitmap as its .bindata
Defined in: bdfparser.ts:1593
#
glowâ–¸ glow(mode?
: null | 0 | 1): Bitmap
Add glow effect to the shape in the bitmap.
The glowing area is one pixel up, right, bottom and left to the original pixels (corners will not be filled in default mode 0 but will in mode 1), and will be filled by '2'
s.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#glow
#
Parameters:Name | Type | Description |
---|---|---|
mode? | null | 0 | 1 | Mode |
Returns: Bitmap
The Bitmap
object itself, which now has a bitmap of the original shape with glow effect as the Bitmap
object's .bindata
Defined in: bdfparser.ts:1690
#
heightâ–¸ height(): number
Get the height of the bitmap.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#height
Returns: number
Height of the bitmap
Defined in: bdfparser.ts:1245
#
overlayâ–¸ overlay(bitmap
: Bitmap): Bitmap
Overlay another bitmap over the current one.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#overlay
#
Parameters:Name | Type | Description |
---|---|---|
bitmap | Bitmap | The incoming bitmap to overlay over the current one |
Returns: Bitmap
The Bitmap
object itself, which now has the combined bitmap as its .bindata
Defined in: bdfparser.ts:1396
#
replaceâ–¸ replace(substr
: string | number, newsubstr
: string | number): Bitmap
Replace a string by another in the bitmap.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#replace
#
Parameters:Name | Type | Description |
---|---|---|
substr | string | number | Substring to be replaced |
newsubstr | string | number | New substring as the replacement |
Returns: Bitmap
The Bitmap
object itself, which now has the altered bitmap as its .bindata
Defined in: bdfparser.ts:1608
#
reprâ–¸ repr(): string
Gets a programmer-readable (multi-line) string
representation of the Bitmap
object.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#repr
Returns: string
String representation
Defined in: bdfparser.ts:1223
#
shadowâ–¸ shadow(xoff?
: null | number, yoff?
: null | number): Bitmap
Add shadow to the shape in the bitmap.
The shadow will be filled by '2'
s.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#shadow
#
Parameters:Name | Type | Description |
---|---|---|
xoff? | null | number | Shadow's offset in x (right) direction |
yoff? | null | number | Shadow's offset in y (top) direction |
Returns: Bitmap
The Bitmap
object itself, which now has a bitmap of the original shape with its shadow as the Bitmap
object's .bindata
Defined in: bdfparser.ts:1646
#
toStringâ–¸ toString(): string
Gets a human-readable (multi-line) string
representation of the Bitmap
object.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#tostring
Returns: string
String representation
Defined in: bdfparser.ts:1208
#
todataâ–¸ todata<T>(datatype?
: T): TodataFuncRetType<T>
Get the bitmap's data in the specified type and format.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#todata
#
Type parameters:Name | Type |
---|---|
T | null | 0 | 1 | 2 | 4 | 3 | 5 |
#
Parameters:Name | Type | Description |
---|---|---|
datatype? | T | Output data type |
Returns: TodataFuncRetType<T>
Bitmap data in the specified type (list or string) and format
Defined in: bdfparser.ts:1754
#
widthâ–¸ width(): number
Get the width of the bitmap.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#width
Returns: number
Width of the bitmap
Defined in: bdfparser.ts:1234
#
__crop_bitmapâ–¸ Private
Static
__crop_bitmap(bitmap
: string[], w
: number, h
: number, xoff
: number, yoff
: number): string[]
#
Parameters:Name | Type |
---|---|
bitmap | string[] |
w | number |
h | number |
xoff | number |
yoff | number |
Returns: string[]
Defined in: bdfparser.ts:1347
#
__crop_stringâ–¸ Private
Static
__crop_string(s
: string, start
: number, length
: number): string
#
Parameters:Name | Type |
---|---|
s | string |
start | number |
length | number |
Returns: string
Defined in: bdfparser.ts:1260
#
__enlarge_bindataâ–¸ Private
Static
__enlarge_bindata(bindata
: string[], x?
: null | number, y?
: null | number): string[]
#
Parameters:Name | Type |
---|---|
bindata | string[] |
x? | null | number |
y? | null | number |
Returns: string[]
Defined in: bdfparser.ts:1556
#
__listofstr_offset_concatâ–¸ Private
Static
__listofstr_offset_concat(list1
: string[], list2
: string[], offset?
: null | number): string[]
#
Parameters:Name | Type |
---|---|
list1 | string[] |
list2 | string[] |
offset? | null | number |
Returns: string[]
Defined in: bdfparser.ts:1306
#
__string_offset_concatâ–¸ Private
Static
__string_offset_concat(s1
: string, s2
: string, offset?
: null | number): string
#
Parameters:Name | Type |
---|---|
s1 | string |
s2 | string |
offset? | null | number |
Returns: string
Defined in: bdfparser.ts:1279
#
concatallâ–¸ Static
concatall(bitmaplist
: Bitmap[], options?
: { align?
: undefined | null | 0 | 1 ; direction?
: undefined | null | 0 | 1 | -1 | 2 ; offsetlist?
: undefined | null | number[] }): Bitmap
Concatenate all Bitmap
objects in an array
.
see
online docs: https://font.tomchen.org/bdfparser_js/bitmap#bitmapconcatall
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
bitmaplist | Bitmap[] | - | List of bitmaps to concatenate |
options | { align? : undefined | null | 0 | 1 ; direction? : undefined | null | 0 | 1 | -1 | 2 ; offsetlist? : undefined | null | number[] } | ... | - |
Returns: Bitmap
Bitmap
object
Defined in: bdfparser.ts:1428