Solved

Stretchblt to printer

Posted on 2002-06-24
13
522 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

691 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