PAINT.C

Go to the documentation of this file.
00001 /* --
00002 OpenFX version 1.0 - Modelling, Animation and Rendering Package
00003 Copyright (C) 2000 OpenFX Development Team
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (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
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 
00019 You may contact the OpenFX development team via elecronic mail
00020 at core@openfx.org, or visit our website at http://openfx.org for
00021 further information and support details.
00022 -- */
00023 
00024 /* PAINT.C */
00025 
00026 static void PaintBackground(HWND hDlg){
00027  int x;
00028  int y;
00029  HDC hDC;
00030  HPALETTE hpalT;
00031  HBRUSH hOldBrush;
00032  RECT rc1,rc2;
00033  HDC hMemDC;
00034  HBITMAP hBmBackground,hbmOld;
00035  BITMAP  bm;
00036  PAINTSTRUCT ps;
00037  hDC = BeginPaint(hDlg,&ps);
00038  hBmBackground=LoadBitmap(hDLLinstance,"screen");
00039  if(hBmBackground != NULL){
00040    GetObject(hBmBackground,sizeof(BITMAP),&bm);
00041    hMemDC = CreateCompatibleDC(hDC);
00042    hbmOld = SelectObject(hMemDC,hBmBackground);
00043    GetClientRect(hDlg,&rc2);
00044    for(x=0;x<(rc2.right/bm.bmWidth)+1;x++)
00045    for(y=0;y<(rc2.bottom/bm.bmHeight)+1;y++)
00046      BitBlt(hDC,
00047           x*bm.bmWidth,y*bm.bmHeight,
00048           bm.bmWidth,
00049           bm.bmHeight,
00050           hMemDC,
00051           0,0,
00052           SRCCOPY);
00053    SelectObject(hMemDC,hbmOld);
00054    DeleteDC(hMemDC);
00055    DeleteObject(hBmBackground);
00056  }
00057  EndPaint(hDlg,&ps);
00058 }
00059 
00060 #if 0
00061    case WM_ERASEBKGND:{
00062       int x;
00063       int y;
00064       HDC hDC;
00065       HPALETTE hpalT;
00066       HBRUSH hOldBrush;
00067       RECT rc1,rc2;
00068       HDC hMemDC;
00069       HBITMAP hBmBackground,hbmOld;
00070       BITMAP  bm;
00071       hDC = (HDC)wparam;
00072       hBmBackground=LoadBitmap(hDLLinstance,"screen");
00073       GetObject(hBmBackground,sizeof(BITMAP),&bm);
00074       hMemDC = CreateCompatibleDC(hDC);
00075       hbmOld = SelectObject(hMemDC,hBmBackground);
00076       GetClientRect(hwnd,&rc2);
00077       for(x=0;x<(rc2.right/bm.bmWidth)+1;x++)
00078       for(y=0;y<(rc2.bottom/bm.bmHeight)+1;y++)
00079         BitBlt(hDC,
00080                 x*bm.bmWidth,y*bm.bmHeight,
00081                 bm.bmWidth,
00082                 bm.bmHeight,
00083                 hMemDC,
00084                 0,0,
00085                 SRCCOPY);
00086       SelectObject(hMemDC,hbmOld);
00087       DeleteDC(hMemDC);
00088       if(hBmBackground != NULL)DeleteObject(hBmBackground);
00089     }
00090     return TRUE;
00091 #endif

Generated on Sun Apr 27 14:20:12 2014 for OpenFX by  doxygen 1.5.6