2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/Graphics/Gradient.cpp $
15 * Routines to draw rectangular gradients.
18 * Revision 1.2 2002/06/09 04:41:17 relnev
19 * added copyright header
21 * Revision 1.1.1.1 2002/05/03 03:28:09 root
25 * 3 12/02/98 5:47p Dave
26 * Put in interface xstr code. Converted barracks screen to new format.
28 * 2 10/07/98 10:52a Dave
31 * 1 10/07/98 10:49a Dave
33 * 17 5/06/98 5:30p John
34 * Removed unused cfilearchiver. Removed/replaced some unused/little used
35 * graphics functions, namely gradient_h and _v and pixel_sp. Put in new
36 * DirectX header files and libs that fixed the Direct3D alpha blending
39 * 16 3/10/98 4:18p John
40 * Cleaned up graphics lib. Took out most unused gr functions. Made D3D
41 * & Glide have popups and print screen. Took out all >8bpp software
42 * support. Made Fred zbuffer. Made zbuffer allocate dynamically to
43 * support Fred. Made zbuffering key off of functions rather than one
46 * 15 1/19/98 6:15p John
47 * Fixed all my Optimized Build compiler warnings
49 * 14 11/30/97 4:04p John
51 * 13 11/30/97 12:18p John
52 * added more 24 & 32-bpp primitives
54 * 12 10/19/97 12:55p John
55 * new code to lock / unlock surfaces for smooth directx integration.
57 * 11 10/14/97 4:50p John
60 * 10 10/14/97 8:08a John
61 * added a bunch more 16 bit support
63 * 9 10/09/97 5:23p John
64 * Added support for more 16-bpp functions
66 * 8 6/11/97 1:12p John
67 * Started fixing all the text colors in the game.
69 * 7 5/12/97 12:27p John
70 * Restructured Graphics Library to add support for multiple renderers.
72 * 6 12/12/96 4:59p Lawrance
73 * made clipping for horizontal and vertical gradient lines right
75 * 5 11/19/96 2:46p Allender
76 * fix up gradient support for 15bpp
78 * 4 11/18/96 4:34p Allender
79 * new 16 bit gradient functions
81 * 3 10/27/96 1:21a Lawrance
82 * added check to avoid divide by zero when calculating gradients
84 * 2 10/26/96 2:56p John
85 * Got gradient code working.
87 * 1 10/26/96 1:45p John
88 * Initial skeletion code.
99 #include "grinternal.h"
100 #include "gradient.h"
101 #include "floating.h"
105 void gr8_gradient(int x1,int y1,int x2,int y2)
107 #ifndef HARDWARE_ONLY
110 int clipped = 0, swapped=0;
115 if (!Current_alphacolor) {
116 gr_line( x1, y1, x2, y2 );
120 INT_CLIPLINE(x1,y1,x2,y2,gr_screen.clip_left,gr_screen.clip_top,gr_screen.clip_right,gr_screen.clip_bottom,return,clipped=1,swapped=1);
126 if ( dx==0 && dy==0 ) {
132 ubyte *dptr = GR_SCREEN_PTR(ubyte,x1,y1);
134 xlat_table = (ubyte *)&Current_alphacolor->table.lookup[0][0];
139 ystep=-gr_screen.rowsize / gr_screen.bytes_per_pixel;
141 ystep=gr_screen.rowsize / gr_screen.bytes_per_pixel;
162 *dptr = xlat_table[(l&0xF00)|*dptr];
172 *dptr = xlat_table[(l&0xF00)|*dptr];
185 *dptr = xlat_table[(l&0xF00)|*dptr];
195 *dptr = xlat_table[(l&0xF00)|*dptr];