CSJ2K.j2k.image.output.ImgWriterPPM.ImgWriterPPM C# (CSharp) Method

ImgWriterPPM() public method

Creates a new writer to the specified File object, to write data from the specified component.

The three components that will be written as R, G and B must be specified through the b1, b2 and b3 arguments.

public ImgWriterPPM ( IFileInfo out_Renamed, BlkImgDataSrc imgSrc, int n1, int n2, int n3 ) : System
out_Renamed IFileInfo
imgSrc BlkImgDataSrc The source from where to get the image data to write. /// ///
n1 int The index of the first component from where to get the data, /// that will be written as the red channel. /// ///
n2 int The index of the second component from where to get the data, /// that will be written as the green channel. /// ///
n3 int The index of the third component from where to get the data, /// that will be written as the green channel. /// ///
return System
        public ImgWriterPPM(IFileInfo out_Renamed, BlkImgDataSrc imgSrc, int n1, int n2, int n3)
        {
            // Check that imgSrc is of the correct type
            // Check that the component index is valid
            if ((n1 < 0) || (n1 >= imgSrc.NumComps) || (n2 < 0) || (n2 >= imgSrc.NumComps) || (n3 < 0) || (n3 >= imgSrc.NumComps) || (imgSrc.getNomRangeBits(n1) > 8) || (imgSrc.getNomRangeBits(n2) > 8) || (imgSrc.getNomRangeBits(n3) > 8))
            {
                throw new System.ArgumentException("Invalid component indexes");
            }
            // Initialize
            w = imgSrc.getCompImgWidth(n1);
            h = imgSrc.getCompImgHeight(n1);
            // Check that all components have same width and height
            if (w != imgSrc.getCompImgWidth(n2) || w != imgSrc.getCompImgWidth(n3) || h != imgSrc.getCompImgHeight(n2) || h != imgSrc.getCompImgHeight(n3))
            {
                throw new System.ArgumentException("All components must have the" + " same dimensions and no" + " subsampling");
            }
            w = imgSrc.ImgWidth;
            h = imgSrc.ImgHeight;

            // Continue initialization
            if (out_Renamed.Exists && !out_Renamed.Delete())
            {
                throw new System.IO.IOException("Could not reset file");
            }
            this.out_Renamed = SupportClass.RandomAccessFileSupport.CreateRandomAccessFile(out_Renamed, "rw");
            src = imgSrc;
            cps[0] = n1;
            cps[1] = n2;
            cps[2] = n3;
            fb[0] = imgSrc.getFixedPoint(n1);
            fb[1] = imgSrc.getFixedPoint(n2);
            fb[2] = imgSrc.getFixedPoint(n3);

            levShift[0] = 1 << (imgSrc.getNomRangeBits(n1) - 1);
            levShift[1] = 1 << (imgSrc.getNomRangeBits(n2) - 1);
            levShift[2] = 1 << (imgSrc.getNomRangeBits(n3) - 1);

            writeHeaderInfo();
        }

Same methods

ImgWriterPPM::ImgWriterPPM ( System fname, BlkImgDataSrc imgSrc, int n1, int n2, int n3 ) : System