diff --git a/src/modules/Image/encodings/atari.c b/src/modules/Image/encodings/atari.c index 5f2f89ecb457bb8d587f70da2fe013c58f192690..2602fed317fa9c9189a54b32bb83149ef3d12442 100644 --- a/src/modules/Image/encodings/atari.c +++ b/src/modules/Image/encodings/atari.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: atari.c,v 1.2 2003/12/13 23:33:21 nilsson Exp $ +|| $Id: atari.c,v 1.3 2003/12/14 22:48:36 nilsson Exp $ */ #include "global.h" @@ -13,6 +13,26 @@ extern struct program *image_program; +void rotate_atari_palette(struct atari_palette* pal, unsigned int left, + unsigned int right) +{ + rgb_group tmp; + unsigned int i; + + if(right>left) { + tmp = pal->colors[right]; + for(i=right; i>left; i--) + pal->colors[i] = pal->colors[i-1]; + pal->colors[left] = tmp; + } + else { + tmp = pal->colors[left]; + for(i=left; i<right; i++) + pal->colors[i] = pal->colors[i+1]; + pal->colors[right] = tmp; + } +} + /* pal is 2*size of palette data */ struct atari_palette* decode_atari_palette(unsigned char *pal, unsigned int size) diff --git a/src/modules/Image/encodings/atari.h b/src/modules/Image/encodings/atari.h index 1bac4d693a88fdca8a690d72789a37f294572efe..8f5ae3cd6afc71c4268d68fbf8cd1effec4788d5 100644 --- a/src/modules/Image/encodings/atari.h +++ b/src/modules/Image/encodings/atari.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: atari.h,v 1.2 2003/12/13 23:33:09 nilsson Exp $ +|| $Id: atari.h,v 1.3 2003/12/14 22:48:36 nilsson Exp $ */ #include "global.h" @@ -16,6 +16,8 @@ struct atari_palette rgb_group *colors; }; +void rotate_atari_palette(struct atari_palette* pal, unsigned int left, + unsigned int right); struct atari_palette* decode_atari_palette(unsigned char *pal, unsigned int size); struct object* decode_atari_screendump(unsigned char *q,