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: n:/project/lib/src/2d/RCS/genrsdbm.c $
21 * $Revision: 1.3 $
22 * $Author: kevin $
23 * $Date: 1994/03/15 13:17:09 $
24 *
25 * Generic routines for unpacking and then drawing/scaling rsd bitmaps.
26 *
27 * This file is part of the 2d library.
28 *
29 * $Log: genrsdbm.c $
30 * Revision 1.3 1994/03/15 13:17:09 kevin
31 * Added clut_bitmap routines.
32 *
33 * Revision 1.2 1994/01/19 18:41:55 kaboom
34 * Fixed typo in clipped clut scale.
35 *
36 * Revision 1.1 1993/12/28 19:34:41 kevin
37 * Initial revision
38 */
39
40 #include "grs.h"
41 #include "grrend.h"
42 #include "clpcon.h"
43 #include "grdbm.h"
44 #include "grcbm.h"
45 #include "rsdunpck.h"
46
unpack_rsd8_ubitmap(grs_bitmap * bm,short x,short y)47 void unpack_rsd8_ubitmap(grs_bitmap *bm, short x, short y)
48 {
49 if (grd_unpack_buf!=NULL) {
50 grs_bitmap tbm;
51 if (gr_rsd8_convert(bm,&tbm)==GR_UNPACK_RSD8_OK)
52 gr_ubitmap(&tbm,x,y);
53 }
54 }
55
unpack_rsd8_bitmap(grs_bitmap * bm,short x,short y)56 int unpack_rsd8_bitmap(grs_bitmap *bm, short x, short y)
57 {
58 if (grd_unpack_buf!=NULL) {
59 grs_bitmap tbm;
60 if (gr_rsd8_convert(bm,&tbm)==GR_UNPACK_RSD8_OK)
61 return gr_bitmap(&tbm,x,y);
62 }
63 return CLIP_ALL;
64 }
65
unpack_rsd8_scale_ubitmap(grs_bitmap * bm,short x,short y,short w,short h)66 void unpack_rsd8_scale_ubitmap(grs_bitmap *bm, short x, short y, short w, short h)
67 {
68 if (grd_unpack_buf!=NULL) {
69 grs_bitmap tbm;
70 if (gr_rsd8_convert(bm,&tbm)==GR_UNPACK_RSD8_OK)
71 gr_scale_ubitmap(&tbm,x,y,w,h);
72 }
73 }
74
unpack_rsd8_scale_bitmap(grs_bitmap * bm,short x,short y,short w,short h)75 int unpack_rsd8_scale_bitmap(grs_bitmap *bm, short x, short y, short w, short h)
76 {
77 if (grd_unpack_buf!=NULL) {
78 grs_bitmap tbm;
79 if (gr_rsd8_convert(bm,&tbm)==GR_UNPACK_RSD8_OK)
80 return gr_scale_bitmap(&tbm,x,y,w,h);
81 }
82 return CLIP_ALL;
83 }
84
unpack_rsd8_clut_scale_ubitmap(grs_bitmap * bm,short x,short y,short w,short h,uchar * cl)85 void unpack_rsd8_clut_scale_ubitmap(grs_bitmap *bm, short x, short y, short w, short h, uchar *cl)
86 {
87 if (grd_unpack_buf!=NULL) {
88 grs_bitmap tbm;
89 if (gr_rsd8_convert(bm,&tbm)==GR_UNPACK_RSD8_OK)
90 gr_clut_scale_ubitmap(&tbm,x,y,w,h,cl);
91 }
92 }
93
unpack_rsd8_clut_scale_bitmap(grs_bitmap * bm,short x,short y,short w,short h,uchar * cl)94 int unpack_rsd8_clut_scale_bitmap(grs_bitmap *bm, short x, short y, short w, short h, uchar *cl)
95 {
96 if (grd_unpack_buf!=NULL) {
97 grs_bitmap tbm;
98 if (gr_rsd8_convert(bm,&tbm)==GR_UNPACK_RSD8_OK)
99 return gr_clut_scale_bitmap(&tbm,x,y,w,h,cl);
100 }
101 return CLIP_ALL;
102 }
103
unpack_rsd8_clut_ubitmap(grs_bitmap * bm,short x,short y,uchar * cl)104 void unpack_rsd8_clut_ubitmap(grs_bitmap *bm, short x, short y, uchar *cl)
105 {
106 if (grd_unpack_buf!=NULL) {
107 grs_bitmap tbm;
108 if (gr_rsd8_convert(bm,&tbm)==GR_UNPACK_RSD8_OK)
109 gr_clut_ubitmap(&tbm,x,y,cl);
110 }
111 }
112
unpack_rsd8_clut_bitmap(grs_bitmap * bm,short x,short y,uchar * cl)113 int unpack_rsd8_clut_bitmap(grs_bitmap *bm, short x, short y, uchar *cl)
114 {
115 if (grd_unpack_buf!=NULL) {
116 grs_bitmap tbm;
117 if (gr_rsd8_convert(bm,&tbm)==GR_UNPACK_RSD8_OK)
118 return gr_clut_bitmap(&tbm,x,y,cl);
119 }
120 return CLIP_ALL;
121 }
122