/// <summary> /// Write a pixel to the file. Assumes pixels will be written /// by the caller consecutively from upper left to bottom /// right a row at a time /// </summary> public void WritePixel(IPixel pixel) { try { if ((fileWriter == null) || (!this.open)) { throw new System.ApplicationException("Raster not open for writing"); } if (currPixel >= totalPixels) { throw new System.ApplicationException("Writing beyond end of pixel data"); } int bandCount = pixel.BandCount; for (int bandNum = 0; bandNum < bandCount; bandNum++) { IPixelBand band = pixel[bandNum]; // calc this pixelband's location in file int location = PixelBandLocation(currPixel, bandNum); this.fileWriter.Seek(location, SeekOrigin.Begin); this.fileWriter.Write(band.GetBytes()); } currPixel++; } catch (System.Exception) { Close(); throw; } }
/// <summary> /// Write a pixel to the file. Assumes pixels will be written /// by the caller consecutively from upper left to bottom /// right a row at a time /// </summary> public void WritePixel(IPixel pixel) { int bandCount = pixel.BandCount; for (int bandNum = 0; bandNum < bandCount; bandNum++) { IPixelBand band = pixel[bandNum]; // calc this pixelband's location in file int location = PixelBandLocation(this.pixelsWritten, bandNum); this.fileWriter.Seek(location, SeekOrigin.Begin); this.fileWriter.Write(band.GetBytes()); } this.pixelsWritten++; }