CSJ2K.Color.SYccColorSpaceMapper.getCompData C# (CSharp) Method

getCompData() public method

Returns, in the blk argument, a block of image data containing the specifed rectangular area, in the specified component. The data is returned, as a copy of the internal data, therefore the returned data can be modified "in place".

The rectangular area to return is specified by the 'ulx', 'uly', 'w' and 'h' members of the 'blk' argument, relative to the current tile. These members are not modified by this method. The 'offset' of the returned data is 0, and the 'scanw' is the same as the block's width. See the 'DataBlk' class.

If the data array in 'blk' is 'null', then a new one is created. If the data array is not 'null' then it is reused, and it must be large enough to contain the block's data. Otherwise an 'ArrayStoreException' or an 'IndexOutOfBoundsException' is thrown by the Java system.

The returned data has its 'progressive' attribute set to that of the input data.

public getCompData ( CSJ2K.j2k.image.DataBlk outblk, int c ) : CSJ2K.j2k.image.DataBlk
outblk CSJ2K.j2k.image.DataBlk
c int The index of the component from which to get the data. Only 0 /// and 3 are valid. /// ///
return CSJ2K.j2k.image.DataBlk
        public override DataBlk getCompData(DataBlk outblk, int c)
        {
            int type = outblk.DataType;

            int i; // j removed

            // Calculate all components:
            for (i = 0; i < ncomps; ++i)
            {

                // Set up the working DataBlk geometry.
                copyGeometry(workInt[i], outblk);
                copyGeometry(workFloat[i], outblk);
                copyGeometry(inInt[i], outblk);
                copyGeometry(inFloat[i], outblk);

                // Request data from the source.
                inInt[i] = (DataBlkInt) src.getInternCompData(inInt[i], i);
            }

            if (type == DataBlk.TYPE_INT)
            {
                if (ncomps == 1)
                    workInt[c] = inInt[c];
                else
                    workInt = mult(inInt);
                outblk.progressive = inInt[c].progressive;
                outblk.Data = workInt[c].Data;
            }

            if (type == DataBlk.TYPE_FLOAT)
            {
                if (ncomps == 1)
                    workFloat[c] = inFloat[c];
                else
                    workFloat = mult(inFloat);
                outblk.progressive = inFloat[c].progressive;
                outblk.Data = workFloat[c].Data;
            }

            // Initialize the output block geometry and set the profiled
            // data into the output block.
            outblk.offset = 0;
            outblk.scanw = outblk.w;

            return outblk;
        }