Image.CreateImage & misunderstanding

Bez kategorii Zostaw komentarz

Dokładnie chodzi o następujące przeciążenie metody:
createImage(byte[] imageData, int imageOffset, int imageLength)
Otóż w dokumentacji stoi:

The imageoffset and imagelength parameters specify a range of data within the imageData byte array. The imageOffset parameter specifies the offset into the array of the first data byte to be used. It must therefore lie within the range [0..(imageData.length-1)]. The imageLength parameter specifies the number of data bytes to be used. It must be a positive integer and it must not cause the range to extend beyond the end of the array. That is, it must be true that imageOffset + imageLength < imageData.length.

Z czego wprost wynika że imageLength = imageData.length-1 natomiast powinno być imageLength = imageData.length łopatologicznie: jeżeli mamy byteArray o długości 10 w tablicy [0...9] to wywołujemy metodę tak:
Image.createImage(byteArray, 0, 10);
a nie tak jak to wynika z dokumentacji:
Image.createImage(byteArray, 0, 9);

Zostaw komentarz

Silnik: Wordpress - Theme autorstwa N.Design Studio. Spolszczenie: Adam Klimowski.
RSS wpisów RSS komentarzy Zaloguj