Link to home
Start Free TrialLog in
Avatar of ericson
ericsonFlag for Brazil

asked on

Stretchblt to printer

Hi all,

when i use stretchblt from a memory dc to a printer dc over a bitmap with white backcolor the background of the printed bitmap is draw with dots that looks like shadow (gray background).
anyone can help me??
Avatar of jkr
jkr
Flag of Germany image

Have you tried to

SetStretchBltMode(hdc,COLORONCOLOR);

?
Another issue: What ROP (raster operation) code are you using with 'StretchBlt()'? IIRC, it should be SRCCOPY.
Avatar of ericson

ASKER

I'm using the SRCCOPY ROP. I will to try the SetStretchBltMode.

thanks.
BTW, check the printer settings - there might just be a problem with the selected color scheme also...
MSDN Says

"An application can use the BitBlt() or StretchBlt() function to print or display a monochrome bitmap. Both printer drivers and display drivers can process monochrome DDBs. However, an application must account for the difference in resolution between a typical display and a typical laser printer. The StretchBlt() function enables an application to appropriately change the size of a monochrome bitmap.

When the display bitmap is a color DDB, printing is more difficult because the display DDB format may not match the printer DDB format. Because Windows supports a wide variety of devices, this situation is quite common. When the formats DDB differ, the application must convert the display DDB into a print DDB or a DIB.

DIBs are designed to ease the process of transferring images between devices. When an application uses a DIB, the GDI or the output driver performs any conversions required for the device. The ShowDIB sample application, provided in the Windows SDK and the Win32 SDK, demonstrates converting a DDB to a DIB and other common manipulations. The file DIB.C is of particular interest. It contains the functions that perform the manipulations. This code can be incorporated into other applications.

For more information, please see the Windows SDK 3.1 DIBView sample or the Win32 SDK WinCap32 sample."


TRY "StretchDIBits" INSTEAD OF "StretchBlt".

GOOD LUCK
Avatar of ericson

ASKER

jkr: Using SetStretchBltMode(hdc,COLORONCOLOR) don't work too.

roshmon: I will to try the StretchDIBits instead of StretchBlt.


The color may look like white on your screen, but it might actually be a shade of very light grey.  The printer will handle that by sprinkling a few black dots arounds.  For instance, if the RGB color is (254,254,254) it will be indistinguishable to the human eye from pure white, but the printer might have a different ideas about that!

The solution:  Print bitmaps that have actual white, not 'near white'.  Or find a way to convert the near-white pixels to pure white ones before blitting to the printer DC.

-- Dan

I found a setting in the Printer settings dialog that may affect this problem.  In my LJ4, under the 'Advanced' tab ( Start > Settings > Printers >right-click HPLJ4 > properties ), there is an item called 'Halftone Setup'.  

See if your printer has the same configuration setting avialble and see if changing it makes a difference.  If so, then let us know what happens and we can proceed to a programmatic solution (if that is necessary).

-- Dan
Dan, is that called a "Color Scheme"? (Sorry, no English W2k here, so I have to ask - some MS localizations are, err, "funny" sometimes <s>)
Avatar of ericson

ASKER

How do I can work with "color scheme"?
I didn't see anything about colors, scheming or otherwise.

Also, I see that on my Brother printer here at home, all of the option on Haltone Setup are dimmed out and unavailable.  It does bring to mind an important point -- I think that StretchBlt is actually implemented by the device driver.  So that might be important.

ericson,
What is the brand and type of printer to which you are printing?

-- Dan
I think, he is blitting a DDB bitmap, thats y I suggested a DIB.
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial