1 /*
2 
3 Copyright (C) 2015-2018 Night Dive Studios, LLC.
4 
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 3 of the License, or
8 (at your option) any later version.
9 
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 
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 /*
20  * $Source: r:/prj/lib/src/2d/RCS/temptm.c $
21  * $Revision: 1.9 $
22  * $Author: kevin $
23  * $Date: 1994/11/09 21:14:00 $
24  *
25  * Temporary texture mapper dispatchers.
26  *
27  * This file is part of the 2d library.
28  *
29  */
30 
31 #include "bitmap.h"
32 #include "clpcon.h"
33 #include "cnvdat.h"
34 #include "fill.h"
35 #include "grpix.h"
36 #include "grs.h"
37 #include "plytyp.h"
38 #include "ifcn.h"
39 #include "tabdat.h"
40 #include "tmapfcn.h"
41 #include "tmaps.h"
42 #include "general.h"
43 
44 enum {
45    POLY, SPOLY, CPOLY, TPOLY, STPOLY
46 };
47 
48 // prototypes
49 void temp_upoint(short x, short y);
50 void temp_point(short x, short y);
51 void temp_flat8_mask_bitmap (grs_bitmap *bm, int x, int y, grs_stencil *sten);
52 void temp_flat8_clut_ubitmap (grs_bitmap *bm, int x, int y, uchar *cl);
53 void temp_tluc8_ubitmap (grs_bitmap *bm, int x, int y);
54 void temp_per_map (grs_bitmap *bm, int n, grs_vertex **vpl);
55 void temp_per_umap (grs_bitmap *bm, int n, grs_vertex **vpl);
56 void temp_clut_per_map (grs_bitmap *bm, int n, grs_vertex **vpl, uchar *clut);
57 void temp_clut_per_umap (grs_bitmap *bm, int n, grs_vertex **vpl, uchar *clut);
58 void temp_lit_per_umap (grs_bitmap *bm, int n, grs_vertex **vpl);
59 void temp_lin_umap(grs_bitmap *bm, int n, grs_vertex **vpl);
60 void temp_lin_map(grs_bitmap *bm, int n, grs_vertex **vpl);
61 void temp_lit_lin_umap(grs_bitmap *bm, int n, grs_vertex **vpl);
62 void temp_lit_lin_map(grs_bitmap *bm, int n, grs_vertex **vpl);
63 void temp_clut_lin_umap(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl);
64 void temp_clut_lin_map(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl);
65 void temp_floor_umap(grs_bitmap *bm, int n, grs_vertex **vpl);
66 void temp_clut_floor_umap(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl);
67 void temp_lit_floor_umap(grs_bitmap *bm, int n, grs_vertex **vpl);
68 void temp_wall_umap(grs_bitmap *bm, int n, grs_vertex **vpl);
69 void temp_clut_wall_umap(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl);
70 void temp_lit_wall_umap(grs_bitmap *bm, int n, grs_vertex **vpl);
71 void temp_scale_umap(grs_bitmap *bm, short x, short y, short w, short h);
72 void temp_clut_scale_umap(grs_bitmap *bm, short x, short y, short w, short h, uchar *cl);
73 int gri_scale_clip(grs_vertex *v0, grs_vertex *v1);
74 
75 void temp_rsd8_ubitmap (grs_bitmap *bm, int x, int y);
76 void temp_rsd8_bitmap (grs_bitmap *bm, int x, int y);
77 
78 
temp_upoint(short x,short y)79 void temp_upoint(short x, short y)
80 {
81    gr_fill_upixel(grd_gc.fcolor, x, y);
82 }
83 
temp_point(short x,short y)84 void temp_point(short x, short y)
85 {
86    gr_fill_pixel(grd_gc.fcolor, x, y);
87 }
88 
temp_rsd8_ubitmap(grs_bitmap * bm,int x,int y)89 void temp_rsd8_ubitmap (grs_bitmap *bm, int x, int y)
90 {
91    ((void (*)(grs_bitmap *_bm,int _x, int _y))
92       grd_function_table[GRC_BITMAP+BMT_RSD8*GRD_FUNCS])(bm, x, y);
93 }
94 
temp_rsd8_bitmap(grs_bitmap * bm,int x,int y)95 void temp_rsd8_bitmap (grs_bitmap *bm, int x, int y)
96 {
97    ((void (*)(grs_bitmap *_bm,int _x, int _y, grs_stencil *_sten))
98       grd_function_table[GRC_STENCIL_BITMAP+BMT_RSD8*GRD_FUNCS])(bm, x, y, grd_clip.sten);
99 }
100 
temp_flat8_mask_bitmap(grs_bitmap * bm,int x,int y,grs_stencil * sten)101 void temp_flat8_mask_bitmap (grs_bitmap *bm, int x, int y, grs_stencil *sten)
102 {
103    ((void (*)(grs_bitmap *_bm,int _x, int _y, grs_stencil *_sten))
104       grd_function_table[GRC_STENCIL_BITMAP+BMT_FLAT8*GRD_FUNCS])(bm, x, y, sten);
105 }
106 
temp_flat8_clut_ubitmap(grs_bitmap * bm,int x,int y,uchar * cl)107 void temp_flat8_clut_ubitmap (grs_bitmap *bm, int x, int y, uchar *cl)
108 {
109    ((void (*)(grs_bitmap *_bm,int _x, int _y, uchar *_cl))
110       grd_function_table[GRC_BITMAP+BMT_FLAT8*GRD_FUNCS])(bm, x, y, cl);
111 }
112 
temp_tluc8_ubitmap(grs_bitmap * bm,int x,int y)113 void temp_tluc8_ubitmap (grs_bitmap *bm, int x, int y)
114 {
115    ((void (*)(grs_bitmap *_bm,int _x, int _y))
116       grd_function_table[GRC_BITMAP+BMT_TLUC8*GRD_FUNCS])(bm, x, y);
117 }
118 
temp_poly(long c,int n,grs_vertex ** vpl)119 int temp_poly (long c, int n, grs_vertex **vpl)
120 {
121    grs_tmap_info ti;
122    grs_bitmap bm;
123 
124    ti.tmap_type=GRC_POLY;
125    ti.flags=0;
126    bm.bits=(uchar *)c;
127    bm.type=POLY;
128    bm.flags=0;
129    return h_map(&bm,n,vpl,&ti);
130 }
131 
temp_upoly(long c,int n,grs_vertex ** vpl)132 void temp_upoly (long c, int n, grs_vertex **vpl)
133 {
134    grs_tmap_info ti;
135    grs_bitmap bm;
136 
137    ti.tmap_type=GRC_POLY;
138    ti.flags=0;
139    bm.bits=(uchar *)c;
140    bm.type=POLY;
141    bm.flags=0;
142    h_umap(&bm,n,vpl,&ti);
143 }
144 
temp_spoly(long c,int n,grs_vertex ** vpl)145 int temp_spoly (long c, int n, grs_vertex **vpl)
146 {
147    grs_tmap_info ti;
148    grs_bitmap bm;
149 
150    ti.tmap_type=GRC_POLY;
151    ti.flags=0;
152    bm.bits=(uchar *)c;
153    bm.type=SPOLY;
154    bm.flags=0;
155    return h_map(&bm,n,vpl,&ti);
156 }
157 
temp_uspoly(long c,int n,grs_vertex ** vpl)158 void temp_uspoly (long c, int n, grs_vertex **vpl)
159 {
160    grs_tmap_info ti;
161    grs_bitmap bm;
162 
163    ti.tmap_type=GRC_POLY;
164    ti.flags=0;
165    bm.bits=(uchar *)c;
166    bm.type=SPOLY;
167    bm.flags=0;
168    h_umap(&bm,n,vpl,&ti);
169 }
170 
temp_cpoly(long c,int n,grs_vertex ** vpl)171 int temp_cpoly (long c, int n, grs_vertex **vpl)
172 {
173    grs_tmap_info ti;
174    grs_bitmap bm;
175 
176    ti.tmap_type=GRC_POLY;
177    ti.flags=0;
178    bm.bits=(uchar *)c;
179    bm.type=CPOLY;
180    bm.flags=0;
181    return h_map(&bm,n,vpl,&ti);
182 }
183 
temp_ucpoly(long c,int n,grs_vertex ** vpl)184 void temp_ucpoly (long c, int n, grs_vertex **vpl)
185 {
186    grs_tmap_info ti;
187    grs_bitmap bm;
188 
189    ti.tmap_type=GRC_POLY;
190    ti.flags=0;
191    bm.bits=(uchar *)c;
192    bm.type=CPOLY;
193    bm.flags=0;
194    h_umap(&bm,n,vpl,&ti);
195 }
196 
temp_tpoly(long c,int n,grs_vertex ** vpl)197 int temp_tpoly (long c, int n, grs_vertex **vpl)
198 {
199    grs_tmap_info ti;
200    grs_bitmap bm;
201 
202    ti.tmap_type=GRC_POLY;
203    bm.bits=(uchar *)c;
204    ti.flags=0;
205    bm.bits=(uchar *)c;
206    bm.type=TPOLY;
207    bm.flags=0;
208    return h_map(&bm,n,vpl,&ti);
209 }
210 
temp_utpoly(long c,int n,grs_vertex ** vpl)211 void temp_utpoly (long c, int n, grs_vertex **vpl)
212 {
213    grs_tmap_info ti;
214    grs_bitmap bm;
215 
216    ti.tmap_type=GRC_POLY;
217    ti.flags=0;
218    bm.bits=(uchar *)c;
219    bm.type=TPOLY;
220    bm.flags=0;
221    h_umap(&bm,n,vpl,&ti);
222 }
223 
temp_stpoly(long c,int n,grs_vertex ** vpl)224 int temp_stpoly (long c, int n, grs_vertex **vpl)
225 {
226    grs_tmap_info ti;
227    grs_bitmap bm;
228 
229    ti.tmap_type=GRC_POLY;
230    ti.flags=0;
231    bm.bits=(uchar *)c;
232    bm.type=STPOLY;
233    bm.flags=0;
234    return h_map(&bm,n,vpl,&ti);
235 }
236 
temp_ustpoly(long c,int n,grs_vertex ** vpl)237 void temp_ustpoly (long c, int n, grs_vertex **vpl)
238 {
239    grs_tmap_info ti;
240    grs_bitmap bm;
241 
242    ti.tmap_type=GRC_POLY;
243    ti.flags=0;
244    bm.bits=(uchar *)c;
245    bm.type=STPOLY;
246    bm.flags=0;
247    h_umap(&bm,n,vpl,&ti);
248 }
249 
temp_per_map(grs_bitmap * bm,int n,grs_vertex ** vpl)250 void temp_per_map (grs_bitmap *bm, int n, grs_vertex **vpl)
251 {
252    if (bm->row==1<<(bm->wlog)) {
253       grs_tmap_info ti;
254       ti.tmap_type=GRC_PER;
255       ti.flags=0;
256       per_map(bm,n,vpl,&ti);
257    }
258 }
259 
temp_per_umap(grs_bitmap * bm,int n,grs_vertex ** vpl)260 void temp_per_umap (grs_bitmap *bm, int n, grs_vertex **vpl)
261 {
262    if (bm->row==1<<(bm->wlog)) {
263       grs_tmap_info ti;
264       ti.tmap_type=GRC_PER;
265       ti.flags=0;
266       per_umap(bm,n,vpl,&ti);
267    }
268 }
269 
temp_clut_per_map(grs_bitmap * bm,int n,grs_vertex ** vpl,uchar * clut)270 void temp_clut_per_map (grs_bitmap *bm, int n, grs_vertex **vpl, uchar *clut)
271 {
272   if (bm->row==1<<(bm->wlog)) {
273       grs_tmap_info ti;
274       ti.tmap_type=GRC_CLUT_PER;
275       ti.flags=TMF_CLUT;
276       ti.clut=clut;
277       per_map(bm,n,vpl,&ti);
278    }
279 }
280 
temp_clut_per_umap(grs_bitmap * bm,int n,grs_vertex ** vpl,uchar * clut)281 void temp_clut_per_umap (grs_bitmap *bm, int n, grs_vertex **vpl, uchar *clut)
282 {
283    if (bm->row==1<<(bm->wlog)) {
284       grs_tmap_info ti;
285       ti.tmap_type=GRC_CLUT_PER;
286       ti.flags=TMF_CLUT;
287       ti.clut=clut;
288       per_umap(bm,n,vpl,&ti);
289    }
290 }
291 
temp_lit_per_umap(grs_bitmap * bm,int n,grs_vertex ** vpl)292 void temp_lit_per_umap (grs_bitmap *bm, int n, grs_vertex **vpl)
293 {
294    if (bm->row==1<<(bm->wlog)) {
295       grs_tmap_info ti;
296       ti.tmap_type=GRC_LIT_PER;
297       ti.flags=0;
298       per_umap(bm,n,vpl,&ti);
299    }
300 }
301 
temp_lin_umap(grs_bitmap * bm,int n,grs_vertex ** vpl)302 void temp_lin_umap(grs_bitmap *bm, int n, grs_vertex **vpl)
303 {
304    if ((bm->row==1<<(bm->wlog))||(grd_gc.fill_type==FILL_CLUT)) {
305       grs_tmap_info ti;
306       if ((n==3)&&((bm->flags&BMF_TRANS)==0))
307          ti.tmap_type=GRC_LIN;
308       else
309          ti.tmap_type=GRC_BILIN;
310       ti.flags=0;
311       h_umap(bm,n,vpl,&ti);
312    }
313 }
314 
temp_lin_map(grs_bitmap * bm,int n,grs_vertex ** vpl)315 void temp_lin_map(grs_bitmap *bm, int n, grs_vertex **vpl)
316 {
317    if ((bm->row==1<<(bm->wlog))||(grd_gc.fill_type==FILL_CLUT)) {
318       grs_tmap_info ti;
319       if ((n==3)&&((bm->flags&BMF_TRANS)==0))
320          ti.tmap_type=GRC_LIN;
321       else
322          ti.tmap_type=GRC_BILIN;
323       ti.flags=0;
324       h_map(bm,n,vpl,&ti);
325    }
326 }
327 
temp_lit_lin_umap(grs_bitmap * bm,int n,grs_vertex ** vpl)328 void temp_lit_lin_umap(grs_bitmap *bm, int n, grs_vertex **vpl)
329 {
330    if ((bm->row==1<<(bm->wlog))||(grd_gc.fill_type==FILL_CLUT)) {
331       grs_tmap_info ti;
332       ti.tmap_type=GRC_LIT_BILIN;
333       ti.flags=0;
334       h_umap(bm,n,vpl,&ti);
335    }
336 }
337 
temp_lit_lin_map(grs_bitmap * bm,int n,grs_vertex ** vpl)338 void temp_lit_lin_map(grs_bitmap *bm, int n, grs_vertex **vpl)
339 {
340    if ((bm->row==1<<(bm->wlog))||(grd_gc.fill_type==FILL_CLUT)) {
341       grs_tmap_info ti;
342       ti.tmap_type=GRC_LIT_BILIN;
343       ti.flags=0;
344       h_map(bm,n,vpl,&ti);
345    }
346 }
347 
temp_clut_lin_umap(grs_bitmap * bm,int n,grs_vertex ** vpl,uchar * cl)348 void temp_clut_lin_umap(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl)
349 {
350    grs_tmap_info ti;
351 
352    if ((n==3)&&((bm->flags&BMF_TRANS)==0))
353       ti.tmap_type=GRC_CLUT_LIN;
354    else
355       ti.tmap_type=GRC_CLUT_BILIN;
356    ti.flags=TMF_CLUT;
357    ti.clut=cl;
358    h_umap(bm,n,vpl,&ti);
359 }
360 
temp_clut_lin_map(grs_bitmap * bm,int n,grs_vertex ** vpl,uchar * cl)361 void temp_clut_lin_map(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl)
362 {
363    grs_tmap_info ti;
364 
365    if ((n==3)&&((bm->flags&BMF_TRANS)==0))
366       ti.tmap_type=GRC_CLUT_LIN;
367    else
368       ti.tmap_type=GRC_CLUT_BILIN;
369    ti.flags=TMF_CLUT;
370    ti.clut=cl;
371    h_map(bm,n,vpl,&ti);
372 }
373 
temp_floor_umap(grs_bitmap * bm,int n,grs_vertex ** vpl)374 void temp_floor_umap(grs_bitmap *bm, int n, grs_vertex **vpl)
375 {
376    if (bm->row==1<<(bm->wlog)) {
377       grs_tmap_info ti;
378       ti.tmap_type=GRC_FLOOR;
379       ti.flags=TMF_FLOOR;
380       h_umap(bm,n,vpl,&ti);
381    }
382 }
383 
temp_clut_floor_umap(grs_bitmap * bm,int n,grs_vertex ** vpl,uchar * cl)384 void temp_clut_floor_umap(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl)
385 {
386    if (bm->row==1<<(bm->wlog)) {
387       grs_tmap_info ti;
388       ti.tmap_type=GRC_CLUT_FLOOR;
389       ti.flags=TMF_CLUT|TMF_FLOOR;
390       ti.clut=cl;
391       h_umap(bm,n,vpl,&ti);
392    }
393 }
394 
temp_lit_floor_umap(grs_bitmap * bm,int n,grs_vertex ** vpl)395 void temp_lit_floor_umap(grs_bitmap *bm, int n, grs_vertex **vpl)
396 {
397    if (bm->row==1<<(bm->wlog)) {
398       grs_tmap_info ti;
399       ti.tmap_type=GRC_LIT_FLOOR;
400       ti.flags=TMF_FLOOR;
401       h_umap(bm,n,vpl,&ti);
402    }
403 }
404 
temp_wall_umap(grs_bitmap * bm,int n,grs_vertex ** vpl)405 void temp_wall_umap(grs_bitmap *bm, int n, grs_vertex **vpl)
406 {
407    if (bm->row==1<<(bm->wlog)) {
408       grs_tmap_info ti;
409       ti.tmap_type=GRC_WALL2D;
410       ti.flags=TMF_WALL;
411       v_umap(bm,n,vpl,&ti);
412    }
413 }
414 
temp_clut_wall_umap(grs_bitmap * bm,int n,grs_vertex ** vpl,uchar * cl)415 void temp_clut_wall_umap(grs_bitmap *bm, int n, grs_vertex **vpl, uchar *cl)
416 {
417    if (bm->row==1<<(bm->wlog)) {
418       grs_tmap_info ti;
419       ti.tmap_type=GRC_CLUT_WALL2D;
420       ti.flags=TMF_CLUT|TMF_WALL;
421       ti.clut=cl;
422       v_umap(bm,n,vpl,&ti);
423    }
424 }
425 
temp_lit_wall_umap(grs_bitmap * bm,int n,grs_vertex ** vpl)426 void temp_lit_wall_umap(grs_bitmap *bm, int n, grs_vertex **vpl)
427 {
428    if (bm->row==1<<(bm->wlog)) {
429       grs_tmap_info ti;
430       ti.tmap_type=GRC_LIT_WALL2D;
431       ti.flags=TMF_WALL;
432       v_umap(bm,n,vpl,&ti);
433    }
434 }
435 
436 /* take int _x,_y; fix _u,_v; stuff them into grs_vertex _vertex */
437 
438 #define make_vertex(_vertex,_x,_y,_u,_v) \
439    _vertex.x = fix_make(_x,0), \
440    _vertex.y = fix_make(_y,0), \
441    _vertex.u = _u,             \
442    _vertex.v = _v
443 
temp_scale_umap(grs_bitmap * bm,short x,short y,short w,short h)444 void temp_scale_umap(grs_bitmap *bm, short x, short y, short w, short h)
445 {
446    grs_tmap_info ti;
447    grs_vertex *vpl[2];
448    grs_vertex v0,v1;
449 
450    vpl[0]=&v0;
451    vpl[1]=&v1;
452    make_vertex(v0,x,y,0,0);
453    make_vertex(v1,x+w,y+h,fix_make(bm->w,0),fix_make(bm->h,0));
454 
455    ti.tmap_type=GRC_SCALE;
456    ti.flags=0;
457    h_umap(bm,2,vpl,&ti);
458 }
459 
temp_clut_scale_umap(grs_bitmap * bm,short x,short y,short w,short h,uchar * cl)460 void temp_clut_scale_umap(grs_bitmap *bm, short x, short y, short w, short h, uchar *cl)
461 {
462    grs_tmap_info ti;
463    grs_vertex *vpl[2];
464    grs_vertex v0,v1;
465 
466    vpl[0]=&v0;
467    vpl[1]=&v1;
468    make_vertex(v0,x,y,0,0);
469    make_vertex(v1,x+w,y+h,fix_make(bm->w,0),fix_make(bm->h,0));
470 
471    ti.tmap_type=GRC_CLUT_SCALE;
472    ti.flags=TMF_CLUT;
473    ti.clut=cl;
474    h_umap(bm,2,vpl,&ti);
475 }
476 
gri_scale_clip(grs_vertex * v0,grs_vertex * v1)477 int gri_scale_clip(grs_vertex *v0, grs_vertex *v1)
478 {
479    int code;
480    fix u_scale,v_scale;
481 
482    if ((v0->x>=grd_fix_clip.right) || (v1->x<=grd_fix_clip.left) ||
483        (v0->y>=grd_fix_clip.bot) || (v1->y<=grd_fix_clip.top))
484       return CLIP_ALL;
485 
486    code = CLIP_NONE;
487 
488    u_scale = fix_div(v1->u,v1->x-v0->x);
489    v_scale = fix_div(v1->v,v1->y-v0->y);
490 
491    if (v0->x<grd_fix_clip.left) {
492       v0->u = fix_mul(u_scale,grd_fix_clip.left-v0->x);
493       v0->x = grd_fix_clip.left;
494       code |= CLIP_LEFT;
495    }
496    if (v1->x>grd_fix_clip.right) {
497       v1->x = grd_fix_clip.right;
498       v1->u = v0->u+fix_mul(u_scale,v1->x-v0->x);
499       code |= CLIP_RIGHT;
500    }
501    if (v0->y<grd_fix_clip.top) {
502       v0->v = fix_mul(v_scale,grd_fix_clip.top-v0->y);
503       v0->y = grd_fix_clip.top;
504       code |= CLIP_TOP;
505    }
506    if (v1->y>grd_fix_clip.bot) {
507       v1->y = grd_fix_clip.bot;
508       v1->v = v0->v+fix_mul(v_scale,v1->y-v0->y);
509       code |= CLIP_RIGHT;
510    }
511    return code;
512 }
513 
temp_scale_map(grs_bitmap * bm,short x,short y,short w,short h)514 int temp_scale_map(grs_bitmap *bm, short x, short y, short w, short h)
515 {
516    grs_tmap_info ti;
517    grs_vertex *vpl[2];
518    grs_vertex v0,v1;
519    int code;
520 
521    vpl[0]=&v0;
522    vpl[1]=&v1;
523    make_vertex(v0,x,y,0,0);
524    make_vertex(v1,x+w,y+h,fix_make(bm->w,0),fix_make(bm->h,0));
525 
526    code=gri_scale_clip(&v0,&v1);
527    if (code==CLIP_ALL) return code;
528 
529    ti.tmap_type=GRC_SCALE;
530    ti.flags=0;
531    h_umap(bm,2,vpl,&ti);
532    return code;
533 }
534 
temp_clut_scale_map(grs_bitmap * bm,short x,short y,short w,short h,uchar * cl)535 int temp_clut_scale_map(grs_bitmap *bm, short x, short y, short w, short h, uchar *cl)
536 {
537    grs_tmap_info ti;
538    grs_vertex *vpl[2];
539    grs_vertex v0,v1;
540    int code;
541 
542    vpl[0]=&v0;
543    vpl[1]=&v1;
544    make_vertex(v0,x,y,0,0);
545    make_vertex(v1,x+w,y+h,fix_make(bm->w,0),fix_make(bm->h,0));
546 
547    code=gri_scale_clip(&v0,&v1);
548    if (code==CLIP_ALL) return code;
549 
550    ti.tmap_type=GRC_CLUT_SCALE;
551    ti.flags=TMF_CLUT;
552    ti.clut=cl;
553    h_umap(bm,2,vpl,&ti);
554    return CLIP_NONE;
555 }
556