mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
Corrected images alpha channel rendering
This commit is contained in:
parent
2895ab552a
commit
aa70ff4ff6
|
@ -328,7 +328,7 @@ public class ViewImage {
|
|||
}
|
||||
|
||||
// make a BufferedImage out of that
|
||||
final BufferedImage i = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
final BufferedImage i = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||
try {
|
||||
i.createGraphics().drawImage(scaled, 0, 0, width, height, null);
|
||||
image = i;
|
||||
|
@ -355,14 +355,14 @@ public class ViewImage {
|
|||
*/
|
||||
protected static Image makeSquare(Image image, final int h, final int w) {
|
||||
if (w > h) {
|
||||
final BufferedImage dst = new BufferedImage(h, h, BufferedImage.TYPE_INT_RGB);
|
||||
final BufferedImage dst = new BufferedImage(h, h, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g = dst.createGraphics();
|
||||
final int offset = (w - h) / 2;
|
||||
g.drawImage(image, 0, 0, h - 1, h - 1, offset, 0, h + offset, h - 1, null);
|
||||
g.dispose();
|
||||
image = dst;
|
||||
} else {
|
||||
final BufferedImage dst = new BufferedImage(w, w, BufferedImage.TYPE_INT_RGB);
|
||||
final BufferedImage dst = new BufferedImage(w, w, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g = dst.createGraphics();
|
||||
final int offset = (h - w) / 2;
|
||||
g.drawImage(image, 0, 0, w - 1, w - 1, 0, offset, w - 1, w + offset, null);
|
||||
|
|
|
@ -866,7 +866,7 @@ public class YaCyDefaultServlet extends HttpServlet {
|
|||
if (height < 0) {
|
||||
height = 96; // bad hack
|
||||
}
|
||||
final BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
final BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||
bi.createGraphics().drawImage(i, 0, 0, width, height, null);
|
||||
result = RasterPlotter.exportImage(bi, targetExt);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public class EncodedImage {
|
|||
if (height < 0) {
|
||||
height = 96; // bad hack
|
||||
}
|
||||
final BufferedImage sourceImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
final BufferedImage sourceImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||
sourceImage.createGraphics().drawImage(i, 0, 0, width, height, null);
|
||||
this.image = RasterPlotter.exportImage(sourceImage, targetExt);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user