Home Reference Source Test
import Bitmap from 'pureimage/src/bitmap.js'
public class | source

Bitmap

The Bitmap class is used for direct pixel manipulation(for example setting a pixel colour, transparency etc). It also provides a factory method for creating new instances of Context

Constructor Summary

Public Constructor
public

constructor(w: number, h: number, options: any)

Creates an instance of Bitmap.

Member Summary

Public Members
public
public
public

Method Summary

Public Methods
public

Calculate Index

public

Context factory.

public

Get the RGBA value of an individual pixel as a hexadecimal number(See NAMED_COLORS for examples)

public

setPixelRGBA(x: number, y: number, rgba: number): void

Set the RGBA(Red, Green, Blue, Alpha) values on an individual pixel level

public

setPixelRGBA_i(x: number, y: number, r: number, g: number, b: number, a: number): void

Set the individual red, green, blue and alpha levels of an individual pixel

Public Constructors

public constructor(w: number, h: number, options: any) source

Creates an instance of Bitmap.

Params:

NameTypeAttributeDescription
w number

Width

h number

Height

options any

Currently unused

Public Members

public data: ArrayBuffer source

public height: number source

public width: number source

Public Methods

public calculateIndex(x: number, y: number): number source

Calculate Index

Params:

NameTypeAttributeDescription
x number

X position

y number

Y position

Return:

number

public getContext(): Context source

Context factory. Creates a new Context instance object for the current bitmap object

Return:

Context

public getPixelRGBA(x: number, y: number): number source

Get the RGBA value of an individual pixel as a hexadecimal number(See NAMED_COLORS for examples)

Params:

NameTypeAttributeDescription
x number

X axis potiion

y number

Y axis position

Return:

number

public setPixelRGBA(x: number, y: number, rgba: number): void source

Set the RGBA(Red, Green, Blue, Alpha) values on an individual pixel level

Params:

NameTypeAttributeDescription
x number

X axis position

y number

Y axis position

rgba number

A hex representation of the RGBA value of the pixel. See NAMED_COLORS for examples

Return:

void

public setPixelRGBA_i(x: number, y: number, r: number, g: number, b: number, a: number): void source

Set the individual red, green, blue and alpha levels of an individual pixel

Params:

NameTypeAttributeDescription
x number

X axis position

y number

Y axis position

r number

Red level

g number

Green level

b number

Blue level

a number

Alpha level

Return:

void