Solved

Stretchblt to printer

Posted on 2002-06-24
13
501 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

806 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