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

wing32.c
Go to the documentation of this file.
00001 /*
00002  * WinG support
00003  *
00004  * Copyright 2007 Dmitry Timoshkov
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #define WIN32_LEAN_AND_MEAN
00022 #include <windows.h>
00023 
00024 /***********************************************************************
00025  *           WinGCreateDC   (WING32.@)
00026  */
00027 HDC CALLBACK WinGCreateDC( void )
00028 {
00029     return CreateCompatibleDC( NULL );
00030 }
00031 
00032 /***********************************************************************
00033  *           WinGRecommendDIBFormat   (WING32.@)
00034  */
00035 BOOL CALLBACK WinGRecommendDIBFormat( BITMAPINFO *bmi )
00036 {
00037     if (!bmi) return FALSE;
00038 
00039     bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
00040     bmi->bmiHeader.biWidth = 320;
00041     bmi->bmiHeader.biHeight = -1;
00042     bmi->bmiHeader.biPlanes = 1;
00043     bmi->bmiHeader.biBitCount = 8;
00044     bmi->bmiHeader.biCompression = BI_RGB;
00045     bmi->bmiHeader.biSizeImage = 0;
00046     bmi->bmiHeader.biXPelsPerMeter = 0;
00047     bmi->bmiHeader.biYPelsPerMeter = 0;
00048     bmi->bmiHeader.biClrUsed = 0;
00049     bmi->bmiHeader.biClrImportant = 0;
00050 
00051     return TRUE;
00052 }
00053 
00054 /***********************************************************************
00055  *           WinGCreateBitmap   (WING32.@)
00056  */
00057 HBITMAP CALLBACK WinGCreateBitmap( HDC hdc, BITMAPINFO *bmi, void **bits )
00058 {
00059     return CreateDIBSection( hdc, bmi, 0, bits, 0, 0 );
00060 }
00061 
00062 /***********************************************************************
00063  *           WinGGetDIBPointer   (WING32.@)
00064  */
00065 void * CALLBACK WinGGetDIBPointer( HBITMAP hbmp, BITMAPINFO *bmi )
00066 {
00067     DIBSECTION ds;
00068 
00069     if (GetObject( hbmp, sizeof(ds), &ds ) == sizeof(ds))
00070     {
00071         if (bmi != NULL)
00072             memcpy( &bmi->bmiHeader, &ds.dsBmih, sizeof(*bmi) );
00073 
00074         return ds.dsBm.bmBits;
00075     }
00076     return NULL;
00077 }
00078 
00079 /***********************************************************************
00080  *           WinGSetDIBColorTable   (WING32.@)
00081  */
00082 UINT CALLBACK WinGSetDIBColorTable( HDC hdc, UINT start, UINT end, RGBQUAD *colors )
00083 {
00084     return SetDIBColorTable( hdc, start, end, colors );
00085 }
00086 
00087 /***********************************************************************
00088  *           WinGGetDIBColorTable   (WING32.@)
00089  */
00090 UINT CALLBACK WinGGetDIBColorTable( HDC hdc, UINT start, UINT end, RGBQUAD *colors )
00091 {
00092     return GetDIBColorTable( hdc, start, end, colors );
00093 }
00094 
00095 /***********************************************************************
00096  *           WinGCreateHalfTonePalette   (WING32.@)
00097  */
00098 HPALETTE CALLBACK WinGCreateHalfTonePalette( void )
00099 {
00100     HDC hdc;
00101     HPALETTE hpal;
00102 
00103     hdc = GetDC( NULL );
00104     hpal = CreateHalftonePalette( hdc );
00105     ReleaseDC( NULL, hdc );
00106 
00107     return hpal;
00108 }
00109 
00110 /***********************************************************************
00111  *           WinGCreateHalfToneBrush   (WING32.@)
00112  */
00113 HBRUSH CALLBACK WinGCreateHalfToneBrush( HDC hdc, COLORREF color, INT type )
00114 {
00115     return CreateSolidBrush( color );
00116 }
00117 
00118 /***********************************************************************
00119  *           WinGStretchBlt   (WING32.@)
00120  */
00121 BOOL CALLBACK WinGStretchBlt( HDC hdcDst, INT xDst, INT yDst, INT widthDst, INT heightDst,
00122                             HDC hdcSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc )
00123 {
00124     int old_blt_mode;
00125     BOOL ret;
00126 
00127     old_blt_mode = SetStretchBltMode( hdcDst, COLORONCOLOR );
00128     ret = StretchBlt( hdcDst, xDst, yDst, widthDst, heightDst,
00129                       hdcSrc, xSrc, ySrc, widthSrc, heightSrc, SRCCOPY );
00130     SetStretchBltMode( hdcDst, old_blt_mode );
00131     return ret;
00132 }
00133 
00134 /***********************************************************************
00135  *           WinGBitBlt   (WING32.@)
00136  */
00137 BOOL CALLBACK WinGBitBlt( HDC hdcDst, INT xDst, INT yDst, INT width,
00138                         INT height, HDC hdcSrc, INT xSrc, INT ySrc )
00139 {
00140     return BitBlt( hdcDst, xDst, yDst, width, height, hdcSrc, xSrc, ySrc, SRCCOPY );
00141 }

Generated on Sat May 26 2012 04:25:25 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.