SinglePixelPackedSampleModel类里
- Java code
public void setPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { int x1 = x + w; int y1 = y + h; if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width || y < 0 || y >= height || h > height || y1 < 0 || y1 > height) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } int lineOffset = y*scanlineStride + x; int srcOffset = 0; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { int value = data.getElem(lineOffset+j); for (int k=0; k < numBands; k++) { value &= ~bitMasks[k]; int srcValue = iArray[srcOffset++]; value |= ((srcValue << bitOffsets[k]) & bitMasks[k]); } data.setElem(lineOffset+j, value); } lineOffset += scanlineStride; } }
value |= ((srcValue << bitOffsets[k])
& bitMasks[k]);
这句为什么要或 那还能set进去么
------解决方案--------------------------------------------------------
LZ看懂了,混个分。谢谢了。呵呵
------解决方案--------------------------------------------------------
java
------解决方案--------------------------------------------------------
数组嘛,这样才能一行一行的取值吧。
------解决方案--------------------------------------------------------
我里个去啊!
我没有看的勇气!