From 059b1aacc9ead51229cd612984a71b39113d2945 Mon Sep 17 00:00:00 2001 From: William Joye Date: Tue, 5 Mar 2019 17:13:33 -0500 Subject: support animated gif --- tkagif/tkagif.C | 90 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 76 insertions(+), 14 deletions(-) diff --git a/tkagif/tkagif.C b/tkagif/tkagif.C index ff3c3d7..09e1249 100644 --- a/tkagif/tkagif.C +++ b/tkagif/tkagif.C @@ -2,6 +2,9 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" +#include +#include + #include #include #include @@ -233,6 +236,31 @@ int TkAGIF::add(int argc, const char* argv[]) } // colortable + int sz =128; + int cnt =8; + int tt =0; + unsigned char red[sz]; + unsigned char green[sz]; + unsigned char blue[sz]; + memset(red,0,sz); + memset(green,0,sz); + memset(blue,0,sz); + // 0: black + // 1: white + red[1] = green[1] = blue[1] = 255; + // 2: red + red[2] = 255; + // 3: green + green[3] = 255; + // 4: blue + blue[4] = 255; + // 5: cyan + green[5] = blue[5] = 255; + // 6: magenta + red[6] = blue[6] = 255; + // 7: yellow + red[7] = green[7] = 255; + // map RGB to Color index unsigned char* pict = new unsigned char[width_*height_]; memset(pict,0,width_*height_); @@ -252,9 +280,54 @@ int TkAGIF::add(int argc, const char* argv[]) unsigned char* src = block.pixelPtr; unsigned char* dst = pict; - for (int jj=0; jjwrite((char*)red+ii,1); out_->write((char*)green+ii,1); -- cgit v0.12