internal ImageLine(ImageInfo imgInfo, ESampleType stype, bool unpackedMode, int[] sci, byte[] scb) { ImgInfo = imgInfo; channels = imgInfo.Channels; bitDepth = imgInfo.BitDepth; FilterUsed = FilterType.FILTER_UNKNOWN; SampleType = stype; SamplesUnpacked = unpackedMode || !imgInfo.Packed; ElementsPerRow = SamplesUnpacked ? imgInfo.SamplesPerRow : imgInfo.SamplesPerRowPacked; if (stype == ESampleType.INT) { Scanline = sci ?? (new int[ElementsPerRow]); ScanlineB = null; MaxSampleVal = bitDepth == 16 ? 0xFFFF : GetMaskForPackedFormatsLs(bitDepth); } else if (stype == ESampleType.BYTE) { ScanlineB = scb ?? (new byte[ElementsPerRow]); Scanline = null; MaxSampleVal = bitDepth == 16 ? 0xFF : GetMaskForPackedFormatsLs(bitDepth); } else { throw new PngjExceptionInternal("bad ImageLine initialization"); } Rown = -1; }
/// <summary> Constructs an ImageLine </summary> /// <param name="imgInfo">Inmutable copy of PNG ImageInfo</param> /// <param name="sampleType">Storage for samples:INT (default) or BYTE</param> /// <param name="unpackedMode">If true and bitdepth less than 8, samples are unpacked. This has no effect if biddepth 8 or 16</param> public ImageLine(ImageInfo imgInfo, ESampleType sampleType, bool unpackedMode, int[] scanLineInt, byte[] scanLineBytes, int imageRow) { this._imgInfo = imgInfo; channels = imgInfo.Channels; this.bitDepth = imgInfo.BitDepth; this.FilterUsed = FilterType.FILTER_UNKNOWN; this.SampleType = sampleType; this.SamplesUnpacked = unpackedMode || !imgInfo.Packed; this._elementsPerRow = this.SamplesUnpacked ? imgInfo.SamplesPerRow : imgInfo.SamplesPerRowPacked; this._imageRow = imageRow; if (sampleType == ESampleType.INT) { _scanline = scanLineInt != null ? scanLineInt : new int[ElementsPerRow]; _scanlineB = null; this._maxSampleVal = bitDepth == 16 ? 0xFFFF : GetMaskForPackedFormatsLs(bitDepth); } else if (sampleType == ESampleType.BYTE) { _scanlineB = scanLineBytes != null ? scanLineBytes : new byte[ElementsPerRow]; _scanline = null; this._maxSampleVal = bitDepth == 16 ? 0xFF : GetMaskForPackedFormatsLs(bitDepth); } else { throw new System.Exception("bad ImageLine initialization"); } }
internal ImageLine( ImageInfo imgInfo, ESampleType stype, bool unpackedMode, int [] sci, byte [] scb ) { this.ImgInfo = imgInfo; channels = imgInfo.Channels; this.bitDepth = imgInfo.BitDepth; this.FilterUsed = FilterType.FILTER_UNKNOWN; this.SampleType = stype; this.SamplesUnpacked = unpackedMode || !imgInfo.Packed; ElementsPerRow = this.SamplesUnpacked ? imgInfo.SamplesPerRow : imgInfo.SamplesPerRowPacked; if ( stype == ESampleType.INT ) { Scanline = sci != null ? sci : new int [ ElementsPerRow ]; ScanlineB = null; maxSampleVal = bitDepth == 16 ? 0xFFFF : GetMaskForPackedFormatsLs ( bitDepth ); } else if ( stype == ESampleType.BYTE ) { ScanlineB = scb != null ? scb : new byte [ ElementsPerRow ]; Scanline = null; maxSampleVal = bitDepth == 16 ? 0xFF : GetMaskForPackedFormatsLs ( bitDepth ); } else throw new PngjExceptionInternal ( "bad ImageLine initialization" ); this.Rown = -1; }
internal ImageLine(ImageInfo imgInfo, ESampleType stype, bool unpackedMode, int[] sci, byte[] scb) { ImgInfo = imgInfo; channels = imgInfo.Channels; bitDepth = imgInfo.BitDepth; FilterUsed = FilterType.FILTER_UNKNOWN; SampleType = stype; SamplesUnpacked = (unpackedMode || !imgInfo.Packed); ElementsPerRow = (SamplesUnpacked ? imgInfo.SamplesPerRow : imgInfo.SamplesPerRowPacked); switch (stype) { case ESampleType.INT: Scanline = ((sci != null) ? sci : new int[ElementsPerRow]); ScanlineB = null; maxSampleVal = ((bitDepth == 16) ? 65535 : GetMaskForPackedFormatsLs(bitDepth)); break; case ESampleType.BYTE: ScanlineB = ((scb != null) ? scb : new byte[ElementsPerRow]); Scanline = null; maxSampleVal = ((bitDepth == 16) ? 255 : GetMaskForPackedFormatsLs(bitDepth)); break; default: throw new PngjExceptionInternal("bad ImageLine initialization"); } Rown = -1; }
/// <summary> /// Constructs an ImageLine /// </summary> /// <param name="imgInfo">Inmutable copy of PNG ImageInfo</param> /// <param name="stype">Storage for samples:INT (default) or BYTE</param> /// <param name="unpackedMode">If true and bitdepth less than 8, samples are unpacked. This has no effect if biddepth 8 or 16</param> public ImageLine(ImageInfo imgInfo, ESampleType stype, bool unpackedMode) : this(imgInfo, stype, unpackedMode, null, null) { }
public ImageLine(ImageInfo imgInfo, ESampleType stype) : this(imgInfo, stype, false) { }
public ImageLine(ImageInfo imgInfo, ESampleType stype) : this(imgInfo, stype, unpackedMode : false) { }