예제 #1
0
        public override Object getDataElements(int x, int y, Object obj, DataBuffer data)
        {
            if (x < 0 || y < 0 || x >= this.width || y >= this.height)
            {
                // awt.63=Coordinates are not in bounds
                throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
            }
            switch (getTransferType())
            {
            case DataBuffer.TYPE_BYTE:
                byte[] bdata;
                if (obj == null)
                {
                    bdata = new byte[1];
                }
                else
                {
                    bdata = (byte[])obj;
                }

                bdata[0] = (byte)data.getElem(y * scanlineStride + x);
                obj      = bdata;
                break;

            case DataBuffer.TYPE_USHORT:
                short[] sdata;
                if (obj == null)
                {
                    sdata = new short[1];
                }
                else
                {
                    sdata = (short[])obj;
                }

                sdata[0] = (short)data.getElem(y * scanlineStride + x);
                obj      = sdata;
                break;

            case DataBuffer.TYPE_INT:
                int[] idata;
                if (obj == null)
                {
                    idata = new int[1];
                }
                else
                {
                    idata = (int[])obj;
                }

                idata[0] = data.getElem(y * scanlineStride + x);
                obj      = idata;
                break;
            }
            return(obj);
        }
예제 #2
0
        public override int getSample(int x, int y, int b, DataBuffer data)
        {
            if (x < 0 || y < 0 || x >= this.width || y >= this.height)
            {
                // awt.63=Coordinates are not in bounds
                throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
            }

            return(data.getElem(bankIndices[b], y * scanlineStride +
                                x * pixelStride + bandOffsets[b]));
        }
예제 #3
0
        public override int getSample(int x, int y, int b, DataBuffer data)
        {
            if (x < 0 || y < 0 || x >= this.width || y >= this.height)
            {
                // awt.63=Coordinates are not in bounds
                throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
            }
            int sample = data.getElem(y * scanlineStride + x);

            return(java.dotnet.lang.Operator.shiftRightUnsignet((sample & this.bitMasks[b]), this.bitOffsets[b]));
        }
예제 #4
0
        public override void setSample(int x, int y, int b, int s, DataBuffer data)
        {
            if (x < 0 || y < 0 || x >= this.width || y >= this.height)
            {
                // awt.63=Coordinates are not in bounds
                throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
            }
            int tmp = data.getElem(y * scanlineStride + x);

            tmp &= ~this.bitMasks[b];
            tmp |= (s << this.bitOffsets[b]) & this.bitMasks[b];
            data.setElem(y * scanlineStride + x, tmp);
        }
        public override int getSample(int x, int y, int b, DataBuffer data)
        {
            if (x < 0 || y < 0 || x >= this.width || y >= this.height || b != 0)
            {
                // awt.63=Coordinates are not in bounds
                throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
            }

            int bitnum = dataBitOffset + x * pixelBitStride;
            int elem   = data.getElem(y * scanlineStride + bitnum / dataElementSize);
            int shift  = dataElementSize - (bitnum & (dataElementSize - 1)) -
                         pixelBitStride;

            return((elem >> shift) & bitMask);
        }
        /**
         * This method is used by other methods of this class. The behaviour of
         * this method depends on the method which has been invoke this one. The
         * argument methodId is used to choose valid behaviour in a particular case.
         * If methodId is equal to 1 it means that this method has been invoked by
         * the setDataElements() method, 2 - means setPixel(), and setSample() in
         * any other cases.
         */
        private void setSample(int x, int y, Object obj,
                               DataBuffer data, int methodId, int s)
        {
            if ((x < 0) || (y < 0) || (x >= this.width) || (y >= this.height))
            {
                // awt.63=Coordinates are not in bounds
                throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
            }

            int bitnum = dataBitOffset + x * pixelBitStride;
            int idx    = y * scanlineStride + bitnum / dataElementSize;
            int shift  = dataElementSize - (bitnum & (dataElementSize - 1))
                         - pixelBitStride;
            int mask = ~(bitMask << shift);
            int elem = data.getElem(idx);

            switch (methodId)
            {
            case 1:
            {                                // Invoked from setDataElements()
                switch (getTransferType())
                {
                case DataBuffer.TYPE_BYTE:
                    s = ((byte[])obj)[0] & 0xff;
                    break;

                case DataBuffer.TYPE_USHORT:
                    s = ((short[])obj)[0] & 0xffff;
                    break;

                case DataBuffer.TYPE_INT:
                    s = ((int[])obj)[0];
                    break;
                }
                break;
            }

            case 2:
            {                                // Invoked from setPixel()
                s = ((int[])obj)[0];
                break;
            }
            }

            elem &= mask;
            elem |= (s & bitMask) << shift;
            data.setElem(idx, elem);
        }
