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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #define RGB_MAX_PER_ITERATION 64
24 #define TAG_PALETTE_COLORS 'claP'
26 VOID
VideoSetAllColorsToBlack(ULONG ColorCount
)
32 for (Color
=0; Color
<ColorCount
; Color
++)
34 MachVideoSetPaletteColor(Color
, 0, 0, 0);
38 VOID
VideoFadeIn(PPALETTE_ENTRY Palette
, ULONG ColorCount
)
42 PPALETTE_ENTRY PaletteColors
;
44 PaletteColors
= FrLdrTempAlloc(sizeof(PALETTE_ENTRY
) * ColorCount
, TAG_PALETTE_COLORS
);
45 if (!PaletteColors
) return;
47 for (Index
=0; Index
<RGB_MAX
; Index
++)
50 for (Color
=0; Color
<ColorCount
; Color
++)
52 MachVideoGetPaletteColor(Color
, &PaletteColors
[Color
].Red
, &PaletteColors
[Color
].Green
, &PaletteColors
[Color
].Blue
);
54 // Increment each color so it approaches its real value
55 if (PaletteColors
[Color
].Red
< Palette
[Color
].Red
)
57 PaletteColors
[Color
].Red
++;
59 if (PaletteColors
[Color
].Green
< Palette
[Color
].Green
)
61 PaletteColors
[Color
].Green
++;
63 if (PaletteColors
[Color
].Blue
< Palette
[Color
].Blue
)
65 PaletteColors
[Color
].Blue
++;
68 // Make sure we haven't exceeded the real value
69 if (PaletteColors
[Color
].Red
> Palette
[Color
].Red
)
71 PaletteColors
[Color
].Red
= Palette
[Color
].Red
;
73 if (PaletteColors
[Color
].Green
> Palette
[Color
].Green
)
75 PaletteColors
[Color
].Green
= Palette
[Color
].Green
;
77 if (PaletteColors
[Color
].Blue
> Palette
[Color
].Blue
)
79 PaletteColors
[Color
].Blue
= Palette
[Color
].Blue
;
84 for (Color
=0; Color
<ColorCount
; Color
++)
86 if ((Color
% RGB_MAX_PER_ITERATION
) == 0)
91 MachVideoSetPaletteColor(Color
, PaletteColors
[Color
].Red
, PaletteColors
[Color
].Green
, PaletteColors
[Color
].Blue
);
95 FrLdrTempFree(PaletteColors
, TAG_PALETTE_COLORS
);
98 VOID
VideoFadeOut(ULONG ColorCount
)
106 for (Index
=0; Index
<RGB_MAX
; Index
++)
108 for (Color
=0; Color
<ColorCount
; Color
++)
110 if ((Color
% RGB_MAX_PER_ITERATION
) == 0)
115 MachVideoGetPaletteColor(Color
, &Red
, &Green
, &Blue
);
130 MachVideoSetPaletteColor(Color
, Red
, Green
, Blue
);