Changes between Version 10 and Version 11 of rfc15_nodatabitmask
- Timestamp:
- Aug 21, 2007, 8:54:50 AM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
rfc15_nodatabitmask
v10 v11 1 1 2 = RFC 14: Band Masks = 2 3 … … 16 17 17 18 {{{ 18 GDALRasterBand *GetMaskBand();19 int GetMaskFlags();19 virtual GDALRasterBand *GetMaskBand(); 20 virtual int GetMaskFlags(); 20 21 }}} 21 22 22 Note that the !GetMaskBand() should always return a GDALRasterBand mask, even if it is only an all 255 mask with the flags indicating G NMF_ALL_VALID.23 Note that the !GetMaskBand() should always return a GDALRasterBand mask, even if it is only an all 255 mask with the flags indicating GMF_ALL_VALID. 23 24 24 25 The !GetMaskFlags() method returns an bitwise OR-ed set of status flags with the following available definitions that may be extended in the future: 25 26 26 * G NMF_ALL_VALID(0x01): There are no invalid pixels, all mask values will be 255. When used this will normally be the only flag set.27 * G NMF_PER_DATASET(0x02): The mask band is shared between all bands on the dataset.28 * G NMF_ALPHA(0x04): The mask band is actually an alpha band and may have values other than 0 and 255.29 * G NMF_NODATA(0x08): Indicates the mask is actually being generated from nodata values.27 * GMF_ALL_VALID(0x01): There are no invalid pixels, all mask values will be 255. When used this will normally be the only flag set. 28 * GMF_PER_DATASET(0x02): The mask band is shared between all bands on the dataset. 29 * GMF_ALPHA(0x04): The mask band is actually an alpha band and may have values other than 0 and 255. 30 * GMF_NODATA(0x08): Indicates the mask is actually being generated from nodata values. (mutually exclusive of GMF_ALPHA) 30 31 31 32 == Default Implementation == … … 33 34 The GDALRasterBand class will include a default implementation of !GetMaskBand() that returns one of three default implementations. 34 35 35 * If the band has a nodata value set, an instance of the new GDALNodataMaskRasterBand class will be returned. !GetMaskFlags() will return G NMF_NODATA.36 * If there is no nodata value, but the dataset has an alpha band that seems to apply to this band (specific rules yet to be determined) and that is of type GDT_Byte then that alpha band will be returned, and the flags G NMF_PER_DATASET and GNMF_ALPHA will be returned in the flags.37 * If neither of the above apply, an instance of the new GDALAllValidRasterBand class will be returned that has 255 values for all pixels. The null flags will return G NMF_ALL_VALID.36 * If the band has a nodata value set, an instance of the new GDALNodataMaskRasterBand class will be returned. !GetMaskFlags() will return GMF_NODATA. 37 * If there is no nodata value, but the dataset has an alpha band that seems to apply to this band (specific rules yet to be determined) and that is of type GDT_Byte then that alpha band will be returned, and the flags GMF_PER_DATASET and GMF_ALPHA will be returned in the flags. 38 * If neither of the above apply, an instance of the new GDALAllValidRasterBand class will be returned that has 255 values for all pixels. The null flags will return GMF_ALL_VALID. 38 39 39 40 The GDALRasterBand will include a protected poMask instance variable and a bOwnMask flag. The first call to the default !GetMaskBand() will result in creation of the GDALNodataMaskRasterBand, GDALAllValidMaskRasterBand and their assignment to poMask with bOwnMask set TRUE. If an alpha band is identified for use, it will be assigned to poMask and bOwnMask set to FALSE. The GDALRasterBand class will take care of deleting the poMask if set and bOwnMask is true in the destructor. Derived band classes may safely use the poMask and bOwnMask flag similarly as long as the semantics are maintained. … … 41 42 == Alpha Bands == 42 43 43 When a dataset has a normal GDT_Byte alpha (transparency) band that applies, it should be returned as the null mask, but the !GetMaskFlags() method should include G NMF_ALPHA. For processing purposes any value other than 0 should be treated as valid data, though some algorithms will treat values between 1 and 254 as partially transparent.44 When a dataset has a normal GDT_Byte alpha (transparency) band that applies, it should be returned as the null mask, but the !GetMaskFlags() method should include GMF_ALPHA. For processing purposes any value other than 0 should be treated as valid data, though some algorithms will treat values between 1 and 254 as partially transparent. 44 45 45 46 == Creating Masks ==