*/
public final class Picture
{
- @Deprecated
- public static final byte[] BMP = new byte[] { 'B', 'M' };
-
public static final byte[] COMPRESSED1 = { (byte) 0xFE, 0x78, (byte) 0xDA };
public static final byte[] COMPRESSED2 = { (byte) 0xFE, 0x78, (byte) 0x9C };
- @Deprecated
- public static final byte[] EMF = { 0x01, 0x00, 0x00, 0x00 };
-
- @Deprecated
- public static final byte[] GIF = new byte[] { 'G', 'I', 'F' };
public static final byte[] IHDR = new byte[] { 'I', 'H', 'D', 'R' };
- @Deprecated
- public static final byte[] JPG = new byte[] { (byte) 0xFF, (byte) 0xD8 };
private static final POILogger log = POILogFactory
.getLogger( Picture.class );
@Deprecated
- public static final byte[] PNG = new byte[] { (byte) 0x89, 0x50, 0x4E,
+ private static final byte[] PNG = new byte[] { (byte) 0x89, 0x50, 0x4E,
0x47, 0x0D, 0x0A, 0x1A, 0x0A };
- @Deprecated
- public static final byte[] TIFF = new byte[] { 0x49, 0x49, 0x2A, 0x00 };
-
- @Deprecated
- public static final byte[] TIFF1 = new byte[] { 0x4D, 0x4D, 0x00, 0x2A };
- @Deprecated
- public static final byte[] WMF1 = { (byte) 0xD7, (byte) 0xCD, (byte) 0xC6,
- (byte) 0x9A, 0x00, 0x00 };
- // Windows 3.x
- @Deprecated
- public static final byte[] WMF2 = { 0x01, 0x00, 0x09, 0x00, 0x00, 0x03 }; // Windows
- // 3.x
private static int getBigEndianInt( byte[] data, int offset )
{
/*
* http://www.codecomments.com/archive281-2004-3-158083.html
*
- * Algorhitm proposed by Patrick TJ McPhee:
+ * Algorithm proposed by Patrick TJ McPhee:
*
* read 2 bytes make sure they are 'ffd8'x repeatedly: read 2 bytes make
* sure the first one is 'ff'x if the second one is 'd9'x stop else if
}
}
- /**
- * @return the horizontal aspect ratio for picture provided by user
- * @deprecated use more precise {@link #getHorizontalScalingFactor()}
- */
- @Deprecated
- public int getAspectRatioX()
- {
- return _picf.getMx() / 10;
- }
-
- /**
- * @return the vertical aspect ratio for picture provided by user
- * @deprecated use more precise {@link #getVerticalScalingFactor()}
- */
- @Deprecated
- public int getAspectRatioY()
- {
- return _picf.getMy() / 10;
- }
-
/**
* @return picture's content as byte array
*/
/**
* @return The amount the picture has been cropped on the left in twips
+ * @deprecated POI 3.8 beta 4.
*/
@Deprecated
public int getDxaCropLeft()
/**
* @return The amount the picture has been cropped on the right in twips
+ * @deprecated POI 3.8 beta 4.
*/
@Deprecated
public int getDxaCropRight()
/**
* @return The amount the picture has been cropped on the bottom in twips
+ * @deprecated POI 3.8 beta 5.
*/
@Deprecated
public int getDyaCropBottom()
/**
* @return The amount the picture has been cropped on the top in twips
+ * @deprecated POI 3.8 beta 5.
*/
@Deprecated
public int getDyaCropTop()
assertEquals(2, pics.size());
Picture pic1 = pics.get(0);
- assertEquals(27, pic1.getAspectRatioX());
+ assertEquals("FIXME: unable to get image width", -1, pic1.getWidth());
assertEquals(270, pic1.getHorizontalScalingFactor());
- assertEquals(27, pic1.getAspectRatioY());
assertEquals(271, pic1.getVerticalScalingFactor());
assertEquals(12000, pic1.getDxaGoal()); // 21.17 cm / 2.54 cm/inch * 72dpi * 20 = 12000
assertEquals(9000, pic1.getDyaGoal()); // 15.88 cm / 2.54 cm/inch * 72dpi * 20 = 9000
assertEquals(0, pic1.getDyaCropBottom());
Picture pic2 = pics.get(1);
- System.out.println(pic2.getWidth());
- assertEquals(76, pic2.getAspectRatioX());
+ assertEquals("FIXME: unable to get image width", -1, pic2.getWidth());
assertEquals(764, pic2.getHorizontalScalingFactor());
- assertEquals(68, pic2.getAspectRatioY());
assertEquals(685, pic2.getVerticalScalingFactor());
assertEquals(12000, pic2.getDxaGoal()); // 21.17 cm / 2.54 cm/inch * 72dpi * 20 = 12000
assertEquals(9000, pic2.getDyaGoal()); // 15.88 cm / 2.54 cm/inch * 72dpi * 20 = 9000