getMask implementation