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/fl8pix.c $
21  * $Revision: 1.5 $
22  * $Author: kevin $
23  * $Date: 1994/08/16 13:14:01 $
24  *
25  * Routines for drawing pixels into a flat 8 canvas.
26  *
27  * This file is part of the 2d library.
28  *
29  * $Log: fl8pix.c $
30  * Revision 1.5  1994/08/16  13:14:01  kevin
31  * Added pixel primitives for all fill modes.
32  *
33  * Revision 1.4  1993/10/19  09:50:49  kaboom
34  * Replaced #include "grd.h" with new headers split from grd.h.
35  *
36  * Revision 1.3  1993/10/01  16:00:45  kaboom
37  * Converted to include clpcon.h instead of clip.h
38  *
39  * Revision 1.2  1993/05/16  00:33:22  kaboom
40  * Fixed clipped case to handle new padded clipping rectangle.
41  *
42  * Revision 1.1  1993/02/16  14:16:16  kaboom
43  * Initial revision
44  */
45 
46 #include "blend.h"
47 #include "cnvdat.h"
48 #include "fl8tf.h"
49 
50 /* draws an unclipped pixel of the given color at (x, y) on the canvas. */
flat8_set_upixel(long color,short x,short y)51 void flat8_set_upixel(long color, short x, short y) {
52     uchar *p;
53 
54     p = grd_bm.bits + grd_bm.row * y + x;
55     *p = color;
56 }
57 
flat8_clut_set_upixel(long color,short x,short y)58 void flat8_clut_set_upixel(long color, short x, short y) {
59     uchar *p;
60 
61     p = grd_bm.bits + grd_bm.row * y + x;
62     *p = ((uchar *)grd_gc.fill_parm)[color];
63 }
64 
flat8_xor_set_upixel(long color,short x,short y)65 void flat8_xor_set_upixel(long color, short x, short y) {
66     uchar *p;
67 
68     p = grd_bm.bits + grd_bm.row * y + x;
69     *p = color ^ *p;
70 }
71 
flat8_blend_set_upixel(long color,short x,short y)72 void flat8_blend_set_upixel(long color, short x, short y) {
73     uchar *p;
74 
75     p = grd_bm.bits + grd_bm.row * y + x;
76     *p = gr_blend(color, *p, grd_gc.fill_parm);
77 }
78 
79 // MLA #pragma off (unreferenced)
flat8_solid_set_upixel(long color,short x,short y)80 void flat8_solid_set_upixel(long color, short x, short y) {
81     uchar *p;
82 
83     p = grd_bm.bits + grd_bm.row * y + x;
84     *p = (uchar)grd_gc.fill_parm;
85 }
86 // MLA #pragma on (unreferenced)
87