Results 1 to 40 of 271

Thread: [VB6] - animated gif function errors:(

Threaded View

  1. #11
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [VB6] - animated gif function errors:(

    You should use the one from post #2 testing disposed animated gif files.zip. It handles all of your gif images.

    About the disposal values (methods)

    Code:
    Each frame has the following:
    
    21 F9 04 X1 X2 X3 X4 00
    
    21 F9  these two bytes define the start of the Graphic Control Extension (GCE)
    
    04     this byte tells you there are 4 bytes (to follow) of GCE data
    
    X1     this byte has the Disposal code and whether or not there is a transparent color
    
    X2 X3  delay for animation: not used
    
    X4     value defines which color from the color table is transparent
    
    00     end of GCE block
    
    Following the previous byte is this one
    
    2C     called the Image Descriptor
      '
      '
      '
      '
    Byte X1 is what you are concerned with

    If the low order bit is 1 then there is a transparent color so use byte X4 to get that color from the color table.

    The following calculation extracts the Disposal code from this byte

    DisposalCode = (X1 \ 4) And 3

    From above we get one of the following

    0 Undefined
    1 Leave
    2 Restore Background
    3 Restore Previous

    OK, so much for that

    Now, about avoiding temp files. It could be possible but would require a lot of rewriting the code. The code saves extracted frames from the original file. These saved pieces of data are actually made into a new gif file format so it can be reloaded back into an Image control using the LoadPicture method. To avoid this you would need to save the image data in memory using various APIs which only saves the image data and not the attributes you need, like the disposal values, transparent color, etc. You would also have to save the new gif file string in a string variable which corresponds to the image data also saved. Now you need to examine the string containing the file format to get the attributes you need and then load the image data into the Picture property of an Image control. However you would have to do the work yourself of making the transparent color which is done for you using the LoadPicture method. This requires additional efforts on your part which might be a little more complicated than you may want to get into.
    Last edited by jmsrickland; Jul 27th, 2012 at 02:09 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width