ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

fade.c
Go to the documentation of this file.
00001 /*
00002  *  FreeLoader
00003  *  Copyright (C) 1998-2003  Brian Palmer  <brianp@sginet.com>
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License along
00016  *  with this program; if not, write to the Free Software Foundation, Inc.,
00017  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018  */
00019 #ifndef _M_ARM
00020 #include <freeldr.h>
00021 
00022 #define RGB_MAX                     64
00023 #define RGB_MAX_PER_ITERATION       64
00024 
00025 VOID VideoSetAllColorsToBlack(ULONG ColorCount)
00026 {
00027     UCHAR       Color;
00028 
00029     MachVideoSync();
00030 
00031     for (Color=0; Color<ColorCount; Color++)
00032     {
00033         MachVideoSetPaletteColor(Color, 0, 0, 0);
00034     }
00035 }
00036 
00037 VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount)
00038 {
00039     ULONG               Index;
00040     UCHAR               Color;
00041     PPALETTE_ENTRY  PaletteColors;
00042 
00043     PaletteColors = MmHeapAlloc(sizeof(PALETTE_ENTRY) * ColorCount);
00044     if (!PaletteColors) return;
00045 
00046     for (Index=0; Index<RGB_MAX; Index++)
00047     {
00048 
00049         for (Color=0; Color<ColorCount; Color++)
00050         {
00051             MachVideoGetPaletteColor(Color, &PaletteColors[Color].Red, &PaletteColors[Color].Green, &PaletteColors[Color].Blue);
00052 
00053             // Increment each color so it approaches its real value
00054             if (PaletteColors[Color].Red < Palette[Color].Red)
00055             {
00056                 PaletteColors[Color].Red++;
00057             }
00058             if (PaletteColors[Color].Green < Palette[Color].Green)
00059             {
00060                 PaletteColors[Color].Green++;
00061             }
00062             if (PaletteColors[Color].Blue < Palette[Color].Blue)
00063             {
00064                 PaletteColors[Color].Blue++;
00065             }
00066 
00067             // Make sure we haven't exceeded the real value
00068             if (PaletteColors[Color].Red > Palette[Color].Red)
00069             {
00070                 PaletteColors[Color].Red = Palette[Color].Red;
00071             }
00072             if (PaletteColors[Color].Green > Palette[Color].Green)
00073             {
00074                 PaletteColors[Color].Green = Palette[Color].Green;
00075             }
00076             if (PaletteColors[Color].Blue > Palette[Color].Blue)
00077             {
00078                 PaletteColors[Color].Blue = Palette[Color].Blue;
00079             }
00080         }
00081 
00082         // Set the colors
00083         for (Color=0; Color<ColorCount; Color++)
00084         {
00085             if ((Color % RGB_MAX_PER_ITERATION) == 0)
00086             {
00087                 MachVideoSync();
00088             }
00089 
00090             MachVideoSetPaletteColor(Color, PaletteColors[Color].Red, PaletteColors[Color].Green, PaletteColors[Color].Blue);
00091         }
00092     }
00093 
00094     MmHeapFree(PaletteColors);
00095 }
00096 
00097 VOID VideoFadeOut(ULONG ColorCount)
00098 {
00099     ULONG       Index;
00100     UCHAR       Color;
00101     UCHAR       Red;
00102     UCHAR       Green;
00103     UCHAR       Blue;
00104 
00105     for (Index=0; Index<RGB_MAX; Index++)
00106     {
00107         for (Color=0; Color<ColorCount; Color++)
00108         {
00109             if ((Color % RGB_MAX_PER_ITERATION) == 0)
00110             {
00111                 MachVideoSync();
00112             }
00113 
00114             MachVideoGetPaletteColor(Color, &Red, &Green, &Blue);
00115 
00116             if (Red > 0)
00117             {
00118                 Red--;
00119             }
00120             if (Green > 0)
00121             {
00122                 Green--;
00123             }
00124             if (Blue > 0)
00125             {
00126                 Blue--;
00127             }
00128 
00129             MachVideoSetPaletteColor(Color, Red, Green, Blue);
00130         }
00131     }
00132 }
00133 #endif

Generated on Fri May 25 2012 04:17:23 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.