Solved

StretchBlt Distortion On MY Screen

Posted on 2000-03-18
7
323 Views
Last Modified: 2013-12-03
I use StretchBlt to display bitmaps thst I earlyer created with Photoshop V. 4.0.If the bitmap file was prepared rom a previouse scaned photo than the output is fine.If it was a cartoon taken from a Clipart cd-rom, than it is looked mostly grayscaled and only few areas looked ok, in the c program (while in Photoshop it looks fine).
I tryed to save the bitmap file in different modes(Indexed,RGB...)but nothing helped.

Thanks In Advance

Lesher Izack
0
Comment
Question by:lesher
7 Comments
 
LVL 15

Expert Comment

by:NickRepin
ID: 2633028
Call SetStretchBltMode before stretching the bitmap.

Try different parameters for iStretchMode of SetStretchBltMode.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2633079
Are you making the image larger or smaller?
0
 

Author Comment

by:lesher
ID: 2635525
Even if I try to open the bitmaps with Bitblt(and not in Strechblt) it does not help.It means the problem exists somewhere else.

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 22

Expert Comment

by:nietod
ID: 2635669
>> if I try to open the bitmaps with Bitblt(and not in Strechblt)
You can't "open" them with these functions.

>> it means the problem
>> exists somewhere else
Why?

If you stratch a bitmap it will look different.  You can't avoid that.  If you increase the size the bitmap will begin to get "chunky"  That is, you will start seeing large blocks of pixels and the edges of things will become "jagged".  If you scrink the bitmap you will loose detail.  Small peices of detail will be lost, faint portions may dissappear, the image may become darker (all this depends on the mode), but in any case the results will be a degradation in the image qauality.
0
 
LVL 2

Accepted Solution

by:
xLs earned 200 total points
ID: 2638494
first StrechBlt may with some graphic cards be hw accelerated, which means it could give quite good quality, since the hardware will add a billiar filter(or any present) and will make the result look good. if your card does not support this StrechBlt gives a pretty ugly result(ugly distored lines every now and then and some ugly pixels).

However it seems like you have problems with loading the image properly. if you use the LoadImage
done with
HANDLE hBitmap = LoadImage(NULL,"file.bmp",IMAGE_BITMAP,LR_DEFAULTSIZE,LR_DEFAULTSIZE,LR_LOADFROMFILE);
//then use StretchBlt(...,..,hBitmap,...);

DeleteObject(hBitmap);

// This should atleast give you a a proper loading of the bitmap.


Good luck on you :)
/xLs
0
 
LVL 22

Expert Comment

by:nietod
ID: 2639795
>> StrechBlt may with some graphic cards be hw
>> accelerated, which means it could give quite
>> good quality
It can't prevent degradation of the image.  Nothing can.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2644357
lesher, do you understand how experts exchange works?
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 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