manoj
Jan 1st, 2000, 02:27 PM
I am doing a project in image processing in Visual basic. I am having some problems regarding bitmap images. I'll detail the problems below.
1) Passing control out of a loop
I am using the following VB code to display the bitmap into an image control. I am taking the values of each pixel from the bitmap file , do some processing, and finally plot each individual pixel on to the image control.Take a look at it.
For x = 1 To head.width
For y = 1 To head.height
img1.PSet (x, y), RGB(r,g,b)
Next y
Next x
The problem with this code is, the user cannot do anything when the bitmap is being displayed, while control is in this loop. I want to give a cancel button to stop the display of the bitmap ie. exit from this loop. Is there a method for this ?
Alternatively, it would be nice if there is a method to speed up the display of the bitmap,like writing the pixel array directly to video memory. [ Using VB only, not using directx ] .In this way, the need for the cancel button would be eliminated.
2)Saving a bitmap
How do I save the image in an image control to a file on the disk in 256 color in BMP format? I used SavePicture method as folows
SavePicture img1.Image, "C:\test.bmp"
The problem is that, it saves the picture in 16 million colors.I cannot use images in 16 Million colors in my project, because I am specifically working with only 256 color bitmaps. Please help.
1) Passing control out of a loop
I am using the following VB code to display the bitmap into an image control. I am taking the values of each pixel from the bitmap file , do some processing, and finally plot each individual pixel on to the image control.Take a look at it.
For x = 1 To head.width
For y = 1 To head.height
img1.PSet (x, y), RGB(r,g,b)
Next y
Next x
The problem with this code is, the user cannot do anything when the bitmap is being displayed, while control is in this loop. I want to give a cancel button to stop the display of the bitmap ie. exit from this loop. Is there a method for this ?
Alternatively, it would be nice if there is a method to speed up the display of the bitmap,like writing the pixel array directly to video memory. [ Using VB only, not using directx ] .In this way, the need for the cancel button would be eliminated.
2)Saving a bitmap
How do I save the image in an image control to a file on the disk in 256 color in BMP format? I used SavePicture method as folows
SavePicture img1.Image, "C:\test.bmp"
The problem is that, it saves the picture in 16 million colors.I cannot use images in 16 Million colors in my project, because I am specifically working with only 256 color bitmaps. Please help.