Results 1 to 15 of 15

Thread: Picturebox Capers

  1. #1

    Thread Starter
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276

    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...

  2. #2

    Thread Starter
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    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...

  3. #3
    jenk
    Guest
    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.

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    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)

  5. #5

    Thread Starter
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    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...

  6. #6

    Thread Starter
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    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...

  7. #7
    jenk
    Guest
    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...

  8. #8

    Thread Starter
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    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...

  9. #9
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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!

  10. #10
    Addicted Member Janus's Avatar
    Join Date
    Aug 2001
    Location
    California
    Posts
    221
    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

  11. #11

    Thread Starter
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    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...

  12. #12

    Thread Starter
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    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...

  13. #13
    Addicted Member Janus's Avatar
    Join Date
    Aug 2001
    Location
    California
    Posts
    221
    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

  14. #14

    Thread Starter
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    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...

  15. #15

    Thread Starter
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    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
  •  



Click Here to Expand Forum to Full Width