[]
Represents an uncompressed in-memory bitmap.
new Bitmap(
width,
height,
backColor?): Bitmap;
Creates a Bitmap instance with optionally initialized pixels.
number
The bitmap width, in pixels.
number
The bitmap height, in pixels.
The optional background color to fill the Bitmap.
Bitmap
ObjectBase.constructor
new Bitmap(
om,
width,
height,
backColor?): Bitmap;
Creates a Bitmap instance with optionally initialized pixels.
An object manager that controls the lifetime of the Bitmap object.
number
The bitmap width, in pixels.
number
The bitmap height, in pixels.
The optional background color to fill the Bitmap.
Bitmap
ObjectBase.constructor
get blackAndWhite(): boolean;
Returns true if all pixels in the image are either black or white.
boolean
get context(): BmpContext;
Gets the current BmpContext for this Bitmap.
get grayscale(): boolean;
Determines whether the image contains only opaque grayscale pixels.
boolean
get height(): number;
Gets the height of the bitmap, in pixels.
number
get id(): number;
Gets the reference to the object.
number
get om(): ObjectManager;
Gets the owner ObjectManager instance.
get width(): number;
Gets the width of the bitmap, in pixels.
number
addGlow(
glowColor,
glowOpacity?,
inflationRadius?,
gaussianBlurRadius?): Bitmap;
Creates a bitmap with glow effect from the current image. The glow effect inflates all non-transparent areas of an image by a specified amount, then applies a Gaussian blur to make the border smooth. The effect appears only if some pixels of the current image are transparent or semi-transparent.
The glow color.
number
The glow opacity, between 0 and 1.
number
The glow inflation radius, in pixels.
number
The Gaussian blur radius, in pixels.
Bitmap
A new Bitmap with glow effect.
addShadow(
xOffset,
yOffset,
shadowColor,
shadowOpacity?,
gaussianBlurRadius?): Bitmap;
Creates a bitmap with shadow from the current image. The shadow appears only if some pixels of the current image are transparent or semi-transparent.
number
The horizontal offset of the shadow, in pixels.
number
The vertical offset of the shadow, in pixels.
The shadow color.
number
The shadow opacity, between 0 and 1.
number
The shadow blur radius, in pixels.
Bitmap
A new Bitmap with shadow.
adjustLevels(
blackPoint,
whitePoint,
outputBlack,
outputWhite,
midtone?): void;
Adjusts the levels of an image histogram. The method maps the input range of values (blackPoint..whitePoint) to the output range (outputBlack..outputWhite) using the specified gamma correction (midtone).
The input black point color.
The input white point color.
The output black point color.
The output white point color.
number
The value of gamma correction.
void
alphaBlend(
srcBitmap,
dstX,
dstY,
options?): void;
Draws the source bitmap with the specified opacity into the current Bitmap.
Bitmap
The Bitmap with the source color data to draw.
number
The x-coordinate of the destination rectangle, in pixels.
number
The y-coordinate of the destination rectangle, in pixels.
The alpha blend options.
void
applyBilevelTransparencyMask(mask, bounds?): void;
Applies a bi-level transparency mask to the current image or its portion.
A BilevelBitmap with the transparency mask.
The target rectangle of the bitmap.
void
applyBradleyThresholdingEffect(
sDivider?,
t?,
bounds?): void;
Applies the in-place effect that converts a monochromatic (grayscale) image to bi-level image using Bradley and Roth's method of adaptive image thresholding.
number
A divider of the image width to calculate the value of s.
number
The value of t parameter.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applyBrightnessContrast(
brightness,
contrast,
bounds?): void;
Applies the in-place effect that updates the image brightness and contrast.
number
A value from -255 to 255 for adjusting the brightness level.
number
A value from -255 to 255 for adjusting the contrast level.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applyDitheringEffect(ditheringMethod?, bounds?): void;
Applies the in-place effect that converts a monochromatic (grayscale) image to bi-level image with two-dimensional error diffusion dithering.
The method of two-dimensional error diffusion dithering. The default is Floyd-Steinberg method.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applyGammaCorrection(gamma?, bounds?): void;
Applies the in-place effect that applies gamma correction to the image.
number
A value of Gamma, from 0.001 to 1000.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applyGaussianBlur(
radius?,
borderMode?,
borderColor?,
bounds?): void;
Applies the in-place effect that applies a Gaussian blur to the image.
number
The radius of the blur, in pixels.
The mapping mode for the pixels outside of the border, "RepeatEdge" if null.
The color used to blend with the edge pixels of the image, "Transparent" if null.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applyGrayscaleEffect(standard?, bounds?): void;
Applies the in-place effect that converts an image to monochromatic gray.
A grayscale standard used for converting full-color image to monochromatic gray.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applyGrayscaleTransparencyMask(mask, bounds?): void;
Applies a grayscale transparency mask to the current image or its portion.
A GrayscaleBitmap with the transparency mask.
The target rectangle of the bitmap.
void
applyHueRotation(angleInDegrees, bounds?): void;
Applies the in-place effect that alters the hue of an image based on the rotation angle.
number
The angle to rotate the hue, in degrees.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applyLuminanceToAlpha(bounds?): void;
Applies the in-place effect that sets the alpha channel to the luminance of the image and sets the color channels to 0.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applyOpacityEffect(opacity, bounds?): void;
Applies the in-place effect that adjusts the opacity of an image by multiplying the alpha channel of the input by the specified opacity value.
number
The multiplier to the input image's alpha channel. The minimum value is 0.0 and the maximum value is 1.0.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applyOtsuThresholdingEffect(bounds?): void;
Applies the in-place effect that converts a monochromatic (grayscale) image to bi-level image using Otsu's method of clustering-based image thresholding.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applySaturationEffect(saturation, bounds?): void;
Applies the in-place effect that alters the saturation of an image.
number
The saturation of the image between 0.0 (monochrome) and 1.0 (fully saturated).
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applySepiaEffect(bounds?): void;
Applies the in-place effect that converts an image to sepia tones.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
applySoftEdges(inflationRadius?, gaussianBlurRadius?): void;
Applies a soft edges effect to the current image. The soft edges effect deflates all non-transparent areas of an image by a specified amount, then applies a Gaussian blur to make the border smooth.
number
The negative radius of inflation, in pixels.
number
The Gaussian blur radius, in pixels.
void
applyTemperatureAndTint(
temperature,
tint,
bounds?): void;
Applies the in-place effect that alters the temperature and tint of an image.
number
Specifies how much to increase or decrease the temperature of the input image. The allowed range is between -1.0 and 1.0.
number
Specifies how much to increase or decrease the tint of the input image. The allowed range is between -1.0 and 1.0.
The target rectangle of the Bitmap, or the entire Bitmap if null.
void
autoLevels(
keepRelativeIntensities?,
lowClipFraction?,
highClipFraction?): void;
Modifies R, G, B color intensities such that the maximum range of values (0..255) is fully covered.
boolean
Indicates if the method should keep the relative intensities of the color channels unchanged.
number
The fraction of extremely low values to be clipped, not greater than 0.1.
number
The fraction of extremely high values to be clipped, not greater than 0.1.
void
bitBlt(
srcBitmap,
dstX,
dstY,
options?): void;
Performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source bitmap into the current Bitmap.
Bitmap
The Bitmap with the source color data to transfer.
number
The x-coordinate of the destination rectangle, in pixels.
number
The y-coordinate of the destination rectangle, in pixels.
The source coordinates, size, and other options.
void
clear(color, bounds?): void;
Clears the whole Bitmap or its part with specified color.
The color to fill the image.
The target rectangle of the Bitmap.
void
clip(
x,
y,
width,
height,
metadataOnly?): Bitmap;
Creates a new Bitmap with a fragment of the image.
number
The X coordinate of the clipping rectangle.
number
The Y coordinate of the clipping rectangle.
number
The width of the clipping rectangle.
number
The height of the clipping rectangle.
boolean
Specifies whether to copy the image metadata only, not actual pixel data. The default is false.
Bitmap
A new Bitmap with a fragment of the source image.
clip(bounds, metadataOnly?): Bitmap;
Creates a new Bitmap with a fragment of the image.
Clipping rectangle of the source image to be extracted as a new Bitmap.
boolean
Specifies whether to copy the image metadata only, not actual pixel data. The default is false.
Bitmap
A new Bitmap with a fragment of the source image.
clone(metadataOnly?): Bitmap;
Creates a new Bitmap with a copy of the image.
boolean
specifies whether to copy the image metadata only, not actual pixel data.
Bitmap
A new Bitmap with a copy of the source image.
compositeAndBlend(
srcBitmap,
dstX,
dstY,
options?): void;
Applies the algorithms of Porter Duff compositing and blending to the current Bitmap (used as backdrop, destination) and the source Bitmap.
Bitmap
The Bitmap with the source color data to composite.
number
The x-coordinate of the destination rectangle, in pixels.
number
The y-coordinate of the destination rectangle, in pixels.
The compositing and blending options.
void
convertToOpaque(backColor, bounds?): void;
Converts an image with transparent or semitransparent pixels to fully opaque with specified background color.
The color to be used as background for transparent pixels.
The target rectangle of the bitmap.
void
exportColorChannel(destination, colorChannel): void;
Copies data from one color channel of the current Bitmap to an existing GrayscaleBitmap of the same pixel size.
The target GrayscaleBitmap.
A channel of the source Bitmap to be exported.
void
flipRotate(action, clipBounds?): Bitmap;
Produces a flipped (horizontal or vertical) and/or rotated (by 90 degree increments) bitmap. The source Bitmap remains unchanged.
The operation to be applied.
Clipping rectangle specifying the area of the source image to be processed.
Bitmap
A new Bitmap with transformed image.
free(): void;
Detaches the object from the ObjectManager and deallocates its memory, if possible.
void
getContentRect(backColor): Rect;
Returns the coordinates of a rectangle with colors different from backColor.
The background color.
A part of the image rectangle excluding the margins with background color.
hasTransparentPixels(bounds?): boolean;
Determines whether the image contains transparent or semitransparent pixels.
The source rectangle to analyse.
boolean
true if at least one non-opaque pixel was found, false otherwise.
importColorChannel(source, colorChannel): void;
Copies data from a GrayscaleBitmap to one color channel of the current Bitmap of the same pixel size.
A GrayscaleBitmap with source data.
A channel of the destination Bitmap to be updated.
void
newContext(bmpContextProperties?): BmpContext;
Creates a BmpContext for the current Bitmap and optionally fills it with a background color.
The settings for creating a DrawingContext for Bitmap.
An instance of BmpContext.
rebind(omTo): void;
Rebinds the object from the current ObjectManager to the specified one.
The new ObjectManager for the object.
void
resize(
width,
height,
interpolationMode?): Bitmap;
Creates a new Bitmap with a resized image fragment. The source Bitmap remains unchanged.
number
The width of the resized image, in pixels.
number
The height of the resized image, in pixels.
The interpolation mode to use when scaling. The default is Linear.
Bitmap
A new Bitmap with resized image.
resize(options): Bitmap;
Creates a new Bitmap with a resized image fragment. The source Bitmap remains unchanged.
The resizing options.
Bitmap
A new Bitmap with resized image.
saveAsJpeg(quality?): Uint8Array;
Saves the Bitmap as an array with JPEG-encoded image data.
number
The image quality from 0 (best compression) to 100 (best quality).
Uint8Array
A byte array with JPEG-encoded image data.
saveAsJpegImage(quality?): Image;
Saves the Bitmap as a JPEG-encoded Image.
number
The image quality from 0 (best compression) to 100 (best quality).
The resulting Image object.
saveAsPng(fastest?): Uint8Array;
Saves the Bitmap as an array with PNG-encoded image data.
boolean
if true, forces the operation to work as fast as possible at the expence of lower compression ratio.
Uint8Array
A byte array with PNG-encoded image data.
saveAsPngImage(fastest?): Image;
Saves the Bitmap as a PNG-encoded Image.
boolean
if true, forces the operation to work as fast as possible at the expence of lower compression ratio.
The resulting Image object.
toBilevelBitmap(
colorChannel?,
lowerBitsFirst?,
whiteIsZero?): BilevelBitmap;
Creates a BilevelBitmap from the current Bitmap. This method does not perform any transformations of the color palette. It is expected that the source Bitmap has already been converted to bi-level palette using some thresholding or dithering effects. The toBilevelBitmap method just copies data from a specified color channel to a new instance of the BilevelBitmap class.
The color channel used as the source of the bi-level data.
boolean
If true, pixels are arranged within a byte such that pixels with lower column indices are stored in the lower-order bits of the byte.
boolean
If true, indicates that 0 represents white and 1 represents black in the resulting BilevelBitmap.
A new instance of BilevelBitmap.
toGrayscaleBitmap(colorChannel?, whiteIsZero?): GrayscaleBitmap;
Creates a GrayscaleBitmap from the current Bitmap. This method does not perform any transformations of the color palette. It is expected that the source Bitmap has already been converted to grayscale palette using the Bitmap#applyGrayscaleEffect or something like that. Alternatively, you can use this method to extract individual channels of a color image without any prior conversion, and treat the resulting GrayscaleBitmap simply as a representation of some image data with 8 bits per pixel. The toGrayscaleBitmap method just copies data from a specified color channel to a new instance of the GrayscaleBitmap class.
The color channel used as the source of grayscale data.
boolean
If true, indicates that 0 represents white and 255 represents black in the resulting GrayscaleBitmap.
A new instance of GrayscaleBitmap.