PDA

Click to See Complete Forum and Search --> : StretchBlt if you dare!!!


Mad Compie
Sep 22nd, 2000, 02:01 PM
A have a picturebox on my screen (Visible=True) with dimensions 2000x2000 pixels. It doesn't fit in the 1024x768 screen.
When I StretchBlt the thing to a 400x400 picturebox, everything beyond 1024x768 looks "scrambled".
I set the StretchBltMode to 4 (smoothing), the scrambling remains the same...
How the hell can I retrieve the invisible part?
At the moment, I have to redraw the picture with a different offset until 2000x2000 has been reached. But I think there's a better solution, which, unfortunately, I can't remember!

PaulLewis
Sep 22nd, 2000, 05:32 PM
I have used this to successfully zoom in or out of an image. For convenience I declare the following:


Public Enum StretchMode
ANDSCANS = 1
DELETESCANS = 3
HALFTONE = 4
ORSCANS = 2
End Enum


Note that you're using HALFTONE but I always have used DELETESCANS. This is the best choice when shrinking an image I believe. Halftone would be suitable for zooming in I think, except that I notice in my code I just use DELETESCANS exclusively...

I guess I must have read it somewhere...

My other declares are:
[code]
Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

Declare Function SetStretchBltMode Lib "gdi32" (ByVal hdc As Long, ByVal nStretchMode As Long) As Long
[code]

Hope it helps.

/\/\isanThr0p
Sep 23rd, 2000, 08:04 PM
just put the thing you have in your huge PicBox in another (visible =false, autoredraw = true)
and blit from this one.

That's all
I hope I could help you

Mad Compie
Sep 24th, 2000, 03:55 AM
Thnaks for replying.
But there is still a little problem.
My picturebox contains gfx, after loading from a database file (which contains types, structures and x-y stuff).
BUT: it also contains Label controls...
A Blt of this picturebox would not contain these label controls, except if I should use the GetWindowDC() API. But this API only accepts the visible window area, doesn't it?
Well, that's my question: how to include the label controls - on a 2000x2000 picturebox - in the StretchBlt command?

PaulLewis
Sep 24th, 2000, 04:11 AM
I don't think I realised you had label control you were attempting to merge with the image.

Once again however, I have done a very similar thing in the app I referred to earlier. I didn't use controls however, I simply BitBlt'd the text (called an annotation) onto the image. At that point, my app would save the image and should a user wish to remove the annotation in the future, they were out of luck. If I had wanted to I could have stored the image and annotation seperately however my app was involving live video capture during a laproscopic procedure and it was VERY important that should an image produced from my system be emailed, there was no chance of the serial number of the image being mixed up due to some stupid database error.

To cut a long story short, you can BitBlt the text you want onto the image, then if AutoUpdate is set to true, the merged text is part of the image. If you need to, store the text seperately so that if the user changes the text, then you can recreate the image again.

Oversimplifiying I know, but from the sound of your posts you know what you're doing (more so than me no doubt).

I would offer my actual classes however I am in the process of negotiating a sales/marketing deal and I would hate for any part of the code to be inadvertantly put into the public domain. If you need more details though, I would be happy to cut and paste the few lines at the guts of the code.

Regards

/\/\isanThr0p
Sep 24th, 2000, 05:05 PM
Just use textout to blt the text onto the pic!

It may seem to simple but I think it's a solution!

Mad Compie
Sep 26th, 2000, 12:43 PM
Thanks, /\/\isanThr0p and Paul.
That's what I also had in mind:
To StretchBlt the picture's created image, and after that, just do the several TextOut into the device's DC.
Thanks for the support, guys.

PS. I recently created an algorithm to move a transparent picture VERY fast and smoothly. Functions like TransparentBlt and derivates also works, but it's very stupid to do scrolling with it.
So I worked with memory DC's and BitBlt.
The app I made, scrolls a 256colour transparent GIF in a circle and while moving the mousecursor, the circle's center also changes! Everything happens very fast and smoothly.
If you're interested I could mail you the source. It's all written in clear, simple VB...

bye

PaulLewis
Sep 26th, 2000, 02:07 PM
I'm always interested in learning something new.

Cheers

/\/\isanThr0p
Sep 26th, 2000, 02:59 PM
As always I have the same opinion as Paul, so go for it.

if you like it more to email:
FGutjahr@gmx.de