Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Printer doesn't stretch any B&W images.


Hi,

I've seen in Eclipse's search that sometimes, few printer doesn't print images (transparent one ?).

I'm experimenting a problem with few images printed by my program, it appear that the one I create from a byte array (by code),
aren't stretched by printer.
I use same code to draw images on gc (created from Display or Printer):
          gc.drawImage( _img, 0,0,oiw,oih, x,ys,iw,ih );
where oiw,oih are size of image, and iw,ih are size of image rescaled to device (using dpi factors).
This code is used to tile images (I'em trying to render a filled patterns).

Here is a screen shot (images drawn to display):

And here is a scan of the print I got, as you can see first image is correctly rescaled, but second one not :
(sorry for the bad resolution, but obviously second images aren't stretched).

the only difference I can see is the way I create images:
- first comes from a file :
        new Image( device, "D:\\tmp\test_image2.png" );
- second comes from a byte array, here is the piece of code I use:
  private static Image getPattern( Device device, RGB _fore, RGB _back, byte pattern_[] )
  {
      RGB rgb[] = new RGB[] { _back, _fore };//_back };
      PaletteData pal = new PaletteData( rgb );
      ImageData data = "" ImageData(64,64,1,pal,1, pattern_ );
      data.transparentPixel = 0;
      Image img_pat_ = new Image( device, data );
      return img_pat_;
  }

Perhaps the way I create image is wrong ?
I'm not sure this printing problem is due to  SWT or if the postscript interpreter can't handle correctly this kind of images...
[this will be very strange for a recent laser printer of a well known company .. ;-)]

Is there any one facing this kind of behaviour ?
Thanks a lot.

Arnaud.

PS: here is the generated postcript code :

Attachment: pattern_screenshot.png
Description: Binary data

Attachment: pattern_scan.png
Description: Binary data

Attachment: print.zip
Description: Zip archive


Back to the top