|
-
Aug 3rd, 2000, 11:24 AM
#1
Thread Starter
Lively Member
Maybe you guys (or girls) can help me out. I have an application that displays items in a listbox. The user can choose to associate a graphics file with each item. As they click through the list a small preview of the graphic is loaded into an image box. This works great until the graphics get to a large size. With jpegs at about 650 x 900 the loading is noticeably slow. Using smaller images helps, but I really want the images to stay large as they can also be viewed at their original size in the program. Any tips or pointers?
Cthulhu Dragon
-
Aug 3rd, 2000, 12:04 PM
#2
Fanatic Member
It will sure help if you post part of you codes. Are you using LoadPicture with an image control?
Chemically Formulated As:
Dr. Nitro
-
Aug 3rd, 2000, 12:10 PM
#3
Thread Starter
Lively Member
I would post if I could, but my code is at home and I am not. 
but, yes I am using the imagebox.picture = loadpicture("Blah") method
I do this in response to the listbox click.
-
Aug 3rd, 2000, 12:27 PM
#4
Fanatic Member
Maybe you can have it load in one imagebox first but have that one hidden and when the user select that file, show that imagebox and hide the other one while loading the next picture into it.
OR
You can use the API BitBlt to paint the picture on.
Chemically Formulated As:
Dr. Nitro
-
Aug 3rd, 2000, 12:39 PM
#5
Thread Starter
Lively Member
I have several hundred entries each containing a picture and I have no way of knowing which will be the next one clicked.
I have thought about bitblt, but was checking if there was a VB way. API it is!
[Edited by CthulhuDragon on 08-03-2000 at 06:25 PM]
-
Aug 3rd, 2000, 12:58 PM
#6
Fanatic Member
Kedaman and Fox knows about this stuff. Send an email to them and I am sure they can help you out.
Chemically Formulated As:
Dr. Nitro
-
Aug 3rd, 2000, 01:00 PM
#7
Keep in mind that BitBlt cannot stretch or shrink the image. It you would like to stretch it, than I suggest that you use the StretchBlt API.
If you want to stay away from API, than the VB equivilent is PaintPicture. The disadvantage of this is that it's a little slower.
-
Aug 3rd, 2000, 04:54 PM
#8
transcendental analytic
Actually, it's Paintpicture that is faster than Stretchblt in stretching images, so don't use Stetchblt.
Also, Loadpicture is the fastest way i can think of, use bitmaps instead of gif's or jpg's.
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.
-
Aug 3rd, 2000, 05:17 PM
#9
Thread Starter
Lively Member
I got a little curious so I did a little test to see what was faster and by how much. I used 2 picture boxes and 2 image boxes. I used paintpicture on the picture boxes and loadpicture on the image boxes. I loaded a 300k jpg into 2 boxes using each method, and a 3.5 MB bmp into the other boxes. They were the same picture one was simply saved as a bmp from a jpg. I used gettickcount before and after the load to see the difference.
Here are the results (These are averages):
JPG using paintpicture - .31s
JPG using loadpicture - .297s
BMP using paintpicture - .063s
BMP using Loadpicture - .078s
So basically the only real difference comes in using BMPs instead of JPGs. But the downside is in diskspace usage.
Cthulhu Dragon
-
Aug 3rd, 2000, 05:51 PM
#10
Kedaman: Stats have shown that StretchBlt is faster.
CthulhuDragon: For the most part, those stats are right, but keep in mind that you can give or take 3ms or so on each result. (It's only a fractional amount so don't worry about it)
-
Aug 3rd, 2000, 07:03 PM
#11
transcendental analytic
Then you have the wrong Stats Meg, probably because you have Autoredraw messing around; I have done tests on this, Paintpicture is roughly 25% faster.
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
|