예제 #7
0
        public override int getSample(int x, int y, int b, DataBuffer data)
        {
            if (x < 0 || y < 0 || x >= this.width || y >= this.height)
            {
                // awt.63=Coordinates are not in bounds
                throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
            }

            return data.getElem(bankIndices[b], y * scanlineStride + x +
                   bandOffsets[b]);
        }
 public override void setSample(int x, int y, int b, int s, DataBuffer data)
 {
     if (x < 0 || y < 0 || x >= this.width || y >= this.height)
     {
         // awt.63=Coordinates are not in bounds
         throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
     }
     int tmp = data.getElem(y * scanlineStride + x);
     tmp &= ~this.bitMasks[b];
     tmp |= (s << this.bitOffsets[b]) & this.bitMasks[b];
     data.setElem(y * scanlineStride + x, tmp);
 }
 public override int getSample(int x, int y, int b, DataBuffer data)
 {
     if (x < 0 || y < 0 || x >= this.width || y >= this.height)
     {
         // awt.63=Coordinates are not in bounds
         throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
     }
     int sample = data.getElem(y * scanlineStride + x);
     return java.dotnet.lang.Operator.shiftRightUnsignet((sample & this.bitMasks[b]), this.bitOffsets[b]);
 }
        public override Object getDataElements(int x, int y, Object obj, DataBuffer data)
        {
            if (x < 0 || y < 0 || x >= this.width || y >= this.height)
            {
                // awt.63=Coordinates are not in bounds
                throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
            }
            switch (getTransferType())
            {
                case DataBuffer.TYPE_BYTE:
                    byte[] bdata;
                    if (obj == null)
                    {
                        bdata = new byte[1];
                    }
                    else
                    {
                        bdata = (byte[])obj;
                    }

                    bdata[0] = (byte)data.getElem(y * scanlineStride + x);
                    obj = bdata;
                    break;
                case DataBuffer.TYPE_USHORT:
                    short[] sdata;
                    if (obj == null)
                    {
                        sdata = new short[1];
                    }
                    else
                    {
                        sdata = (short[])obj;
                    }

                    sdata[0] = (short)data.getElem(y * scanlineStride + x);
                    obj = sdata;
                    break;
                case DataBuffer.TYPE_INT:
                    int[] idata;
                    if (obj == null)
                    {
                        idata = new int[1];
                    }
                    else
                    {
                        idata = (int[])obj;
                    }

                    idata[0] = data.getElem(y * scanlineStride + x);
                    obj = idata;
                    break;
            }
            return obj;
        }
        /**
         * This method is used by other methods of this class. The behaviour of
         * this method depends on the method which has been invoke this one. The
         * argument methodId is used to choose valid behaviour in a particular case.
         * If methodId is equal to 1 it means that this method has been invoked by
         * the setDataElements() method, 2 - means setPixel(), and setSample() in
         * any other cases.
         */
        private void setSample(int x, int y, Object obj,
                 DataBuffer data, int methodId, int s)
        {
            if ((x < 0) || (y < 0) || (x >= this.width) || (y >= this.height))
            {
                // awt.63=Coordinates are not in bounds
                throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
            }

            int bitnum = dataBitOffset + x * pixelBitStride;
            int idx = y * scanlineStride + bitnum / dataElementSize;
            int shift = dataElementSize - (bitnum & (dataElementSize - 1))
                    - pixelBitStride;
            int mask = ~(bitMask << shift);
            int elem = data.getElem(idx);

            switch (methodId)
            {
                case 1:
                    {                        // Invoked from setDataElements()
                        switch (getTransferType())
                        {
                            case DataBuffer.TYPE_BYTE:
                                s = ((byte[])obj)[0] & 0xff;
                                break;
                            case DataBuffer.TYPE_USHORT:
                                s = ((short[])obj)[0] & 0xffff;
                                break;
                            case DataBuffer.TYPE_INT:
                                s = ((int[])obj)[0];
                                break;
                        }
                        break;
                    }
                case 2:
                    {                        // Invoked from setPixel()
                        s = ((int[])obj)[0];
                        break;
                    }
            }

            elem &= mask;
            elem |= (s & bitMask) << shift;
            data.setElem(idx, elem);
        }
        public override int getSample(int x, int y, int b, DataBuffer data)
        {
            if (x < 0 || y < 0 || x >= this.width || y >= this.height || b != 0)
            {
                // awt.63=Coordinates are not in bounds
                throw new java.lang.ArrayIndexOutOfBoundsException("Coordinates are not in bounds"); //$NON-NLS-1$
            }

            int bitnum = dataBitOffset + x * pixelBitStride;
            int elem = data.getElem(y * scanlineStride + bitnum / dataElementSize);
            int shift = dataElementSize - (bitnum & (dataElementSize - 1)) -
                    pixelBitStride;

            return (elem >> shift) & bitMask;
        }