Fade an Image

This is a discussion on Fade an Image within the Windows Programming forums, part of the Platform Specific Boards category; Hi i am working on a loop that will get the value of colours that are in the image and ...

  1. #1
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215

    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?

  2. #2
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    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

  3. #3
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    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

  4. #4
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    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...)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. Replies: 1
    Last Post: 05-27-2009, 12:46 PM
  3. Simple Image Processing
    By ejohns85 in forum C++ Programming
    Replies: 4
    Last Post: 03-19-2009, 12:10 PM
  4. Replies: 6
    Last Post: 03-03-2005, 02:52 AM
  5. Replies: 4
    Last Post: 03-02-2003, 08:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21