Announcement

Collapse
No announcement yet.

Printing a Bitmap

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printing a Bitmap

    I am having trouble printing a bitmap. The code below works
    with my Epson 1500 Laser, gives a black & white copy of the
    (color) bitmap on a color postscript printer and garbage on
    an HP 712C. Can anybody help?

    In the code, all variables a long
    pdc = printer device context (no error getting this)
    hbm = handle of bitmap

    GetObject hbm, SIZEOF(bm), bm
    bmx = bm.bmWidth
    bmy = bm.bmHeight
    hdc = GetDC(Hwnd)
    mdc = CreateCompatibleDC(hdc)
    SelectObject mdc, hbm
    pdcmem = CreateCompatibleDC(pdc)
    pbm = CreateCompatibleBitmap(pdc, bmx, bmy)
    SelectObject pdcmem, pbm
    BitBlt pdcmem, 0, 0, bmx, bmy, mdc, 0, 0, %SRCCOPY
    BitBlt pdc, 0, 0, bmx, bmy, pdcmem, 0, 0, bmx, bmy, %SRCCOPY

    Now delete objects etc ...

  • #2
    There is an excellent example of printing a color BMP by Don Dickinson in the FILES area of the PB web site... www.powerbasic.com/files/pub



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      You should look at the sample that I posted (see lance's message).
      The reason that your code doesn't work is that BitBlt doesn't work on a bunch or printers. It will work on some. If you're printing a monochrome bitmap it should work on almost all. But for color you really should use DIBs.

      Best Regards,
      Don
      Don Dickinson
      www.greatwebdivide.com

      Comment

      Working...
      X