Results 1 to 2 of 2

Thread: transparent gif

  1. #1
    Join Date
    Nov 2003
    Kalmar, Sweden

    Unhappy transparent gif

    Ok.This have been a problem for me thelongest time.

    I cant seem to genrate a transparent gif and stream it to the browser.

    I've studied a couple of articles/code-snippets on this with a bit of a frustating result.

    one article: http://www.realworldasp.net/article.asp?article=142 seems to work. When I link to the page that streams an image, the image actually appears to be transparent. (i checked by using diffrent background colors) the problem with this is that the code is in VB. I ofcourse, use C#

    the other article: http://aspalliance.com/cookbook/View...spx?Chapter=22 (link onthe bootom) have the code-sample in C# but when I use it (or link to the apsx-page that strams the image) the background does NOT appear to be transparent.

    Now, the two code-samples looks very similar but yet, when i try it, it simply does not work.

    Can anyone help me on this? does the second snippet of code work for anyone else?


  2. #2
    Join Date
    Nov 2003
    Kalmar, Sweden
    Ok... this is what I've come up with... after LOADS of hours...

    I converted the code from the realworldasp-link from VB to C#

    however in order to pass the compilation I had to change the following:

    win32api win32 = new win32api();
    win32.CopyArrayTo(pBits, bits, Height * stride);


    //win32api win32 = new win32api();
    win32api.CopyArrayTo(pBits, bits, Height * stride);

    this because I get a error message:
    "Static member 'myProject.win32api.CopyArrayTo(int, byte[], int)' cannot be accessed with an instance reference; qualify it with a type name instead"

    This is why I have to chanhe it. I am now wondering (except for the obvious why...) what the risks/limitations with this might be by doing it this way.

    I am not good at .NET arcitecture, but it seems to me like a stupid thing to do... can anyone explain to me what I'm doing?


    by the way... the win32api declaration looks like this:

    public class win32api
    [DllImport("KERNEL32.DLL", EntryPoint="RtlMoveMemory", SetLastError=true, CharSet=CharSet.Auto, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)]

    public static extern void CopyArrayTo([In, MarshalAs(UnmanagedType.I4)] Int32 hpvDest, [In, Out] byte[] hpvSource, int cbCopy);


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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