3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
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 2 of the License, or
8 * (at your option) any later version.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #define RGB_MAX_PER_ITERATION 64
25 VOID
VideoSetAllColorsToBlack(ULONG ColorCount
)
31 for (Color
=0; Color
<ColorCount
; Color
++)
33 MachVideoSetPaletteColor(Color
, 0, 0, 0);
37 VOID
VideoFadeIn(PPALETTE_ENTRY Palette
, ULONG ColorCount
)
41 PALETTE_ENTRY PaletteColors
[ColorCount
];
43 for (Index
=0; Index
<RGB_MAX
; Index
++)
46 for (Color
=0; Color
<ColorCount
; Color
++)
48 MachVideoGetPaletteColor(Color
, &PaletteColors
[Color
].Red
, &PaletteColors
[Color
].Green
, &PaletteColors
[Color
].Blue
);
50 // Increment each color so it approaches its real value
51 if (PaletteColors
[Color
].Red
< Palette
[Color
].Red
)
53 PaletteColors
[Color
].Red
++;
55 if (PaletteColors
[Color
].Green
< Palette
[Color
].Green
)
57 PaletteColors
[Color
].Green
++;
59 if (PaletteColors
[Color
].Blue
< Palette
[Color
].Blue
)
61 PaletteColors
[Color
].Blue
++;
64 // Make sure we haven't exceeded the real value
65 if (PaletteColors
[Color
].Red
> Palette
[Color
].Red
)
67 PaletteColors
[Color
].Red
= Palette
[Color
].Red
;
69 if (PaletteColors
[Color
].Green
> Palette
[Color
].Green
)
71 PaletteColors
[Color
].Green
= Palette
[Color
].Green
;
73 if (PaletteColors
[Color
].Blue
> Palette
[Color
].Blue
)
75 PaletteColors
[Color
].Blue
= Palette
[Color
].Blue
;
80 for (Color
=0; Color
<ColorCount
; Color
++)
82 if ((Color
% RGB_MAX_PER_ITERATION
) == 0)
87 MachVideoSetPaletteColor(Color
, PaletteColors
[Color
].Red
, PaletteColors
[Color
].Green
, PaletteColors
[Color
].Blue
);
92 VOID
VideoFadeOut(ULONG ColorCount
)
100 for (Index
=0; Index
<RGB_MAX
; Index
++)
102 for (Color
=0; Color
<ColorCount
; Color
++)
104 if ((Color
% RGB_MAX_PER_ITERATION
) == 0)
109 MachVideoGetPaletteColor(Color
, &Red
, &Green
, &Blue
);
124 MachVideoSetPaletteColor(Color
, Red
, Green
, Blue
);