2 * libwmfun - WindowMaker texture function library
3 * Copyright (C) 1999 Tobias Gloth
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
25 * Revision 1.1 2000/12/03 18:58:41 id
26 * initiate plugins branch
28 * Revision 1.1.1.1 1999/02/21 17:16:47 gloth
35 RImage
*bilinear(int argc
, char **argv
, int width
, int height
, int relief
)
46 if (!start_image("bilinear", argc
, 4, 5, width
, height
, &image
)) {
50 for (i
= 0; i
< 4; i
++) {
51 if (!parse_color(argv
[i
], color
[i
])) {
52 error("can't parse color: \"%s\"\n", argv
[i
]);
58 for (i
= 0; i
< height
; i
++) {
59 int b
= 0xff * i
/ height
;
62 for (j
= 0; j
< width
; j
++) {
63 int r
= 0xff * j
/ width
;
72 for (k
= 0; k
< 3; k
++) {
75 f
[1] * color
[1][k
] + f
[2] * color
[2][k
] + f
[3] * color
[3][k
]) >> 8;
78 if (RRGBAFormat
== image
->format
)