1 /****************************************************************************
2 * Copyright (C) 1996 by Leo Khramov
3 * email: old@sunct2.jinr.dubna.su
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 ****************************************************************************/
19 void (*im_coding
)(unsigned int,unsigned int,unsigned int,char**);
20 void im_truetruecoding(unsigned int ir
,unsigned int ig
,unsigned int ib
,char **imdata
)
34 *(--imd
)=(char)(ir
& 0xff);
41 void im_truenocoding(unsigned int ir
,unsigned int ig
,unsigned int ib
,char **imdata
)
43 *((*imdata
)++)=ir
&0xff;
44 *((*imdata
)++)=ig
&0xff;
45 *((*imdata
)++)=ib
&0xff;
48 char *im_alloc_true(int l
,int h
)
55 l
+= b_pad
- l
% b_pad
;
57 return (char*) malloc(l
*h
);
60 void im_setzero(char* s
,int len
)
66 void im_memcopy(char *src
, char* dest
, int len
)
69 if (src
==dest
|| len
<=0)
70 return; /* nothin' to do */
72 if (src
<dest
&& src
+len
>dest
)
73 { /* do backward copy */
75 dest
= dest
+ len
- 1;
76 for ( ; len
>0; len
--, src
--, dest
--)
82 for ( ; len
>0; len
--, src
++, dest
++)
90 unsigned int im_get_linew_true(unsigned int w
)
97 line_w
+= b_pad
- line_w
% b_pad
;
99 line_w
=w
*3; //24 bit non-converted images in PseudoColor before convertion.