|
-
Mar 2nd, 2001, 12:30 AM
#1
Thread Starter
Member
I decided to make a thumbnailer as my VB learning project, add HTML skillz to that and it comes out pretty good. I am stuck however, on a fairly simple task - resizing a bitmap. There is a gazillion ways of doing this of course, but I can't use one properly. I first tried to use PictureClip and it worked, but the quality was horrible. Now I switched to PaintPicture, which works well but I can't get the output size right.
I load an image into the source picture box, then scale the image to the desired, say, height, and then scale the width accordingly (or the other way), and everything is perfect. When I analize the final height and width variables, they are what they should be, but when I do
picDest.PaintPicture picSrc.Picture, 0, 0, PicHeight, PicWidth
The resulting image dimensions are different from PicHeight and PicWidth (usually smaller)
Any way I can fix that? Or is there another way, without using two pic boxes and their huge overhead?
Thanks
-
Mar 2nd, 2001, 04:13 AM
#2
transcendental analytic
paintpicture syntax is:
object.PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode
by omiting parameters for target size, how could you expect it to resize at all? If you want to leave the source dimensions as they are, you could omit them.
Paintpicture can be used with forms/pictureboxes picture properties, Stretchblt is available for blitting between dc's if you want to keep a lower resource usage.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Mar 2nd, 2001, 10:03 AM
#3
Thread Starter
Member
Oops
I am in awe of my own stupidity - simply variable manipulation and it works.
I can resize like that. Height1 and Width1 are the target size, everything else can be left out. The funny thing is, the result is still 3 pixels less, so I had to add those to the formula. I will look into StretchBlt, I think I have a demo of it somewhere, and it's much faster than Paint.
-
Mar 2nd, 2001, 10:20 AM
#4
transcendental analytic
funny thing is, that Paintpicture is faster Note that scalemode determines what units are is used, that is independently for source and target, that's not probably the problem, if you picturebox has a border and you use the width/height instead of scalewidth/scaleheight then you could get this error.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|