Just tested under Java 1.4.1_01/Linux 2.4.18-686 -> cups 1.1.14 -> hp psc 750 with 
300x300dpi:

a)

public int print(Graphics g, PageFormat pf, int pageIndex) {
 if (pageIndex == 0) {
  BufferedImage bi = new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB);
  bi.setRGB(0, 0, 0x000000);
  bi.setRGB(0, 1, 0xffffff);
  bi.setRGB(1, 0, 0xffffff);
  bi.setRGB(1, 1, 0x000000);

  Graphics2D g2d = (Graphics2D) g;
  g2d.translate(pf.getImageableX(), pf.getImageableY());
  g2d.scale(200, 200);
  g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
     RenderingHints.VALUE_INTERPOLATION_BILINEAR);
  g2d.drawImage(bi, null, null);
  return Printable.PAGE_EXISTS;
 } else {
  return Printable.NO_SUCH_PAGE;
}

=> PrintJob size: 3k
RenderingHints.VALUE_INTERPOLATION_BILINEAR ignored!

b)
public int print(Graphics g, PageFormat pf, int pageIndex) {
 if (pageIndex == 0) {
  BufferedImage bi = new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB);
  bi.setRGB(0, 0, 0x000000);
  bi.setRGB(0, 1, 0xffffff);
  bi.setRGB(1, 0, 0xffffff);
  bi.setRGB(1, 1, 0x000000);

  Graphics2D g2d = (Graphics2D) g;
  g2d.translate(pf.getImageableX(), pf.getImageableY());
  AffineTransform af = g2d.getTransform();
  g2d.scale(1. / af.getScaleX(), 1. / af.getScaleY());
  af.scale(200, 200);
  AffineTransformOp op = new AffineTransformOp(af,
      AffineTransformOp.TYPE_BILINEAR);

  BufferedImage dest = op.filter(bi, null);
  g2d.drawImage(dest, null, null);
  return Printable.PAGE_EXISTS;
 } else {
  return Printable.NO_SUCH_PAGE;
}

=> PrintJob size:  426k
bilinear Interpolation!

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to