-
Fade an Image
Hi i am working on a loop that will get the value of colours that are in the image and then fade them - once the image has faded i want it to move on to a next image
I am having trouble getting the loop it either multiply the colours by 10 each time the loop is incremented
Can anyone help?
-
Do you want to fade into the second image? Well first get all the pixels of the image, you may want to use DIB (Device indipendant Bitmap) as in this case it would be faster doing calculations on the image. Anyway what ever method you are using in psudo code
for each pixel on vertical
...for each pixel on horizontal
......displayimage[x][y] = image1[x][y][c]*f + image2[x][y][c]*(1-f)
and send displayimage to be displayed. where c is the color (obviously a DIB is not stored in that format). and f is the percent to show image1. Just have F cycle from 1.0 to 0 to fade image1 into image2
-
well i have just come up with some code that might help - just unsure what else i need to add to get it working as there a an access violation. this is the code that im working with
Code:
ImagePixels->Red = TrackBar2->Position;
ImagePixels->Green = TrackBar2->Position;
ImagePixels->Blue = TrackBar2->Position;
there is a class that has the imagepixle values in - this is more to do with brighness but it is still the same idea
-
Perhaps the problem is imagepixels or TrackBar2 is pointing to data that is not proporly owned by your program. Check and make sure imagepixels is within bounds of the memory you allocated, similarly for TrackBar2. to do this debug in someway.
Please provide more info on problem (how images are managed (DIB, getpixel/setpixel, not OS specific et.cc) )(class structure, data structures etc...)