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/fl8cnv.c $ 21 * $Revision: 1.78 $ 22 * $Author: kevin $ 23 * $Date: 1994/11/12 02:21:59 $ 24 * 25 * General-purpose routines for drawing into straight-8 bitmaps. 26 * This file is part of the 2d library. 27 * 28 */ 29 30 #include "flat8.h" 31 #include "general.h" 32 #include "grnull.h" 33 #include "icanvas.h" 34 35 typedef void (*ptr_type)(); 36 37 void (*flat8_canvas_table[GRD_CANVAS_FUNCS])() = { 38 (ptr_type)flat8_set_upixel, /* 8-bit pixel set/get */ 39 (ptr_type)gen_set_pixel, 40 (ptr_type)flat8_get_upixel, 41 (ptr_type)flat8_get_pixel, 42 43 (ptr_type)flat8_set_upixel24, /* 24-bit pixel set/get */ 44 (ptr_type)flat8_set_pixel24, 45 (ptr_type)flat8_get_upixel24, 46 (ptr_type)flat8_get_pixel24, 47 48 (ptr_type)flat8_clear, /* integral, straight primitives */ 49 (ptr_type)temp_upoint, 50 (ptr_type)temp_point, 51 (ptr_type)flat8_set_upixel, /* 8-bit pixel set/get */ 52 (ptr_type)gen_set_pixel_interrupt, 53 gr_null, 54 gr_null, 55 (ptr_type)gen_urect, 56 (ptr_type)gen_rect, 57 (ptr_type)gen_ubox, 58 (ptr_type)gen_box, 59 60 gr_null, /* fixed-point rendering primitives */ 61 gr_null, 62 gr_null, 63 gr_null, 64 gr_null, 65 gr_null, 66 (ptr_type)temp_upoly, 67 (ptr_type)temp_poly, 68 (ptr_type)temp_uspoly, 69 (ptr_type)temp_spoly, 70 (ptr_type)temp_ucpoly, 71 (ptr_type)temp_cpoly, 72 (ptr_type)temp_utpoly, 73 (ptr_type)temp_tpoly, 74 (ptr_type)temp_ustpoly, 75 (ptr_type)temp_stpoly, 76 77 (ptr_type)gen_vox_rect, 78 (ptr_type)gen_vox_poly, 79 (ptr_type)gen_vox_cpoly, 80 (ptr_type)flat8_interp2_ubitmap, 81 (ptr_type)flat8_filter2_ubitmap, 82 gr_not_imp, // (ptr_type) gen_roll_ubitmap, MLA - not used? 83 gr_not_imp, // (ptr_type) gen_roll_bitmap, MLA - not used? 84 85 (ptr_type)temp_wall_umap, 86 gr_null, 87 (ptr_type)temp_lit_wall_umap, 88 gr_null, 89 (ptr_type)temp_clut_wall_umap, 90 gr_null, 91 92 (ptr_type)temp_floor_umap, 93 gr_null, 94 (ptr_type)temp_lit_floor_umap, 95 gr_null, 96 (ptr_type)temp_clut_floor_umap, 97 gr_null, 98 99 gr_null, /* linear texture mappers */ 100 gr_null, 101 gr_null, 102 gr_null, 103 (ptr_type)temp_lin_umap, 104 (ptr_type)temp_lin_map, 105 (ptr_type)temp_lin_umap, 106 (ptr_type)temp_lin_map, 107 (ptr_type)temp_lin_umap, 108 (ptr_type)temp_lin_map, 109 (ptr_type)temp_lin_umap, 110 (ptr_type)temp_lin_map, 111 112 gr_null, /* lit linear texture mappers */ 113 gr_null, 114 gr_null, 115 gr_null, 116 (ptr_type)temp_lit_lin_umap, 117 (ptr_type)temp_lit_lin_map, 118 gr_null, 119 gr_null, 120 (ptr_type)temp_lit_lin_umap, 121 (ptr_type)temp_lit_lin_map, 122 gr_null, 123 gr_null, 124 125 gr_null, /* clut linear texture mappers */ 126 gr_null, 127 gr_null, 128 gr_null, 129 (ptr_type)temp_clut_lin_umap, 130 (ptr_type)temp_clut_lin_map, 131 gr_null, 132 gr_null, 133 (ptr_type)temp_clut_lin_umap, 134 (ptr_type)temp_clut_lin_map, 135 (ptr_type)temp_clut_lin_umap, 136 (ptr_type)temp_clut_lin_map, 137 138 gr_null, /* solid linear mapper */ 139 gr_null, 140 141 gr_null, /* perspective texture mappers */ 142 gr_null, 143 gr_null, 144 gr_null, 145 (ptr_type)temp_per_umap, 146 (ptr_type)temp_per_map, 147 gr_null, 148 gr_null, 149 (ptr_type)temp_per_umap, 150 (ptr_type)temp_per_map, 151 gr_null, 152 gr_null, 153 154 gr_null, /* lit perspective texture mappers */ 155 gr_null, 156 gr_null, 157 gr_null, 158 (ptr_type)temp_lit_per_umap, 159 gr_null, 160 gr_null, 161 gr_null, 162 (ptr_type)temp_lit_per_umap, 163 gr_null, 164 gr_null, 165 gr_null, 166 167 gr_null, /* clut perspective texture mappers */ 168 gr_null, 169 gr_null, 170 gr_null, 171 (ptr_type)temp_clut_per_umap, 172 (ptr_type)temp_clut_per_map, 173 gr_null, 174 gr_null, 175 (ptr_type)temp_clut_per_umap, 176 (ptr_type)temp_clut_per_map, 177 gr_null, 178 gr_null, 179 180 gr_null, /* solid perspective mapper */ 181 gr_null, 182 183 (ptr_type)gen_int_ucircle, /* curves, should change to fixed-point */ 184 (ptr_type)gen_int_circle, 185 (ptr_type)gen_fix_ucircle, 186 (ptr_type)gen_fix_circle, 187 (ptr_type)gen_int_udisk, 188 (ptr_type)gen_int_disk, 189 (ptr_type)gen_fix_udisk, 190 (ptr_type)gen_fix_disk, 191 (ptr_type)gen_int_urod, 192 (ptr_type)gen_int_rod, 193 (ptr_type)gen_fix_urod, 194 (ptr_type)gen_fix_rod, 195 196 // MLA - added these two for the device functions 197 (ptr_type)flat8_flat8_ubitmap, /* bitmap drawing functions. */ 198 (ptr_type)gen_flat8_bitmap, 199 (ptr_type)flat8_mono_ubitmap, 200 (ptr_type)gen_mono_bitmap, 201 (ptr_type)temp_flat8_ubitmap, 202 (ptr_type)gen_flat8_bitmap, 203 (ptr_type)gen_flat24_ubitmap, 204 (ptr_type)gen_flat24_bitmap, 205 (ptr_type)temp_rsd8_ubitmap, 206 (ptr_type)temp_rsd8_bitmap, 207 (ptr_type)temp_tluc8_ubitmap, 208 (ptr_type)gen_tluc8_bitmap, 209 210 gr_null, /* bitmap drawing functions through a clut. */ 211 gr_null, 212 gr_null, 213 gr_null, 214 (ptr_type)temp_flat8_clut_ubitmap, 215 (ptr_type)gen_flat8_clut_bitmap, 216 gr_null, 217 gr_null, 218 (ptr_type)unpack_rsd8_clut_ubitmap, 219 (ptr_type)unpack_rsd8_clut_bitmap, 220 gr_null, 221 gr_null, 222 223 gr_null, /* rsd8 solid bitmap functions. No longer used. */ 224 gr_null, 225 226 gr_null, /* bitmap scale functions. */ 227 gr_null, 228 (ptr_type)flat8_mono_scale_ubitmap, 229 (ptr_type)flat8_mono_scale_bitmap, 230 (ptr_type)temp_scale_umap, 231 (ptr_type)temp_scale_map, 232 gr_null, 233 gr_null, 234 (ptr_type)temp_scale_umap, 235 (ptr_type)temp_scale_map, 236 (ptr_type)temp_scale_umap, 237 (ptr_type)temp_scale_map, 238 239 gr_null, /* rsd8 solid scale functions. No longer used. */ 240 gr_null, 241 242 gr_null, /* clut scale functions. */ 243 gr_null, 244 gr_null, 245 gr_null, 246 (ptr_type)temp_clut_scale_umap, 247 (ptr_type)temp_clut_scale_map, 248 gr_null, 249 gr_null, 250 (ptr_type)temp_clut_scale_umap, 251 (ptr_type)temp_clut_scale_map, 252 (ptr_type)temp_clut_scale_umap, 253 (ptr_type)temp_clut_scale_map, 254 255 gr_null, /* bitmap mask draw functions. */ 256 gr_null, 257 gr_null, 258 gr_null, 259 (ptr_type)flat8_flat8_ubitmap, 260 (ptr_type)temp_flat8_mask_bitmap, 261 gr_null, 262 gr_null, 263 gr_null, 264 gr_null, 265 gr_null, 266 gr_null, 267 268 gr_null, /* bitmap get functions. */ 269 gr_null, 270 gr_null, 271 gr_null, 272 (ptr_type)flat8_get_flat8_ubitmap, 273 (ptr_type)gen_get_flat8_bitmap, 274 gr_null, 275 gr_null, 276 gr_null, 277 gr_null, 278 gr_null, 279 gr_null, 280 281 gr_null, /* bitmap horizontal flip functions */ 282 gr_null, 283 gr_null, 284 gr_null, 285 (ptr_type)flat8_hflip_flat8_ubitmap, 286 (ptr_type)gen_hflip_flat8_bitmap, 287 gr_null, 288 gr_null, 289 gr_null, 290 gr_null, 291 gr_null, 292 gr_null, 293 294 gr_null, /* bitmap clut horizontal flip functions */ 295 gr_null, 296 gr_null, 297 gr_null, 298 (ptr_type)flat8_clut_hflip_flat8_ubitmap, 299 (ptr_type)gen_clut_hflip_flat8_bitmap, 300 gr_null, 301 gr_null, 302 gr_null, 303 gr_null, 304 gr_null, 305 gr_null, 306 307 gr_null, /* bitmap horizontal doubling. */ 308 gr_null, 309 gr_null, 310 gr_null, 311 (ptr_type)flat8_flat8_h_double_ubitmap, 312 gr_null, 313 gr_null, 314 gr_null, 315 gr_null, 316 gr_null, 317 gr_null, 318 gr_null, 319 320 gr_null, /* bitmap vertical doubling. */ 321 gr_null, 322 gr_null, 323 gr_null, 324 (ptr_type)flat8_flat8_v_double_ubitmap, 325 gr_null, 326 gr_null, 327 gr_null, 328 gr_null, 329 gr_null, 330 gr_null, 331 gr_null, 332 333 gr_null, /* bitmap horizontal and vertical doubling. */ 334 gr_null, 335 gr_null, 336 gr_null, 337 gr_null, 338 gr_null, 339 gr_null, 340 gr_null, 341 gr_null, 342 gr_null, 343 gr_null, 344 gr_null, 345 346 gr_null, /* bitmap smooth horizontal doubling. */ 347 gr_null, 348 gr_null, 349 gr_null, 350 (ptr_type)flat8_flat8_smooth_h_double_ubitmap, 351 gr_null, 352 gr_null, 353 gr_null, 354 gr_null, 355 gr_null, 356 gr_null, 357 gr_null, 358 359 gr_null, /* bitmap smooth vertical doubling. */ 360 gr_null, 361 gr_null, 362 gr_null, 363 gr_null, 364 gr_null, 365 gr_null, 366 gr_null, 367 gr_null, 368 gr_null, 369 gr_null, 370 gr_null, 371 372 gr_null, /* bitmap smooth horizontal and vertical doubling. */ 373 gr_null, 374 gr_null, 375 gr_null, 376 (ptr_type)flat8_flat8_smooth_hv_double_ubitmap, 377 gr_null, 378 gr_null, 379 gr_null, 380 gr_null, 381 gr_null, 382 gr_null, 383 gr_null, 384 385 (ptr_type)gen_font_ustring, /* text/font functions. */ 386 (ptr_type)gen_font_string, 387 (ptr_type)gen_font_scale_ustring, 388 (ptr_type)gen_font_scale_string, 389 (ptr_type)gen_font_uchar, 390 (ptr_type)gen_font_char, 391 392 (ptr_type)flat8_calc_row, /* utility functions. */ 393 (ptr_type)flat8_sub_bitmap, 394 395 gr_null, /* placeholders for primitiveless chains */ 396 gr_null, 397 }; 398