< prev index next >
modules/graphics/src/main/java/com/sun/javafx/iio/bmp/BMPImageLoaderFactory.java
Print this page
rev 8890 : RT-40778
*** 472,494 ****
return null;
}
int hght = Math.abs(bih.biHeight);
! if ((width > 0 && width != bih.biWidth) ||
! (height > 0 && height != hght))
! {
! throw new IOException("scaling for BMP is not supported");
! }
// Pass image metadata to any listeners.
ImageMetadata imageMetadata = new ImageMetadata(null, Boolean.TRUE,
! null, null, null, null, null, bih.biWidth, hght,
null, null, null);
updateImageMetadata(imageMetadata);
! int stride = bih.biWidth * 3;
byte image[] = new byte[stride * hght];
switch (bih.biBitCount) {
case 1:
--- 472,493 ----
return null;
}
int hght = Math.abs(bih.biHeight);
! int[] outWH = ImageTools.computeDimensions(bih.biWidth, hght, width, height, preserveAspectRatio);
! width = outWH[0];
! height = outWH[1];
// Pass image metadata to any listeners.
ImageMetadata imageMetadata = new ImageMetadata(null, Boolean.TRUE,
! null, null, null, null, null, width, height,
null, null, null);
updateImageMetadata(imageMetadata);
! int bpp = 3;
! int stride = bih.biWidth * bpp;
byte image[] = new byte[stride * hght];
switch (bih.biBitCount) {
case 1:
*** 527,538 ****
break;
default:
throw new IOException("Unknown BMP bit depth");
}
! return new ImageFrame(ImageStorage.ImageType.RGB, ByteBuffer.wrap(image),
! bih.biWidth, hght, stride, null, null);
}
}
public final class BMPImageLoaderFactory implements ImageLoaderFactory {
--- 526,543 ----
break;
default:
throw new IOException("Unknown BMP bit depth");
}
! ByteBuffer img = ByteBuffer.wrap(image);
! if (bih.biWidth != width || hght != height) {
! img = ImageTools.scaleImage(img, bih.biWidth, hght, bpp,
! width, height, smooth);
! }
!
! return new ImageFrame(ImageStorage.ImageType.RGB, img,
! width, height, width * bpp, null, imageMetadata);
}
}
public final class BMPImageLoaderFactory implements ImageLoaderFactory {
< prev index next >