Hjg.Pngcs.PngReader.ReadRowByte C# (CSharp) Method

ReadRowByte() public method

public ReadRowByte ( int nrow ) : Hjg.Pngcs.ImageLine
nrow int
return Hjg.Pngcs.ImageLine
        public ImageLine ReadRowByte(int nrow)
        {
            if (imgLine == null)
                imgLine = new ImageLine(ImgInfo, ImageLine.ESampleType.BYTE, unpackedMode);
            if (imgLine.Rown == nrow) // already read
                return imgLine;
            ReadRowByte(imgLine.ScanlineB, nrow);
            imgLine.FilterUsed = (FilterType)rowbfilter[0];
            imgLine.Rown = nrow;
            return imgLine;
        }

Same methods

PngReader::ReadRowByte ( byte buffer, int nrow ) : byte[]

Usage Example

コード例 #1
0
    bool ReadImage( PngReader _png )
    {
        /*
        ImageLine line = pngr.ReadRowInt( y );
        int[] scanline = line.Scanline;

        string l = "";
        for( int x=0; x<scanline.Length; x++ )
        {
            int ci = scanline[ x ];
            l += ci.ToString() + ",";
        }

        Debug.Log ("line " + y + ": " + l );
        */

        int x,y;
        for( y=0; y<m_height; y++ )
        {
            ImageLine line = _png.ReadRowByte( y );
            //byte[] lineBytes = _png.ReadRowByte( y );
            byte[] lineBytes = line.ScanlineB;// GetScanlineInt();

            for( x=0; x<m_width; x++ )
            {
                byte src_c = lineBytes[ x ];
                byte remapped_c = src_c;
                if( m_config.m_colorRemapSourceToDest.ContainsKey( (int)src_c ))
                    remapped_c = (byte)m_config.m_colorRemapSourceToDest[ src_c ];
                m_colorUsed[ remapped_c ] = true;

                int dst_i = (y*m_width)+x;
                m_image[ dst_i ] = remapped_c;
            }
        }

        return true;
    }