Dim Gif As Bitmap = New Bitmap("c:\testray.gif") 'loads a GIF file into a bitmap object. Gif.Palette.Entries(6) = Color.FromArgb(0, 255, 0, 255) 'Hey, this should be making this pallete color a transparent color in the GIF, right? |
'These are animated gif protocol constants. By = New Byte() {33, 255, 11, 78, 69, 84, 83, 67, 65, 80, 69, 50, 46, 48, 3, 1, 0, 0, 0} Bz = New Byte() {33, 249, 4, 9, 20, 0, 255, 0} 'extension introducer 'application extension 'size of block: 11 for "NETSCAPE2.0" (78, 69, 84, 83, 67, 65, 80, 69, 50, 46, 48) 'Size of block, followed by [1][0][0] 'Block terminator 'Extension introducer 'Graphic control extension 'Size of block 'Flags: reserved., disposal method, user input, transparent color 'Delay time low byte [X] 'Delay time high byte [Y], the delay time can be found with 256 * Y ms + X ms 'Transparent color index 'Block terminator |
MS = New IO.MemoryStream 'That's a memory stream, which streams gif data into the binary writer. FS = New IO.FileStream("C:\animacion.gif", IO.FileMode.OpenOrCreate) 'This is the file stream to which we save our GIf to file. BW = New IO.BinaryWriter(FS) 'This is the binary writer, which actually writes to the file stream. 'The MS writes to the BW, which writes to the FS, which writes to the 'file - isn't this ingenious. :) |