PDLab.java (pdfbox-2.0.23-src) | : | PDLab.java (pdfbox-2.0.24-src) | ||
---|---|---|---|---|
skipping to change at line 73 | skipping to change at line 73 | |||
// | // | |||
@Override | @Override | |||
public BufferedImage toRGBImage(WritableRaster raster) throws IOException | public BufferedImage toRGBImage(WritableRaster raster) throws IOException | |||
{ | { | |||
int width = raster.getWidth(); | int width = raster.getWidth(); | |||
int height = raster.getHeight(); | int height = raster.getHeight(); | |||
BufferedImage rgbImage = new BufferedImage(width, height, BufferedImage. TYPE_INT_RGB); | BufferedImage rgbImage = new BufferedImage(width, height, BufferedImage. TYPE_INT_RGB); | |||
WritableRaster rgbRaster = rgbImage.getRaster(); | WritableRaster rgbRaster = rgbImage.getRaster(); | |||
float minA = getARange().getMin(); | PDRange aRange = getARange(); | |||
float maxA = getARange().getMax(); | PDRange bRange = getBRange(); | |||
float minB = getBRange().getMin(); | float minA = aRange.getMin(); | |||
float maxB = getBRange().getMax(); | float maxA = aRange.getMax(); | |||
float minB = bRange.getMin(); | ||||
float maxB = bRange.getMax(); | ||||
float deltaA = maxA - minA; | ||||
float deltaB = maxB - minB; | ||||
// always three components: ABC | // always three components: ABC | |||
float[] abc = new float[3]; | float[] abc = new float[3]; | |||
for (int y = 0; y < height; y++) | for (int y = 0; y < height; y++) | |||
{ | { | |||
for (int x = 0; x < width; x++) | for (int x = 0; x < width; x++) | |||
{ | { | |||
raster.getPixel(x, y, abc); | raster.getPixel(x, y, abc); | |||
// 0..255 -> 0..1 | // 0..255 -> 0..1 | |||
abc[0] /= 255; | abc[0] /= 255; | |||
abc[1] /= 255; | abc[1] /= 255; | |||
abc[2] /= 255; | abc[2] /= 255; | |||
// scale to range | // scale to range | |||
abc[0] *= 100; | abc[0] *= 100; | |||
abc[1] = minA + (abc[1] * (maxA - minA)); | abc[1] = minA + abc[1] * deltaA; | |||
abc[2] = minB + (abc[2] * (maxB - minB)); | abc[2] = minB + abc[2] * deltaB; | |||
float[] rgb = toRGB(abc); | float[] rgb = toRGB(abc); | |||
// 0..1 -> 0..255 | // 0..1 -> 0..255 | |||
rgb[0] *= 255; | rgb[0] *= 255; | |||
rgb[1] *= 255; | rgb[1] *= 255; | |||
rgb[2] *= 255; | rgb[2] *= 255; | |||
rgbRaster.setPixel(x, y, rgb); | rgbRaster.setPixel(x, y, rgb); | |||
} | } | |||
skipping to change at line 158 | skipping to change at line 162 | |||
@Override | @Override | |||
public int getNumberOfComponents() | public int getNumberOfComponents() | |||
{ | { | |||
return 3; | return 3; | |||
} | } | |||
@Override | @Override | |||
public float[] getDefaultDecode(int bitsPerComponent) | public float[] getDefaultDecode(int bitsPerComponent) | |||
{ | { | |||
PDRange a = getARange(); | PDRange a = getARange(); | |||
PDRange b = getARange(); | PDRange b = getBRange(); | |||
return new float[] { 0, 100, a.getMin(), a.getMax(), b.getMin(), b.getMa x() }; | return new float[] { 0, 100, a.getMin(), a.getMax(), b.getMin(), b.getMa x() }; | |||
} | } | |||
@Override | @Override | |||
public PDColor getInitialColor() | public PDColor getInitialColor() | |||
{ | { | |||
if (initialColor == null) | if (initialColor == null) | |||
{ | { | |||
initialColor = new PDColor(new float[] { | initialColor = new PDColor(new float[] { | |||
0, | 0, | |||
End of changes. 3 change blocks. | ||||
7 lines changed or deleted | 11 lines changed or added |