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 are not paying attention to what I am saying to you.

    First: Asc(91) does not equal 5B. It the other way around; Asc(Chr(&H5B)) = 91. To get the hexadecimal you simply do this Hex(91) = 5B

    If it is decimal 91 (which means the byte is 5B then there is no Global Color Table so it is meaningless to try and to find it's size.

    Second, you do not use the last 3-bits like you are doing. Do not do this:

    3 * (2 ^ ((011) + 1))=12288

    because you are using the last 3-bits as the value and that is not what you should do. 011 = 3 so you math would be this:

    3 * (2 ^ 3) + 1 = 25

    Your VB code is this:

    3 * (2 ^ (Asc(Mid(GifBuffer, 11, 1)) And 3)) + 1

    But remember, &H5B says there is no global color table which means that the frame(s) have their own so the above calculation would be meaningless in this case but you would use this when there is a global color table or use it for a local color table except the offset 11 would be a different number

    3 * (2 ^ (Asc(Mid(GifBuffer, ??, 1)) And 3)) + 1

    where ?? is the string position for the byte that is used for a local color table

    To extract the values from this byte use the following

    7654 3210
    xxxx xxxx

    And 128 to get x000 0000 = Global Color Table Flag
    And 48 to get 0xxx 0000 = Color Resolution
    And 8 to get 0000 x000 = Sort Flag
    And 3 to get 0000 0xxx = Global Color Table Size
    Last edited by jmsrickland; Aug 16th, 2012 at 03:19 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