// Copyright 2020 BitBank Software, Inc. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. //=========================================================================== #ifndef __ANIMATEDGIF__ #define __ANIMATEDGIF__ #include #include #include #include #define memcpy_P memcpy #define PROGMEM // // GIF Animator // Written by Larry Bank // Copyright (c) 2020 BitBank Software, Inc. // bitbank@pobox.com // // Designed to decode images up to 480x320 // using less than 22K of RAM // /* GIF Defines and variables */ #define MAX_CHUNK_SIZE 255 // // These 2 macros can be changed to limit the amount of RAM // required by the decoder. For example, decoding 1-bit images to // a 128x32 display will not need a max code size of 12 nor a palette // with 256 entries // #define MAX_CODE_SIZE 12 #define MAX_COLORS 256 #define LZW_BUF_SIZE (6 * MAX_CHUNK_SIZE) #define LZW_HIGHWATER (4 * MAX_CHUNK_SIZE) #ifdef __LINUX__ #define MAX_WIDTH 2048 #else #define MAX_WIDTH 320 #endif // __LINUX__ // This buffer is used to store the pixel sequence in reverse order // it needs to be large enough to hold the longest possible // sequence (1<