class HexaPDF::ImageLoader::PNG
def add_smask_image(dict, mask_data, from_indexed: false)
If the optional argument +from_indexed+ is +true+, it is assumed that the +mask_data+ was
data.
Adds a source mask image to the image described by +dict+ using +mask_data+ as the source
def add_smask_image(dict, mask_data, from_indexed: false) decode_parms = { Predictor: 15, Colors: 1, BitsPerComponent: (from_indexed ? 8 : dict[:BitsPerComponent]), Columns: dict[:Width], } stream_opts = (from_indexed ? {} : {filter: :FlateDecode, decode_parms: decode_parms}) stream = HexaPDF::StreamData.new(lambda { mask_data }, **stream_opts) smask_dict = { Type: :XObject, Subtype: :Image, Width: dict[:Width], Height: dict[:Height], ColorSpace: :DeviceGray, BitsPerComponent: (from_indexed ? 8 : dict[:BitsPerComponent]), } smask = @document.add(smask_dict, stream: stream) smask.set_filter(:FlateDecode, decode_parms) dict[:SMask] = smask end