/// <summary> /// Creates a new BandedSampleModel with the specified /// width and height. The new BandedSampleModel will have the same /// number of bands, storage data type, and bank indices /// as this BandedSampleModel. The band offsets will be compressed /// such that the offset between bands will be w*pixelStride and /// the minimum of all of the band offsets is zero. </summary> /// <param name="w"> the width of the resulting <code>BandedSampleModel</code> </param> /// <param name="h"> the height of the resulting <code>BandedSampleModel</code> </param> /// <returns> a new <code>BandedSampleModel</code> with the specified /// width and height. </returns> /// <exception cref="IllegalArgumentException"> if <code>w</code> or /// <code>h</code> equals either /// <code>Integer.MAX_VALUE</code> or /// <code>Integer.MIN_VALUE</code> </exception> /// <exception cref="IllegalArgumentException"> if <code>dataType</code> is not /// one of the supported data types </exception> public override SampleModel CreateCompatibleSampleModel(int w, int h) { int[] bandOffs; if (NumBanks == 1) { bandOffs = OrderBands(BandOffsets_Renamed, w * h); } else { bandOffs = new int[BandOffsets_Renamed.Length]; } SampleModel sampleModel = new BandedSampleModel(DataType_Renamed, w, h, w, BankIndices_Renamed, bandOffs); return(sampleModel); }
/// <summary> /// Constructs a BandedSampleModel with the specified parameters. /// The pixel stride will be one data element. The scanline stride /// will be the same as the width. Each band will be stored in /// a separate bank and all band offsets will be zero. </summary> /// <param name="dataType"> The data type for storing samples. </param> /// <param name="w"> The width (in pixels) of the region of /// image data described. </param> /// <param name="h"> The height (in pixels) of the region of image /// data described. </param> /// <param name="numBands"> The number of bands for the image data. </param> /// <exception cref="IllegalArgumentException"> if <code>dataType</code> is not /// one of the supported data types </exception> public BandedSampleModel(int dataType, int w, int h, int numBands) : base(dataType, w, h, 1, w, BandedSampleModel.CreateIndicesArray(numBands), BandedSampleModel.CreateOffsetArray(numBands)) { }