示例#1
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$
            }

            data.setElem(bankIndices[b], y * scanlineStride + x * pixelStride
                         + bandOffsets[b], s);
        }
示例#2
0
        public override void setDataElements(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:
                data.setElem(y * scanlineStride + x, ((byte[])obj)[0] & 0xff);
                break;

            case DataBuffer.TYPE_USHORT:
                data.setElem(y * scanlineStride + x, ((short[])obj)[0] & 0xffff);
                break;

            case DataBuffer.TYPE_INT:
                data.setElem(y * scanlineStride + x, ((int[])obj)[0]);
                break;
            }
        }
示例#3
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);
        }
        /**
         * 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);
        }
示例#5
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$
            }

            data.setElem(bankIndices[b], y * scanlineStride + x +
                           bandOffsets[b], s);
        }
 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 void setDataElements(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:
             data.setElem(y * scanlineStride + x, ((byte[])obj)[0] & 0xff);
             break;
         case DataBuffer.TYPE_USHORT:
             data.setElem(y * scanlineStride + x, ((short[])obj)[0] & 0xffff);
             break;
         case DataBuffer.TYPE_INT:
             data.setElem(y * scanlineStride + x, ((int[])obj)[0]);
             break;
     }
 }
        /**
         * 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);
        }