Solved

Stretchblt to printer

Posted on 2002-06-24
13
488 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
Comment Utility
Have you tried to

SetStretchBltMode(hdc,COLORONCOLOR);

?
0
 
LVL 86

Expert Comment

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

Author Comment

by:ericson
Comment Utility
I'm using the SRCCOPY ROP. I will to try the SetStretchBltMode.

thanks.
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
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
Comment Utility
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
Comment Utility
jkr: Using SetStretchBltMode(hdc,COLORONCOLOR) don't work too.

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


0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
How do I can work with "color scheme"?
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
Comment Utility
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
Comment Utility
hi ericson,
Do you have any additional questions?  Do any comments need clarification?

-- Dan
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 clear a vector as well as how to detect empty vectors in C++.

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now