DsPdfJS API - v9.1.0
    Preparing search index...

    Class GrayscaleBitmap

    Represents a grayscale image or transparency mask with 8 bits per pixel.

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • get height(): number

      Gets the height of the GrayscaleBitmap, in pixels.

      Returns number

    • get id(): number

      Gets the reference to the object.

      Returns number

    • get transparencyMask(): boolean

      Gets or sets a value indicating whether the image is used to define an alpha mask of another image.

      Returns boolean

    • set transparencyMask(value: boolean): void

      Gets or sets a value indicating whether the image is used to define an alpha mask of another image.

      Parameters

      • value: boolean

      Returns void

    • get whiteIsZero(): boolean

      Gets or sets a value specifying whether 0 represents white and 255 represents black (if true) or vice versa (if false).

      Returns boolean

    • set whiteIsZero(value: boolean): void

      Gets or sets a value specifying whether 0 represents white and 255 represents black (if true) or vice versa (if false).

      Parameters

      • value: boolean

      Returns void

    • get width(): number

      Gets the width of the GrayscaleBitmap, in pixels.

      Returns number

    Methods

    • 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).

      Parameters

      • blackPoint: number

        The input black point (between 0 and 255).

      • whitePoint: number

        The input white point (between 0 and 255).

      • outputBlack: number

        The output black point (between 0 and 255).

      • outputWhite: number

        The output white point (between 0 and 255).

      • Optionalmidtone: number = 1.0

        The value of gamma correction.

      Returns void

    • Applies a Gaussian blur to this GrayscaleBitmap.

      Parameters

      • Optionalradius: number = 9

        The radius of the blur, in pixels.

      • OptionalborderMode: GaussianBlurBorderMode | null

        The mapping mode for the pixels outside of the border, "RepeatEdge" if null.

      • OptionalborderColor: number = 0

        The color used to blend with the edge pixels of the image (between 0 and 255).

      Returns void

    • When applied to a grayscale mask built from a color image using the Bitmap#toGrayscaleBitmap method, modifies it so that the result can be used as a transparency mask to produce "Glow" or "Soft Edges" effects.

      Parameters

      • OptionalinfRadius: number = 4

        The radius of inflation (positive, glow) or deflation (negative, soft edges), in pixels.

      • OptionalblurRadius: number = 6

        The radius of Gaussian blur, in pixels.

      Returns void

    • Modifies pixel intensities such that available range of values (0..255) is fully covered.

      Returns void

    • Modifies pixel intensities, clipping extremely low and extremely high values, such that available range of values (0..255) is fully covered.

      Parameters

      • lowClipFraction: number

        The fraction of extremely low values to be clipped, not greater than 0.1.

      • highClipFraction: number

        The fraction of extremely high values to be clipped, not greater than 0.1.

      Returns void

    • Clears the GrayscaleBitmap with the specified value.

      Parameters

      • value: number

        The value (between 0 and 255) to fill the image.

      • Optionalbounds: Bounds | null

        The target rectangle of the GrayscaleBitmap.

      Returns void

    • Creates a new GrayscaleBitmap with a fragment of the image.

      Parameters

      • bounds: Bounds

        A clipping rectangle to be extracted as a new GrayscaleBitmap.

      • OptionalmetadataOnly: boolean = false

        Specifies whether to copy the image metadata only, not actual pixel data.

      Returns GrayscaleBitmap

      A new instance of the GrayscaleBitmap.

    • Detaches the object from the ObjectManager and deallocates its memory, if possible.

      Returns void

    • Inverts the pixel colors from black to white and vice versa.

      Returns void

    • Creates a semi-transparent Bitmap from the current GrayscaleBitmap. This method treats the current GrayscaleBitmap as a transparency mask, regardless of the transparencyMask property value.

      Parameters

      • shadowColor: Color

        The color to fill opaque pixels of the target bitmap.

      • OptionalopacityFactor: number = 1

        Additional factor to scale the alpha channel.

      • OptionalzeroIsOpaque: boolean = false

        Specifies whether zero values correspond to fully opaque (true) or fully transparent (false) pixels.

      Returns Bitmap

      A new instance of the Bitmap class.