SecureBlackbox 2020 iOS Edition

Questions / Feedback?

sigBackgroundMask (property)

Contains the background image mask.


@property (nonatomic,readwrite,assign,getter=sigBackgroundMask,setter=setSigBackgroundMask:) NSData* sigBackgroundMask;
- (NSData*)sigBackgroundMask;
- (void)setSigBackgroundMask:(NSData*)newSigBackgroundMask;
public var sigBackgroundMask: Data {
  get {...}
set {...} }


Contains the background image mask.

Masks provide means for marking transparent areas on your signature widgets. Specifically, a transparency mask tells PDF viewing apps which pixels of the signature widget should be kept visible and which should be rendered transparent instead.

In most cases, you will need a unique mask that is tailored for your signature widget image. This is something that you will need to create yourself basing on your preferences and the actual image design.

A mask is effectively a matrix of bits, with each bit corresponding to a pixel on your background bitmap. A bit is set to 1 if the corresponding pixel needs to be made transparent, or to 0 if it needs to be opaque.

To create the mask that can be passed to BackgroundMask, please follow the below procedure:

Go through the bitmap of your signature widget bitmap row to row, processing each row of pixels from left to right. For each row,

1. Start with an empty bit string.

2. For every pixel in a row, add '1' bit if you want it to be transparent, or '0' bit if you want it to be opaque.

3. Upon reaching the end of the row, append '0' bits to your bit string until the number of bits in it is a multiple of 8. This is because each row of pixels needs to be represented with a whole number of bytes.

4. Convert the bit string to a byte array by grouping every 8 bits into a byte.

Do the same for every row of pixels, and then concatenate the received byte arrays together. Pass the created byte array to SetSigBackgroundMask().

A small example. Imagine your image is 19 pixels wide and 3 pixels tall. Imagine you want to make it 'semi-transparent' by using a 'mesh' pattern. The mask will therefore look like this:

10101010 10101010 10100000 // first row

01010101 01010101 01000000 // second row

10101010 10101010 10100000 // third row

Note that the last 5 bits of each row are padding '0' bits and are ignored: you only need them to make each row contain a whole number of bytes. When converted to a byte string, this would look like

0xAA 0xAA 0xA0

0x55 0x55 0x40

0xAA 0xAA 0xA0

, or, if written as a byte array, (0xAA, 0xAA, 0xA0, 0x55, 0x55, 0x40, 0xAA, 0xAA, 0xA0): this is what you need to pass to SetSigBackgroundMask().

Copyright (c) 2022 /n software inc. - All rights reserved.
SecureBlackbox 2020 iOS Edition - Version 20.0 [Build 8165]