|
-
Feb 17th, 2002, 02:10 PM
#1
Thread Starter
PowerPoster
Picturebox Capers
Guys,
I'm having problems with resizing images and displaying them.
I have the images stored in a picturebox, I resize them to another picture box using StretchBlt and they appear to lose colour depth.
This is irritating me.
Any ideas how I can get around this?
Thanks in advance...
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Feb 17th, 2002, 02:29 PM
#2
Thread Starter
PowerPoster
Additional:
The output of the resized picture is a 24 bit bitmap, so it's not losing the colour palette/depth.
In which case, there must be something wrong with the StretchBlt's resizing method.
Great.
Any ideas how to stop it maiming the image?
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Feb 17th, 2002, 04:42 PM
#3
Hi,
Just load the BMP into both picture boxs to set the palettes up
correctly, then imediatley after do your blitting...
could do this either with load picture (just to test) then try
picture1.picture=picture2.picture
blitstuff here
HTH.
-
Feb 17th, 2002, 06:03 PM
#4
Good Ol' Platypus
Try passing different values to the SetStretchBltMode API call (or whatever its called ).
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 17th, 2002, 06:34 PM
#5
Thread Starter
PowerPoster
Jenk,
Done that, the problem seems to lie with the stretchblt call.
Sas,
I'll have a look at it in more detail and post back.
Thanks guys....
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Feb 18th, 2002, 07:18 AM
#6
Thread Starter
PowerPoster
Guys,
I've had a look at the call and I'm using it correctly. I've also had a look at loads of tutorials on it and they all use it the same way I have.
So why is the image seeming to lose colour depth? The image is still 24 bit, but it's cut down the number of used colours.
This is driving me crazy...
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Feb 18th, 2002, 02:01 PM
#7
Ok - this may be a long shot, but check out the StrechDIBits api.
This has a parameter for forcing the colour table palette.
(either RGB or PAL)
Its more complex to use but may solve your problem...
-
Feb 18th, 2002, 07:31 PM
#8
Thread Starter
PowerPoster
Hmmmm..... The shot's so long, I need binoculars to see the end of it.
Well, as I'm too drunk to type any long words (or even see straight) I'll have a look at that idea tomorrow.
Cheers dude!
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Feb 21st, 2002, 11:20 AM
#9
Frenzied Member
programming drunk is fun ...
the next day you only wonder about the wierd code you came up with
well basically don't do that to much, I hardly ever drink and if so I am normaly to tired to concentrate. (well maybe to drunk too )
Sanity is a full time job
Puh das war harter Stoff!
-
Feb 21st, 2002, 10:22 PM
#10
Addicted Member
DIBits functions rule, but they suck for downsampling. to resize down you have to set the resizing mode properly... i forget which mode to use. You could always do a manual resize with GetDIBits and StretchDIBits, too.
"1 4m 4 1337 #4xz0r!'
Janus
-
Feb 24th, 2002, 02:40 AM
#11
Thread Starter
PowerPoster
Goddamn!
I've just checked on this thread and realised that I'd utterly forgot about that last bit. This is what happens when you're drunk! 
I'm looking into that StretchDlBits thing now...
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Feb 24th, 2002, 04:31 AM
#12
Thread Starter
PowerPoster
Right,
I've had a look and it's confused the hell out of me.
What's the default StretchBltMode btw?
And that StretchDIBits just blew my head off my shoulders and halfway across the street.
Anyone got a good tutorial of the thing in action (preferably downsizing images)...?
Please? I'd love you forever....
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Feb 24th, 2002, 11:26 AM
#13
Addicted Member
Yes, I have a number of examples, I'll try and throw together one for resizing...
Until then, check out this example from PSC:
http://www.planet-source-code.com/vb...29762&lngWId=1
I wrote it a while back, it shows how to use GetDIBits and StretchDIBits. With enough smarts you could modify it to do manual downsampling. 
I think the resampling mode you want is COLORONCOLOR, but I forget.
"1 4m 4 1337 #4xz0r!'
Janus
-
Feb 24th, 2002, 12:28 PM
#14
Thread Starter
PowerPoster
Thankyou Janus.
I'll look at that now - greatly appreciated!
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Mar 11th, 2002, 11:09 AM
#15
Thread Starter
PowerPoster
Janus,
You'll be pleased to know I had a look at that.
Less pleased to know that I have absolutely no idea what's going on.
I'm crap at GDI stuff and the code in there is simply beyond me.
MY head hurts....
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|