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.
26 #define RGB_MAX_PER_ITERATION 64
28 VOID
VideoSetAllColorsToBlack(U32 ColorCount
)
34 for (Color
=0; Color
<ColorCount
; Color
++)
36 MachVideoSetPaletteColor(Color
, 0, 0, 0);
40 VOID
VideoFadeIn(PPALETTE_ENTRY Palette
, U32 ColorCount
)
44 PALETTE_ENTRY PaletteColors
[ColorCount
];
46 for (Index
=0; Index
<RGB_MAX
; Index
++)
49 for (Color
=0; Color
<ColorCount
; Color
++)
51 MachVideoGetPaletteColor(Color
, &PaletteColors
[Color
].Red
, &PaletteColors
[Color
].Green
, &PaletteColors
[Color
].Blue
);
53 // Increment each color so it approaches its real value
54 if (PaletteColors
[Color
].Red
< Palette
[Color
].Red
)
56 PaletteColors
[Color
].Red
++;
58 if (PaletteColors
[Color
].Green
< Palette
[Color
].Green
)
60 PaletteColors
[Color
].Green
++;
62 if (PaletteColors
[Color
].Blue
< Palette
[Color
].Blue
)
64 PaletteColors
[Color
].Blue
++;
67 // Make sure we haven't exceeded the real value
68 if (PaletteColors
[Color
].Red
> Palette
[Color
].Red
)
70 PaletteColors
[Color
].Red
= Palette
[Color
].Red
;
72 if (PaletteColors
[Color
].Green
> Palette
[Color
].Green
)
74 PaletteColors
[Color
].Green
= Palette
[Color
].Green
;
76 if (PaletteColors
[Color
].Blue
> Palette
[Color
].Blue
)
78 PaletteColors
[Color
].Blue
= Palette
[Color
].Blue
;
83 for (Color
=0; Color
<ColorCount
; Color
++)
85 if ((Color
% RGB_MAX_PER_ITERATION
) == 0)
90 MachVideoSetPaletteColor(Color
, PaletteColors
[Color
].Red
, PaletteColors
[Color
].Green
, PaletteColors
[Color
].Blue
);
95 VOID
VideoFadeOut(U32 ColorCount
)
103 for (Index
=0; Index
<RGB_MAX
; Index
++)
105 for (Color
=0; Color
<ColorCount
; Color
++)
107 if ((Color
% RGB_MAX_PER_ITERATION
) == 0)
112 MachVideoGetPaletteColor(Color
, &Red
, &Green
, &Blue
);
127 MachVideoSetPaletteColor(Color
, Red
, Green
, Blue
);