Solved

Stretchblt to printer

Posted on 2002-06-24
13
507 Views
Last Modified: 2012-06-21
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??
0
Comment
Question by:ericson
  • 4
  • 4
  • 3
  • +1
13 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 7105187
Have you tried to

SetStretchBltMode(hdc,COLORONCOLOR);

?
0
 
LVL 86

Expert Comment

by:jkr
ID: 7105234
Another issue: What ROP (raster operation) code are you using with 'StretchBlt()'? IIRC, it should be SRCCOPY.
0
 

Author Comment

by:ericson
ID: 7105586
I'm using the SRCCOPY ROP. I will to try the SetStretchBltMode.

thanks.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 86

Expert Comment

by:jkr
ID: 7106252
BTW, check the printer settings - there might just be a problem with the selected color scheme also...
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7106552
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
0
 

Author Comment

by:ericson
ID: 7108549
jkr: Using SetStretchBltMode(hdc,COLORONCOLOR) don't work too.

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


0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7109310
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

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7109333
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
0
 
LVL 86

Expert Comment

by:jkr
ID: 7109485
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>)
0
 

Author Comment

by:ericson
ID: 7109545
How do I can work with "color scheme"?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7109662
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
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7109670
I think, he is blitting a DDB bitmap, thats y I suggested a DIB.
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 400 total points
ID: 7115821
hi ericson,
Do you have any additional questions?  Do any comments need clarification?

-- Dan
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question