int idx = getPictureIndex()-1;\r
EscherBSERecord bse = (EscherBSERecord)lst.get(idx);\r
for ( int i = 0; i < pict.length; i++ ) {\r
- if (Arrays.equals(bse.getUid(), pict[i].getUID())){\r
+ if (pict[i].getOffset() == bse.getOffset()){\r
return pict[i];\r
}\r
}\r
+ System.err.println("Warning - no picture found for our BSE offset " + bse.getOffset());\r
return null;\r
}\r
\r
*/\r
protected byte[] header;\r
\r
+ /**\r
+ * The offset to the picture in the stream\r
+ */\r
+ protected int offset;\r
+\r
public PictureData(){\r
header = new byte[PictureData.HEADER_SIZE];\r
}\r
\r
// Save the picture data\r
pictdata = new byte[size];\r
+ this.offset = offset;\r
System.arraycopy(pictstream, startPos, pictdata, 0, pictdata.length);\r
}\r
\r
return header;\r
}\r
\r
+ /**\r
+ * File offset in the 'Pictures' stream\r
+ *\r
+ * @return offset in the 'Pictures' stream\r
+ */\r
+ public int getOffset(){\r
+ return offset;\r
+ }\r
+\r
+ /**\r
+ * Set offset of this picture in the 'Pictures' stream.\r
+ * We need to set it when a new picture is created.\r
+ *\r
+ * @param offset in the 'Pictures' stream\r
+ */\r
+ public void setOffset(int offset){\r
+ this.offset = offset;\r
+ }\r
+\r
/**\r
* Compute 16-byte checksum of this picture\r
*/\r