CSJ2K.j2k.wavelet.synthesis.InvWTFull.getCompData C# (CSharp) Метод

getCompData() публичный Метод

Returns a block of image data containing the specifed rectangular area, in the specified component, as a copy (see below). The rectangular area is specified by the coordinates and dimensions of the 'blk' object.

The area to return is specified by the 'ulx', 'uly', 'w' and 'h' members of the 'blk' argument. These members are not modified by this method.

The data returned by this method is always a copy of the internal data of this object, if any, and it can be modified "in place" without any problems after being returned. 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 must be big enough to contain the requested area.

The returned data always has its 'progressive' attribute unset (i.e false)

public getCompData ( CSJ2K.j2k.image.DataBlk blk, int c ) : CSJ2K.j2k.image.DataBlk
blk CSJ2K.j2k.image.DataBlk Its coordinates and dimensions specify the area to /// return. If it contains a non-null data array, then it must be large /// enough. If it contains a null data array a new one is created. The /// fields in this object are modified to return the data. /// ///
c int The index of the component from which to get the data. /// ///
Результат CSJ2K.j2k.image.DataBlk
        public override DataBlk getCompData(DataBlk blk, int c)
        {
            //int j;
            System.Object dst_data; // src_data removed
            int[] dst_data_int; // src_data_int removed
            float[] dst_data_float; // src_data_float removed

            // To keep compiler happy
            dst_data = null;

            // Ensure output buffer
            switch (blk.DataType)
            {

                case DataBlk.TYPE_INT:
                    dst_data_int = (int[]) blk.Data;
                    if (dst_data_int == null || dst_data_int.Length < blk.w * blk.h)
                    {
                        dst_data_int = new int[blk.w * blk.h];
                    }
                    dst_data = dst_data_int;
                    break;

                case DataBlk.TYPE_FLOAT:
                    dst_data_float = (float[]) blk.Data;
                    if (dst_data_float == null || dst_data_float.Length < blk.w * blk.h)
                    {
                        dst_data_float = new float[blk.w * blk.h];
                    }
                    dst_data = dst_data_float;
                    break;
                }

            // Use getInternCompData() to get the data, since getInternCompData()
            // returns reference to internal buffer, we must copy it.
            blk = getInternCompData(blk, c);

            // Copy the data
            blk.Data = dst_data;
            blk.offset = 0;
            blk.scanw = blk.w;
            return blk;
        }